Why This Matters
The three great theorems of vector calculus -- Green theorem, Stokes theorem, and the divergence theorem -- are among the most beautiful and powerful results in all of mathematics. Each one says the same thing in a different setting: what happens on the boundary determines what happens in the interior (and vice versa).
Green theorem connects a line integral around a closed curve to a double integral over the enclosed region. Stokes theorem generalizes this to 3D: a line integral around the boundary of a surface equals the surface integral of the curl. The divergence theorem goes further: the flux through a closed surface equals the volume integral of the divergence inside. These theorems unify differential and integral calculus in multiple dimensions, and they are the mathematical foundation of conservation laws in physics -- conservation of mass, energy, charge, and momentum.
Define Terms
Visual Model
The full process at a glance. Click Start tour to walk through each step.
The three great theorems of vector calculus: each equates an integral over a region to an integral over its boundary.
Code Example
// Verify Green theorem numerically
// F = (P, Q) = (-y, x)
// Curve: unit circle, Region: unit disk
// Line integral of F.dr around circle should equal
// double integral of (dQ/dx - dP/dy) over disk
// Left side: line integral around unit circle
function lineIntegralCircle(n) {
const dt = 2 * Math.PI / n;
let sum = 0;
for (let i = 0; i < n; i++) {
const t = (i + 0.5) * dt;
const x = Math.cos(t), y = Math.sin(t);
const dx = -Math.sin(t) * dt;
const dy = Math.cos(t) * dt;
// F = (-y, x), F.dr = -y*dx + x*dy
sum += (-y * dx + x * dy);
}
return sum;
}
// Right side: double integral of curl over unit disk
// curl = dQ/dx - dP/dy = d(x)/dx - d(-y)/dy = 1 - (-1) = 2
function doubleIntegralDisk(n) {
const dx = 2.0 / n;
let sum = 0;
for (let i = 0; i < n; i++) {
const x = -1 + (i + 0.5) * dx;
for (let j = 0; j < n; j++) {
const y = -1 + (j + 0.5) * dx;
if (x * x + y * y <= 1) {
sum += 2 * dx * dx; // curl = 2
}
}
}
return sum;
}
console.log("Line integral (n=10000):", lineIntegralCircle(10000).toFixed(6));
console.log("Double integral (n=200):", doubleIntegralDisk(200).toFixed(6));
console.log("Exact (2*pi):", (2 * Math.PI).toFixed(6));
// Divergence theorem: verify in 2D
// F = (x, y), div F = 2
// Flux through unit circle = integral of F.n ds
function fluxCircle(n) {
const dt = 2 * Math.PI / n;
let sum = 0;
for (let i = 0; i < n; i++) {
const t = (i + 0.5) * dt;
const x = Math.cos(t), y = Math.sin(t);
// Outward normal on unit circle is (cos t, sin t)
// F.n = x*cos(t) + y*sin(t) = cos^2(t) + sin^2(t) = 1
sum += 1 * dt;
}
return sum;
}
// Double integral of div F = 2 over unit disk = 2 * pi
console.log("Flux (n=10000):", fluxCircle(10000).toFixed(6));
console.log("Integral of div (n=200):", doubleIntegralDisk(200).toFixed(6));
console.log("Both should equal 2*pi =", (2 * Math.PI).toFixed(6));Interactive Experiment
Try these exercises:
- Verify Green theorem for F = (x^2, xy) around the unit square [0,1] x [0,1]. Compute both the line integral (4 segments) and the double integral of (dQ/dx - dP/dy) = (y - 0) = y over the square.
- Change the region to a triangle with vertices (0,0), (1,0), (0,1). Parameterize all three edges and sum the line integrals. Compare to the double integral.
- For the divergence theorem, try F = (x^2, y^2) on the unit circle. Compute both sides and verify they agree.
- Increase the resolution and observe convergence. Which side of the theorem converges faster in your numerical experiments?
- Try a field where the curl is zero everywhere. Green theorem predicts the line integral around any closed curve is zero. Verify this for F = (x, y).
Quick Quiz
Coding Challenge
Write a function called `verifyGreen` that takes n as input and verifies Green theorem for F(x,y) = (x*y, x^2) on the unit square [0,1] x [0,1]. Compute both sides: (1) the line integral of F around the square boundary (counterclockwise: bottom, right, top, left edges), and (2) the double integral of (dQ/dx - dP/dy) over the square. Return a string `line,area` with both values rounded to 4 decimal places. They should be approximately equal. The curl is dQ/dx - dP/dy = 2x - x = x. The integral of x over [0,1]x[0,1] is 1/2.
Real-World Usage
These fundamental theorems underpin modern science and engineering:
- Electromagnetism (Maxwell equations): Gauss law (divergence theorem) relates charge inside a surface to electric flux through it. Faraday law (Stokes theorem) relates changing magnetic flux to induced voltage around a loop.
- Fluid dynamics: The divergence theorem converts local conservation of mass (continuity equation) into a statement about flow through boundaries. Engineers use this to analyze pipe networks and aerodynamic surfaces.
- Computational physics: Finite element methods use Green theorem and integration by parts to convert differential equations into integral formulations that computers can solve.
- Heat transfer: Fourier law of heat conduction, combined with the divergence theorem, gives the heat equation. The total heat flowing out of a region equals the integral of the heat source inside.
- Conservation laws: Every conservation law in physics (mass, energy, momentum, charge) has the form: rate of change inside = flux through boundary. This is the divergence theorem applied to the conserved quantity.