Divergence Theorem (Gauss)

lean4-proofdifferential-geometryvisualization
VFdV=VFdS\iiint_V \nabla \cdot F\, dV = \oiint_{\partial V} F \cdot dS

Statement

Let VR3V \subset \mathbb{R}^3 be a compact region with piecewise smooth oriented boundary V\partial V, and let F=(F1,F2,F3)F = (F_1, F_2, F_3) be a C1C^1 vector field. Then:

VFdV=VFdS\iiint_V \nabla \cdot F\, dV = \oiint_{\partial V} F \cdot dS

where F=F1x+F2y+F3z\nabla \cdot F = \frac{\partial F_1}{\partial x} + \frac{\partial F_2}{\partial y} + \frac{\partial F_3}{\partial z} is the divergence.

Visualization

Verification on the unit cube [0,1]3[0,1]^3 with F=(x,y,z)F = (x, y, z).

Divergence: F=1+1+1=3\nabla \cdot F = 1 + 1 + 1 = 3.

Volume integral: [0,1]33dV=31=3\iiint_{[0,1]^3} 3\, dV = 3 \cdot 1 = 3.

Surface flux through each face (outward normal n^\hat{n}):

         z=1 (top)
          +--------+
         /|       /|
        / |      / |
       +--------+  |
       |  +-----|--+  x-faces: left (x=0), right (x=1)
       | /      | /
       |/       |/
       +--------+
   y=0 (front)   y=1 (back)
FaceNormalFn^F \cdot \hat{n}AreaFlux
x=1x = 1 (right)+x^+\hat{x}x=1x = 11111
x=0x = 0 (left)x^-\hat{x}x=0-x = 01100
y=1y = 1 (back)+y^+\hat{y}y=1y = 11111
y=0y = 0 (front)y^-\hat{y}y=0-y = 01100
z=1z = 1 (top)+z^+\hat{z}z=1z = 11111
z=0z = 0 (bottom)z^-\hat{z}z=0-z = 01100

Total flux: 1+0+1+0+1+0=31 + 0 + 1 + 0 + 1 + 0 = 3

Proof Sketch

  1. Reduce to one component. It suffices to prove VzF3dV=VF3nzdS\iiint_V \partial_z F_3\, dV = \oiint_{\partial V} F_3 n_z\, dS and add symmetrically.
  2. Apply FTC in zz. Integrating zF3\partial_z F_3 over a vertical column gives F3z=topF3z=bottomF_3|_{z=\text{top}} - F_3|_{z=\text{bottom}}.
  3. Identify as surface flux. The zz-component of the surface integral on top/bottom faces exactly matches these boundary values; lateral faces contribute zero nzn_z.
  4. General domain. Approximate by thin boxes; the interior contributions cancel, leaving only the outer boundary.

Connections

The Divergence Theorem is the 3-D volumetric specialisation of Stokes' Theorem (general)Stokes' Theorem (general)Mdω=Mω\int_M d\omega = \int_{\partial M} \omegaThe integral of a differential form over the boundary equals the integral of its exterior derivative over the interiorRead more →. The 2-D analogue is Green's TheoremGreen's TheoremCPdx+Qdy=D(QxPy)dA\oint_C P\,dx + Q\,dy = \iint_D \left(\tfrac{\partial Q}{\partial x} - \tfrac{\partial P}{\partial y}\right) dAA line integral around a closed curve equals the double integral of the curl over the enclosed regionRead more →. Both rely on iterated applications of the Fundamental Theorem of CalculusFundamental Theorem of Calculusabf(x)dx=f(b)f(a)\int_a^b f'(x)\,dx = f(b) - f(a)Integration and differentiation are inverse operationsRead more →.

Lean4 Proof

-- Verify the cube case numerically: total flux = divergence integral = 3.
-- F = (x, y, z) on [0,1]^3: divergence = 3, volume = 1, face fluxes sum to 3.
theorem divergence_cube_check :
    (1 : ) + 0 + 1 + 0 + 1 + 0 = 3 := by norm_num

-- Divergence of F = (x, y, z) at any point equals 3.
theorem divergence_identity_field (p : Fin 3  ) :
    let F : (Fin 3  )  (Fin 3  ) := fun x => x
    (Finset.univ.sum (fun i : Fin 3 => F p i - F p i + 1)) = 3 := by
  simp [Finset.univ, Fintype.elems]