The divergence theorem
Statement
Let \( V \subseteq \mathbb{R}^3 \) be a bounded region whose boundary \( \partial V = S \) is a piecewise-smooth, closed, orientable surface, oriented by the outward unit normal \( \mathbf{n} \). Let \( \mathbf{F} = (F_1, F_2, F_3) \) be a vector field of class \( C^1 \) on an open set \( U \) with \( \overline{V} \subseteq U \). Then \[ \iiint_V (\nabla \cdot \mathbf{F})\, dV \;=\; \oiint_S \mathbf{F} \cdot \mathbf{n}\, dS, \] where \( \nabla \cdot \mathbf{F} = \frac{\partial F_1}{\partial x} + \frac{\partial F_2}{\partial y} + \frac{\partial F_3}{\partial z} \) is the divergence of \( \mathbf{F} \).
Why it matters
The divergence theorem (Gauss's theorem, Ostrogradsky's theorem) is the three-dimensional capstone of the fundamental theorem of calculus: it converts a volume integral of a local differential quantity (divergence, a limit of flux per unit volume) into a boundary integral of the flux itself. It is the mechanism by which local conservation laws — mass, charge, energy, probability — are derived from global balance statements, and conversely by which continuum field equations (Maxwell's equations, the continuity equation, the Navier–Stokes equations) are extracted from integral physical principles.
Structurally it sits alongside Green's theorem and the classical Stokes theorem as an instance of the generalized Stokes theorem for differential forms, \( \int_M d\omega = \int_{\partial M} \omega \); understanding its proof is the natural route into that unification.
Hypotheses
Proof
We give the classical proof by decomposing \( V \) into elementary regions — regions simultaneously projectable onto each coordinate plane — proving the componentwise identity on each, and gluing.
Result
Reading. The total "outflow-producing" activity of \(\mathbf{F}\) summed throughout the volume equals the net flow of \(\mathbf{F}\) escaping through the boundary — sources and sinks inside \(V\) are exactly what the boundary flux measures.
Scope. Applies to any bounded \( V\subset\mathbb{R}^3 \) with piecewise-smooth, coherently outward-oriented boundary, for any vector field \(C^1\) on a neighbourhood of \(\overline V\). Generalizes verbatim to \(\mathbb{R}^n\) (flux through an \((n-1)\)-dimensional boundary equals the volume integral of divergence) and is the \(n=3\) instance of the generalized Stokes theorem \( \int_V d\omega = \int_{\partial V}\omega \) for the \(2\)-form \(\omega = \iota_{\mathbf F} (dx\wedge dy\wedge dz)\).
Corollaries & converses
- Solenoidal fields have zero net flux: if \( \nabla\cdot\mathbf{F}=0 \) throughout \(V\), then \( \oiint_{\partial V}\mathbf{F}\cdot\mathbf{n}\,dS = 0 \) for every such \(V\) — this is why magnetic flux through any closed surface vanishes (\( \nabla\cdot\mathbf{B}=0 \)).
- Green's identities: taking \( \mathbf{F} = u\nabla v \) with \( u,v \in C^2 \) yields Green's first identity \( \iiint_V (u\nabla^2 v + \nabla u\cdot\nabla v)\,dV = \oiint_S u\,\partial v/\partial n\, dS \); antisymmetrizing gives Green's second identity.
- Local converse (pointwise characterization): if \( \oiint_{\partial B_r(p)} \mathbf{F}\cdot\mathbf{n}\, dS = o(r^3) \) fails to vanish suitably, one shows \( \nabla\cdot\mathbf{F}(p) = \lim_{r\to 0} \frac{1}{\text{vol}(B_r(p))}\oiint_{\partial B_r(p)}\mathbf{F}\cdot\mathbf{n}\,dS \); this recovers divergence from flux and is often taken as the coordinate-free definition of divergence.
- Global converse fails: the identity holding for one particular pair \((V,\mathbf F)\) does not imply \( \nabla\cdot\mathbf{F}\equiv 0\) or anything about \(\mathbf F\) off \(V\); the theorem is an identity for each admissible \((V,\mathbf F)\), not a biconditional characterizing \(\mathbf F\).
Fails without
- Drop \(C^1\)-on-a-neighbourhood-of-\(\overline V\): \( \mathbf F=\mathbf r/|\mathbf r|^3 \) on the unit ball \(V\) (singular at the interior point \(0\)) gives \( \oiint_S \mathbf F\cdot\mathbf n\,dS = 4\pi \neq 0 = \) the (improper, and actually divergent as a Lebesgue integral of \(0\) plus a delta-like concentration) naive volume side; correctly, \(\nabla\cdot\mathbf F = 4\pi\delta_0\) as a distribution, and the classical theorem simply does not apply.
- Drop boundedness of \(V\): the half-space example in Hypotheses shows a finite divergence integral (here \(0\)) can be paired with an infinite or ill-defined flux integral, so the two sides cannot be compared, let alone equated.
- Drop coherent outward orientation: reversing the normal on part of \(S\) (e.g. treating an inner boundary component of an annular shell with the wrong sign) changes the right side by twice the flux through that component while leaving the left side untouched, breaking equality.
Common errors
- Forgetting that \(S\) must be closed: applying the divergence theorem to an open surface (like a hemisphere alone, without its disk base) and expecting the flux to equal a volume integral — there is no enclosed volume, so the theorem does not apply at all.
- Using an inward-pointing normal (common when a surface is naturally parametrized "into" the region) without negating the result, silently flipping the sign of the answer.
- Applying the theorem to a field with a singularity strictly inside \(V\) (e.g. inverse-square fields at the origin, or \(1/r\) potentials) without excising a small ball around the singularity first — the "\(\nabla\cdot\mathbf F=0\) almost everywhere" trap.
- Computing \(\nabla\cdot\mathbf F\) in a curvilinear coordinate system using the Cartesian formula \(\partial F_1/\partial x + \cdots\) applied naively to non-Cartesian components, instead of the correct curvilinear divergence formula (e.g. in spherical coordinates).
- Confusing the divergence theorem with Stokes' theorem (curl and a bounding curve vs. divergence and a bounding surface) and mismatching the dimension of the boundary object with the differential operator used.
Discussion
The theorem was discovered piecemeal: special cases appear in Lagrange's work on fluid mechanics (1762), Gauss used it in 1813 in the context of gravitational attraction, and Mikhail Ostrogradsky gave the first general proof in 1826 (hence "Ostrogradsky's theorem" in much of the Russian and French literature) while studying heat flow. Its physical content predates its formal statement: any local conservation law "rate of accumulation = – net outflow" becomes, via the divergence theorem, the continuity equation \( \partial\rho/\partial t + \nabla\cdot\mathbf{J} = 0 \), since the theorem is exactly the tool that converts "flux through every closed surface obeys a global balance" into "a pointwise differential equation holds everywhere."
The proof strategy given here — verify on elementary building blocks, then glue via boundary cancellation — is the template shared by Green's theorem in the plane and the classical Stokes theorem in space, and it is no accident: all three, together with the fundamental theorem of calculus itself, are the low-dimensional shadows of the single generalized Stokes theorem for differential forms on oriented manifolds with boundary, \( \int_M d\omega = \int_{\partial M}\omega \). The divergence theorem corresponds to integrating the exterior derivative of a 2-form (the "flux form" associated to \(\mathbf F\)) over a 3-manifold.
The cancellation-on-shared-faces argument (Step 10) is the discrete/finite version of a much more general phenomenon: it is exactly what makes the boundary operator on chains satisfy \( \partial\circ\partial = 0 \) in simplicial/singular homology, and the same mechanism underlies the divergence theorem's role as the archetype for defining weak (distributional) divergence via integration by parts — \( \int_V u\,\nabla\cdot\mathbf F\,dV = -\int_V \nabla u\cdot\mathbf F\, dV + \int_{\partial V} u\,\mathbf F\cdot\mathbf n\, dS \) — the starting point of the weak formulation used throughout PDE theory and finite element methods.
Common misconception. Students often believe the theorem requires \(V\) to be convex or "nice" like a ball; in fact any bounded region admitting a decomposition into finitely many simple pieces works — this includes regions with holes (as long as all boundary components, inner and outer, are given consistent outward orientation) and quite irregular polyhedral or piecewise-smooth shapes.
Worked examples
Reading. The radial field \(\mathbf F=\mathbf r\) has constant divergence \(3\) everywhere, so the flux through any sphere is exactly \(3\) times the enclosed volume.
Reading. Even though \(\mathbf F\) is not radial, the divergence theorem still reduces a six-face flux computation to a single, symmetric volume integral.
Problems
- Compute \( \oiint_S \mathbf F\cdot\mathbf n\, dS \) where \( \mathbf F=(0,0,z) \) and \(S\) is the boundary of the cylinder \( x^2+y^2\le a^2,\ 0\le z\le h \).
Solution
\( \nabla\cdot\mathbf F = 1 \), so by the divergence theorem the flux equals \( \text{vol}(V) = \pi a^2 h \). (Direct check: the flux is \(0\) through the curved side since \(F_3=z\) contributes only through \(n_3\) which is \(0\) there; through the top \(z=h\), \(n=(0,0,1)\), contribution \( h\cdot\pi a^2 \); through the bottom \(z=0\), \(n=(0,0,-1)\), contribution \(0\). Total \(\pi a^2 h\), matching.) - Let \( \mathbf F = (x,y,z)/|(x,y,z)|^3 \) on \( \mathbb{R}^3\setminus\{0\} \). Show directly that \( \nabla\cdot\mathbf F = 0 \) away from the origin, and explain why the divergence theorem does not give \( \oiint_S \mathbf F\cdot\mathbf n\,dS = 0 \) when \(S\) is a sphere centred at the origin.
Solution
With \(r=|(x,y,z)|\), \(F_1=x r^{-3}\), so \( \partial F_1/\partial x = r^{-3} + x\cdot(-3r^{-4})(x/r) = r^{-3}-3x^2 r^{-5}\); summing the analogous \(y,z\) terms gives \( 3r^{-3} - 3r^{-5}(x^2+y^2+z^2) = 3r^{-3}-3r^{-3}=0 \) for \(r\neq 0\). The divergence theorem requires \(\mathbf F\) to be \(C^1\) on a neighbourhood of the closed ball \(\overline V\), including the interior point \(0\); since \(\mathbf F\) is undefined (blows up) at \(0\in V\), the hypothesis fails and the theorem simply does not apply — indeed direct computation gives \( \oiint_S \mathbf F\cdot\mathbf n\,dS = 4\pi \neq 0 \). - Use the divergence theorem to evaluate \( \oiint_S \mathbf F\cdot\mathbf n\, dS \) for \( \mathbf F = (2x, -y, z) \) over the surface of the box \( [0,2]\times[0,1]\times[0,3] \).
Solution
\( \nabla\cdot\mathbf F = 2-1+1=2 \), constant. Volume of the box is \(2\cdot1\cdot3=6\), so the flux is \(2\cdot 6 = 12\). - A region \(V\) has a spherical cavity: \(V = B_2(0)\setminus \overline{B_1(0)}\) (the shell between radii 1 and 2), and \( \mathbf F=(x,y,z) \). Using that \(\partial V\) has two components (outer sphere \(r=2\) with outward normal pointing away from origin, inner sphere \(r=1\) with outward normal pointing toward the origin, since it points out of \(V\)), verify the divergence theorem.
Solution
\( \nabla\cdot\mathbf F = 3 \), so \( \iiint_V 3\,dV = 3\left(\tfrac43\pi 2^3 - \tfrac43\pi 1^3\right) = 3\cdot\tfrac43\pi(8-1)=28\pi \). On the outer sphere, \( \mathbf F\cdot\mathbf n = r = 2 \), giving \(2\cdot 4\pi(2)^2=32\pi\). On the inner sphere the outward-from-\(V\) normal is \(-\mathbf r/r\), so \( \mathbf F\cdot\mathbf n = -r=-1 \), giving \((-1)\cdot 4\pi(1)^2=-4\pi\). Total flux \(=32\pi-4\pi=28\pi\), matching the volume integral. - Using the divergence theorem, prove that for any closed surface \(S=\partial V\) and any constant vector \( \mathbf c \), \( \oiint_S (\mathbf c\times \mathbf r)\cdot \mathbf n\, dS = 0 \), where \( \mathbf r=(x,y,z) \).
Solution
Write \( \mathbf F = \mathbf c\times\mathbf r \) with \( \mathbf c=(c_1,c_2,c_3) \) constant. Then \( \mathbf F = (c_2 z - c_3 y,\ c_3 x - c_1 z,\ c_1 y - c_2 x) \), so \[ \nabla\cdot\mathbf F = \frac{\partial}{\partial x}(c_2 z-c_3y) + \frac{\partial}{\partial y}(c_3x-c_1z)+\frac{\partial}{\partial z}(c_1y-c_2x) = 0+0+0=0 \] identically, since each component of \(\mathbf F\) does not depend on its own differentiating variable (each term involves only the other two coordinates, and \(\mathbf c\) is constant). By the divergence theorem, \( \oiint_S \mathbf F\cdot\mathbf n\,dS = \iiint_V \nabla\cdot\mathbf F\, dV = \iiint_V 0\,dV=0 \) for every admissible \(V\).