# Gauss's divergence theorem for a scalar field

I know Gauss's divergence theorem for a vector field:

$$\iint{\vec{F}\cdot\hat{n}}\space{dS}=\iiint\nabla\cdot\vec{F}\space{dV}$$

But how do you apply this to a scalar field? For example, if you wanted to find the surface integral of $z^2$ over a unit cube:

$$\iint_{S}z^2{dS}$$

where $S$ is the surface of unit cube, how would you approach this using Gauss's divergence theorem?

• Isn't that a dot product in the surface integral, not a cross product? – Muphrid Jun 15 '13 at 5:26
• you must mean $S$ as the surface of the unit cube. – smiley06 Jun 15 '13 at 5:41

You can always write $z^2 = z^2 \hat{n}.\hat{n}$ where $\hat{n}$ is the unit normal then using divergence theorem your expression becomes $$\iiint_{|z|\leq 1} \nabla.(z^2\hat{n})dV$$

• So does that mean the integral will become $\int_{-1}^1\int_{-1}^1\int_{-1}^1{2z}dz\space{dy}\space{dx}$? – Ataraxia Jun 15 '13 at 5:47
• The normal vector is different for each face on the cube. – Shuhao Cao Jun 15 '13 at 5:50
• Well in this case $\hat{n} = \pm z^2 e_i$ for $i \in \{1,2,3\}$, for the case of $\pm z^2 e_3$ you have $\pm 2z$ and otherwise $0$. – smiley06 Jun 15 '13 at 5:59
• @smiley06 What? Then just try the double integral directly on the face $F$ that has $e_1$ as unit outward normal, see if you can get $$\iint_F z^2 dy\wedge dz$$ equal to 0. – Shuhao Cao Jun 15 '13 at 6:11
• To be more explicit, you have to have a (nice) vector field defined everywhere on the volume. $\hat n$ is only defined (piecewise smoothly) on the surface, not inside. Indeed, there is no continuous unit vector field inside agreeing with $\hat n$ on the surface. – Ted Shifrin Jun 15 '13 at 11:27

Indeed we can use divergence theorem if we could find an $F$ such that: $$\iint_S g\,dS = \iint_S F\cdot n\,dS.\tag{1}$$

Though the example you gave is not very illustrative it seems. Say the unit cube is $D = [0,1]\times[0,1]\times [0,1]$. The faces perpendicular to the $x$-axis have unit outward normals $(\pm 1,0,0)$, if we want $F\cdot (1,0,0) = z^2$ on the face $\{x = 1\}\cap D$, while $F\cdot (-1,0,0) = z^2$ on the face $\{x = 0\}\cap D$ as well?

Here we can't find a well-defined $F$ such that $F\cdot n = z^2$ on all six faces of the unit cube, and we have to evaluate directly: $$\mathrm{Top} + \mathrm{Bottom} = \iint_{[0,1]\times[0,1]\times \{1\}} 1 \,dxdy + \iint_{[0,1]\times[0,1]\times \{-1\}} 0 \,dxdy, \\ \mathrm{Right} + \mathrm{Left} = \iint_{[0,1]\times\{1\}\times [0,1]} z^2 \,dzdx + \iint_{[0,1]\times \{-1\}\times[0,1]} z^2 \,dzdx, \\ \mathrm{Front} + \mathrm{Back} = \iint_{\{1\}\times[0,1]\times [0,1]} z^2 \,dydz + \iint_{\{-1\}\times[0,1]\times [0,1]} z^2 \,dydz.$$

Based on my teaching experience, the problem to illustrate (1) is actually taking $S$ to be the unit 2-sphere: $$S = S^2 = \{(x,y,z): x^2 + y^2 + z^2 = 1\},$$ so that the unit outward normal is $n=(x,y,z)$: $$\iint_S z^2 \,dS = \iint_S (0,0,z)\cdot (x,y,z) \,dS = \iiint_{B(0,1)} \nabla\cdot (0,0,z)\,dV = |B(0,1)|.$$