# What's wrong with my calculation for checking the divergence law?

Here is a problem in Griffiths Introduction to Electrodynamics as follows.

Check the divergence theorem for the function $\mathbf{v} = r^2\mathbf{\hat{r}}$, using as your volume, the sphere of radius R, centered at the origin?

Here is my calculation for the surface intergral part, please help me finding the error in it.

$$\mathbf{v} = r^2(\sin\theta \cos\phi \ \mathbf{\hat{x}} + \sin\theta \sin\phi \ \mathbf{\hat{y}} + \cos \theta \ \mathbf{\hat{z}})$$

\begin{align} \oint_s \mathbf{v} \cdot d\mathbf{a} &= 2 \iint r^2 \cos\theta\ dxdy \\
&= 2 \iint r^2 \cdot \frac{z}{r} dxdy \\
&= 2R \iint \sqrt{R^2 - x^2 - y^2} dxdy \\
&= 2R \int_{r=0}^{R}\sqrt{R^2 - r^2} rdr \int_{\theta=0}^{2\pi} d\theta \\
&= 4\pi R\int_{\theta=0}^{\frac{\pi}{2}}\sqrt{R^2 - R^2{\sin^2\theta}} R\sin\theta\ R\cos\theta\ d\theta \\
&= \frac{4\pi R^4}{3} \end{align}

But the right answer should be $4\pi R^4$ considering the left part of the divergence theorem $\int_V \nabla\cdot\mathbf{v}\ d\tau$. I have check my answer serveral times but could not find error, could you help me?

thanks.

-
I tried to fix your math formatting. I hope I did not inadvertently introduce any errors. – Rahul Dec 8 '10 at 7:09
@Rahul: Thanks, I am trying to fix it, but could not find a way out. It helps a lot! – Jichao Dec 8 '10 at 7:12
Also, while I'm sure someone else will come along and find the error in your lengthy calculation, I wanted to point out that there's a much easier way to compute the surface integral. Since $\mathbf v$ and $d\mathbf a$ are both parallel to $\hat {\mathbf r}$, your surface integral is simply $\oint \mathbf v \cdot d \mathbf a$ = $\oint r^2 da$ = $R^2 \oint da$ = $R^2 \cdot 4\pi R^2$ = $4\pi R^4$. – Rahul Dec 8 '10 at 7:16
I have forget the intergral on the other sides, so the result should be multiplied by 3, thus we would get the right answer. – Jichao Dec 8 '10 at 9:08

The integral $2 \iint r^2 \cos\theta\ dxdy$ was correctly evaluated to $4\pi R^4/3$. But it represents only the contribution of the $z$-component of the vector field to the surface integral. By symmetry, the $x$- and $y$- components contribute as much. The total is $4\pi R^4$, as expected.