# Charged enclosed by the sphere

I'm reviewing the book "Conquering the Physics GRE" for my upcoming Physics GRE. I came across this problem which I'm having trouble with understanding. In particular, I understand the solution that the author provides but I don't understand what is wrong with my approach.

Q. The Electric field inside a sphere of radius $$R$$ is given by $$E = E_0 z^2 \hat{\textbf{z}}$$. What is the total charge of the sphere?

The authors approach involving taking the divergence of the electric field to get the charge density and then integrating the density over the volume of the sphere to get charged enclosed, which in their case turns out to be $$0$$.

But we can also just use a concentric sphere of radius $$r$$ ($$0 < r \le R$$) as a Gaussian surface and just use the integral form of Maxwell's equation to calculate the charge enclosed.

$$\oint \limits_{S} \vec{E} \cdot d\vec{S} = \frac{Q_{enc}}{\epsilon_0} .$$

Since the area vector points in the radial direction, if we assume it makes an angle $$\theta$$ with the Electric Field vector, and given $$z = r cos(\theta)$$, we have

$$Q_{enc} = \epsilon_0 \int \limits_{0}^{\pi} \int \limits_{0}^{2\pi} E_0 r^2 cos^2(\theta) r^2 sin(\theta) d\theta d\phi,$$

$$Q_{enc} = \frac{4 \pi \epsilon_0 E_0}{3} r^4 .$$

If we want the charge enclosed by the sphere, we just set $$r = R$$, so we get

$$Q = \frac{4 \pi \epsilon_0 E_0}{3} R^4 .$$

which isn't zero.

I'm having trouble figuring out where I'm going wrong. Any suggestions appreciated.

I think you forgot to account for $$\mathbf{\hat{z}}$$

Let $$\mathbf{\hat{r}}$$ be the normal to the surface of our sphere. If you take the route of integrating the electric field over the surface of the sphere that contains the charge, then you will be evaluating the following quantity.

$$z^2 \mathbf{\hat{z}}.\mathbf{\hat{r}}=z^2 \mathbf{\hat{z}}.\mathbf{r}/r=z^2\, z/r=z^3/r$$

So you will be integrating $$z^3$$ over the surface of the sphere centered on the origin. Since $$z^3$$ is an odd function the integral will vanish.

• Thanks! Indeed I forgot the $\hat{z}$. FYI, I marked your answer as correct, but I don't have enough reputation to publicly upvote you, so just thanking you via this comment. – timoneo Mar 4 at 2:39
• I thought this question was fascinating. I don't understand where the minus sign appears to make the function odd. Shouldn't ^z and ^r point in the same direction over the entire surface of the sphere, giving a positive dot product over the entire surface? – lamplamp Mar 4 at 3:06
• @timoneo: good question. Glad I could help – Cryo Mar 4 at 3:10
• @lamplamp: $\mathbf{\hat{z}}$ does point in the same direction at all points, but $\mathbf{\hat{r}}$ does not since it is normal and points out of the sphere. If this sphere was Earth, $\mathbf{\hat{r}}$ would point in the direction of the rocket taking off the Earth and flying to space, so on north pole $\mathbf{\hat{r}}$ points "up", whilst on south pole it points "down". – Cryo Mar 4 at 3:14
• Thanks, when I read the question, I assumed that z was referencing a radial coordinate as a dummy variable to distinguish from r. From the thread here, I now believe that z was chosen to as standard Cartesian, which makes perfect sense about the function being odd. – lamplamp Mar 4 at 3:20

There is also a nice geometrical argument for this. Since the field is $$\vec E=z^2\hat z$$, the fields lines always point along $$+\hat z$$ and the magnitude of the field does not depend on the position in the $$xy$$-plane. As a result, every field line that enters the sphere must also exit the sphere, so the net flux must be $$0$$, and therefore the net enclosed charge must be $$0$$. • Arrows point in the z direction? I have somehow a hard time understanding your graph. – lalala Mar 4 at 11:02
• The arrows represent the vector field $\vec{E}$. The z-axis is the axis going from left to right. The circle is a cross section of the sphere. – infinitezero Mar 4 at 13:07
• Frankly, this is a pretty misleading plot. The streamline density is completely wrong - it hints at an electric field density which increases along x and y instead of z. – Emilio Pisanty Mar 4 at 14:23
• @EmilioPisanty I added the axes. – ZeroTheHero Mar 4 at 14:33
• @ZeroTheHero The problem is with the plot, not with the axes. While the streamlines are indeed streamlines, the streamline density is wrong. – Emilio Pisanty Mar 4 at 17:41