Summary of Vector Calculus
All the main theorems of vector calculus are versions of one statement: integrating a derivative over a region gives the same result as integrating the original function over the region's boundary. This page puts the operators, identities and theorems of the chapter side by side as a reference, gives a short guide for choosing the right tool, and checks the key identities with SymPy and on a discrete grid.
The three operators
With , a scalar field and a vector field :
| Operator | Input → output | Formula | Meaning |
|---|---|---|---|
| scalar → vector | direction of steepest increase; directional derivatives | ||
| vector → vector | circulation per unit area; local spin | ||
| vector → scalar | outward flux per unit volume; sources and sinks | ||
| Laplacian | scalar → scalar | how differs from its local average |
Details and examples are in Curl and Divergence and, for a first look, Divergence and Curl.
Identities
| Identity | Consequence |
|---|---|
| gradient fields are irrotational | |
| curl fields are incompressible (no sources) | |
| product rule for gradients | |
| product rule for divergence | |
| product rule for curl | |
| used to derive wave equations; is applied componentwise | |
| On a simply connected region: | test for a conservative field |
The theorems: derivative inside = function on the boundary
| Theorem | Region (dimension) | Boundary | Statement |
|---|---|---|---|
| Fundamental Theorem of Calculus | interval (1) | two points | |
| Fundamental Theorem for Line Integrals | curve from to (1) | two points | |
| Green's theorem, circulation form | plane region (2) | closed curve, counter-clockwise | |
| Green's theorem, flux form | plane region (2) | closed curve, outward normal | |
| Stokes' theorem | oriented surface (2) | closed curve, right-hand rule | |
| Divergence theorem | solid (3) | closed surface, outward |
Two quick consequences: the flux of through a closed surface is 0 (no boundary curve), and the circulation of around a closed curve is 0 (the two endpoints coincide). These are the integral forms of the first two identities.
Which tool when
Line integral ∫_C F · dr
├─ curl F = 0 on a simply connected region → find f with ∇f = F, use f(B) − f(A)
├─ C closed, planar → Green's theorem
├─ C closed, in space → Stokes: span C with the simplest surface (often flat)
└─ otherwise → parametrise C and integrate
Flux ∬_S F · dS
├─ S closed → divergence theorem (watch for singularities inside, e.g. r/|r|³)
├─ S open but F = curl G → Stokes: only the boundary of S matters
├─ S open, closing it with a simple lid helps → divergence theorem minus the lid's flux
└─ otherwise → parametrise S: ∬_D F(r(u, v)) · (r_u × r_v) dAChecking the identities symbolically
SymPy's sympy.vector module knows grad, curl and div. With completely arbitrary functions , , , , of , the identities must simplify to zero.
import sympy as sp
from sympy.vector import CoordSys3D, gradient, curl, divergence
N = CoordSys3D('N')
x, y, z = N.x, N.y, N.z
f = sp.Function('f')(x, y, z)
P, Q, R = [sp.Function(name)(x, y, z) for name in 'PQR']
F = P * N.i + Q * N.j + R * N.k
print("curl(grad f) =", curl(gradient(f)))
print("div(curl F) =", sp.simplify(divergence(curl(F))))
lhs = divergence(f * F)
rhs = f * divergence(F) + gradient(f).dot(F)
print("div(fF) - [f div F + grad f · F] =", sp.simplify(lhs - rhs))
lap = lambda h: sp.diff(h, x, 2) + sp.diff(h, y, 2) + sp.diff(h, z, 2)
cc = curl(curl(F))
right = gradient(divergence(F)) - (lap(P) * N.i + lap(Q) * N.j + lap(R) * N.k)
print("curl curl F - (grad div F - ∇²F) =", [sp.simplify((cc - right).dot(e)) for e in (N.i, N.j, N.k)])curl(grad f) = 0
div(curl F) = 0
div(fF) - [f div F + grad f · F] = 0
curl curl F - (grad div F - ∇²F) = [0, 0, 0]
Every identity rests on the equality of mixed partials (Clairaut's theorem from Partial Derivatives): in the terms come in pairs like .
The identities survive discretisation
Fluid solvers rely on a discrete version of . In 2D, store a stream function at the grid corners, and define the face velocities and by differences along each face. The net outflow of every cell is then a sum of corner values that cancels exactly, whatever is:
import numpy as np
rng = np.random.default_rng(7)
n, h = 64, 1.0 / 64
psi = rng.normal(size=(n + 1, n + 1)) # random stream function at corners [i, j] = (x_i, y_j)
u = (psi[:, 1:] - psi[:, :-1]) / h # on vertical faces: d(psi)/dy
v = -(psi[1:, :] - psi[:-1, :]) / h # on horizontal faces: -d(psi)/dx
div = (u[1:, :] - u[:-1, :]) / h + (v[:, 1:] - v[:, :-1]) / h
print("cells:", div.size)
print("largest |div| :", f"{float(np.abs(div).max()):.1e}")
print("largest |u| :", f"{float(np.abs(u).max()):.1e}")cells: 4096
largest |div| : 3.6e-12
largest |u| : 3.5e+02
Velocities of size hundreds, yet every cell has zero net flux up to rounding: the discrete operators commute exactly as the continuous ones do, which is why staggered "MAC" grids are the standard layout for incompressible flow.
In software
- Fluid simulation: projection makes ; vorticity () drives swirl effects; staggered grids keep the identities exact.
- AI steering and navigation: potential fields give forces ; curl-free means no loop can gain energy, and adding a small curl term makes agents circle obstacles instead of getting stuck.
- Lighting: irradiance is a flux; the solid-angle formula behind area lights and inside/outside tests comes from the divergence theorem applied to .
- Geometry: shoelace area (Green), mesh volume and inertia (divergence theorem), vertex normals ().
Exercises
Exercise 1: Classify the fields
For each field decide whether its curl and its divergence are zero: (a) , (b) , (c) .
Answer
(a) curl , div 0. (b) curl , div 0. (c) curl , div 3.
Solution
Exercise 2: Can it be a curl?
Is there a field with ?
Answer
No.
Solution
If then . Here , which is not identically zero, so no such exists.
Exercise 3: Choose the theorem
Compute for around any closed curve .
Answer
Solution
Exercise 4: Close the surface (code)
Find the upward flux of through the paraboloid , , by closing it with the unit disc at and using the divergence theorem. Check with the graph formula in SymPy.
Answer
.
Solution
import sympy as sp
r, t = sp.symbols('r t', nonnegative=True)
x, y = r * sp.cos(t), r * sp.sin(t)
integrand = x * (2 * x) + y * (2 * y) + 1 # -P g_x - Q g_y + R with g_x = -2x, g_y = -2y
print(sp.integrate(sp.simplify(integrand) * r, (r, 0, 1), (t, 0, 2 * sp.pi)))2*pi
Test yourself
Which statement is the integral form of the identity ?
- The circulation of a gradient around a loop is 0
- The flux of through any closed surface is 0
- Green's theorem in flux form
To compute along an open curve, the first thing worth checking is…
- whether
- whether on a simply connected region, so has a potential
- whether is planar
- whether is constant
All the main theorems share which pattern?
- integral of a derivative over a region = integral of the function over its boundary
- every field is a gradient
- flux equals circulation
- volume equals surface area