Flux Out of a Surface - Example

The flux out of a surface
$S$
is
$\int_{S} \mathbf{F} \cdot \mathbf{n} dS$
. If
$S$
is the surface
$x^2 +y^2 +z^2 =9$
then
$\mathbf{n} = \frac{2x \mathbf{i} + 2y \mathbf{j} + 2z \mathbf{k}}{\sqrt{4x^2 + 4y^2 = 4z^2}} = \frac{x \mathbf{i} + y \mathbf{j} + z \mathbf{k}}{r}$
and
$\mathbf{F} = \frac{x}{\sqrt{2}} \mathbf{i} + \frac{y}{\sqrt{2}} \mathbf{j} + \frac{z}{\sqrt{2}} \mathbf{k}$

The integral is
\begin{aligned} \int_S \mathbf{F} \cdot \mathbf{n} dS &= (\frac{x}{\sqrt{2}} \mathbf{i} + \frac{y}{\sqrt{2}} \mathbf{j} + \frac{z}{\sqrt{2}} \mathbf{k}) \cdot (\frac{x}{r} \mathbf{i} + \frac{y}{r} \mathbf{j} + \frac{z}{r} \mathbf{k}) \\ &= \int_S \frac{x^2 +y^2 + z^2}{r \sqrt{2}} dS \end{aligned}

In spherical polar coordinates the integral becomes
\begin{aligned} A &= \int^{\pi}_0 \int^{2 \pi}_0 \frac{r^2}{r \sqrt{2}} r^2 sin \theta d \theta d \phi \\ &= \frac{2 \pi r^3}{\sqrt{2}} \int^{\pi}_0 sin \theta d \theta \\ &= \frac{2 \pi r^3}{\sqrt{2}} [- cos \theta]^{\pi}_0 \\ &= \frac{2 \pi r^3}{\sqrt{2}}(-cos \pi -(-cos 0)) \\ &= \frac{108 \pi r^3}{\sqrt{2}} \end{aligned}