For twenty-three chapters you have been chasing a single slogan, even when you could not yet see where it led: the integral of a derivative over a region equals the values on the boundary. It first appeared in Chapter 14, the Fundamental Theorem of...
Prerequisites
- Chapter 35: Line Integrals
- Chapter 36: Surface Integrals
Learning Objectives
- State and apply Stokes' theorem.
- State and apply the Divergence theorem.
- Recognize these as generalizations of Green's theorem and FTC.
- Use them to compute integrals that would otherwise be impractical.
- Apply to Maxwell's equations and fluid dynamics.
In This Chapter
- 37.1 The Climb to the Summit
- 37.2 Stokes' Theorem: Circulation Equals Curl-Flux
- 37.3 Verifying Stokes' Theorem by Hand
- 37.4 The Divergence Theorem: Flux Equals Total Divergence
- 37.5 Verifying the Divergence Theorem by Hand
- 37.6 One Slogan, Four Theorems
- 37.7 The Payoff: Maxwell's Equations
- 37.8 More Conservation Laws: One Pattern, Many Sciences
- 37.9 When Curl or Divergence Vanishes: Potentials
- 37.10 Numerical Verification in Python
- 37.11 Discrete and Higher-Dimensional Versions
- Looking Ahead
- Reflection
Chapter 37 — Stokes' Theorem and the Divergence Theorem
37.1 The Climb to the Summit
For twenty-three chapters you have been chasing a single slogan, even when you could not yet see where it led: the integral of a derivative over a region equals the values on the boundary. It first appeared in Chapter 14, the Fundamental Theorem of Calculus, where the "region" was an interval $[a,b]$, its "boundary" was the two endpoints, and the slogan read $\int_a^b f'\,dx = f(b) - f(a)$. In Chapter 35 it returned, dressed for two dimensions: Green's theorem traded an interval for a planar region $D$ and traded the two endpoints for the closed curve $\partial D$ that fences it in.
This chapter is the summit of that climb. Here the slogan finally reaches three dimensions, and it does so in two distinct guises — one built from curl, one built from divergence. These are the two crowning theorems of vector calculus, and physicists, engineers, and applied mathematicians use them daily.
Stokes' theorem says that the circulation of a field around the rim of a surface equals the total curl flowing through that surface:
$$\oint_{\partial S} \mathbf{F} \cdot d\mathbf{r} = \iint_S (\nabla \times \mathbf{F}) \cdot d\mathbf{S}.$$
The Divergence theorem (also called Gauss's theorem) says that the flux of a field outward through a closed surface equals the total divergence contained in the solid it bounds:
$$\oiint_{\partial E} \mathbf{F} \cdot d\mathbf{S} = \iiint_E (\nabla \cdot \mathbf{F}) \, dV.$$
Read each one slowly and you will hear the same sentence we have been repeating since Chapter 14. On the left, an integral over a boundary — a curve $\partial S$, a surface $\partial E$. On the right, an integral of a derivative — the curl $\nabla\times\mathbf{F}$, the divergence $\nabla\cdot\mathbf{F}$ — over the interior. Both are the Fundamental Theorem of Calculus, grown up and moved into space.
The Key Insight. Stokes' theorem and the Divergence theorem are the three-dimensional faces of one idea: integrate a derivative over a region, and out pops an integral over its boundary. FTC (Chapter 14) is that idea in 1D; Green's theorem (Chapter 35) is it in 2D; these two are it in 3D. Chapter 38 will collapse all of them into a single equation. The whole of vector calculus is this one slogan, dimension by dimension.
This chapter delivers both theorems with motivation, geometric pictures, three levels of rigor, verification examples you can check by hand, a numerical confirmation in Python, and a payoff that has shaped the modern world: Maxwell's equations, the four laws of electromagnetism, are nothing but these theorems applied to electric and magnetic fields. By the end you will see why a single mathematical slogan underlies radio, light, and the entire electrical age.
37.2 Stokes' Theorem: Circulation Equals Curl-Flux
Begin with curl. Back in Chapter 34 we defined the curl of a vector field, $\nabla\times\mathbf{F}$, as the field's local tendency to rotate — drop a tiny paddle wheel into the flow, and the curl tells you how fast and about which axis it spins. In Chapter 35 we met circulation, the line integral $\oint_C \mathbf{F}\cdot d\mathbf{r}$, which measures the net "push" a field gives to something traveling once around a closed loop $C$. Stokes' theorem is the bridge between these two ideas.
Stokes' Theorem. Let $S$ be a piecewise-smooth oriented surface in $\mathbb{R}^3$ whose boundary is a piecewise-smooth simple closed curve $\partial S$, oriented compatibly with $S$ by the right-hand rule. Let $\mathbf{F}$ be a vector field with continuous first partial derivatives on a region containing $S$. Then $$\oint_{\partial S} \mathbf{F} \cdot d\mathbf{r} = \iint_S (\nabla \times \mathbf{F}) \cdot d\mathbf{S}.$$
The orientation condition is the one piece of bookkeeping you must respect. Choose a direction for the surface normal $\mathbf{n}$ (which fixes $d\mathbf{S} = \mathbf{n}\,dS$). Then the boundary $\partial S$ must be traversed so that, if you walk along it with your head pointing along $\mathbf{n}$, the surface is on your left. Equivalently: curl the fingers of your right hand in the direction you walk the boundary, and your thumb points along $\mathbf{n}$. Flip the normal, and you must flip the direction you walk — both sides of Stokes' theorem change sign together, so the equation stays true.
Geometric Intuition. Picture the surface $S$ as a soap film stretched across a wire loop $\partial S$. The right side of Stokes' theorem, $\iint_S (\nabla\times\mathbf{F})\cdot d\mathbf{S}$, adds up all the microscopic spinning happening inside the film. The left side, $\oint_{\partial S}\mathbf{F}\cdot d\mathbf{r}$, measures the net swirl you feel walking once around the rim. Why are they equal? Imagine tiling the film with tiny paddle wheels. Where two neighbors touch, their rims spin in opposite directions and cancel. Only the outer rims — the ones touching the wire, with no neighbor to cancel them — survive. The interior swirl telescopes outward to the boundary. That cancellation is the entire theorem in one image.
A crucial and liberating feature: the right-hand side depends only on the boundary curve, not on which surface fills it. A wire loop can be spanned by a flat disk, a hemispherical dome, or a wildly crumpled balloon — Stokes' theorem says all of them give the same curl-flux, because all of them give the same boundary line integral. (The precise reason is that the curl field is divergence-free; we return to this in §37.9.) This is what makes Stokes' theorem a computational gift: when one surface is hideous to integrate over, swap it for a friendlier one with the same rim.
Stokes' theorem contains Green's theorem
Stokes' theorem is not a new species; it is Green's theorem (Chapter 35) liberated from the plane. Suppose $S$ lies flat in the $xy$-plane with upward normal $\mathbf{n} = \hat{\mathbf{z}}$, and write $\mathbf{F} = \langle P, Q, 0\rangle$. The curl reduces to
$$\nabla\times\mathbf{F} = \left\langle 0,\ 0,\ \frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y}\right\rangle,$$
so $(\nabla\times\mathbf{F})\cdot\hat{\mathbf{z}} = Q_x - P_y$, and Stokes' theorem collapses to
$$\oint_{\partial S} P\,dx + Q\,dy = \iint_S \left(\frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y}\right)dA.$$
That is exactly Green's theorem in its circulation form. So Green's theorem is the special case of Stokes' theorem where the surface happens to be a flat patch of the $xy$-plane. Stokes' theorem lifts that flat patch up off the page and lets it bend into any surface in space.
Historical Note. The theorem bears the name of George Gabriel Stokes (1819–1903), but he did not discover it. It appeared first as a postscript in an 1850 letter from William Thomson (Lord Kelvin) to Stokes. Stokes then set it as a problem on the 1854 Smith's Prize examination at Cambridge — which is how it entered the textbooks under his name. One of the students sitting that exam was James Clerk Maxwell, who would soon use exactly this theorem to forge the equations of electromagnetism (§37.7). Mathematical immortality, it turns out, can come from writing a good exam question.
37.3 Verifying Stokes' Theorem by Hand
The fastest way to trust a theorem is to watch both sides land on the same number. We will do this carefully.
Example 1 — the rotational field on a disk. Take $\mathbf{F} = \langle -y, x, 0\rangle$, the standard counterclockwise swirl, and let $S$ be the unit disk $D: x^2 + y^2 \le 1$ in the $xy$-plane, oriented upward ($\mathbf{n} = \hat{\mathbf{z}}$). The boundary $\partial S$ is the unit circle, and the right-hand rule says to traverse it counterclockwise.
Right side (curl-flux). Compute the curl:
$$\nabla\times\mathbf{F} = \begin{vmatrix}\hat{\mathbf{i}} & \hat{\mathbf{j}} & \hat{\mathbf{k}} \\[2pt] \partial_x & \partial_y & \partial_z \\[2pt] -y & x & 0\end{vmatrix} = \langle\, 0 - 0,\ 0 - 0,\ 1 - (-1)\,\rangle = \langle 0, 0, 2\rangle.$$
Then $(\nabla\times\mathbf{F})\cdot\hat{\mathbf{z}} = 2$, and
$$\iint_S (\nabla\times\mathbf{F})\cdot d\mathbf{S} = \iint_D 2\,dA = 2 \cdot (\text{area of unit disk}) = 2\pi.$$
Left side (circulation). Parametrize the unit circle by $\mathbf{r}(t) = \langle\cos t, \sin t, 0\rangle$ for $t\in[0,2\pi]$, so $\mathbf{r}'(t) = \langle-\sin t, \cos t, 0\rangle$. On the curve, $\mathbf{F} = \langle-\sin t, \cos t, 0\rangle$, and
$$\oint_{\partial S}\mathbf{F}\cdot d\mathbf{r} = \int_0^{2\pi}\langle-\sin t,\cos t,0\rangle\cdot\langle-\sin t,\cos t,0\rangle\,dt = \int_0^{2\pi}(\sin^2 t + \cos^2 t)\,dt = \int_0^{2\pi}1\,dt = 2\pi.$$
Both sides equal $2\pi$. ✓ This is the same line integral we computed in Chapter 35; Stokes' theorem reproduces it as a curl-flux.
Example 2 — same rim, harder surface. Now exploit the surface-independence we advertised. Keep $\mathbf{F} = \langle -y, x, 0\rangle$ and the same boundary circle, but span it with the upper unit hemisphere $S': x^2 + y^2 + z^2 = 1,\ z\ge 0$, oriented with outward (upward) normal. Directly integrating $(\nabla\times\mathbf{F})\cdot d\mathbf{S} = \langle 0,0,2\rangle\cdot d\mathbf{S}$ over a curved hemisphere looks unpleasant — but Stokes' theorem promises the answer must again be $2\pi$, because the boundary is still the unit circle and the line integral has not changed. We confirm this numerically in §37.10. The lesson: choose the surface that makes your life easiest. Here the flat disk wins; sometimes the dome wins. Stokes' theorem lets you choose.
Common Pitfall. Many students forget that Stokes' theorem demands the boundary be oriented consistently with the chosen normal, and they lose a sign. If you pick the upward normal $+\hat{\mathbf{z}}$ but then walk the boundary clockwise, you will compute $\oint = -2\pi$ while the surface integral gives $+2\pi$, and conclude the theorem is "wrong." It is not — you broke the right-hand rule. Always fix the normal first, then let the right hand tell you which way to walk. A mismatched orientation flips exactly one side of the equation.
Check Your Understanding. Let $\mathbf{F} = \langle z, x, y\rangle$ and let $S$ be any surface whose boundary is the unit circle in the $xy$-plane, traversed counterclockwise (normal pointing up). Find $\oint_{\partial S}\mathbf{F}\cdot d\mathbf{r}$ using Stokes' theorem.
Answer
Compute the curl: $\nabla\times\langle z,x,y\rangle = \langle \partial_y y - \partial_z x,\ \partial_z z - \partial_x y,\ \partial_x x - \partial_y z\rangle = \langle 1, 1, 1\rangle$. The simplest spanning surface is the flat unit disk with normal $\hat{\mathbf{z}}$, so $(\nabla\times\mathbf{F})\cdot\hat{\mathbf{z}} = 1$ and $\oint_{\partial S}\mathbf{F}\cdot d\mathbf{r} = \iint_D 1\,dA = \pi$. Notice we never had to parametrize the line integral at all — Stokes' theorem turned a circulation into the area of a disk.
Why Stokes' theorem is true: a proof sketch
The honest proof is a careful patchwork, and it earns the cancellation picture from §37.2.
Why we care. Stokes' theorem lets us trade a hard surface integral for an easy line integral (or vice versa), and it is the engine that converts Maxwell's circulation laws between their integral and differential forms.
Key idea. Cut $S$ into many tiny, nearly flat patches. On each patch, the field is almost constant and the surface is almost a plane, so Green's theorem (which we already proved in Chapter 35) applies locally: the curl-flux through the patch equals the circulation around the patch's little boundary.
The cancellation. Now sum over all patches. Every interior edge is shared by two adjacent patches, and they traverse that edge in opposite directions — so those contributions cancel in pairs. The only edges that survive are the ones on the outer rim, which together form $\partial S$. Summing the patch-Green's-theorems therefore gives exactly
$$\sum_{\text{patches}}\iint_{\text{patch}}(\nabla\times\mathbf{F})\cdot d\mathbf{S} = \sum_{\text{patches}}\oint_{\partial\,\text{patch}}\mathbf{F}\cdot d\mathbf{r} = \oint_{\partial S}\mathbf{F}\cdot d\mathbf{r}.$$
As the patches shrink, the left sum becomes the surface integral $\iint_S (\nabla\times\mathbf{F})\cdot d\mathbf{S}$, and the theorem falls out.
Math Major Sidebar. The patchwork argument is morally correct but conceals real analytic work: one must show the patch errors vanish in the limit (they are higher-order in the patch size) and handle curvature so the local "flat" Green's theorem is legitimate to leading order. The cleanest rigorous route parametrizes $S$ by a map $\mathbf{r}: D\to\mathbb{R}^3$ from a planar region $D$, pulls the line integral back to $\partial D$, applies the genuine planar Green's theorem on $D$, and checks via the chain rule and the vector identity $\nabla\times(\nabla g)=\mathbf{0}$ that the pulled-back integrand matches $(\nabla\times\mathbf{F})\cdot(\mathbf{r}_u\times\mathbf{r}_v)$. The mixed second-partials $g_{uv}=g_{vu}$ (Clairaut's theorem, Chapter 29) is the linchpin that makes the cross-terms cancel. Spivak's Calculus on Manifolds does this honestly in a dozen pages — and then reveals it is a one-line corollary of the general Stokes' theorem we preview in §37.16.
37.4 The Divergence Theorem: Flux Equals Total Divergence
The second great theorem swaps curl for divergence and a surface for a solid. Recall from Chapter 34 that the divergence $\nabla\cdot\mathbf{F}$ measures how much a field spreads out from a point — it is the local "source strength," positive where the field gushes outward, negative where it drains inward. The flux $\oiint_S\mathbf{F}\cdot d\mathbf{S}$, from Chapter 36, measures the net amount of the field passing outward through a closed surface. The Divergence theorem ties them together.
The Divergence Theorem (Gauss's Theorem). Let $E$ be a solid region in $\mathbb{R}^3$ bounded by a piecewise-smooth closed surface $\partial E$, oriented with the outward-pointing normal. Let $\mathbf{F}$ have continuous first partial derivatives on a region containing $E$. Then $$\oiint_{\partial E} \mathbf{F} \cdot d\mathbf{S} = \iiint_E (\nabla \cdot \mathbf{F}) \, dV.$$
In words: the net flux out through the skin equals the total source strength inside. If you sum up every tiny source and sink throughout the volume, you get exactly the net amount escaping through the boundary — nothing is created or destroyed in transit.
Geometric Intuition. Picture the solid $E$ packed full of tiny boxes, like sugar cubes filling a bag. Each cube has its own little flux: stuff flows in some faces and out others, and the net outflow from one cube is (divergence) × (its volume). Now stack the cubes. Wherever two cubes share a face, the flux leaving one enters the other — those internal fluxes cancel exactly, plus against minus. Only the faces on the outer skin of the bag have no neighbor to cancel them. So the sum of all the internal source strengths telescopes outward and equals the flux through the skin $\partial E$. It is the same telescoping that drove Stokes' theorem, one dimension up.
Historical Note. The theorem is named for Carl Friedrich Gauss (1777–1855), who used special cases in his 1813 work on gravitational attraction, though Lagrange, Ostrogradsky, and Green all discovered versions independently in the same era. In the French and Russian literature it is often called Ostrogradsky's theorem, after Mikhail Ostrogradsky, who gave the first general proof in 1826. As with Stokes' theorem, the name is a historical accident — the mathematics belongs to a whole generation.
37.5 Verifying the Divergence Theorem by Hand
Example 3 — the radial field on a ball. Take $\mathbf{F} = \langle x, y, z\rangle$, the field that points straight outward from the origin, and let $E$ be the closed unit ball $x^2+y^2+z^2\le 1$, with boundary the unit sphere.
Right side (total divergence). The divergence is constant:
$$\nabla\cdot\mathbf{F} = \frac{\partial x}{\partial x} + \frac{\partial y}{\partial y} + \frac{\partial z}{\partial z} = 1 + 1 + 1 = 3.$$
So $\displaystyle\iiint_E 3\,dV = 3\cdot\text{Vol}(E) = 3\cdot\tfrac{4}{3}\pi = 4\pi.$
Left side (flux). On the unit sphere the outward normal is $\mathbf{n} = \langle x,y,z\rangle$ (the position vector, already a unit vector since $x^2+y^2+z^2=1$). Therefore $\mathbf{F}\cdot\mathbf{n} = x^2+y^2+z^2 = 1$ everywhere on the sphere, and
$$\oiint_{\partial E}\mathbf{F}\cdot d\mathbf{S} = \oiint_{\partial E} 1\,dS = \text{surface area of unit sphere} = 4\pi.$$
Both sides equal $4\pi$. ✓ We computed this flux directly in Chapter 36; the Divergence theorem recovers it from a one-line volume integral.
Example 4 — flux through a box. Compute the outward flux of $\mathbf{F} = \langle x^2, y^2, z^2\rangle$ through the surface of the unit cube $[0,1]^3$. A direct surface integral means six separate face integrals. The Divergence theorem collapses all six into one:
$$\nabla\cdot\mathbf{F} = 2x + 2y + 2z.$$
$$\oiint_{\partial E}\mathbf{F}\cdot d\mathbf{S} = \iiint_{[0,1]^3}(2x+2y+2z)\,dV.$$
By symmetry the three terms contribute equally. For the first,
$$\iiint_{[0,1]^3} 2x\,dV = 2\int_0^1 x\,dx\int_0^1 dy\int_0^1 dz = 2\cdot\tfrac12\cdot 1\cdot 1 = 1,$$
and the $2y$ and $2z$ terms each give $1$ as well, for a total flux of $\boxed{3}$. One volume integral replaced six surface integrals. This is the practical superpower of the Divergence theorem: closed surfaces are exactly where it shines.
Example 5 — turning a nasty surface integral into an easy volume integral. Find the flux of $\mathbf{F} = \langle x^3, y^3, z^3\rangle$ through the unit sphere. Directly, $\mathbf{F}\cdot\mathbf{n} = x^4 + y^4 + z^4$ on the sphere — an unpleasant integrand. Through divergence it becomes routine:
$$\nabla\cdot\mathbf{F} = 3x^2 + 3y^2 + 3z^2 = 3\rho^2 \quad(\text{in spherical, with } \rho = \sqrt{x^2+y^2+z^2}).$$
Switching to spherical coordinates ($dV = \rho^2\sin\phi\,d\rho\,d\phi\,d\theta$, Chapter 33),
$$\iiint_E 3\rho^2\,dV = 3\int_0^{2\pi}\!\!\int_0^{\pi}\!\!\int_0^1 \rho^2\cdot\rho^2\sin\phi\,d\rho\,d\phi\,d\theta = 3\underbrace{\left(\int_0^1\rho^4\,d\rho\right)}_{1/5}\underbrace{\left(\int_0^\pi\sin\phi\,d\phi\right)}_{2}\underbrace{\left(\int_0^{2\pi}d\theta\right)}_{2\pi} = 3\cdot\tfrac15\cdot 2\cdot 2\pi = \frac{12\pi}{5}.$$
The direct surface integral of $x^4+y^4+z^4$ is far more work. Whenever you face a flux through a closed surface, reach for the Divergence theorem first.
Common Pitfall. The Divergence theorem requires a closed surface — one with no holes, that fully encloses a solid — and it requires $\mathbf{F}$ to be differentiable everywhere inside. Two traps follow. First, if the surface is open (a hemisphere shell with no flat bottom, say), you cannot apply the theorem until you cap it off, and you must then subtract the cap's flux. Second, if the field has a singularity inside — the inverse-square field $\mathbf{F} = \mathbf{r}/\|\mathbf{r}\|^3$ blows up at the origin — the theorem fails as stated, because $\nabla\cdot\mathbf{F}$ is not defined throughout $E$. That failure is not a bug; it is precisely how a point charge produces nonzero flux through any sphere around it (the heart of Gauss's law, §37.6). Check enclosure and differentiability before you apply either theorem.
Check Your Understanding. Use the Divergence theorem to find the outward flux of $\mathbf{F} = \langle 2x, 3y, z\rangle$ through any closed surface enclosing a solid region $E$ of volume $V$.
Answer
$\nabla\cdot\mathbf{F} = 2 + 3 + 1 = 6$, a constant. So the flux is $\iiint_E 6\,dV = 6V$. The flux depends only on the volume enclosed, not the shape of the surface — a direct consequence of the divergence being constant. For a unit ball, $V = \tfrac{4}{3}\pi$ and the flux is $8\pi$.
Why the Divergence theorem is true: a proof sketch
The argument mirrors the sugar-cube picture and Stokes' patchwork exactly.
Key idea. Partition $E$ into tiny boxes. For one box of dimensions $\Delta x\times\Delta y\times\Delta z$ at position $(x,y,z)$, compute the net flux out of its six faces. Consider just the two faces perpendicular to the $x$-axis: the flux out the right face minus the flux in the left face is approximately
$$\big[F_1(x+\Delta x, y, z) - F_1(x, y, z)\big]\,\Delta y\,\Delta z \approx \frac{\partial F_1}{\partial x}\,\Delta x\,\Delta y\,\Delta z.$$
Adding the analogous $y$- and $z$-face pairs, the net flux out of the box is
$$\approx \left(\frac{\partial F_1}{\partial x} + \frac{\partial F_2}{\partial y} + \frac{\partial F_3}{\partial z}\right)\Delta x\,\Delta y\,\Delta z = (\nabla\cdot\mathbf{F})\,\Delta V.$$
The cancellation. Sum over all boxes. Each interior face is shared by two adjacent boxes whose outward normals point in opposite directions, so those fluxes cancel in pairs. Only the boxes' outer faces — the ones forming $\partial E$ — survive. Taking the limit as the boxes shrink turns the left sum into the flux $\oiint_{\partial E}\mathbf{F}\cdot d\mathbf{S}$ and the right sum into $\iiint_E(\nabla\cdot\mathbf{F})\,dV$. Equal in the limit; theorem proved.
Notice that this gives a beautiful definition of divergence as flux density: $\nabla\cdot\mathbf{F}$ is the limiting net outward flux per unit volume,
$$\nabla\cdot\mathbf{F}(P) = \lim_{V\to 0}\frac{1}{V}\oiint_{\partial V}\mathbf{F}\cdot d\mathbf{S}.$$
Divergence is the infinitesimal Divergence theorem. The macroscopic statement is just this microscopic identity summed up.
37.6 One Slogan, Four Theorems
Step back and look at what we have. Four theorems, spanning Chapters 14, 35, and 37, all say the same sentence in different dimensions:
$$\int_{\partial M}(\text{a field}) = \int_M (\text{a derivative of that field}).$$
| Theorem | Region $M$ | Boundary $\partial M$ | "Derivative" on the right | Chapter |
|---|---|---|---|---|
| Fundamental Theorem of Calculus | interval $[a,b]$ | endpoints $\{a, b\}$ | $f'$ | 14 |
| Green's theorem | planar region $D$ | curve $\partial D$ | $Q_x - P_y$ (2D curl) | 35 |
| Stokes' theorem | surface $S$ | curve $\partial S$ | $\nabla\times\mathbf{F}$ | 37 |
| Divergence theorem | solid $E$ | surface $\partial E$ | $\nabla\cdot\mathbf{F}$ | 37 |
Each row drops the dimension of the boundary by one relative to the region, and each replaces "the field on the boundary" with "a derivative of the field inside." FTC is the seed (one point's worth of boundary, a single derivative $f'$); the others are it grown into higher dimensions. This is the deepest structural fact in all of calculus, and it is why your instructor in Chapter 14 told you to memorize the slogan. You have now seen it bloom in every dimension up to three.
In Chapter 38 we make the unification literal: a single equation, $\int_{\partial M}\omega = \int_M d\omega$, of which all four rows above are special cases obtained by choosing the dimension and the type of object $\omega$. For now, savor the pattern. Four theorems, one idea.
Real-World Application — Computational fluid dynamics (engineering). Modern aircraft, engine, and weather simulations are built on finite-volume methods, which discretize space into millions of little cells and apply the Divergence theorem to each one. Instead of solving the fluid equations at every point, the solver tracks only the flux of mass, momentum, and energy across cell faces — and the Divergence theorem guarantees that what leaves one cell enters its neighbor, so the scheme conserves mass and energy exactly, down to round-off. Every time an engineer at Boeing or a forecaster at a weather center runs a CFD simulation, the Divergence theorem is the conservation law being enforced cell by cell.
37.7 The Payoff: Maxwell's Equations
Here is the moment vector calculus earns its place in history. In the 1860s James Clerk Maxwell collected the known laws of electricity and magnetism and discovered they could be written as four equations — and that those four equations predicted light to be an electromagnetic wave. Every one of Maxwell's equations comes in two forms, an integral form (a statement about flux or circulation through finite regions) and a differential form (a statement about divergence or curl at each point). Stokes' theorem and the Divergence theorem are precisely the dictionary that translates between the two.
Gauss's law for electricity (Divergence theorem)
The integral form says the electric flux out of any closed surface equals the enclosed charge over $\varepsilon_0$:
$$\oiint_{\partial E}\mathbf{E}\cdot d\mathbf{S} = \frac{Q_{\text{enc}}}{\varepsilon_0} = \frac{1}{\varepsilon_0}\iiint_E \rho\,dV,$$
where $\rho$ is charge density. Apply the Divergence theorem to the left side:
$$\iiint_E (\nabla\cdot\mathbf{E})\,dV = \frac{1}{\varepsilon_0}\iiint_E \rho\,dV.$$
Since this holds for every region $E$ — make $E$ a tiny ball around any point and shrink it — the integrands must agree pointwise:
$$\boxed{\ \nabla\cdot\mathbf{E} = \frac{\rho}{\varepsilon_0}\ } \qquad\text{(Gauss's law, differential form).}$$
The integral form is the one you use to compute fields when there is symmetry (a sphere, a cylinder, a plane); the differential form is the one you feed into Poisson's equation $\nabla^2 V = -\rho/\varepsilon_0$ to solve boundary-value problems. The Divergence theorem says they carry identical physical content.
Gauss's law for magnetism (Divergence theorem)
There are no magnetic monopoles — no isolated north or south poles — so the net magnetic flux out of any closed surface is zero:
$$\oiint_{\partial E}\mathbf{B}\cdot d\mathbf{S} = 0 \quad\xrightarrow{\ \text{Divergence theorem}\ }\quad \boxed{\ \nabla\cdot\mathbf{B} = 0\ }.$$
Every magnetic field line that enters a region must leave it. We will return to this innocuous-looking equation in §37.9 — it is exactly the condition that lets us write $\mathbf{B}$ as the curl of a vector potential.
Faraday's law of induction (Stokes' theorem)
A changing magnetic flux through a loop induces an electromotive force around the loop — this is how every electric generator and transformer on Earth works:
$$\oint_{\partial S}\mathbf{E}\cdot d\mathbf{r} = -\frac{d\Phi_B}{dt} = -\frac{d}{dt}\iint_S \mathbf{B}\cdot d\mathbf{S}.$$
Apply Stokes' theorem to the left and move the time derivative inside the right integral (the surface is fixed):
$$\iint_S (\nabla\times\mathbf{E})\cdot d\mathbf{S} = -\iint_S \frac{\partial\mathbf{B}}{\partial t}\cdot d\mathbf{S}.$$
True for every surface $S$, so the integrands match:
$$\boxed{\ \nabla\times\mathbf{E} = -\frac{\partial\mathbf{B}}{\partial t}\ } \qquad\text{(Faraday's law, differential form).}$$
Ampère–Maxwell law (Stokes' theorem)
The original Ampère's law said a current $I_{\text{enc}}$ piercing a loop produces a magnetic circulation around it:
$$\oint_{\partial S}\mathbf{B}\cdot d\mathbf{r} = \mu_0 I_{\text{enc}} = \mu_0\iint_S \mathbf{J}\cdot d\mathbf{S},$$
where $\mathbf{J}$ is current density. Stokes' theorem converts the circulation:
$$\iint_S(\nabla\times\mathbf{B})\cdot d\mathbf{S} = \mu_0\iint_S \mathbf{J}\cdot d\mathbf{S} \quad\Longrightarrow\quad \nabla\times\mathbf{B} = \mu_0\mathbf{J}.$$
Maxwell noticed this was inconsistent with charge conservation (it forces $\nabla\cdot\mathbf{J} = 0$, which is false when charge accumulates) and fixed it by adding a displacement current term $\mu_0\varepsilon_0\,\partial_t\mathbf{E}$:
$$\boxed{\ \nabla\times\mathbf{B} = \mu_0\mathbf{J} + \mu_0\varepsilon_0\frac{\partial\mathbf{E}}{\partial t}\ } \qquad\text{(Ampère–Maxwell law).}$$
That extra term — invisible in the static case, demanded by mathematical consistency — is what closes the loop between electric and magnetic fields and lets them sustain each other as a traveling wave. It is, quite literally, why light exists.
The four equations together
| Law | Integral form | Differential form | Theorem used |
|---|---|---|---|
| Gauss (electric) | $\displaystyle\oiint_{\partial E}\mathbf{E}\cdot d\mathbf{S} = \dfrac{Q_{\text{enc}}}{\varepsilon_0}$ | $\nabla\cdot\mathbf{E} = \dfrac{\rho}{\varepsilon_0}$ | Divergence |
| Gauss (magnetic) | $\displaystyle\oiint_{\partial E}\mathbf{B}\cdot d\mathbf{S} = 0$ | $\nabla\cdot\mathbf{B} = 0$ | Divergence |
| Faraday | $\displaystyle\oint_{\partial S}\mathbf{E}\cdot d\mathbf{r} = -\dfrac{d\Phi_B}{dt}$ | $\nabla\times\mathbf{E} = -\dfrac{\partial\mathbf{B}}{\partial t}$ | Stokes' |
| Ampère–Maxwell | $\displaystyle\oint_{\partial S}\mathbf{B}\cdot d\mathbf{r} = \mu_0\!\left(I_{\text{enc}} + \varepsilon_0\dfrac{d\Phi_E}{dt}\right)$ | $\nabla\times\mathbf{B} = \mu_0\mathbf{J} + \mu_0\varepsilon_0\dfrac{\partial\mathbf{E}}{\partial t}$ | Stokes' |
The two divergence equations describe sources (where field lines begin and end); the two curl equations describe circulation (how changing fields wrap around each other). The integral column gives physical intuition and computes symmetric fields; the differential column is what you differentiate again to derive the wave equation. The entire dictionary between the two columns is Stokes' theorem and the Divergence theorem. Without the mathematics of this chapter, Maxwell's equations would be four disconnected experimental rules instead of one unified field theory.
Real-World Application — From Maxwell's equations to the wave equation (physics). Take the curl of Faraday's law, substitute Ampère–Maxwell, and use a vector identity; in a vacuum ($\rho = 0$, $\mathbf{J} = \mathbf{0}$) you get $\nabla^2\mathbf{E} = \mu_0\varepsilon_0\,\partial_t^2\mathbf{E}$. This is the wave equation with speed $c = 1/\sqrt{\mu_0\varepsilon_0}$. Plug in the measured constants and that speed comes out to $3\times 10^8$ m/s — the speed of light. Maxwell's stunning 1865 conclusion: light is an electromagnetic wave. Radio, radar, Wi-Fi, and fiber optics are all engineering consequences of a wave equation that Stokes' theorem and the Divergence theorem helped assemble.
37.8 More Conservation Laws: One Pattern, Many Sciences
The Maxwell derivation used the same move twice: write a balance law as a flux equation over a region, apply the Divergence theorem, and conclude a pointwise differential law. This move is so general it produces the governing equations of half of physics. Here are three more, each a flux balance turned into a PDE by the Divergence theorem — a vivid case of the recurring theme that calculus is the mathematics of change and the same calculus appears in every quantitative field.
The continuity equation (conservation of mass)
For a fluid of density $\rho(\mathbf{x},t)$ and velocity $\mathbf{u}(\mathbf{x},t)$, the mass inside a fixed region $V$ can change only by mass flowing across the boundary:
$$\frac{d}{dt}\iiint_V \rho\,dV = -\oiint_{\partial V}\rho\,\mathbf{u}\cdot d\mathbf{S}.$$
The minus sign says outflow decreases the mass inside. Apply the Divergence theorem to the right side and pull the time derivative inside the (fixed) volume on the left:
$$\iiint_V \frac{\partial\rho}{\partial t}\,dV = -\iiint_V \nabla\cdot(\rho\mathbf{u})\,dV.$$
True for every $V$, so the integrands match:
$$\boxed{\ \frac{\partial\rho}{\partial t} + \nabla\cdot(\rho\mathbf{u}) = 0\ } \qquad\text{(continuity equation).}$$
This is the bedrock of fluid dynamics, aerodynamics, and atmospheric modeling. The identical structure, with $\rho$ replaced by charge density and $\rho\mathbf{u}$ by current density $\mathbf{J}$, gives conservation of charge $\partial_t\rho + \nabla\cdot\mathbf{J} = 0$ — the very consistency condition that forced Maxwell to add the displacement current.
The heat equation (conservation of energy)
Let $T(\mathbf{x},t)$ be temperature. The thermal energy in a region $V$ changes only by heat flowing across its boundary, where the heat flux is $\mathbf{q} = -k\nabla T$ (Fourier's law: heat flows downhill, from hot to cold):
$$\frac{d}{dt}\iiint_V c\rho\,T\,dV = -\oiint_{\partial V}\mathbf{q}\cdot d\mathbf{S} = \oiint_{\partial V} k\nabla T\cdot d\mathbf{S}.$$
Apply the Divergence theorem:
$$\iiint_V c\rho\,\frac{\partial T}{\partial t}\,dV = \iiint_V \nabla\cdot(k\nabla T)\,dV.$$
Equating integrands and taking $k$ constant gives the heat equation:
$$\boxed{\ \frac{\partial T}{\partial t} = \alpha\,\nabla^2 T\ },\qquad \alpha = \frac{k}{c\rho}.$$
This single PDE governs how heat diffuses through a solid, how a drop of ink spreads in water, how option prices evolve in the Black–Scholes model of finance, and (in its imaginary-time cousin) how quantum wavefunctions propagate. All of it descends from a flux balance and the Divergence theorem.
Computing volume from a surface
A delightfully practical corollary: choose $\mathbf{F} = \langle x, 0, 0\rangle$, so $\nabla\cdot\mathbf{F} = 1$. Then the Divergence theorem reads
$$\text{Vol}(E) = \iiint_E 1\,dV = \oiint_{\partial E} x\,(d\mathbf{S})_x,$$
the volume computed entirely from data on the boundary surface. This is the 3D analog of the surveyor's "shoelace formula," and it is exactly how computer-graphics and CAD software compute the volume of a solid from its triangulated boundary mesh — no interior sampling required, just a sum over the faces. The boundary knows the volume.
Add to Your Modeling Portfolio. Add a conservation law to your model — a balance between change inside a region and flux across its boundary, converted to a differential equation by the Divergence theorem. Biology: model a signaling molecule diffusing through tissue with the reaction–diffusion equation $\partial_t c = D\nabla^2 c + R(c)$ — the heat equation plus a source term — and identify the flux $-D\nabla c$ crossing a cell membrane. Economics: treat a quantity (capital, goods, population) flowing through input–output sectors as a conserved current, and write the continuity equation $\partial_t \rho + \nabla\cdot\mathbf{J} = (\text{net production})$ for it. Physics: start from Maxwell's integral laws and use Stokes' and the Divergence theorem to derive all four differential forms, then assemble the vacuum wave equation $\nabla^2\mathbf{E} = c^{-2}\partial_t^2\mathbf{E}$. Data Science: implement a discrete divergence on a graph or mesh (in/out flux per node) and verify a discrete conservation law numerically — the foundation of finite-volume solvers and graph diffusion.
37.9 When Curl or Divergence Vanishes: Potentials
Two identities you proved in Chapter 34 unlock the deepest structural consequences of this chapter:
$$\nabla\cdot(\nabla\times\mathbf{A}) = 0 \qquad\text{and}\qquad \nabla\times(\nabla f) = \mathbf{0}.$$
"The divergence of a curl is zero" and "the curl of a gradient is zero." Read together with Stokes' and the Divergence theorems, they tell us when a field is secretly the derivative of a potential.
Conservative fields (curl-free). If $\nabla\times\mathbf{F} = \mathbf{0}$ on a simply-connected domain, then $\mathbf{F} = \nabla f$ for some scalar potential $f$ — the field is conservative, and its line integrals are path-independent (Chapter 35). Stokes' theorem makes this transparent: if the curl vanishes, every circulation $\oint_{\partial S}\mathbf{F}\cdot d\mathbf{r} = \iint_S \mathbf{0}\cdot d\mathbf{S} = 0$, so the field does no net work around any loop.
Solenoidal fields (divergence-free). One dimension up: if $\nabla\cdot\mathbf{F} = 0$ everywhere on a suitable domain, then $\mathbf{F} = \nabla\times\mathbf{A}$ for some vector potential $\mathbf{A}$ — the field is solenoidal. The Divergence theorem makes this transparent: if the divergence vanishes, the flux through every closed surface is zero, so field lines never start or stop — they only form closed loops, which is exactly what a curl field does.
The most important instance is magnetism. Gauss's law for magnetism said $\nabla\cdot\mathbf{B} = 0$, so there exists a magnetic vector potential $\mathbf{A}$ with $\mathbf{B} = \nabla\times\mathbf{A}$. This potential is not a mathematical convenience — in quantum mechanics (the Aharonov–Bohm effect) $\mathbf{A}$ has measurable physical consequences even where $\mathbf{B}$ itself is zero.
This also explains the surface-independence of Stokes' theorem from §37.2. If two surfaces $S_1$ and $S_2$ share the same boundary, gluing them forms a closed surface bounding a solid $E$. The Divergence theorem applied to the curl field gives $\oiint(\nabla\times\mathbf{F})\cdot d\mathbf{S} = \iiint_E \nabla\cdot(\nabla\times\mathbf{F})\,dV = \iiint_E 0\,dV = 0$, so the curl-fluxes through $S_1$ and $S_2$ are equal. The two great theorems lean on each other.
Geometric Intuition. There is a ladder here: gradient → curl → divergence, each the "derivative" at its level. A field at the bottom of a derivative (a gradient) has zero at the next level up (zero curl); a curl has zero divergence. Going the other way, a field with zero at one level is the derivative of a potential from the level below — provided the domain has no holes. Conservative fields are gradients; solenoidal fields are curls. The same staircase, climbed in Chapter 38, is the exact sequence of differential forms, and "the derivative of a derivative is zero" becomes the single identity $d(d\omega) = 0$.
37.10 Numerical Verification in Python
We close the loop with the textbook's standard three-tier pattern: state the theorem analytically, verify it by hand (done above), then watch the machine agree. We verify both great theorems numerically.
First, Stokes' theorem for $\mathbf{F} = \langle -y, x, 0\rangle$ on the unit disk (Example 1) — and, to demonstrate surface-independence, we also compute the curl-flux over the hemisphere spanning the same circle.
import numpy as np
from scipy.integrate import quad, dblquad
# --- Stokes' theorem: ∮_∂S F·dr = ∬_S (∇×F)·dS ---
# F = (-y, x, 0). curl F = (0, 0, 2). Boundary: unit circle, CCW.
# LEFT side: line integral around the unit circle r(t)=(cos t, sin t, 0)
def line_integrand(t: float) -> float:
F = np.array([-np.sin(t), np.cos(t), 0.0]) # F evaluated on the circle
r_prime = np.array([-np.sin(t), np.cos(t), 0.0]) # dr/dt
return F @ r_prime
line_int, _ = quad(line_integrand, 0, 2*np.pi)
# RIGHT side, surface 1 (flat disk): ∬ (0,0,2)·(0,0,1) dA = 2 * area = 2π
flux_disk = 2 * np.pi
# RIGHT side, surface 2 (upper hemisphere) parametrized by (φ,θ):
# (∇×F)·dS = (0,0,2)·(R² sinφ)(sinφcosθ, sinφsinθ, cosφ) dφ dθ = 2 cosφ sinφ dφ dθ
flux_hemi, _ = dblquad(lambda phi, theta: 2*np.cos(phi)*np.sin(phi),
0, 2*np.pi, # theta
0, np.pi/2) # phi (upper hemisphere)
print(f"Line integral (boundary) : {line_int:.6f}") # 6.283185
print(f"Curl-flux through disk : {flux_disk:.6f}") # 6.283185
print(f"Curl-flux through dome : {flux_hemi:.6f}") # 6.283185
# All three equal 2π — Stokes' holds, and the surface choice doesn't matter.
All three numbers print $2\pi \approx 6.283185$: the boundary line integral matches the curl-flux, and the disk and the hemisphere give the same flux even though they are wildly different surfaces — surface-independence, confirmed numerically.
Now the Divergence theorem for $\mathbf{F} = \langle x, y, z\rangle$ on the unit ball (Example 3), comparing the triple integral of the divergence against the analytic flux.
import numpy as np
from scipy.integrate import tplquad
# --- Divergence theorem: ∯_∂E F·dS = ∭_E (∇·F) dV ---
# F = (x, y, z). ∇·F = 3. E = unit ball.
# RIGHT side: ∭_E 3 dV over the unit ball, set up in Cartesian limits.
vol_integral, _ = tplquad(
lambda z, y, x: 3.0, # integrand ∇·F = 3
-1, 1, # x
lambda x: -np.sqrt(1 - x**2), # y lower
lambda x: np.sqrt(1 - x**2), # y upper
lambda x, y: -np.sqrt(max(1 - x**2 - y**2, 0)), # z lower
lambda x, y: np.sqrt(max(1 - x**2 - y**2, 0))) # z upper
# LEFT side (analytic): on the unit sphere F·n = x²+y²+z² = 1, so flux = surface area = 4π
flux_analytic = 4 * np.pi
print(f"Volume integral ∭ 3 dV : {vol_integral:.4f}") # ~12.566 (= 3 * 4/3 π = 4π)
print(f"Flux ∯ F·dS (analytic) : {flux_analytic:.4f}") # 12.566
# Both equal 4π — the Divergence theorem holds numerically.
Both sides print $4\pi \approx 12.566$. The triple integral of the divergence, computed by scipy with no knowledge of the boundary, equals the flux we found by hand from the sphere's geometry.
Computational Note. Notice the
max(1 - x**2 - y**2, 0)guard in thetplquadlimits: near the equator of the ball, floating-point round-off can make the argument of the square root slightly negative, andnp.sqrtof a negative number returnsnan, which would poison the integral. Clamping the argument at zero is a standard defensive trick when adaptive quadrature probes the very edge of a curved domain. This is the kind of numerical hazard the theorem itself never sees but the computer always does — and it is why we verify by hand and by machine: hand computation builds understanding; machine computation builds power, and each catches the other's blind spots.
37.11 Discrete and Higher-Dimensional Versions
The theorems of this chapter are not confined to smooth surfaces and continuous fields. They have discrete cousins that power modern computation, and they generalize to every dimension.
Discrete versions. On a triangulated mesh or a grid, the Divergence theorem becomes the statement that the sum of fluxes through a cell's faces equals the cell's net source — the basis of the finite-volume method in computational fluid dynamics and the finite-element method in structural engineering. Stokes' theorem discretizes to "the sum of edge circulations around a face equals the face's curl," the basis of discrete differential geometry and of the curl-conserving solvers used in computer graphics and electromagnetics. In every case the discrete theorem is exact, not approximate — the telescoping cancellation of §37.5 works just as cleanly on a finite mesh as on a continuum.
Higher dimensions. The pattern of §37.6 does not stop at three dimensions. On an $n$-dimensional manifold $M$ with $(n-1)$-dimensional boundary $\partial M$, the general Stokes' theorem reads
$$\int_{\partial M}\omega = \int_M d\omega,$$
where $\omega$ is a differential $(n-1)$-form and $d\omega$ is its exterior derivative. The four theorems of this book are simply the small-$n$ cases:
| $n$ | $M$ | $\omega$ | $d\omega$ | Classical name |
|---|---|---|---|---|
| 1 | interval | 0-form (function $f$) | $f'\,dx$ | FTC |
| 2 | planar region | 1-form $P\,dx + Q\,dy$ | $(Q_x - P_y)\,dx\wedge dy$ | Green's |
| 2 | surface in $\mathbb{R}^3$ | 1-form | 2-form | Stokes' |
| 3 | solid in $\mathbb{R}^3$ | 2-form | 3-form | Divergence |
| $\ge 4$ | $n$-manifold | $(n-1)$-form | $n$-form | general Stokes' |
One theorem; infinitely many guises. This is the synthesis we make fully explicit in Chapter 38.
Math Major Sidebar. Differential forms give vector calculus a coordinate-free, dimension-independent language. The exterior derivative $d$ unifies gradient, curl, and divergence into a single operator that raises form-degree by one, and the two "derivative-of-a-derivative-is-zero" identities of §37.9 collapse into the single elegant law $d^2 = 0$. The general Stokes' theorem $\int_{\partial M}\omega = \int_M d\omega$ then subsumes every theorem in this chapter, plus the classical FTC, plus their analogs on curved spaces (Riemannian manifolds) where there is no global coordinate system at all. This is the language of modern differential geometry, gauge theory, and general relativity — and Chapter 38 is your invitation to it.
Looking Ahead
You have reached the summit of vector calculus. Two theorems — Stokes' and the Divergence theorem — now let you trade boundary integrals for region integrals and back, and you have seen them assemble Maxwell's equations, the continuity equation, and the heat equation out of nothing but a flux balance and a derivative.
Chapter 38 makes the unification this chapter kept hinting at completely explicit: it introduces differential forms and the single equation $\int_{\partial M}\omega = \int_M d\omega$ that contains FTC (Chapter 14), Green's theorem (Chapter 35), and both theorems of this chapter as special cases. It is the deepest and most beautiful idea in all of calculus, and you are now ready for it.
Then Part VIII brings the journey home: Chapter 39 assembles your Modeling Portfolio into a finished mathematical model, and Chapter 40 steps back to survey the whole landscape — from Newton's mechanics to Maxwell's light to the training of neural networks — and asks what calculus made possible.
Reflection
For two millennia, the slogan you learned in Chapter 14 — the integral of a derivative over a region equals the values on its boundary — was hidden inside a single one-dimensional theorem about areas and slopes. In this chapter it reached its full height. Stokes' theorem and the Divergence theorem are that same sentence, spoken in three dimensions, and they turned out to be the mathematical scaffolding of the physical world: the equations of electricity, magnetism, light, fluid flow, and heat are all this chapter's two theorems wearing the costumes of physics.
If the theorems do not yet feel inevitable, that is normal — work the verification examples until both sides land on the same number without effort, and the inevitability will come. What you have really learned is that the universe keeps careful books: what happens inside a region is fully accounted for by what crosses its boundary. Newton and Leibniz saw the first page of that ledger. You have now read it to the end of three dimensions. Turn to Chapter 38, and watch all of it become one line.