# Electric field of an infinite, uniformly charged layer with thickness $a$

I was trying to calculate the electric field on any point of the $z$-axis of a layer with the following properties:

1. It as a thickness of $a$
2. It is placed along the XY plane
3. It is infinite in extension
4. It has a uniform density of charge $\rho_o$

So I decided to do the following: let's imagine that the entire surface is made out of concentric pipe segments centered in $(0,0,0)$:

(Here you can see why I'm not a renowned artist). Each segment has a thickness of $dr$ and therefore a volume of $dV=(2\pi r) a dr$. It also has a charge $dq=\rho_o dV$.

For any point $(x,y,z)$ outside of the layer itself the electric field must point upwards and it must be the sum of the fields from all the infinitesimal rings under it. The further a right is, the bigger the angle $\theta$ between $dE$ and the $z$-axis. So we have:

$$E=\int_S dE = \int_S \frac{1}{4\pi \epsilon_o} \frac{\rho_o dV}{r^2+z^2}\cos{\theta} = \int_S \frac{1}{4\pi \epsilon_o} \frac{\rho_o dV}{r^2+z^2}\frac{z}{\sqrt{r^2+z^2}}$$

Taking the constants out, integrating and simplifying we get:

$$E= \frac{\rho_o a}{2\epsilon_o}$$

Now, I don't think what I got is right even if I'm not able to see where I failed. The field apparently doesn't depend on how close or far away we are from the layer, and that seems wrong. So I either made a math mistake or my premises were wrong. Where did I get it wrong and how?

PS: I realize I could express the field in vectorial form, but it's the process of deriving the equation above that I'm interested in.