Find flux through a sphere

Find flux of $\vec{F} =<0,0,z>$ through the sphere of radius $a$ centered at the origin.

Using Gauss Divergence Theorem

$$\nabla \cdot \vec{F} = 1 \\ \therefore \int_S \vec{F}\cdot \hat{n} ~dS= \iiint_R 1 ~dV =\frac{4}{3}\pi a^3$$

Calculating the surface integral by using sperical co-ordinates $(\rho, \phi, \theta )$

$$\hat{n} = \frac{1}{a} <x,y,z> \\ \vec{F} \cdot \hat{n}=\frac{z^2}{a}$$

w.k.t

$$dS= a^2 \sin(\theta) ~ d\phi d\theta \\ z= a cos(\phi)$$

substituting:

$$\int_s \vec{F}\cdot \hat{n} ~dS = \int_0^{2\pi} \int_0^\pi \frac{a^2 cos^2(\phi)}{a} a^2 \sin(\theta) ~ d\phi d\theta \\$$

This integral will evaluate to zero, because $sin(\theta)$ will be integrated from $0$ to $2\pi$.

I'm getting two different answers. Where am I going wrong?

In spherical coordinates $(r,\theta,\phi)$, $z=r\cos(\theta)$ and $dS=r^2\sin(\theta)\,d\theta\,d\phi$ where $\theta \in[0,\pi]$ and $\phi\in[0,2\pi]$.

Then, note that

$$\int_0^{\pi}\cos^2(\theta)\sin(\theta)\,d\theta=\frac{2}{3}$$

so that

$$\oint_{|r|=a}\vec F(\vec r)\cdot \hat n\,dS=\int_0^{2\pi}\int_0^\pi \frac{a^2\cos^2(\theta)}{a}\,a^2\sin(\theta)\,d\theta\,d\phi=\frac{4\pi a^3}{3}$$

as expected!

• I see where i went wrong, thanks! – jumpmonkey Jun 4 '17 at 13:51
• You're welcome. My pleasure. – Mark Viola Jun 4 '17 at 13:53