📊 Section 1 — Interactive Simulation
Pick a field $\vec F$, pick a region or surface, and compare both sides of the theorem live. Watch how curl/divergence inside a small box matches the circulation/flux around its boundary.
Compute
Vector Field F
Region Shape
Surface (Stokes mode)
3D Volume (div3 mode)
Parameters
Display
Tips
• Try rotation field on disc: LHS=2πR², RHS=∬2dA=2·πR². ✓
• Try source field in div2 mode: flux = 2·area, div = 2 everywhere.
• Stokes mode on hemisphere vs flat disk — both give same answer because they share a boundary.
• Sweep size — error should decay as $O(1/n^2)$.
🪜 Section 2 — The Idea, Step by Step
From "what goes in must come out" up to the single line that contains all three theorems — built gently, assuming no prior vector calculus.
Picture a kiddie pool out in the rain. Drops sprinkle in across the whole surface, and water also dribbles out over the rim. If the pool is neither overflowing nor draining, those two totals have to match: all the rain landing inside equals all the water crossing the edge. That one accounting rule — whatever is happening throughout the interior is bookkept exactly by what crosses the boundary — is Green's, Stokes', and the Divergence theorem. Everything else is just choosing what "inside" and "edge" mean.
Drop a tiny paddle wheel into a flowing field $\vec F$ and walk a small square around it, adding up how much the flow pushes you along your path. That running total is the circulation. Shrink the square and the circulation per unit area settles onto one number at that point — the curl, written $Q_x - P_y$ for $\vec F=(P,Q)$. Green's theorem says: add the curl over every tiny square tiling a region $D$, watch the shared inner edges cancel in pairs, and all that survives is the single loop around the outer boundary: $$\oint_{\partial D} P\dd{x}+Q\dd{y} \;=\; \iint_D (Q_x - P_y)\dd{A}.$$ Test it on the spinning field $\vec F=(-y,x)$ over the unit disc. The curl is $1-(-1)=2$ everywhere, so the right side is $2\times(\text{area }\pi)=2\pi$ — and walking the rim also gives $2\pi$. They agree because they must.
Trade "circulation around a curve" for "flux through a surface," and "curl" for "divergence," and you climb the ladder. The Divergence theorem says the net flux of $\vec F$ out of a closed surface $\partial V$ equals the total source strength $\divg\vec F=\partial_x F_1+\partial_y F_2+\partial_z F_3$ packed inside: $\oiint_{\partial V}\vec F\cdot d\vec S=\iiint_V \divg\vec F\dd{V}$. Stokes' is the curved-surface version of Green's: circulation around a rim equals the flux of $\curl\vec F$ through any surface that caps that rim. All three collapse to one line, $\int_{\partial M}\omega=\int_M d\omega$ — the boundary integral of a quantity $\omega$ equals the interior integral of its derivative. In the sim the R slider sets the region size, n chops the boundary for the LHS, and m chops the interior for the RHS; the two sides are computed completely independently, so when the readouts match you are watching the theorem, not a rigged demo.
First, pick the rotation field on the disc in Green's mode and hit Compute — LHS and RHS both land on $2\pi R^2$ in exact agreement because the curl is the constant $2$. Next, switch to the source field $(x,y)$ in 2D Divergence mode: the divergence is $2$ everywhere, so the flux out of any region equals $2\times$ its area — grow R and watch both numbers scale together. Finally, in Stokes' mode compare the hemisphere against the flat disk: both report the same flux because they share the unit-circle boundary — exactly the "any cap works" claim. For a reality check, drag the boundary count n down near its minimum and watch $|\text{LHS}-\text{RHS}|$ swell as discretization error, then slide it back up and see the gap shrink like $O(1/n^2)$.
📐 Section 3 — Theory: The Big Three
All three theorems say the same thing in different dimensions: an integral over a boundary equals an integral of a derivative over the interior. They're special cases of the generalized Stokes theorem $\int_{\partial M}\omega = \int_M d\omega$.
For a positively-oriented simple closed curve $C$ bounding a region $D\subset\R^2$, and $\vec F = (P, Q)$ with $P, Q\in C^1(\overline D)$: $$\oint_C P\dd{x} + Q\dd{y} \;=\; \iint_D \left(\frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y}\right)\dd{A}.$$
The integrand on the right is the scalar curl (sometimes written $\curl\vec F\cdot\hat k$). Circulation around the boundary = total infinitesimal rotation inside.
For a solid region $V\subset\R^3$ with piecewise-smooth boundary $\partial V$ oriented outward, and $C^1$ vector field $\vec F$: $$\oiint_{\partial V}\vec F\cdot d\vec S \;=\; \iiint_V \divg\vec F\dd{V} \;=\; \iiint_V (\partial_x F_1 + \partial_y F_2 + \partial_z F_3)\dd{V}.$$
Flux through the boundary = total net source-strength inside. The 2D analogue: $\oint_C\vec F\cdot \vec n\dd{s} = \iint_D \divg\vec F\dd{A}$.
For an oriented piecewise-smooth surface $S\subset\R^3$ with boundary $\partial S$ (right-hand rule matches surface normal), and $C^1$ vector field $\vec F$: $$\oint_{\partial S}\vec F\cdot d\vec r \;=\; \iint_S (\curl\vec F)\cdot d\vec S.$$
Circulation around any boundary = flux of curl through any surface filling it. Two surfaces sharing the same boundary give the same answer.
Symbol Table
| Symbol | Meaning | Type |
|---|---|---|
| $\partial D$ | Boundary of region $D$ (a curve in 2D, a surface in 3D) | 1- or 2-manifold |
| $\curl\vec F$ | Vector curl in 3D: $(\partial_y R - \partial_z Q, \partial_z P - \partial_x R, \partial_x Q - \partial_y P)$ | Vector field on $\R^3$ |
| $\divg\vec F$ | $\partial_x F_1 + \partial_y F_2 + \partial_z F_3$ | Scalar field |
| $d\vec S$ | Oriented surface element $\vec n\dd{S}$ | Vector 2-form |
| $d\vec r$ | Oriented line element | Vector 1-form |
| $\omega, d\omega$ | Differential form & its exterior derivative | Form algebra |
Why They're All One Theorem
- $\omega = f$ (0-form), $M = $ curve from $a$ to $b$: $f(b)-f(a) = \int_a^b f'$ — FTC.
- $\omega = P\dd{x}+Q\dd{y}$ (1-form), $M = D\subset\R^2$: $d\omega = (Q_x - P_y)\dd{x}\wedge\dd{y}$ — Green's.
- $\omega = F_1\dd{x}+F_2\dd{y}+F_3\dd{z}$, $M = $ surface in $\R^3$: $d\omega$ encodes curl — Stokes'.
- $\omega = F_1\dd{y}\wedge\dd{z}+F_2\dd{z}\wedge\dd{x}+F_3\dd{x}\wedge\dd{y}$, $M = $ 3D volume: $d\omega = \divg\vec F\dd{V}$ — Divergence theorem.
Simulation ↔ Symbol Mapping
tab Green's | 2D circulation form: LHS = $\oint P\dd{x}+Q\dd{y}$, RHS = $\iint(Q_x-P_y)\dd{A}$ |
tab 2D Div | 2D flux form: LHS = $\oint\vec F\cdot\vec n\dd{s}$, RHS = $\iint\divg\vec F\dd{A}$ |
tab 3D Div | $\oiint_{\partial V}\vec F\cdot d\vec S$ vs $\iiint_V\divg\vec F\dd{V}$ |
tab Stokes' | $\oint_{\partial S}\vec F\cdot d\vec r$ vs $\iint_S\curl\vec F\cdot d\vec S$ |
readout LHS | boundary integral (line/surface as appropriate) |
readout RHS | interior integral (curl/div over the region) |
readout match? | ✓ if LHS-RHS within numerical tolerance; otherwise indicates discretization error |
graph conv | LHS and RHS both as functions of region size — they should track each other |
Worked Example — Green's on a Disc
$\vec F = (-y, x)$, $D$ = unit disc, $C = \partial D$.
LHS: $\oint_C -y\dd{x}+x\dd{y}$. Parametrize $x=\cos t, y=\sin t$, $\dd{x}=-\sin t\dd{t}, \dd{y}=\cos t\dd{t}$. Integrand $= -\sin t \cdot(-\sin t) + \cos t\cdot\cos t = 1$. $\oint = \int_0^{2\pi} 1\dd{t} = 2\pi$.
RHS: $Q_x - P_y = \partial_x(x) - \partial_y(-y) = 1 - (-1) = 2$. $\iint_D 2\dd{A} = 2\cdot\pi = 2\pi$. ✓ $\boxed{\text{LHS}=\text{RHS}=2\pi.}$
Worked Example — Divergence Theorem on the Unit Ball
$\vec F = (x, y, z)$, $V$ = unit ball, $\partial V$ = unit sphere.
LHS: $\oiint_{\partial V}\vec F\cdot d\vec S$. On the sphere, $\vec n = (x,y,z)$, so $\vec F\cdot\vec n = x^2+y^2+z^2 = 1$. $\oiint 1\dd{S} = 4\pi$.
RHS: $\divg\vec F = 1+1+1 = 3$. $\iiint_V 3\dd{V} = 3\cdot\frac{4\pi}{3} = 4\pi$. ✓ $\boxed{\text{Flux}=\text{Div-integral}=4\pi.}$
Worked Example — Stokes' for Two Surfaces Sharing a Boundary
$\vec F = (-y, x, 0)$ (rotation lifted to 3D). $\curl\vec F = (0, 0, 2)$. Boundary $C$ = unit circle in $xy$-plane.
Surface 1 (flat disk $z=0$): normal $\hat k$, $\curl\vec F\cdot\hat k = 2$. Flux $= 2\cdot\pi = 2\pi$.
Surface 2 (upper hemisphere): normal $= (x,y,z)$ on the sphere, $\curl\vec F\cdot\vec n = 2z$. Flux $= \iint_{\text{hemi}} 2z\dd{S}$. Parametrize: $z = \cos\phi$, $\dd{S}=\sin\phi\dd\phi\dd\theta$. Flux $= \int_0^{2\pi}\!\int_0^{\pi/2} 2\cos\phi\sin\phi\dd\phi\dd\theta = 2\pi\cdot 1 = 2\pi$.
Boundary integral (LHS): $\oint_C \vec F\cdot d\vec r = 2\pi$ (computed earlier in Topic #11). All three agree. $\boxed{\text{Different surfaces, same flux} = 2\pi.}$ This is the magic of Stokes.
❓ Section 4 — Frequently Asked Questions
Divergence at a point is "net outflow per unit volume" — the rate at which the field is locally creating new field-flow. Positive divergence = source (water bubbling out); negative = sink (drain). By the divergence theorem, $\divg\vec F(\vec p) = \lim_{V\to\{\vec p\}} \frac{1}{\text{vol}(V)}\oiint_{\partial V}\vec F\cdot d\vec S$ — the local source density.
Curl at a point is the local "spin axis" — its direction is the rotation axis (right-hand rule), magnitude is twice the angular speed of an infinitesimal paddle wheel placed there. By Stokes', $(\curl\vec F)(\vec p)\cdot\vec n = \lim_{A\to\{\vec p\}}\frac{1}{\text{area}(A)}\oint_{\partial A}\vec F\cdot d\vec r$ — circulation per unit area, oriented by $\vec n$.
Key takeaway: $\divg$ measures local sourcing/sinking; $\curl$ measures local rotation. Both are limits of boundary integrals shrunk to a point.The theorems are mathematically exact. Any visible mismatch in the simulation is numerical discretization error. For polynomial fields and smooth boundaries, Simpson-like rules can hit exact answers (no error). For non-polynomial fields (e.g.\ Gaussians, $1/r^2$) or near singularities, you get $O(1/n^2)$ midpoint error on both sides — increasing the grid size reduces it.
Watch out for: (i) sharp corners on the region — discretization can't capture them; (ii) singularities of the field inside the region (e.g.\ $\vec F = (-y,x)/(x^2+y^2)$ at the origin) — the integrands blow up and the theorem's hypotheses fail; (iii) boundary orientation flipped — gives sign error of exactly $-1$.
Key takeaway: theorem-side mismatches in the sim are always numerical, not mathematical. The exception is when the hypotheses (C¹ field, smooth boundary) fail.Maxwell's first equation in differential form: $\divg\vec E = \rho/\varepsilon_0$ where $\rho$ is charge density. Integrate both sides over any volume $V$ and apply the divergence theorem on the left: $\oiint_{\partial V}\vec E\cdot d\vec S = \iiint_V \divg\vec E\dd{V} = \frac{1}{\varepsilon_0}\iiint_V\rho\dd{V} = \frac{Q_{\text{enc}}}{\varepsilon_0}.$
This is Gauss's law in integral form — total flux of $\vec E$ through a closed surface equals enclosed charge over $\varepsilon_0$. Same logic gives the integral form of $\divg\vec B = 0$: total magnetic flux through any closed surface is zero (no magnetic monopoles).
The same conversion takes Faraday's $\nabla\times\vec E = -\partial_t\vec B$ to its integral form $\oint\vec E\cdot d\vec r = -\frac{d}{dt}\iint\vec B\cdot d\vec S$ via Stokes' theorem, and Ampère-Maxwell to its integral form. All four Maxwell equations exist in both forms; the theorems are the conversion factory.
Key takeaway: Maxwell's equations come in pairs (differential, integral). Green/Stokes/Divergence theorems are the conversion. Physicists use whichever form is easier for the problem at hand.Suppose $S_1$ and $S_2$ both have boundary $C$, oriented consistently. Glue them along $C$: $S_1 \cup (-S_2)$ (flipping the orientation of $S_2$) forms a closed surface enclosing some volume $V$. By the divergence theorem applied to $\curl\vec F$: $\iint_{S_1}\curl\vec F\cdot d\vec S - \iint_{S_2}\curl\vec F\cdot d\vec S = \oiint_{S_1\cup(-S_2)}\curl\vec F\cdot d\vec S = \iiint_V\divg(\curl\vec F)\dd{V}.$
The key identity: $\divg(\curl\vec F) = 0$ for any $C^2$ field $\vec F$ (you can check by direct expansion — mixed partials cancel pairwise). So the right side is zero, hence $\iint_{S_1} = \iint_{S_2}$. Any surface filling $C$ works.
This is why in EM you can compute the flux of $\vec B$ through a coil using any convenient surface bounded by the coil — flat disk, dome, anything. The result is determined entirely by the coil.
Key takeaway: $\divg\curl = 0$ + divergence theorem ⇒ flux of a curl through a surface depends only on the boundary, not the surface.Two main scenarios. (1) Boundary is complicated, interior is simple. Example: compute $\oiint_{\partial V}\vec F\cdot d\vec S$ where $\partial V$ is six faces of a cube. Doing six surface integrals separately is painful. If $\divg\vec F = c$ constant, the answer is just $c\cdot\text{vol}(V)$ — one multiplication. (2) Interior is hard, boundary is simple. Less common but happens: a tricky volume integral becomes a manageable surface integral once you realize it's $\divg$ of something nicer.
Rule of thumb: write down both sides. The one with fewer terms or simpler region wins. For Stokes', the analogous trick: if a line integral is hard, look for a $\curl$ form on the inside that's easy to integrate over any filling surface.
Aerospace example: lift force on an airfoil. Direct surface integration of pressure × normal over the wing skin is hard. But the lift can be related (via Kutta-Joukowski) to circulation around the wing, computed once and used everywhere.
Key takeaway: pick the side with the simpler geometry or simpler integrand. The theorems give you the choice — use it.On an oriented smooth manifold $M$ of dimension $n$ with boundary $\partial M$, and a $(n-1)$-form $\omega$ on $M$, the generalized Stokes theorem says: $\int_{\partial M}\omega = \int_M d\omega$. That's it. One line. The vector-calculus theorems of $\R^3$ are specializations to particular $M$, $\omega$, and dimensions.
This abstraction unifies FTC (dim 1), Green's/2D-Divergence (dim 2), Stokes'/3D-Divergence (dim 3), and extends seamlessly to any dimension. In 4D-spacetime, it's how integral conservation laws (charge, energy-momentum) get written in relativistic field theory. In algebraic topology, it underlies de Rham cohomology: $H^k_{\text{dR}}(M) = \ker(d_k)/\text{img}(d_{k-1})$ — measures "holes" in $M$ via forms-mod-exact.
Stokes' theorem is the source of the duality between geometry (manifolds with boundary) and algebra (forms with exterior derivative). The fact that $d^2 = 0$ (exterior derivative squared is zero) is what makes "closed = exact on contractible domains" work, generalizing "curl-free ⇒ gradient" and "divergence-free ⇒ curl of something".
Key takeaway: generalized Stokes is one line: $\int_{\partial M}\omega = \int_M d\omega$. Every vector-calc theorem you've learned is a corollary in low dimensions.Three failure modes. (1) Field is not $C^1$ inside the region. If $\vec F$ has a singularity in $D$, the curl/divergence may not be integrable, or it's a delta function. The classic vortex $\vec F = (-y, x)/(x^2+y^2)$ has $\curl\vec F = 0$ everywhere except the origin, but $\oint_C\vec F\cdot d\vec r = 2\pi$ around the unit circle — the theorem says $\iint_D 0\dd{A} = 2\pi$, which is false. The resolution: $\curl\vec F$ contains a Dirac mass at the origin (in distributional sense), and $\iint_D \delta\dd{A} = 1$, giving the $2\pi$.
(2) Boundary is not piecewise smooth. Fractal boundaries (snowflake curves) lack a well-defined tangent or normal; the theorems need to be extended via measure theory.
(3) Orientation inconsistency. If the boundary orientation doesn't match the right-hand rule for the surface normal (or CCW for 2D regions), the theorem holds with the opposite sign. Always check orientation conventions in your textbook.
Key takeaway: smoothness hypotheses matter. Singularities in $\vec F$ are interpreted as distributional sources; orientation conventions must agree.