Calculus
Divergence Theorem (Gauss)
Outward flux through a closed surface = volume integral of divergence
The divergence theorem says outward flux through a closed surface equals the integral of divergence over the enclosed volume: ∯_∂V F·dS = ∭_V ∇·F dV. Gauss's theorem turns surface integrals into volume integrals and underpins Coulomb's law, the continuity equation and the integral form of Maxwell's equations.
- Statement∯_∂V F·dS = ∭_V ∇·F dV
- Surface ∂VClosed, piecewise-smooth, outward normal
- HypothesisF ∈ C¹ on a neighbourhood of V
- DiscoveredLagrange 1762; rediscovered Gauss 1813, Ostrogradsky 1826
- GeneralisationsGeneralized Stokes', differential forms
- Applies inGauss's law, continuity, heat equation, fluid sources
Watch the 60-second explainer
A condensed visual walkthrough — narrated, captioned, under a minute.
The statement
Let V be a bounded solid region in ℝ³ whose boundary ∂V is a piecewise-smooth, closed, outward-oriented surface. Let F = ⟨P, Q, R⟩ have continuous first partials on a neighbourhood of V. Then
∯_∂V F · dS = ∭_V (∇·F) dV.
The left-hand side is total outward flux of F through the boundary. The right-hand side is the volume integral of divergence ∇·F = ∂P/∂x + ∂Q/∂y + ∂R/∂z. The two are equal — flux out equals sources inside.
The intuition is conservation. Imagine V is a region of space and F is the velocity of a fluid times its density (the mass-flux vector). The flux out of ∂V is the mass leaving per unit time. Divergence is the local source rate per unit volume. Sum local sources, get total leaving — that is what the theorem encodes.
Worked example — flux of the radial field through a sphere
Let F = r̂ — the unit radial vector field. In Cartesian terms, F = ⟨x, y, z⟩ / √(x² + y² + z²). Compute the flux out of a sphere of radius R centred at the origin.
Direct computation. On the sphere of radius R, F is the unit outward normal. So F·n̂ = 1 everywhere on the surface, and the flux is just (surface area) = 4πR².
By the divergence theorem. Compute ∇·F. Using r = √(x²+y²+z²),
∇·(r̂) = 2/r.
Integrate over the ball of radius R using spherical coordinates dV = r² sin φ dr dφ dθ:
∭_V (2/r) dV = ∫₀^{2π}∫₀^π∫₀^R (2/r) · r² sin φ dr dφ dθ
= 4π ∫₀^R 2r dr = 4π R².
Both sides give 4πR². Note the divergence is not constant — yet the theorem accommodates non-uniform divergence flawlessly.
Worked example — flux through a cube the painful way and the easy way
Let F = ⟨x², y², z²⟩ and let V be the unit cube [0,1]³. The painful way is to set up six surface integrals (one per face). The easy way:
∇·F = 2x + 2y + 2z,
∭_V (2x + 2y + 2z) dV = 2 · (½ · 1 · 1) · 3 = 3.
(Each of the three integrals ∭ 2x dV equals 1 by symmetry.) So total outward flux through the cube is 3 — done in two lines, instead of six surface parametrisations.
Worked example — Gauss's law for a point charge
The electric field of a point charge q at the origin is E = (q / 4πε₀) r̂ / r². Compute its flux through a sphere of radius R, centred at the origin.
On the sphere, E is parallel to the outward normal n̂ = r̂, with magnitude q/(4πε₀ R²). Flux:
∯ E·dS = q/(4πε₀ R²) · (surface area) = q/(4πε₀ R²) · 4πR² = q/ε₀.
The flux is independent of R. By the divergence theorem, ∭ ∇·E dV = q/ε₀ for any sphere — and indeed ∇·E = ρ/ε₀ = (q · δ³)/ε₀ as a distribution. Gauss's law in integral form, ∯ E·dS = Q_enc/ε₀, is the divergence theorem applied to Maxwell's first equation.
This is more than a calculation trick. By choosing different gaussian surfaces — spheres around point charges, infinite cylinders around line charges, pillbox surfaces around planes — you get the field of any charge distribution with enough symmetry, in three lines instead of three pages.
Divergence vs Stokes' vs Green's
The "fundamental trio" of vector calculus, side by side:
| Green's theorem | Stokes' theorem | Divergence theorem | |
|---|---|---|---|
| Region | Plane region D ⊂ ℝ² | Surface S ⊂ ℝ³ | Solid V ⊂ ℝ³ |
| Boundary | Curve ∂D | Curve ∂S | Closed surface ∂V |
| Boundary integral | ∮ P dx + Q dy | ∮ F·dr | ∯ F·dS |
| Interior integrand | ∂Q/∂x − ∂P/∂y | (∇×F)·n̂ | ∇·F |
| Operator on F | 2D curl (scalar) | 3D curl (vector) | Divergence (scalar) |
| Boundary type | Open or closed curve | Closed curve | Closed surface (no boundary itself) |
| Topological hypothesis | D simply connected | S oriented, ∂S simple closed | V bounded, ∂V outward-oriented |
| Generalises to | Stokes' (3D) | ∫_∂Ω ω = ∫_Ω dω (forms) | Same generalised statement |
All three identities are special cases of the generalised Stokes' theorem, ∫_∂Ω ω = ∫_Ω dω, with ω a differential form whose degree depends on the dimension. The fundamental theorem of calculus is the 1D version. The trio above are simply the geometric incarnations of "boundary captures interior" in dimensions 2 and 3.
Why the divergence theorem is true
The proof for a "type-I" region — one of the form a ≤ x ≤ b, c(x) ≤ y ≤ d(x), e(x,y) ≤ z ≤ f(x,y) — proceeds component by component. Take just the third component R k̂. Then
∭_V ∂R/∂z dV = ∬ [R(x,y,f) − R(x,y,e)] dA,
by the fundamental theorem in z. The right side is the flux of R k̂ out through the top face minus the flux into the bottom face — i.e. the total outward flux of R k̂. Apply the same to P î and Q ĵ and add. A general region is decomposed into pieces of this form and the interior face contributions cancel.
Where the divergence theorem appears
- Gauss's law (electrostatics). ∯ E·dS = Q_enc / ε₀. Computes the electric field of charge distributions with spherical, cylindrical or planar symmetry by choosing a "Gaussian surface."
- Gauss's law for magnetism. ∯ B·dS = 0. The absence of magnetic monopoles. Equivalent to the differential form ∇·B = 0 by the divergence theorem.
- Continuity equation. ∂ρ/∂t + ∇·J = 0 expresses local conservation. Integrate and apply Gauss': dM/dt = −∯ J·dS — global conservation. Mass, charge, probability all satisfy continuity equations of this form.
- Heat equation. Fourier's law gives heat flux q = −k∇T. The divergence theorem applied to ∂(ρcT)/∂t + ∇·q = 0 gives the heat equation ∂T/∂t = α∇²T.
- Archimedes' principle. The buoyant force on a submerged body is ∯ p n̂ dS, where p is hydrostatic pressure. The divergence theorem rewrites this as ∭ ∇p dV = ∭ ρg dV — the weight of the displaced fluid. Two thousand years of physical insight, in one identity.
- Volume by surface integral. Apply Gauss' to F = ⟨x, 0, 0⟩: ∭_V 1 dV = ∯ x dy ∧ dz. Used in CAD to compute polyhedron volume from triangle meshes.
- Reynolds' transport theorem. A workhorse identity in fluid dynamics that traces the rate of change of an integrated quantity inside a moving control volume; proof leans on the divergence theorem.
Conservation laws
Every conservation law in continuum physics has the same skeleton:
∂ρ/∂t + ∇·J = σ.
ρ is a density; J is a flux; σ is a source. Integrate over a fixed volume V, apply the divergence theorem to the J-term:
d/dt ∭_V ρ dV + ∯_∂V J·dS = ∭_V σ dV.
"Rate of change inside" + "rate flowing out" = "rate produced." Mass, charge, energy, probability, particle number — all of physics's conservation laws live in this template, and the divergence theorem is what guarantees the differential and integral forms are equivalent.
Who was Gauss
The result was first written down by Lagrange in 1762, in a paper on gravitational potentials. Gauss rediscovered it in 1813, in his memoir Theoria attractionis corporum sphaeroidicorum, where he used it to extract the field of an ellipsoid. Mikhail Ostrogradsky published the modern statement in 1826. In American and Soviet textbooks the result is sometimes "Ostrogradsky's theorem"; in most others, "the divergence theorem" or "Gauss's theorem." The mathematics is the same, the credit is shared.
Common mistakes
- Using an open surface. The divergence theorem requires ∂V to enclose V completely. A bowl-shaped surface is open — it does not bound a 3D region — and Gauss's theorem does not apply. Use Stokes' theorem instead, or close the surface up by adding a cap and subtract the cap's flux at the end.
- Inward-pointing normals. Convention: ∂V must be oriented with outward normals. Inward-pointing normals flip the sign on the left side; you get the negative of the volume integral. Check your parametrisation before you trust the answer.
- Forgetting ∂V is the boundary of V. If you have one surface in mind and one volume in mind, make sure the surface really bounds the volume. A sphere bounds a ball; a sphere does not bound the entire space outside it (the outside is unbounded, and the theorem fails there).
- Crossing a singularity. If F or its divergence blows up somewhere inside V, the integrals do not converge and the identity fails. The fix is to use a generalised version: cut out a small ball around the singularity and treat it as an additional inner boundary.
- Confusing Gauss's theorem with Gauss's law. Gauss's theorem is the mathematical identity (works for any C¹ vector field). Gauss's law is its application to the electric field, with ∇·E = ρ/ε₀. The law is one application; the theorem is the underlying mathematics.
- Computing ∇·F componentwise wrong. ∇·F = ∂P/∂x + ∂Q/∂y + ∂R/∂z. Each component differentiated by its matching variable. A surprisingly common typo is to differentiate P by y or Q by z. Write out the formula explicitly the first time.
Frequently asked questions
What does the divergence theorem say in plain words?
The amount of stuff flowing out through a closed surface equals the amount of stuff being created (or destroyed) inside. Sum the divergence — the local source rate — over every point of the volume and you get the net outward flux through the boundary. Conservation written as a calculus identity.
Why does the surface have to be closed?
The theorem turns a surface integral over ∂V into a volume integral over V. ∂V must be the complete boundary of V — every escape path counted. Open surfaces leave gaps where flux can leave un-tallied; the identity simply does not hold. For surfaces with holes, the right tool is Stokes' theorem instead.
How does Gauss's law follow from the divergence theorem?
Maxwell's first equation in differential form is ∇·E = ρ/ε₀. Integrate over a volume V and apply the divergence theorem on the left: ∯ E·dS = (1/ε₀) ∭ ρ dV = Q_enc/ε₀. The integral form — total electric flux equals enclosed charge over ε₀ — is the celebrated Gauss's law, used to compute fields of point charges, lines and shells in three lines.
What is the continuity equation?
∂ρ/∂t + ∇·J = 0. Mass (or charge) cannot appear from nowhere. Integrate it over any volume and the divergence theorem gives dM/dt = −∯ J·dS — the rate of change of mass inside equals minus the rate flux through the boundary. This is conservation of mass, charge or probability rewritten via Gauss's theorem.
Does the divergence theorem hold on regions with holes?
Yes, with care. If V is the region between two closed surfaces (a spherical shell, say), the boundary ∂V has two components, and you must sum the outward fluxes through each — outward through the outer surface and inward through the inner surface (since the inner surface bounds V from outside). Doing this correctly recovers the residue-style results that compute fields of point charges from spherical shells.
Why is divergence sometimes called "flux density"?
Apply the divergence theorem to a tiny ball of volume ΔV around a point: ∯ F·dS ≈ ∇·F · ΔV. So ∇·F at a point is the limiting outward flux per unit volume — a density of sources. Positive divergence: a source. Negative: a sink. Zero: incompressible. The divergence theorem is the rigorous statement that this density really integrates to the total outward flux.