This is a question from my textbook but I have trouble in tackling it:
Let $$\mathbf F = (x^2+y^2+2+z^2)\mathbf i + (e^{x^2} + y^2)\mathbf j + (3+x)\mathbf k$$
Let $a > 0$, and let $S$ be the part of the spherical surface $x^2 + y^2 + z^2 = 2az + 3a^2$ that is above the $xy$-plane. Find the flux of $F$ outward across $S$.
Well, the first idea that came into my mind is to use divergence theorem, so here is my steps:
$$\operatorname{div}\mathbf F = (2x+2y)$$
$$\int_0^{2\pi} \int_0^{\sqrt{3} a} \int_0^{\sqrt{4a^2-r^2} + a} 2r^2 (\sin \theta + \cos \theta) \,dz\, dr\, d\theta$$
but the part of $\int_0^{2pi} (\sin \theta+\cos \theta) d\theta$ would result in $0$. However, the answer is $9 \pi a^2$ according to the textbook.
Can anyone help me please?
There is a part of the spherical surface $S$ you can complete the square:
\begin{align} x^2+y^2+z^2-2az+\overbrace{a^2+a^2}^{\text{complete sqr}} &=3a^2 \\ x^2+y^2+(z-a)^2&=4a^2 \end{align} That is above $xy$-plane ($z=0$) and the bottom of it is a disk in the $xy$-plane $$x^2+y^2+(0-a^2)=4a^2 \to x^2+y^2=3a^2$$ These form boundary region $G$.
The bottom disk we can call $T$ of this region has outward normal $\hat{\mathbf{N}}=-\mathbf{k}$. Now as you calculated $\text{div}\,\mathbf{F}=2x+2y$.
Now the divergence theorem states that the total flux outward this whole region is the sum of the flux of the bottom disk and the spherical cap $S$ (that we want to calculate). So $$\iint_S \mathbf{F} \bullet \hat{\mathbf{N}} dS+\iint_T \mathbf{F} \bullet (-\mathbf{k}) dS=\iiint_G \text{div}\,\mathbf{F} \, dV$$ Now because $G$ is symmetric about $x=0$ and $y=0$ the centroids are $\bar{x},\bar{y}=0$ and total flux $$\iiint_G \text{div}\,\mathbf{F} \, dV=(2\bar{x}+2\bar{y})\times\text{Volume of G} =0$$ which means flux outward $S$ equals \begin{align} \iint_S \mathbf{F} \bullet \hat{\mathbf{N}} dS &=-\iint_T \mathbf{F} \bullet (-\mathbf{k}) dS \\ &=\iint_T 3+x \; dxdy \\ &=(3+\bar{x})\times\text{area of T}, \;\;\text{where} \; \bar{x}=0 \; (\text{centroid}) \\ &=3\times\pi\times 3a^2\\ &=9\pi a^2 \end{align}
Hope this satisfies!