Divergence theorem, integrals don't give the same result. I am trying to find the flux going out of the semi sphere $$z=\sqrt{4-x^2-y^2}$$ using the divergence theorem, but I'm getting different results between the integrals:
$$\iiint \operatorname{div} F\, dV= \int_0^{2\pi}\int_0^{\frac{\pi}{2}}\int_0^23r^2\sin(\varphi)\,dr\,d\varphi\,d\theta=16\pi$$
and
\begin{align*}\iint FdS&=\int_0^{2\pi}\int_0^{\frac{\pi}{2}}8\cos^2(\theta)\sin^3(\varphi)+8\sin^2(\theta)\sin^3(\varphi)+4\sin(\varphi)\cos^2(\varphi)\,d\varphi\,d\theta\\
&+\int_0^{2\pi}\int_0^{2}(r\cos(\theta),r\sin(\theta),0)(0,0,-r)\,dr\,d\theta\\
&=\frac{40}{3}\pi,
\end{align*}
and the vector field is
$$F(x,y,z)=(x,y,z).$$
If anyone could help me I'd appreciate it, thank you!
 A: Your divergence integral looks fine, as $\operatorname{div}F=3.$ I don't think you've set up your surface integral correctly. And yes, brackets would aid in clarity! I would use spherical coordinates for the top of the semi-sphere, and polar (cylindrical) coordinates for the base.
You have:
\begin{align*}
\iint_S(\mathbf{F}\cdot\mathbf{n})\,dS&=\iint_{\text{top}}(\mathbf{F}\cdot\mathbf{n})\,dS+\iint_{\text{base}}(\mathbf{F}\cdot\mathbf{n})\,dS\\
&=\int_0^{2\pi}\int_0^{\pi/2}\left[\langle x,y,z\rangle\cdot\underbrace{\frac{\langle x,y,z\rangle}{\sqrt{x^2+y^2+z^2}}}_{\mathbf{n}=\hat{\mathbf{r}}}\right]r^2\sin(\varphi)\,d\varphi\,d\theta \\
&+\int_0^{2\pi}\int_0^2\left[\langle x,y,z\rangle\cdot\underbrace{\langle 0,0,-1\rangle}_{\mathbf{n}}\right]\,r\,dr\,d\theta\\
&=r^3\int_0^{2\pi}\int_0^{\pi/2}\sin(\varphi)\,d\varphi\,d\theta+\underbrace{\int_0^{2\pi}\int_0^2(-z\,r)\,dr\,d\theta}_{=0,\;\text{because}\; z=0}\\
&=16\pi,
\end{align*}
as before. Note that I used the simplification
$$\langle x,y,z\rangle\cdot\frac{\langle x,y,z\rangle}{\sqrt{x^2+y^2+z^2}}=\frac{x^2+y^2+z^2}{\sqrt{x^2+y^2+z^2}}=\frac{r^2}{r}=r,$$
and that $r=2$ on the top surface of the semi-sphere.
