Electric field due to a square sheet, missing by a factor of 2, need insight 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$
 A: Your math is correct as far as the calculations are concerned, but you made an error in your choice of variables. The contribution of a single line of charge at horizontal position $y$ is
$$E_{z}(y) = \frac{1}{4\pi\epsilon_0} \frac{\lambda a z}{\left( z^2 + y^2 \right) \left( z^2 + y^2 + \frac{a^2}{4} \right)^\frac{1}{2}} .$$
At position $y = a/2$, which is the segment you evaluated, this reduces to your result (your first formula). But as you integrate over a range of $y$-values, the difference between $y$ and $a/2$ becomes significant. You are keeping the integration boundary $a/2$ equal to the horizontal coordinate $y$ (since they are both called $a/2$ in your calculation), so you are actually integrating over the yellow section of the plane in this picture:

That happens to be half the plane, and therefore you got half the correct result.
To find the total field strength, you would integrate the expression above:
$$E = \int_{-\frac a2}^{\frac a2} E_z(y)\, dy = \frac{\sigma}{4\pi\epsilon_0} a z \int_{-\frac a2}^{\frac a2} \frac{dy}{\left( z^2 + y^2 \right) \left( z^2 + y^2 + \frac{a^2}{4} \right)^\frac{1}{2}}$$
which according to an engine works out to
$$E = \frac{\sigma}{4\pi\epsilon_0} \left. 2 \arctan{\left( \frac{a^2}{z \left( a^2 + 4 (y^2 + z^2) \right)^\frac12} \right) } \right|_{-\frac a2}^{\frac a2} = \frac{\sigma}{\pi\epsilon_0} \arctan{\left( \frac{a^2}{2\,z\,\left( 2 a^2 + 4 z^2 \right)^\frac12} \right)}\,.$$
A few checks to see if the extreme cases turn out correct. From a large distance, with $z \gg a$, the plane looks like a point - and indeed, since $\arctan x \approx x$ for small $x$, the equation reduces to
$$E_{z \to \infty} = \frac{\sigma}{\pi\epsilon_0} \frac{a^2}{2\,z\,\left(4z^2\right)^\frac12} = \frac{Q}{4\pi\epsilon_0 z^2} $$
which is the field of a point charge.
Conversely, if $a$ is very large, we should have the field of an infinite plane, which does not depend on the distance $z$:
$$E_{a \to \infty} = \frac{\sigma}{\pi\epsilon_0} \lim_{a \to \infty} \arctan{\left( \frac{a^2}{2\,z\,\left( 2 a^2 + 4 z^2 \right)^\frac12}\right)} = \frac{\sigma}{\pi\epsilon_0} \frac{\pi}{2} = \frac{\sigma}{2\epsilon_0}\, .$$
