Finding $\int_S z\,dS$ where $S=\left\{ \big(x,y,z\big):x^2+y^2+z^2=a^2,z\ge 0, a>0\right\}$ $$\int_Sz\,dS$$
$$S=\big\{ \big(x,y,z\big):x^2+y^2+z^2=a^2,z\ge 0, a>0\big\}$$

I've already calculate this surface integral " by hand " :
$$z=\sqrt{a^2-x^2-y^2}\text{, thus,}$$
$$\int_SzdS=\int\int_{x^2+y^2\le a^2}\sqrt{a^2-x^2-y^2}\cdot\bigg(\sqrt{1+z_x^2+z_y^2}\bigg)dxdy$$
$$=\int_SzdS=\int\int_{x^2+y^2\le a^2}\sqrt{a^2-x^2-y^2}\cdot\bigg(\sqrt{\frac{a^2}{a^2-x^2-y^2}}\bigg)dxdy=\int_SzdS=\int\int_{x^2+y^2\le a^2}adxdy=a^3\pi.$$

I want to prove it by using the Gauss divergence theorem, but im making a mistake somewhere:
$$\text{Let } F=(F_1,F_2,F_3),$$
$$\text{And i want  to find the unit normal vector $\hat n$ of $S$ }$$
$$\hat n =\frac{\nabla f}{\lvert \nabla f \rvert}\text{, where } f:=x^2+y^2+z^2-a^2$$
$$\text{we get: }\hat n=\big(\frac{x}{a},\frac{y}{a},\frac{z}{a}\big)\quad \text{ we want:}$$
$$F\cdot\hat n=z \Rightarrow F_1=F_2=0,F_3=a$$
$$\Rightarrow \nabla \cdot F=0+0+0=0$$
$$\text{but obviously } \int_S zdS\ne 0$$
What am i doing wrong?
thank you.

 A: With the same trick, you can use Stokes' theorem in one of two ways. First is directly:
$$\nabla \times H = (0,0,a) \to H = (0,ax,0)$$
which gives us the line integral
$$\int\limits_{x^2+y^2=a^2\:\cap\:z=0}(0,ax,0)\cdot dr = a^3\int_0^{2\pi}\cos^2 t\:dt = \pi a^3$$
Or we can use a corollary of Stokes' theorem, which says that we can shift the surface integral over to another surface that shares the same boundary as the original (Think distorting a bubble when you blow it from a hoop). In this case we can say that
$$\iint\limits_{x^2+y^2+z^2=a^2\:\cap\:z\geq 0}(0,0,a)\cdot dS = \iint\limits_{x^2+y^2\leq a^2\:\cap \:z=0}(0,0,a)\cdot dS = a\iint\limits_{x^2+y^2\leq a^2}\;dA = \pi a^3$$
A: But you can apply the Gauss Divergence Theorem if you add to the surface the bottom disk $z=0$, $x^2+y^2\le a^2$, oriented downward. You now have a closed surface and so the flux across that closed surface is the integral of $\text{div}\,F$ over the region enclosed. As you showed, that integral will be $0$.
Therefore, it follows that the flux of $F$ across $S$ is the negative of the flux downward across the disk, i.e., the positive flux upward across the disk. (This makes sense, right? Since there are no sources in the solid hemisphere, whatever flows across the bottom must then flow outward across $S$.) But the flux of $F$ upward across the disk is easy to calculate, since $F_3=a$ is constant. We get $a\cdot \pi a^2 = \pi a^3$, as desired.
Note that Ninad's second solution is equivalent to this. But the approach using Gauss's Theorem works more generally when $\text{div}\,F\ne 0$. You just have to compute the triple integral of $\text{div}\,F$ and then adjust by the flux across the bottom.
