1. The problem statement, all variables and given/known data An infinite plane slab of thickness 2d lies in the xy-plane with −d<z<d. Its charge density is given as ρ = kz^{2} for −d<z< d and zero otherwise. (i) Find the electric field, E(z), for all z. 2. Relevant equations Gauss' law 3. The attempt at a solution This problem is pretty easy to do with a gaussian surface. However. I wanted to know if I could also do it by calculating the field directly from coulombs law (I know it would be far more tedious but I'm just curious) with the integral 1/4∏ε_{0}∫_{V}ρ/r^{2}dv = 1/4∏ε_{0}∫∫∫ρ/(x^{2}+y^{2}+z^{2}) dxdydx where the integrals of y and x run from -∞ to ∞ and the integral of z runs from -d to d. But if so, this integral would only hold for being outside the slab right?
The integral $$\frac{1}{4\pi\epsilon_0}\int_V \frac{\rho}{r^2}\,dv,$$ where r is understood to be the distance from the volume element dv to the point at which you're trying to calculate the E field, isn't quite correct because you're not taking into account the vector nature of the electric field. The integral as written sums the magnitude of the electric field, but that's not how superposition works for the E field. Even if we ignore that error, your second integral $$\frac{1}{4\pi\epsilon_0}\int_V \frac{\rho}{x^2+y^2+z^2}\,dv$$ doesn't equal the first one because r^{2} isn't equal to ##x^2+y^2+z^2##. Still, your basic idea is right. You can calculate the electric field using this method, though as you noted, it's tedious.
but x^{2}+y^{2}+z^{2} does equal r^{2}? But you are right I didn't put account for the vector nature. from symmetry we see that the field must point along the z-axis. So therefore multiplying by a cosine(which can be written as a ratio of z and r) should do the trick - then I would be correct right?
Oops, there was a typo in my last post. Forgot the square. ##\sqrt{x^2+y^2+z^2}## is the distance from the origin to the point (x,y,z). Unless you're calculating the electric field at the origin, it's not equal to the distance r which appears in Coulomb's law.
You could try to solve the Poisson equation, del^{2}V = -ρ/ε_{0}. At least that's not a vector integration, but maybe a painful 2nd order partial differential equation. You'd have to do it twice: once for inside the slab where ρ = ρ, then again outside the slab where ρ = 0. Then E = -del V. Bonne chance.