So the problem is asking me to find the Electric field a height z above the center of a square sheet of side a
I approach the problem a different way than the book, I derive the electric field due to a line of charge of side $a$ a height z above the center of a square loop, and I verified it to be $\frac{1}{4\pi\epsilon_0}$ $\frac{\lambda a z}{(z^2+\frac{a^2}{4}) (z^2+\frac{a^2}{2})^\frac{1}{2}}$ $\hat z$
Now the way I do it is that I let that line have a thickness $da$ where da is a width element not an area element (as the side of the square is a), so now the linear charge density $\lambda$ is equal to the surface charge density multiplied by that small thickness $da$ , that is
$\lambda = \sigma da$
So the Electric field $dE$ due to a line of small thickness $da$ is
$dE$ = $\frac{1}{4\pi\epsilon_0}$ $\frac{\sigma da z a}{(z^2+\frac{a^2}{4}) (z^2+\frac{a^2}{2})^\frac{1}{2}}$ $\hat z$
I integrate this field from $0$ to $a$ then,
$E$ = $\frac{\sigma z}{4\pi\epsilon_0}$ $\int_0^a$ $\frac{ada}{(z^2+\frac{a^2}{4}) (z^2+\frac{a^2}{2})^\frac{1}{2}}$ $\hat z$
This integral yields $\frac{4}{z}$ $\tan^{-1}(\sqrt{1+\frac{a^2}{2z^2}}$ $|^{a}_{0}$
= $\frac{4}{z}$ $[\tan^{-1} (\sqrt{1+\frac{a^2}{2z^2}} -\frac{\pi}{4}]$
That is the value of the integral, now multiply it by $\frac{\sigma z}{4\pi\epsilon_0}$
Then $E$=$\frac{\sigma}{\pi\epsilon_0}$ $[\tan^{-1} (\sqrt{1+\frac{a^2}{2z^2}} -\frac{\pi}{4}]$
I'm missing it by a factor of 2, the answer should be $\frac{2\sigma}{\pi\epsilon_0}$ $[\tan^{-1} (\sqrt{1+\frac{a^2}{2z^2}}) -\frac{\pi}{4}]$
I'm pretty sure about the mathematical steps, I'm assuming I made a false assumption at the beginning, but its been more than 20 hours and I still haven't figured out what it is, any help would be appreciated.
Here's a picture to show you how I think I can do it
This red line is of width $da$ and I want to integrate $dE$ from $0$ to $a$