Problem: Find the electric field inside a sphere of radius R with charge density r = r 0r/R.
This Gauss' law problem includes an integration, because the charge density is not a constant.
We begin with a diagram showing the field lines, and a Gaussian surface- a sphere with radius r < R.
Next we calculate the flux through this surface. As in any problem with spherical symmetry, we find
But Er is constant over the surface of the Gaussian sphere, so
Now the charge inside this Gaussian surface is the sum of the charges in each differential element (spherical shell of thickness dr) . dq = r dV with dV = 4p r2dr.
Now we apply Gauss' law:
Thus inside the sphere the electric field strength increases as r2. Outside, it decreases as 1/r2, as for a point charge.