The Divergence Theorem
Gauss's theorem - §5.11, Kaplan
Prereq: §3.4 Divergence • §5.5 Green's Theorem • §4.7 Surface Area
How much fluid escapes a closed box every second? The answer connects what happens on the surface to what's happening inside.
Surface Integrals - Quick Review
Before stating the theorem, we need one piece of machinery: the surface integral of a vector field. If $S$ is a surface in space with outward unit normal $\mathbf{n}$, and $\mathbf{v} = L\,\mathbf{i} + M\,\mathbf{j} + N\,\mathbf{k}$ is a vector field, then
measures the flux of $\mathbf{v}$ across $S$ - the total rate at which the field "flows through" the surface. When the surface is given as $z = f(x,y)$, we have $d\sigma = \sqrt{1 + f_x^2 + f_y^2}\,dx\,dy$ (recall §4.7). For coordinate faces of a box, the normal is simply $\pm\mathbf{i}$, $\pm\mathbf{j}$, or $\pm\mathbf{k}$, so the flux integral reduces to integrating one component of $\mathbf{v}$ over that face.
The component form is often written:
From Green's to Gauss
Recall Green's theorem in its flux form. For a 2D vector field $\mathbf{v} = P\,\mathbf{i} + Q\,\mathbf{j}$ and a region $R$ bounded by a closed curve $C$:
This says: the total outward flux across the boundary curve equals the total divergence over the enclosed area.
Now here's the natural question: what if we go one dimension higher? Instead of a curve bounding a region in the plane, we have a surface $S$ bounding a solid region $R$ in space. Instead of a 2D divergence, we have the 3D divergence $\text{div}\,\mathbf{v} = \frac{\partial L}{\partial x} + \frac{\partial M}{\partial y} + \frac{\partial N}{\partial z}$. The generalization should feel inevitable:
The Divergence Theorem
Let $\mathbf{v} = L\,\mathbf{i} + M\,\mathbf{j} + N\,\mathbf{k}$ be a vector field whose components have continuous partial derivatives in a domain $D$. Let $S$ be a piecewise smooth surface forming the complete boundary of a bounded closed region $R$ in $D$, and let $\mathbf{n}$ be the outer normal of $S$. Then:
In component form:
The physical meaning is beautiful: for a fluid with velocity $\mathbf{u}$, the left side measures the total flux leaving $R$ through its boundary. The right side sums up all the "sources" inside. Mass can only leave by crossing the boundary - that's conservation of mass.
Proof Sketch
We prove just the $N\,dx\,dy$ component - the other two follow by relabeling variables. Assume $R$ can be written as
$$f_1(x,y) \le z \le f_2(x,y), \quad (x,y) \in R_{xy}$$where $R_{xy}$ is a region in the $xy$-plane. Then $S$ splits into three pieces: the top $S_2: z = f_2(x,y)$, the bottom $S_1: z = f_1(x,y)$, and the sides $S_3$ (where the normal is horizontal, so $\cos\gamma = 0$ and $N\,dx\,dy = 0$ there).
Surface integral side:
On $S_2$ the outward normal points up, so $N\,dx\,dy$ picks up $+N[x, y, f_2(x,y)]$. On $S_1$ the outward normal points down, giving $-N[x, y, f_1(x,y)]$. Together:
$$\iint_S N\,dx\,dy = \iint_{R_{xy}} \bigl\{N[x,y,f_2(x,y)] - N[x,y,f_1(x,y)]\bigr\}\,dx\,dy$$Volume integral side:
$$\iiint_R \frac{\partial N}{\partial z}\,dx\,dy\,dz = \iint_{R_{xy}} \left[\int_{f_1}^{f_2} \frac{\partial N}{\partial z}\,dz\right] dx\,dy = \iint_{R_{xy}} \bigl\{N[x,y,f_2] - N[x,y,f_1]\bigr\}\,dx\,dy$$The two sides are identical. For more complex regions, we cut $R$ into pieces of this type; the surface integrals over internal cuts cancel in pairs, leaving only the integral over the full boundary $S$.
Divergence as Flux per Unit Volume
The Divergence Theorem gives us a powerful new interpretation of $\text{div}\,\mathbf{v}$. Take a small sphere $S_r$ of radius $r$ centered at a point $(x_1, y_1, z_1)$ with volume $V_r = \frac{4}{3}\pi r^3$. The theorem says
$$\iint_{S_r} v_n\,d\sigma = \iiint_{R_r} \text{div}\,\mathbf{v}\,dV$$By the Mean Value Theorem for integrals, the right side equals $\text{div}\,\mathbf{v}(x^*, y^*, z^*) \cdot V_r$ for some point in $R_r$. Dividing both sides by $V_r$ and letting $r \to 0$:
In words: divergence = flux per unit volume. This meaning is coordinate-free - it doesn't depend on how we set up our axes - which is a deeply satisfying thing.
For a fluid with velocity $\mathbf{u}$ and density $\rho$, setting $\mathbf{v} = \rho\mathbf{u}$ and applying conservation of mass gives the continuity equation:
Worked Examples
Example (Problem 1a): Evaluate $\iint_S x\,dy\,dz + y\,dz\,dx + z\,dx\,dy$ where $S$ is the unit sphere $x^2 + y^2 + z^2 = 1$ with outer normal.
Here $\mathbf{v} = x\,\mathbf{i} + y\,\mathbf{j} + z\,\mathbf{k}$, so $\text{div}\,\mathbf{v} = 1 + 1 + 1 = 3$. By the Divergence Theorem:
$$\iint_S \mathbf{v} \cdot \mathbf{n}\,d\sigma = \iiint_R 3\,dV = 3 \cdot \frac{4}{3}\pi = 4\pi$$Without the theorem, we'd have to parametrize the sphere and compute a nasty surface integral. With it, we just compute a volume.
Example (Problem 1b): Evaluate $\iint_S v_n\,d\sigma$ where $\mathbf{v} = x^2\,\mathbf{i} + y^2\,\mathbf{j} + z^2\,\mathbf{k}$ and $S$ is the surface of the unit cube $0 \le x,y,z \le 1$.
$\text{div}\,\mathbf{v} = 2x + 2y + 2z$, so
$$\iiint_R (2x + 2y + 2z)\,dV = \int_0^1\!\int_0^1\!\int_0^1 (2x+2y+2z)\,dz\,dy\,dx$$By symmetry, each of the three terms contributes equally. For the $2x$ term: $\int_0^1 2x\,dx \cdot \int_0^1 dy \cdot \int_0^1 dz = 1 \cdot 1 \cdot 1 = 1$. So the total is $1 + 1 + 1 = 3$.
Final Review - When the Theorem Saves the Day
The Divergence Theorem is a tool with a narrow profile but enormous leverage. The whole game on exam day is recognizing when it applies, when it doesn't, and which side of the equation is easier to compute.
$\mathbf{v} = L\,\mathbf{i} + M\,\mathbf{j} + N\,\mathbf{k}$ has continuous partials in a domain containing $R$, $S$ is the piecewise-smooth boundary of $R$, and $\mathbf{n}$ is the outer normal so that $v_n = \mathbf{v}\cdot\mathbf{n}$.
- $S$ is closed (the complete boundary of a solid region).
- $\text{div}\,\mathbf{v}$ is simple - constant, zero, or a polynomial.
- The triple integral over $R$ is easier than parametrizing $S$.
The clearest signal is "compute the flux out of a sphere / cube / closed surface" with a polynomial vector field. Almost always faster via the volume integral.
- $S$ isn't closed - we'd have to cap it first.
- $\mathbf{v}$ has a singularity inside $R$ (e.g. $\mathbf{v} = \mathbf{r}/|\mathbf{r}|^3$ at the origin) - Kaplan's continuity hypothesis fails and the identity lies.
- $\text{div}\,\mathbf{v}$ is uglier than the surface integral. Always glance at it before committing.
If $S$ is open (like a hemisphere with no bottom), close it with a cap $S^*$ to form a closed surface $S \cup S^*$. Apply the theorem to the closed surface, then subtract the (usually easy) flux through the cap:
$$\iint_S v_n\,d\sigma \;=\; \iiint_R \text{div}\,\mathbf{v}\,dx\,dy\,dz \;-\; \iint_{S^*} v_n\,d\sigma.$$- $\mathbf{v} = x\,\mathbf{i} + y\,\mathbf{j} + z\,\mathbf{k}$ has $\text{div}\,\mathbf{v} = 3$, so $\iint_S v_n\,d\sigma = 3\,\text{Vol}(R)$. Use this to read off volume from a flux.
- $\mathbf{v} = x^2\,\mathbf{i} + y^2\,\mathbf{j} + z^2\,\mathbf{k}$ has $\text{div}\,\mathbf{v} = 2(x + y + z)$ - clean, often combines with symmetry on a cube (cf. our worked example).
- If $\text{div}\,\mathbf{v} = 0$ in $R$, the flux through any closed surface in $R$ is zero. Kaplan calls such a field solenoidal.
The three big theorems on one shelf. So we don't mix them up:
- Green's (§5.5): 2-D, line $\leftrightarrow$ area. $\oint P\,dx + Q\,dy = \iint_R \left(\dfrac{\partial Q}{\partial x} - \dfrac{\partial P}{\partial y}\right) dx\,dy$.
- Stokes (§5.12): 3-D, line $\leftrightarrow$ surface. $\oint_C \mathbf{v}\cdot d\mathbf{r} = \iint_S (\text{curl}\,\mathbf{v})_n\,d\sigma$.
- Gauss / Divergence (§5.11): 3-D, surface $\leftrightarrow$ volume. $\iint_S v_n\,d\sigma = \iiint_R \text{div}\,\mathbf{v}\,dx\,dy\,dz$.
The pattern: each one trades one boundary dimension for one interior dimension, with the relevant differential operator inserted.
Traps to Watch For
Most failed Divergence Theorem problems fall into one of these patterns. We name them now to make them recognizable later.
- Applying it to an open surface. The theorem requires a closed surface. If we're given a hemisphere, paraboloid cap, or disk-bounded patch, either close it (the cap trick above) or reach for Stokes instead.
- Wrong normal direction. Kaplan's statement assumes the outer normal. If a problem specifies inward, flip the sign of the answer. Sketching $\mathbf{n}$ once before integrating saves us from sign-flip errors at the end.
- Singularity inside $R$. Fields like $\mathbf{v} = \mathbf{r}/|\mathbf{r}|^3$ have $\text{div}\,\mathbf{v} = 0$ everywhere except the origin - and the theorem fails if the origin is in $R$, since the continuity hypothesis is violated. The flux is $4\pi$, not $0$. (This is the heart of Gauss's law in physics.)
- Computing surface area instead of flux. $\iint_S d\sigma$ is area; $\iint_S v_n\,d\sigma$ is flux. Reading the integrand carefully prevents the embarrassment of converting "area of a sphere" into a volume integral.
- Forgetting to integrate the divergence. The volume side is $\iiint_R \text{div}\,\mathbf{v}\,dx\,dy\,dz$, not just $\text{div}\,\mathbf{v}$ at one point times the volume - unless the divergence happens to be constant.
- Mixing up Gauss with Green's or Stokes. Gauss is the only one converting a closed surface to a volume. If we see a line integral, it's Green's (2-D) or Stokes (3-D). If we see an open surface bounded by a curve, it's Stokes. The shelf above is worth a 30-second look before any §5 problem.
Practice Problems - §5.11
From Kaplan, problems after §5.11
$\mathbf{v} = e^y\cos z\,\mathbf{i} + e^x\sin z\,\mathbf{j} + e^x\cos y\,\mathbf{k}$
$\text{div}\,\mathbf{v} = \frac{\partial}{\partial x}(e^y\cos z) + \frac{\partial}{\partial y}(e^x\sin z) + \frac{\partial}{\partial z}(e^x\cos y) = 0 + 0 + 0 = 0$
$\displaystyle\iint_S \mathbf{v}\cdot\mathbf{n}\,d\sigma = \iiint_R 0\,dV = \boxed{0}$
$\nabla F = 2x\,\mathbf{i} + 2y\,\mathbf{j} + 2z\,\mathbf{k}$
$\text{div}(\nabla F) = \nabla^2 F = 2 + 2 + 2 = 6$
$\displaystyle\iint_S \nabla F \cdot \mathbf{n}\,d\sigma = \iiint_R 6\,dV = 6\,\text{Vol}(R)$