Green's theorem, Stokes' theorem, and the divergence theorem are all the same idea at different dimensions: the integral of a derivative over a region equals the integral of the original over the boundary. This is the generalized Stokes' theorem. It connects everything in vector calculus back to the fundamental theorem of calculus.
The pattern: interior derivative = boundary value
In one dimension: ∫_a^b f'(x) dx = f(b) − f(a). The integral of the derivative on the interior equals the function on the boundary. Every theorem in this chapter is this same sentence, spoken in a higher dimension.
Green's theorem (2D)
For a vector field F = (P, Q) and a region R with boundary curve ∂R: the circulation around the boundary equals the integral of the curl over the interior. ∮ P dx + Q dy = ∫∫ (∂Q/∂x − ∂P/∂y) dA.
Scheme
; Green's theorem: F = (-y, x), R = unit disk; Curl = dQ/dx - dP/dy = 1 - (-1) = 2; LHS: double integral of 2 over unit disk = 2*pi; RHS: line integral around unit circle
(define pi 3.141592653589793)
; LHS: area integral of curl(F) = 2 over unit disk; integral of 2 dA = 2 * pi * r^2 = 2*pi
(define lhs (* 2 pi))
; RHS: line integral F.dr around unit circle; r(t) = (cos(t), sin(t)), r'(t) = (-sin(t), cos(t)); F(r(t)) = (-sin(t), cos(t)); F.r' = sin^2(t) + cos^2(t) = 1
(define (integrate fn a b n)
(let* ((dt (/ (- b a) n)))
(do ((i 0 (+ i 1))
(sum 0 (+ sum (fn (+ a (* dt (+ i 0.5)))))))
((= i n) (* sum dt)))))
(define rhs
(integrate (lambda (t) 1) 0 (* 2 pi) 1000))
(display "LHS (area integral of curl): ") (display lhs) (newline)
(display "RHS (line integral): ") (display rhs) (newline)
(display "Equal? ") (display (< (abs (- lhs rhs)) 0.001))
Python
import numpy as np
# Green's theorem: F = (-y, x) on unit disk# curl = 2, area integral = 2*pi
lhs = 2 * np.pi
# Line integral around unit circle: integrand = 1
t = np.linspace(0, 2*np.pi, 10000)
rhs = np.sum(np.ones_like(t) * (t[1]-t[0]))
print(f"Area integral of curl: {lhs:.6f}")
print(f"Line integral: {rhs:.6f}")
print(f"Equal? {np.isclose(lhs, rhs)}")
Stokes' theorem (3D surfaces)
Stokes' theorem generalizes Green's to 3D: for a surface S bounded by curve ∂S, ∫∫_S (curl F) · dS = ∮_(∂S) F · dr. The curl integrated over the surface equals the circulation around its boundary.
Scheme
; Stokes' theorem: F = (-y, x, 0) on the unit disk in the xy-plane; curl(F) = (0, 0, 2); Surface: z=0, normal = (0,0,1); curl(F).n = 2; LHS: integral of 2 over unit disk = 2*pi (same as Green's!)
(define pi 3.141592653589793)
; This is exactly Green's theorem when the surface is flat.; Stokes in 3D = Green in 2D.
(display "Stokes on a flat surface = Green's theorem") (newline)
(display "curl(F) . n = 2") (newline)
(display "Surface integral = 2 * area(disk) = 2*pi = ")
(display (* 2 pi)) (newline)
; The key insight: Green's, Stokes', and the divergence theorem; are all instances of the generalized Stokes' theorem:; integral of d(omega) over M = integral of omega over boundary(M)
(display "All three are: integral(d_omega, M) = integral(omega, dM)")
Python
# Stokes' theorem on flat surface = Green's theoremimportmath# curl(F).n = 2, surface = unit disk# Surface integral = 2 * area(disk) = 2*piprint("Stokes on a flat surface = Green's theorem")
print("curl(F) . n = 2")
print("Surface integral = 2 * area(disk) = 2*pi = " + format(2 * math.pi, ".6f"))
print("All three are: integral(d_omega, M) = integral(omega, dM)")
Divergence theorem (3D volumes)
For a solid region V bounded by closed surface ∂V: ∫∫∫_V (div F) dV = &oiint;_(∂V) F · dS. The divergence integrated over the volume equals the net flux out through the boundary.
Scheme
; Divergence theorem: F = (x, y, z) on the unit ball; div(F) = 1 + 1 + 1 = 3; LHS: integral of 3 over unit ball = 3 * (4/3)*pi = 4*pi
(define pi 3.141592653589793)
(define lhs (* 3 (/ 4.03) pi))
(display "Volume integral of div(F) = 3 * (4/3)*pi = ")
(display lhs) (newline)
; RHS: flux of F = (x,y,z) through unit sphere; On the sphere, n = (x,y,z) and F.n = x^2+y^2+z^2 = 1; Flux = integral of 1 over unit sphere = 4*pi
(define rhs (* 4 pi))
(display "Surface flux = 4*pi = ") (display rhs) (newline)
(display "Equal? ") (display (< (abs (- lhs rhs)) 0.001)) (newline)
; Divergence theorem verified:; The net outward flux equals the total "source strength" inside.
(display "Net source inside = net flux out")
Python
# Divergence theorem: F = (x,y,z) on unit ballimportmath# div(F) = 3, volume integral = 3 * (4/3)*pi = 4*pi
lhs = 3 * (4.0/3) * math.pi
print("Volume integral of div(F) = 3 * (4/3)*pi = " + format(lhs, ".6f"))
# Flux through unit sphere: F.n = 1, surface area = 4*pi
rhs = 4 * math.pi
print("Surface flux = 4*pi = " + format(rhs, ".6f"))
print("Equal? " + str(abs(lhs - rhs) < 0.001))
print("Net source inside = net flux out")
One theorem, three dimensions
The generalized Stokes' theorem says: ∫_M dω = ∫_(∂M) ω. In 1D, ω is a function and dω is its derivative. In 2D, ω is a 1-form and dω is the curl. In 3D, ω is a 2-form and dω is the divergence. The boundary operator ∂ and the exterior derivative d are dual: integration translates between them.
Scheme
; Summary: all three theorems in one pattern;; Dim Interior Boundary Theorem; --- -------- -------- -------; 1D f'(x)dx f(b)-f(a) FTC; 2D curl(F)dA F.dr Green/Stokes; 3D div(F)dV F.dS Divergence;; Each row says: integrate the derivative inside = evaluate on boundary
(display "1D: integral(f', [a,b]) = f(b) - f(a)") (newline)
(display "2D: integral(curl F, R) = integral(F, dR)") (newline)
(display "3D: integral(div F, V) = integral(F, dV)") (newline)
(newline)
(display "The exterior derivative d generalizes all three:") (newline)
(display " d on 0-forms = gradient") (newline)
(display " d on 1-forms = curl") (newline)
(display " d on 2-forms = divergence") (newline)
(display " d^2 = 0 (curl of gradient = 0, div of curl = 0)")
Python
# One theorem, three dimensionsprint("1D: integral(f', [a,b]) = f(b) - f(a)")
print("2D: integral(curl F, R) = integral(F, dR)")
print("3D: integral(div F, V) = integral(F, dV)")
print()
print("The exterior derivative d generalizes all three:")
print(" d on 0-forms = gradient")
print(" d on 1-forms = curl")
print(" d on 2-forms = divergence")
print(" d^2 = 0 (curl of gradient = 0, div of curl = 0)")