Chapter 19
25 min read
Section 166 of 353

Green's Theorem

Vector Calculus

Learning Objectives

By the end of this section, you will be able to:

  1. State and apply Green's theorem CPdx+Qdy=D(QxPy)dA\oint_C P\,dx + Q\,dy = \iint_D \left( \frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y} \right) dA to convert between a boundary line integral and a region double integral.
  2. Explain the microscopic intuition — every closed line integral is a sum of tiny rotations, and interior rotations cancel in pairs.
  3. Use orientation correctly: positive (CCW) orientation keeps the region on the left as you walk along the boundary.
  4. Compute area from a boundary alone using A=12C(xdyydx)A = \tfrac{1}{2}\oint_C (x\,dy - y\,dx) — the principle behind the planimeter and the shoelace formula.
  5. Connect Green's theorem to its physical meaning (circulation = total curl) and to Stokes' theorem, which we meet in section 19.8.
Why This Matters: Green's theorem is the first rung on the ladder that ends with Stokes and Divergence. It is also a deep practical tool — it's why a mechanical planimeter can measure any area by tracing its boundary, why image-processing libraries compute polygon area from a vertex list, and why fluid dynamics measures circulation around a wing instead of integrating vorticity inside it.

The Big Picture

We have spent two sections computing line integrals CFdr\int_C \mathbf{F} \cdot d\mathbf{r} by parametrizing curves and grinding out one-variable integrals. That is powerful, but it answers questions edge-by-edge, never globally.

Green's theorem gives us a second perspective. It says: for a well-behaved field, the total work done as you walk once around a closed curve CC equals the total rotational tendency of the field accumulated over the region DD enclosed by the curve.

The central identity: for a positively oriented simple closed curve CC bounding a region DD,
CPdx+Qdy  =  D(QxPy)dA.\oint_C P\,dx + Q\,dy \;=\; \iint_D \left( \frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y} \right) dA.
Read it as: boundary circulation = interior curl, integrated.

The promise is striking. A one-dimensional integral around a curve and a two-dimensional integral over a region carry the same information. Anything you can compute on one side, you can compute on the other — whichever is easier.


Where Green's Theorem Came From

George Green (1793–1841) was a self-taught English miller's son who, in 1828, published a slim pamphlet titled An Essay on the Application of Mathematical Analysis to the Theories of Electricity and Magnetism. The pamphlet contained the first version of the theorem now bearing his name. Green wrote it to compute electrostatic potentials inside conductors — he needed to turn an integral over a surface charge into an integral over its volume.

For decades the essay sat almost unread; Green sold around fifty copies. It was rescued in the 1850s by William Thomson (Lord Kelvin), who reprinted it and built upon it. The same idea, generalized into three dimensions, became Stokes' theorem (1854) and the basis of Maxwell's electromagnetic equations.

Green never went to a university until age 40. He did most of his mathematics while running a windmill in Nottingham. The mill still stands and is a museum.

Microscopic Circulation: The Idea Behind the Proof

Why should a boundary integral and an interior integral be equal? The cleanest way to see it is to chop the region into tiny squares.

Imagine a small loop around a single tiny square of side hh centered at (x,y)(x,y). Walking CCW around it, the four edge contributions to Pdx+Qdy\oint P\,dx + Q\,dy are, after a Taylor expansion:

cellPdx+Qdy    (QxPy)(x,y)h2.\oint_{\text{cell}} P\,dx + Q\,dy \;\approx\; \left( \frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y} \right)(x,y) \cdot h^2.

That is, each cell's circulation equals its curl times area. So if we add up the circulations of all the tiny cells tiling DD, we get the right-hand side DcurldA\iint_D \text{curl}\,dA.

And on the left? Every interior edge is shared by two adjacent cells — and the two cells traverse that edge in opposite directions. The contributions cancel. After the dust settles, only the unshared edges — the actual outer boundary CC — survive. The sum of cell circulations is exactly CPdx+Qdy\oint_C P\,dx + Q\,dy.

One sentence to remember the proof: interior edges cancel in pairs, so all that's left is the boundary.

Interactive: Cells, Cancellation, and the Boundary

Increase the grid resolution and watch the interior edges cancel — every red pair of arrows on an interior edge points in opposite directions, contributing zero in total. Only the blue outer loop survives.

Loading visualization...

Statement of Green's Theorem

Green's theorem. Let CC be a piecewise-smooth, simple closed curve in the plane, oriented counter-clockwise. Let DD be the region enclosed by CC. If P(x,y)P(x,y) and Q(x,y)Q(x,y) have continuous partial derivatives on an open region containing DD, then:
CPdx+Qdy  =  D(QxPy)dA.\oint_C P\,dx + Q\,dy \;=\; \iint_D \left( \frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y} \right) dA.

The integrand on the right, Q/xP/y\partial Q/\partial x - \partial P/\partial y, is the scalar 2D curl of F=(P,Q)\mathbf{F} = (P,Q). It measures the infinitesimal rotation rate of the field at each point: positive means CCW spin, negative means CW spin, zero means locally irrotational.

ObjectLives onMeasures
CPdx+Qdy\oint_C P\,dx + Q\,dy1D curve CCTotal circulation around the loop
D(Q/xP/y)dA\iint_D \left( \partial Q/\partial x - \partial P/\partial y \right) dA2D region DDTotal infinitesimal rotation inside
Green's theoremTheir equalityBoundary = interior total

Orientation Matters

Positive orientation of CC means you walk along CC with the region DD on your left. For a simple closed curve in the plane this is counter-clockwise. If you traverse the boundary the other way, the line integral flips sign: C=C\oint_{-C} = -\oint_C.

Holes in the region. If DD has a hole, treat the inner and outer boundaries separately. The outer boundary is CCW and the inner one is CW (so the region is always on your left). Green's theorem becomes CoutCin=DcurldA\oint_{C_{\text{out}}} - \oint_{C_{\text{in}}} = \iint_D \text{curl}\,dA.

Proof Sketch from Tiny Rectangles

We make the intuition above rigorous in the simplest case: a rectangle D=[a,b]×[c,d]D = [a,b] \times [c,d].

Step 1. Compute CPdx\oint_C P\,dx by walking around the rectangle CCW. The two vertical sides have dx=0dx=0, so they contribute nothing. The bottom side (left to right) and the top side (right to left) contribute:

CPdx  =  abP(x,c)dxabP(x,d)dx  =  ab[P(x,d)P(x,c)]dx.\oint_C P\,dx \;=\; \int_a^b P(x,c)\,dx - \int_a^b P(x,d)\,dx \;=\; -\int_a^b \bigl[ P(x,d) - P(x,c) \bigr] dx.

Step 2. By the fundamental theorem of calculus applied in the y-direction, P(x,d)P(x,c)=cdPy(x,y)dyP(x,d) - P(x,c) = \int_c^d \frac{\partial P}{\partial y}(x,y)\,dy. Substituting:

CPdx  =  abcdPydydx  =  DPydA.\oint_C P\,dx \;=\; -\int_a^b \int_c^d \frac{\partial P}{\partial y}\,dy\,dx \;=\; -\iint_D \frac{\partial P}{\partial y}\,dA.

Step 3. The analogous argument for CQdy\oint_C Q\,dy gives DQ/xdA\iint_D \partial Q/\partial x\,dA. Adding:

CPdx+Qdy  =  D(QxPy)dA.\oint_C P\,dx + Q\,dy \;=\; \iint_D \left( \frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y} \right) dA.

For a general region, tile it with rectangles, apply this lemma to each, and sum. As we noted, the interior contributions cancel and only the boundary survives.


Interactive: Line Integral = Double Integral

For each preset field, the panel computes the left-hand side (a line integral around the circle of radius RR) and the right-hand side (a double integral of the curl over the disk). Slide the radius and switch the field — the two values track each other to numerical precision.

The orange marker walking the boundary shows the position r(t)\mathbf{r}(t); the orange arrow attached to it is the field F(r(t))\mathbf{F}(\mathbf{r}(t)) at that point. The red/blue shading is the curl heat map — red for positive (CCW spin), blue for negative (CW spin).

Loading visualization...
Try this: pick the Radial field. Its curl is zero everywhere, so the heat map is blank and both integrals are zero regardless of radius — the field is conservative, just like in the previous section. Now pick the Saddle field. Its curl 2x+2y2x + 2y changes sign across the line y=xy=-x: positive in the upper-right, negative in the lower-left. The two halves cancel, leaving zero. Move the boundary off-center (mentally) and you can imagine the cancellation breaking.

Worked Example: A Closed Curve Around a Triangle

Let F(x,y)=(y2,3xy)\mathbf{F}(x,y) = (y^2,\, 3xy), and let CC be the boundary of the triangle TT with vertices (0,0)(0,0), (2,0)(2,0), and (0,2)(0,2), traversed CCW. We want CFdr\oint_C \mathbf{F} \cdot d\mathbf{r}.

Direct parametrization would require three integrals (one per edge), each with its own bookkeeping. Green's theorem turns this into a single double integral over TT:

QxPy  =  x(3xy)y(y2)  =  3y2y  =  y.\frac{\partial Q}{\partial x} - \frac{\partial P}{\partial y} \;=\; \frac{\partial}{\partial x}(3xy) - \frac{\partial}{\partial y}(y^2) \;=\; 3y - 2y \;=\; y.

So the answer is TydA\iint_T y\,dA over the triangle. The triangle is described by 0x20 \le x \le 2, 0y2x0 \le y \le 2 - x.

TydA  =  0202xydydx  =  02(2x)22dx  =  12(2x)3302  =  86  =  43.\iint_T y\,dA \;=\; \int_0^2 \int_0^{2-x} y\,dy\,dx \;=\; \int_0^2 \frac{(2-x)^2}{2}\,dx \;=\; \frac{1}{2} \cdot \frac{(2-x)^3}{-3}\bigg|_0^2 \;=\; \frac{8}{6} \;=\; \frac{4}{3}.

Therefore CFdr=43\oint_C \mathbf{F} \cdot d\mathbf{r} = \tfrac{4}{3}. Let's verify this by the direct method.

Expand: verify the same answer by integrating along each edge

We parametrize each of the three edges and add up the contributions.

Edge 1: (0,0)(2,0)(0,0) \to (2,0). Set r(t)=(t,0)\mathbf{r}(t)=(t,0), t[0,2]t \in [0,2]. Then dr=(1,0)dtd\mathbf{r}=(1,0)\,dt, F(t,0)=(0,0)\mathbf{F}(t,0) = (0,0). Integral = 0.

Edge 2: (2,0)(0,2)(2,0) \to (0,2). Set r(t)=(22t,2t)\mathbf{r}(t)=(2-2t,\,2t), t[0,1]t \in [0,1]. Then dr=(2,2)dtd\mathbf{r}=(-2,\,2)\,dt, and F=((2t)2,3(22t)(2t))=(4t2,12t12t2)\mathbf{F} = ((2t)^2,\, 3(2-2t)(2t)) = (4t^2,\, 12t - 12t^2). So

Fdr=8t2+24t24t2=32t2+24t.\mathbf{F}\cdot d\mathbf{r} = -8t^2 + 24t - 24t^2 = -32t^2 + 24t.

Integrating from 0 to 1: 01(32t2+24t)dt=323+12=323+363=43\int_0^1 (-32t^2 + 24t)\,dt = -\tfrac{32}{3} + 12 = -\tfrac{32}{3} + \tfrac{36}{3} = \tfrac{4}{3}.

Edge 3: (0,2)(0,0)(0,2) \to (0,0). Set r(t)=(0,22t)\mathbf{r}(t) = (0,\,2-2t), t[0,1]t \in [0,1]. Then dr=(0,2)dtd\mathbf{r} = (0,\,-2)\,dt, F=((22t)2,0)\mathbf{F} = ((2-2t)^2,\,0). Integral = 0.

Total: 0+43+0=430 + \tfrac{4}{3} + 0 = \tfrac{4}{3} ✓ — exactly what Green's theorem gave us in one line.

Three edges, three parametrizations, one careful expansion. The double integral did the same job in two lines of algebra. This is why Green's theorem is so widely used in practice — it picks whichever side is cheaper to compute.


Green's Theorem as an Area Formula

Here is a beautiful specialization. If we pick P=y/2P=-y/2 and Q=x/2Q=x/2, then Q/xP/y=12(12)=1\partial Q/\partial x - \partial P/\partial y = \tfrac{1}{2} - (-\tfrac{1}{2}) = 1. The right-hand side of Green's theorem becomes simply D1dA=Area(D)\iint_D 1\,dA = \text{Area}(D). Therefore:

Area(D)  =  12C(xdyydx).\text{Area}(D) \;=\; \frac{1}{2}\oint_C (x\,dy - y\,dx).

The area inside a closed curve is determined entirely by the curve. You never have to know what is "inside".

For a polygon with vertices (x0,y0),(x1,y1),,(xn1,yn1)(x_0,y_0), (x_1,y_1), \ldots, (x_{n-1},y_{n-1}) (in CCW order), the integral becomes a finite sum. On the edge from (xi,yi)(x_i,y_i) to (xi+1,yi+1)(x_{i+1},y_{i+1}), parametrize linearly; the algebra collapses to one term per edge:

Area  =  12i=0n1(xiyi+1xi+1yi).\text{Area} \;=\; \frac{1}{2} \left| \sum_{i=0}^{n-1} (x_i y_{i+1} - x_{i+1} y_i) \right|.

This is the famous shoelace formula, used everywhere from middle-school geometry to computer graphics to GIS software. It is nothing more than Green's theorem written out for piecewise-linear boundaries.

Interactive: Compute Area From the Boundary

Drag any vertex. Each row on the right is one edge's contribution to 12(xdyydx)\tfrac{1}{2}\oint(x\,dy - y\,dx); hover a row to highlight that edge. The total in the green box is the polygon area, computed without ever looking at the interior.

Loading visualization...

Real-World Applications

The Planimeter: Mechanical Green's Theorem

A planimeter is a 19th-century mechanical device for measuring the area of an arbitrary closed shape — used heavily by land surveyors, naval architects, and doctors measuring tumor cross-sections on X-rays. You trace the perimeter once with a stylus, and a wheel records the area.

How? The planimeter linkage is engineered so that the only motion the recording wheel responds to is the one that, when integrated around a closed curve, equals Green's integrand for area. Tracing the boundary is physically computing 12(xdyydx)\tfrac{1}{2}\oint(x\,dy - y\,dx). The wheel reading at the end is the area. No computer needed — Green's theorem made flesh in brass.

Computer Graphics and GIS

Every GIS package needs to compute the area of polygons — countries, parcels, lakes, watersheds. They all use the shoelace formula, i.e. the polygonal form of Green's theorem. Triangulation libraries that test "is this polygon CCW or CW?" do it by checking the sign of the shoelace sum — positive for CCW, negative for CW.

In raster image processing, computing the moments (centroid, principal axes) of a connected region is most efficient via Green's theorem: you only need to walk the boundary pixels, not all interior pixels. For an image with millions of pixels but a short boundary, this is dramatically faster.

Fluid Mechanics and Aerodynamics

For an incompressible 2D fluid with velocity field u=(u,v)\mathbf{u} = (u, v), the integrand v/xu/y\partial v/\partial x - \partial u/\partial y is called the vorticity ω\omega. Green's theorem says the circulation of the velocity around a closed curve equals the total vorticity inside:

Γ=Cudr=DωdA.\Gamma = \oint_C \mathbf{u} \cdot d\mathbf{r} = \iint_D \omega\,dA.

This is the foundation of the Kutta–Joukowski theorem: the lift per unit length on an airfoil is L=ρUΓL = \rho \, U_\infty \, \Gamma, where Γ\Gamma is the circulation around the wing. Engineers don't measure vorticity in every cubic millimeter inside the boundary layer; they measure circulation on a loop around it. Green's theorem makes the two equivalent.


Python Implementation

Here is a small library that numerically verifies Green's theorem for any field F=(P,Q)\mathbf{F}=(P,Q) on any region, and then specializes to the shoelace-style area formula.

Green's Theorem in Python
🐍python
1Imports

Only NumPy is needed. Every integral here is a Riemann sum, so we just need arrays and basic arithmetic — no calculus library required.

3Closed line integral, signature

This function evaluates ∮_C (P dx + Q dy) for any closed curve given as a parametrization t → (x(t), y(t)). Splitting the field into P and Q matches the form Green's theorem uses on the left-hand side.

EXECUTION STATE
P = (x, y) → P(x, y), first component of F
Q = (x, y) → Q(x, y), second component of F
curve = t → (x(t), y(t)), parametrization of C
n = 2000
16Build the t-grid

We slice [t_start, t_end] into n equal subintervals. ts has length n+1 (the endpoints), and dt is the width of each subinterval. For a unit circle traced once, t_end − t_start = 2π and dt ≈ 0.00314.

EXECUTION STATE
ts = array of n+1 = 2001 values from 0 to 2π
dt = 2π / n ≈ 0.003142
19Loop body: midpoint sampling

For each subinterval we evaluate the integrand at its midpoint. The midpoint rule is second-order accurate, so 2000 subintervals already pin down the integral to ~7 decimal places for smooth fields.

LOOP TRACE · 3 iterations
Iteration i = 0
t = (0 + 2π/n)/2 ≈ 0.001571
(x, y) = (cos(t), sin(t)) ≈ (1.0000, 0.0016)
dx = −sin(t) ≈ −0.0016 (via central diff)
dy = cos(t) ≈ 1.0000
P·dx + Q·dy = (−y)(dx) + (x)(dy) ≈ 1.0000
contribution = ≈ 1.0000 · dt ≈ 0.003142
Iteration i = n/4 (one quarter around)
t = ≈ π/2
(x, y) = ≈ (0, 1)
dx = ≈ −1
dy = ≈ 0
P·dx + Q·dy = (−1)(−1) + (0)(0) = 1
After all n iterations
total = ≈ 2π ≈ 6.283185
22Numerical r'(t)

Because curve is supplied as a black-box function, we differentiate it numerically with a central difference. Using h = dt/8 keeps the truncation error well below the integration error.

31Double integral of the curl

The right-hand side of Green's theorem is ∬_D (∂Q/∂x − ∂P/∂y) dA. We approximate it on a regular n×n grid, computing the curl numerically at each grid cell that lies inside the region.

42Predicate-based region

Passing inside(x, y) as a function lets the same routine handle disks, ellipses, triangles, L-shapes — anything for which we can test 'is this point inside?'. The grid covers a bounding box; only cells passing the predicate contribute.

50Numerical partial derivatives

∂Q/∂x and ∂P/∂y are evaluated by a central difference of step eps = 1e-5. The contribution of this cell to the double integral is curl(x, y) × area_of_cell = curl × hx × hy.

EXECUTION STATE
dQ_dx = (Q(x+ε,y) − Q(x−ε,y)) / 2ε
dP_dy = (P(x,y+ε) − P(x,y−ε)) / 2ε
curl = dQ_dx − dP_dy
58Concrete field F = (-y, x)

P = −y and Q = x, so ∂Q/∂x − ∂P/∂y = 1 − (−1) = 2. The curl is the constant 2 everywhere — every interior point contributes the same amount per unit area.

65Run both sides of Green's theorem

We compute the left-hand side ∮_C F·dr and the right-hand side ∬_D curl dA independently. The closed-form value for a circle of radius R is 2·πR². They all agree:

EXECUTION STATE
line_value = ≈ 6.283185
double_value = ≈ 6.283185
exact 2πR² = ≈ 6.283185
76Polygon area via Green's theorem

Setting P = −y/2, Q = x/2 gives curl = 1, so by Green's theorem ∬_D 1 dA = ½ ∮ (x dy − y dx). On a polygon the line integral collapses into a finite sum — one term per edge. This is the shoelace formula.

LOOP TRACE · 4 iterations
Iteration i = 0 (edge from (0,0) → (4,0))
x1, y1 = 0, 0
x2, y2 = 4, 0
x1·y2 − x2·y1 = 0·0 − 4·0 = 0
s = 0
Iteration i = 1 (edge from (4,0) → (1,3))
x1, y1 = 4, 0
x2, y2 = 1, 3
x1·y2 − x2·y1 = 4·3 − 1·0 = 12
s = 12
Iteration i = 2 (edge from (1,3) → (0,0))
x1, y1 = 1, 3
x2, y2 = 0, 0
x1·y2 − x2·y1 = 1·0 − 0·3 = 0
s = 12
After the loop
area = 0.5 · |s| = 6.0
81 lines without explanation
1import numpy as np
2
3def line_integral_closed(P, Q, curve, t_start=0, t_end=2*np.pi, n=2000):
4    """
5    Compute the closed line integral ∮_C (P dx + Q dy) numerically.
6
7    Parameters
8    ----------
9    P, Q     : functions of (x, y) — the two components of F.
10    curve    : function t -> (x(t), y(t)) parametrizing the boundary.
11    n        : number of subintervals used in the midpoint rule.
12
13    Returns
14    -------
15    integral : float, an estimate of ∮_C F · dr.
16    """
17    ts = np.linspace(t_start, t_end, n + 1)
18    dt = (t_end - t_start) / n
19    total = 0.0
20    for i in range(n):
21        t = 0.5 * (ts[i] + ts[i + 1])   # midpoint of the i-th subinterval
22        x, y = curve(t)
23        # numerical r'(t) via central difference
24        h = dt / 8
25        x1, y1 = curve(t - h)
26        x2, y2 = curve(t + h)
27        dx = (x2 - x1) / (2 * h)
28        dy = (y2 - y1) / (2 * h)
29        total += (P(x, y) * dx + Q(x, y) * dy) * dt
30    return total
31
32
33def double_integral_curl(P, Q, x_min, x_max, y_min, y_max, inside, n=400):
34    """
35    Compute ∬_D (∂Q/∂x − ∂P/∂y) dA over a region D.
36
37    D is described by a predicate inside(x, y) so the same routine works
38    for circles, triangles, polygons, etc.
39    """
40    hx = (x_max - x_min) / n
41    hy = (y_max - y_min) / n
42    eps = 1e-5
43    total = 0.0
44    for i in range(n):
45        for j in range(n):
46            x = x_min + (i + 0.5) * hx
47            y = y_min + (j + 0.5) * hy
48            if not inside(x, y):
49                continue
50            dQ_dx = (Q(x + eps, y) - Q(x - eps, y)) / (2 * eps)
51            dP_dy = (P(x, y + eps) - P(x, y - eps)) / (2 * eps)
52            curl = dQ_dx - dP_dy
53            total += curl * hx * hy
54    return total
55
56
57# Field with a tractable curl: F = (-y, x) ⇒ curl = 2.
58P = lambda x, y: -y
59Q = lambda x, y: x
60
61# Boundary: unit circle traced counter-clockwise.
62R = 1.0
63circle = lambda t: (R * np.cos(t), R * np.sin(t))
64
65line_value = line_integral_closed(P, Q, circle)
66inside_disk = lambda x, y: x * x + y * y <= R * R
67double_value = double_integral_curl(P, Q, -R, R, -R, R, inside_disk)
68
69print(f"line integral ∮ F·dr     = {line_value:.6f}")
70print(f"double integral ∬ curl dA = {double_value:.6f}")
71print(f"exact value 2·area       = {2 * np.pi * R * R:.6f}")
72# Expected output (all three numbers agree up to numerical error):
73# line integral ∮ F·dr     = 6.283185
74# double integral ∬ curl dA = 6.283185
75# exact value 2·area       = 6.283185
76
77
78# Green's theorem as an area formula:
79# Area(D) = (1/2) ∮_C (x dy − y dx).
80def polygon_area_greens(vertices):
81    """Apply Green's theorem to a polygon, vertex by vertex."""
82    n = len(vertices)
83    s = 0.0
84    for i in range(n):
85        x1, y1 = vertices[i]
86        x2, y2 = vertices[(i + 1) % n]
87        s += x1 * y2 - x2 * y1
88    return 0.5 * abs(s)
89
90
91triangle = [(0.0, 0.0), (4.0, 0.0), (1.0, 3.0)]
92print(f"triangle area = {polygon_area_greens(triangle):.4f}")  # 6.0000

We start with plain Python because the algorithm is what matters: a midpoint Riemann sum along the curve, a grid-based Riemann sum over the region, and a shoelace loop for polygons. The next step in any real pipeline is to replace those Python loops with vectorized NumPy or PyTorch ops — the structure stays identical, only the inner loop becomes F(r)r\mathbf{F}(\mathbf{r}) \cdot \mathbf{r}' applied to a whole batch of tt values at once.

PyTorch connection: the same calculation in PyTorch lets you differentiate through the area — for example, optimizing the shape of a wing to minimize a target circulation. Replace np.linspace with torch.linspace, wrap the vertices in a requires_grad=True tensor, and loss.backward() propagates derivatives back through the shoelace formula. Green's theorem becomes a differentiable geometric layer.

Common Pitfalls

PitfallWhat goes wrongFix
Wrong orientationTraversing the boundary CW gives curldA-\iint \text{curl}\,dA — sign flippedAlways check: walking the curve, is the region on your left?
Field singular inside DDF=(y,x)/(x2+y2)\mathbf{F} = (-y, x)/(x^2 + y^2) on a curve around the origin gives 2π2\pi, not 0Green's theorem requires P,QP, Q to have continuous partials throughout DD — exclude singularities
Non-simple curvesSelf-intersecting curves create regions with overlapping orientationsDecompose into simple closed sub-curves and apply the theorem to each
Curl sign mistakeWriting P/xQ/y\partial P/\partial x - \partial Q/\partial y instead of Q/xP/y\partial Q/\partial x - \partial P/\partial yMnemonic: the partial that survives is the one matching the other variable — QQ with xx, PP with yy
Holes treated naivelyApplying Green's theorem to an annulus by using only the outer circleSubtract the inner-boundary line integral, or equivalently traverse the inner boundary CW
Polygon vertices in wrong orderShoelace sum is negative — using it without absolute value gives a negative areaEither take |\cdot| at the end, or sort vertices to be CCW

Summary

  1. Green's theorem CPdx+Qdy=D(Q/xP/y)dA\oint_C P\,dx + Q\,dy = \iint_D (\partial Q/\partial x - \partial P/\partial y)\,dA identifies boundary circulation with total interior curl.
  2. The proof is local: chop DD into tiny cells, each cell's circulation is curl ×\times area, and interior edges cancel in pairs. Only the outer boundary survives.
  3. Orientation: positive (CCW) keeps the region on the left. Flipping orientation flips the line integral's sign.
  4. Area formula: A=12C(xdyydx)A = \tfrac{1}{2}\oint_C(x\,dy - y\,dx) — and for polygons it specializes to the shoelace formula.
  5. Practical impact: conservation laws in fluid mechanics, the planimeter, GIS area computation, vorticity-based aerodynamics, and the moments of shapes in image processing all trace back to this single identity.
Looking ahead. Green's theorem is a 2D identity relating a boundary integral to an interior integral. The very same idea, lifted to 3D, becomes Stokes' theorem (closed curve in 3D \leftrightarrow surface it bounds, section 19.8) and the Divergence theorem (closed surface \leftrightarrow volume it encloses, section 19.9). Together they are three faces of the same fundamental principle: a function's behavior on a boundary determines, and is determined by, its derivatives in the interior.
Loading comments...