# Electric field of infinite slab

When reading a book about basic electrodynamics (in a section about electrostatics), I came upon the following problem:

An infinite plane slab, of thickness $2d$, carries a uniform volume charge density $\rho$. Find the electric field, as a function of $y$, where $y=0$ at the center.

The slab parallel to the $x$-$z$ plane, and is thus perpendicular to the $y$-axis, contained between $y=-d$ and $y=d$ but reaching infinitely into the $x$ and $z$ directions.

The book I'm reading utilizes Gauss's law (using a "Gaussian pillbox" circling around the $y$-axis), but I was a bit confused by the method they used, and when doing the problem I instead thought like this:

If we place a test charge on the $y$-axis at $y=a$, then the charge experiences a positive force (pointing the positive $y$ direction) due to the volume charge behind it (from $y=-d$ to $y=a$) and experiences a negative force (gets "pushed backwards") due to the volume charge in front of it (from $y=a$ to $y=d$). So for $|y|<d$, the electric field would be the total field made up of a bunch of infinitesimally-thin charged planes behind the test charge minus the field made up of a bunch of infinitesimally-thin charged places in front of the test charge, or:

$$E(y) = \int_{-d}^y \frac{\rho}{2 \epsilon_0} \,dy \,\,\, - \,\,\, \int_{y}^d \frac{\rho}{2 \epsilon_0} \,dy = \frac{\rho}{\epsilon_0} y$$

Since the magnitude of a field of an infinitesimally-thin infinite plane is $\frac{\sigma}{2 \epsilon_0}$ and in this instance $\sigma = \rho dy$.

This is, in fact, the answer the book gives. Was my thought process incorrect? That is, can a volume of charge really "push" as if it were a point charge? I wasn't too sure if my logic was correct and that I could rely on this idea in the future.

If my intuition was wrong, could someone please explain how one would use Gauss's law in this problem?

I would like to clarify something here. Magnitude of a field of an infinitesimally-thin infinite plane is $\frac{\sigma}{2 \epsilon_0}$. We use $\sigma$ here not $\rho$ because $\sigma$ indicate the planar charge density since the plane is very thin. This is different from that in your problem where the plane is having a thick, so the answer that was given by your book is correct. And a volume charge doesn't "push" as if it were a point charge because a volume charge contain infinite point charge