Gauss divergence theorem

Imagine trying to measure how much water is leaking out through the curved surface of a lumpy tank by directly integrating flow across every patch of that surface — six faces for a cube, an awkward curved cap for a hemisphere, endless piecing together. Gauss's divergence theorem offers a shortcut: instead of chasing flux around a closed surface, add up how much the vector field is "spreading out" at every point inside the solid it encloses. The two totals are guaranteed equal. This is the natural 3D sequel to Green's theorem in the MA10002 vector calculus unit, and the second of the three integral theorems — Green's, Gauss's, Stokes's — that close out the chapter. Below we state it precisely, see why it works, verify it on a sphere and a cube, and collect the traps that cost the most marks in exams.

The core insight

The total outward flux of a vector field through a closed surface equals the total divergence integrated over the solid volume it encloses, turning hard surface computations into easier triple integrals.

The core idea

Let VV be a solid region in space bounded by a piecewise-smooth closed surface S=∂VS = \partial V, oriented with outward unit normal n^\hat{\mathbf n}. If F⃗\vec F has continuous first partial derivatives on an open region containing VV, Gauss's divergence theorem states:

∭V∇⋅F⃗ dV=∯SF⃗⋅n^ dS.\iiint_V \nabla\cdot\vec F\,dV = \oiint_S \vec F\cdot\hat{\mathbf n}\,dS.

where: ∇⋅F⃗=∂F1∂x+∂F2∂y+∂F3∂z\nabla\cdot\vec F = \dfrac{\partial F_1}{\partial x}+\dfrac{\partial F_2}{\partial y}+\dfrac{\partial F_3}{\partial z} is the divergence of F⃗=(F1,F2,F3)\vec F=(F_1,F_2,F_3), dVdV is a volume element, dSdS is a surface-area element, and ∯S\oiint_S denotes integration over the entire closed surface.

Why it is useful.

  • Closed surfaces made of several pieces (spheres, capped cylinders, cubes) usually force you to add up several separate surface integrals if you attack the flux directly; the divergence theorem collapses all of that bookkeeping into one triple integral over the solid.
  • If ∇⋅F⃗=0\nabla\cdot\vec F=0 everywhere inside VV — a solenoidal field — the theorem instantly gives ∯SF⃗⋅n^ dS=0\oiint_S\vec F\cdot\hat{\mathbf n}\,dS=0 with no computation at all, since the volume integral of zero is zero.
  • The direction also runs backwards: an awkward triple integral of a divergence can sometimes be replaced by an easier flux computation over the boundary, whichever side of the equation is simpler for the given problem.

Reading the physics. Divergence at a point measures how strongly the field is "spreading out" there — outward flux per unit volume, in the limit of a tiny box shrunk to that point. Gauss's theorem says that summing this local spreading-out over the whole solid must reproduce exactly the net flow crossing the outer boundary, because any flux leaving one small cell simply enters the neighbouring cell — those interior contributions cancel in pairs, leaving only the flux that crosses the outer skin SS.

Figure
A solid cut into small cubes with flux arrows cancelling between neighbours inside and surviving only at the outer boundary
Interior flux cancels; only the boundary flux survives Shared interior faces: flux out of one cell = flux into the next — they cancel flux out

Verify Gauss's divergence theorem

The goal is to confirm, by two entirely independent routes, that the theorem's two sides really do produce the same number for a concrete field and solid — the volume-integral side using ∇⋅F⃗\nabla\cdot\vec F over the ball, and the surface-integral side using an outward-normal flux computation over the sphere — so both must be carried through in full and compared, not just one side computed and assumed to match.

Step 1. Take F⃗(x,y,z)=x ı^+y ȷ^+z k^\vec F(x,y,z)=x\,\hat\imath+y\,\hat\jmath+z\,\hat k and the solid ball V: x2+y2+z2≤a2V:\ x^2+y^2+z^2\le a^2 of radius aa, boundary SS the sphere of radius aa. Compute the divergence first: ∇⋅F⃗=∂x∂x+∂y∂y+∂z∂z=1+1+1=3\nabla\cdot\vec F=\dfrac{\partial x}{\partial x}+\dfrac{\partial y}{\partial y}+\dfrac{\partial z}{\partial z}=1+1+1=3, a constant.

Step 2. Evaluate the volume-integral side. Since the divergence is the constant 33 throughout VV, ∭V∇⋅F⃗ dV=3∭VdV=3⋅(43πa3)=4πa3\displaystyle\iiint_V \nabla\cdot\vec F\,dV=3\iiint_V dV=3\cdot\left(\frac43\pi a^3\right)=4\pi a^3, using the standard volume formula for a ball of radius aa.

Step 3. Evaluate the surface-integral side independently. On the sphere x2+y2+z2=a2x^2+y^2+z^2=a^2 the outward unit normal is n^=1a(x,y,z)\hat{\mathbf n}=\frac1a(x,y,z), because the position vector is itself perpendicular to a sphere centred at the origin. So F⃗⋅n^=1a(x2+y2+z2)=1a⋅a2=a\vec F\cdot\hat{\mathbf n}=\frac1a(x^2+y^2+z^2)=\frac1a\cdot a^2=a, a constant value everywhere on SS.

Step 4. Integrate that constant over the sphere's area 4πa24\pi a^2: ∯SF⃗⋅n^ dS=a⋅4πa2=4πa3\displaystyle\oiint_S\vec F\cdot\hat{\mathbf n}\,dS=a\cdot4\pi a^2=4\pi a^3. Both sides equal 4πa34\pi a^3 exactly, confirming the theorem on this solid and field.

Worked example

Problem. Use Gauss's divergence theorem to find the total outward flux of F⃗(x,y,z)=x2 ı^+y2 ȷ^+z2 k^\vec F(x,y,z)=x^2\,\hat\imath+y^2\,\hat\jmath+z^2\,\hat k through the surface of the unit cube V: 0≤x≤1, 0≤y≤1, 0≤z≤1V:\ 0\le x\le1,\ 0\le y\le1,\ 0\le z\le1 (lengths in metres).

Step 1. Compute the divergence: ∇⋅F⃗=∂(x2)∂x+∂(y2)∂y+∂(z2)∂z=2x+2y+2z\nabla\cdot\vec F=\dfrac{\partial(x^2)}{\partial x}+\dfrac{\partial(y^2)}{\partial y}+\dfrac{\partial(z^2)}{\partial z}=2x+2y+2z.

Step 2. Convert the flux into the triple integral guaranteed by the theorem: ∭V(2x+2y+2z) dV=∫01∫01∫01(2x+2y+2z) dx dy dz\displaystyle\iiint_V(2x+2y+2z)\,dV=\int_0^1\int_0^1\int_0^1(2x+2y+2z)\,dx\,dy\,dz, avoiding six separate face computations.

Step 3. By symmetry of the cube, ∭V2x dV=∭V2y dV=∭V2z dV\iiint_V 2x\,dV=\iiint_V 2y\,dV=\iiint_V 2z\,dV, so evaluate one term and triple it. For the 2x2x term, ∫01∫01∫012x dx dy dz=(∫012x dx)(1)(1)=[x2]01=1\int_0^1\int_0^1\int_0^1 2x\,dx\,dy\,dz=\left(\int_0^1 2x\,dx\right)(1)(1)=[x^2]_0^1=1, since the yy and zz integrations each contribute a factor of 11.

Step 4. Add the three equal contributions: 1+1+1=31+1+1=3.

The total outward flux through the surface of the cube is 3\mathbf{3} (SI flux units). A direct six-face computation would take considerably longer than this single triple integral.

Competitive stretch

If instead F⃗=x2ı^+y2ȷ^+z2k^\vec F=x^2\hat\imath+y^2\hat\jmath+z^2\hat k were evaluated over the same cube but you were only asked for the flux through the single face x=1x=1 (not the closed surface), the divergence theorem would not apply directly — it needs the entire closed boundary. That flux must be computed as a standalone surface integral, ∫01∫01(1)2 dy dz=1\int_0^1\int_0^1 (1)^2\,dy\,dz=1, illustrating that the theorem's shortcut is only available once the full closed surface is in play.

Common traps

  • Applying the theorem to a surface that is not closed — for example, only the curved part of a hemisphere without its flat disc base — Gauss's theorem needs the entire boundary ∂V\partial V, including any flat caps.
  • Using an inward-pointing normal instead of the required outward normal, which flips the sign of the surface-integral side and gives −4πa3-4\pi a^3 instead of 4πa34\pi a^3 in a sphere-type check.
  • Forgetting that F⃗\vec F must have continuous partial derivatives throughout the closed solid VV, not merely on its boundary — a field singular at an interior point (such as 1/r21/r^2 at the origin of a ball containing the origin) cannot be plugged in directly.
  • Computing ∇⋅F⃗\nabla\cdot\vec F incorrectly by dotting components with the wrong variable — divergence is specifically ∂F1/∂x+∂F2/∂y+∂F3/∂z\partial F_1/\partial x+\partial F_2/\partial y+\partial F_3/\partial z, matching each component to its own coordinate, never mixing them.

Ask the tutor: Want to try the divergence theorem on a cylinder with caps, or check your own flux computation step by step?

Why does the divergence theorem work — what makes the interior contributions cancel?

Picture the solid chopped into many tiny cubes. Divergence measures the outward flux per unit volume across one tiny cube's own boundary. Any interior face is shared by two neighbouring cubes, and the outward direction for one cube is the inward direction for its neighbour, so the flux leaving one cell exactly cancels the flux entering the next. Summing divergence over every tiny cube therefore leaves only the faces that lie on the outer skin of the whole solid — which is precisely the closed surface SS. That is why the volume sum of local "spreading out" reproduces the total flux crossing the boundary.

Do I always have to compute both sides of the theorem in an exam question?

No — usually the theorem is a shortcut, not a check. If the question only asks for the flux through a closed surface, compute ∇⋅F⃗\nabla\cdot\vec F and evaluate the single triple integral; there is no need to also do the surface integral. You only compute both sides when the question explicitly says "verify" the theorem, as in the sphere example here, where the point is to show the two independently computed numbers agree.

What if the solid has a hole in it, like a solid cylinder with a smaller cylinder drilled out?

The theorem still applies, but the boundary SS must include every piece of the surface enclosing the actual solid region, oriented outward from the material — that means the outer cylindrical surface pointing away from the axis and the inner drilled surface pointing back toward the axis (into the hole), plus any flat annular caps. As long as F⃗\vec F has continuous partial derivatives throughout the solid material (the drilled-out region is excluded, so any singularity there does not matter), the volume integral over the material equals the flux through this full multi-piece boundary.

Before this

Where this leads