A solid nonconductive sphere of radius R has volume charge density rho that varies with the radius as
The charge distribution is spherically symmetric, extending out to radius R. Although the charge distribution is not uniform, the simple radial dependence maintains the spherical symmetry. Note that the charge enclosed by an surface will involve an integral over the enclosed volume of the surface considered.
Step 2: Understand the symmetry: The only variable on which E may depend is r, the distance from the center of the sphere of charge. There is no angular dependence because the charged object is spherically symmetric, i.e. it does not matter at which angle about the sphere you view it.
Similar arguments determine that the direction of E is radially away from the center of the sphere, perpendicular to the surface of the sphere at all locations.
Step 3: Construct the gaussian surface: Given the symmetry of the charge distribution and resulting electric field, the appropriate choice for gaussian surface is a sphere of radius r centered about the charged sphere. For r < R, the gaussian sphere will be inside the sphere of charge.
For r > R, the gaussian sphere will be outside the sphere of charge.
Step 4: Examine the gaussian surface and evaluate electric flux:
The gaussian sphere consists of one simple surface (unlike the case of the gaussian cylinder or can consisting of a cylindrical tube and two flat end caps). Everywhere on the surface of the gaussian sphere the electric field is pointing in the same direction as the infinitesimal area vector. Also, the magnitude of E is constant everywhere on the gaussian surface. Thus the electric flux for the gaussian surfaces above, both inside the charged sphere and outside is:
Step 5: Evaluate the enclosed charge:
The evaluation of the charge enclosed by a sphere of radius r involves the integral of the density over the enclosed volume. Since the charge density depends only the distance from the center of the sphere, i.e., it has only a radial dependence, we may span the volume enclosed with spherical shells from r'=0 to r'=r. Please note the introduction of the dummy variable of integration r' since we are already using the variable r to represent the radius of the gaussian sphere.
Please note that the last formula holds only for volumes entirely inside the charged sphere; once outside the sphere, the charge density is zero.
E inside the charged sphere:
E outside the charged sphere:
With the gaussian sphere outside the charged sphere, the enclosed charge will be the total charge Q.
Please note that both expressions for E are equal for r = R