Does the Divergence Theorem Work on a Surface? The divergence theorem in $\mathbb{R}^3$ says that the integral of the divergence of a vector field over a solid $\Omega$ in $\mathbb{R}^3$ equals the flux through the surface of $\Omega$ denoted by $\partial \Omega$. 
My question is that can you use the divergence theorem in $\mathbb{R}^3$ where you're integrating the divergence of a vector field over a surface $S$ in $\mathbb{R}^3$ to get the flux through the edges ($\partial S$) of the surface? So if the surface $S$ is closed in $\mathbb{R}^3$ such as a sphere, then clearly $\partial S = 0$ so the integral of the divergence over this particular $S$ is $0$?
 A: You could ask the same question about a region in the plane: can you integrate the divergence of a vector field on a region to obtain a flux through the boundary curve?  The answer is yes.  If $R$ is any region in the plane with counterclockwise boundary curve $\partial R$, then
$$
\int_{R}\left(\frac{\partial P}{\partial x}+\frac{\partial Q}{\partial y}\right) dA \;=\; \oint_{\partial R} \left(-Q\,dx + P\, dy\right).
$$
for any vector field $P\hspace{0.5pt}\textbf{i}+Q\textbf{j}$.  However, this two-dimensional version of the Divergence Theorem isn't anything new: it's just Green's Theorem applied to the vector field $(-Q,P)$.  Note that $(-Q,P)$ is obtained from $(P,Q)$ by rotating each vector counterclockwise by $90^\circ$, so the two-dimesnonal Divergence Theorem is just a "rotated" version of Green's Theorem.
The Divergence Theorem for a surface in $\mathbb{R}^3$ is similar, except that it's basically a "rotated" version of the Curl Theorem (sometimes called Stokes' Theorem).  Specifically, if $S$ is a surface with unit normal $\textbf{n}$ and $\textbf{F}$ is a vector field tangent to $S$, then we can rotate $\textbf{F}$ counterclockwise $90^\circ$ by taking its cross product with $\textbf{n}$ (so the rotated field is $\textbf{n}\times\textbf{F}$).  Then we can define the "divergence" of $\textbf{F}$ on $S$ by
$$
\mathrm{div}_S(\textbf{F}) \;=\; \textbf{n}\cdot \mathrm{curl}(\textbf{n}\times\textbf{F}).
$$
This formula makes sense even if $\textbf{F}$ isn't tangent to $S$, since it ignores any component of $\textbf{F}$ in the normal direction.
The curl theorem tells us that
$$
\int_S \textbf{n}\cdot\mathrm{curl}(\textbf{G})\;dA \;=\; \oint_{\partial S} \textbf{t}\cdot \textbf{G}\; ds
$$
for any vector field $\textbf{G}$, where $\textbf{t}$ is the unit tangent vector to the curve $\partial S$ (oriented using the right-hand rule).  Substituting $\textbf{G} = \textbf{n}\times\textbf{F}$ gives
$$
\int_S \mathrm{div}_S(\textbf{F})\,dA \;=\; \oint_{\partial S} \textbf{t}\cdot(\textbf{n}\times\textbf{F})\; ds.
$$
This is the Divergence Theorem on a surface that you're looking for.  The triple product $\textbf{t}\cdot(\textbf{n}\times\textbf{F})$ computes the flux of $\textbf{F}$ through the boundary curve. Perhaps a better way to write the same formula is
$$
\int_S \mathrm{div}_S(\textbf{F})\,dA \;=\; \oint_{\partial S} (\textbf{t}\times\textbf{n})\cdot\textbf{F}\; ds,
$$
where $\textbf{t}\times\textbf{n}$ is a unit vector tangent to the surface, perpendicular to the boundary curve, and pointing directly "out".
