Foundations to Frontier
Tests
A. Mathematical Foundations › A3 Calculus and Analysis › Vector calculus

Vector Fields, Divergence, Curl and the Laplacian

A vector field attaches an arrow to every point: wind, fluid velocity, force, a gradient. Divergence measures how much the field spreads out (sources and sinks), curl measures how much it spins, and the Laplacian measures how a value differs from its neighbourhood average. These three operators run heat flow, fluid dynamics, electromagnetism and much of physics-informed ML.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

An arrow at every point

A weather map draws a little arrow at every city showing which way the wind blows and how hard. That’s a vector field. Two simple questions tell you a lot about it:

  • Does stuff spread out here? A garden sprinkler pushes water outward in all directions. That’s a source. A drain pulls water in, and that’s a sink. The divergence measures this.
  • Does stuff spin here? Drop a tiny paddle wheel into a river. If it turns, the water has curl.

A third idea: the Laplacian asks “is this spot hotter or colder than its neighbours on average?” Heat always flows to even that out.

Vector fields: where does stuff spread out, and where does it spin?
colour by:
at the centre: div = 1.000, curl = 1.000
outward flux ∮F·n ds = 0.785 · flux / area = 1.000
circulation ∮F·dr = 0.785 · circulation / area = 1.000
Shrink the radius: flux/area → divergence, circulation/area → curl. That limit is the definition (and Green's theorem, A3.4-3).
F = a(x, y) + b(−y, x) + c(y, 0). Divergence = 2a everywhere, curl = 2b − c everywhere. Orange = positive div, blue = negative.
Why engineers care

Air flowing over a wing, plasma in a rocket engine, a robot’s potential field for avoiding obstacles, and the magnetic field a spacecraft’s magnetometer reads are all vector fields. Divergence and curl are the first two things an engineer checks.

📝 Quick check (Level 0)
0/3 answered
  1. 1. A sprinkler head is a…
  2. 2. A paddle wheel spins in the flow. The flow has…
  3. 3. A spot colder than its surroundings will…

Level 1: Beginner

★★☆☆☆ Basic⏱ 15 minSecondary-school mathematics: arithmetic and elementary algebra.

The operators

Write the “del” operator ∇=(∂x,∂y,∂z)\nabla = (\partial_x, \partial_y, \partial_z). For a scalar ff and a field F=(P,Q,R)\mathbf F = (P, Q, R):

Operator Formula Input → output Meaning
gradient ∇f=(fx,fy,fz)\nabla f = (f_x, f_y, f_z) scalar → vector steepest uphill (A3.2-3)
divergence ∇⋅F=Px+Qy+Rz\nabla\cdot\mathbf F = P_x + Q_y + R_z vector → scalar outflow per unit volume
curl ∇×F=(Ry−Qz, Pz−Rx, Qx−Py)\nabla\times\mathbf F = (R_y - Q_z,\ P_z - R_x,\ Q_x - P_y) vector → vector spin axis and rate
Laplacian ∇2f=fxx+fyy+fzz\nabla^2 f = f_{xx} + f_{yy} + f_{zz} scalar → scalar difference from the local average

In 2-D, the curl of (P,Q)(P,Q) is the scalar Qx−PyQ_x - P_y, the zz-component of the 3-D curl.

Examples:

  • F=(x,y)\mathbf F = (x, y): divergence 1+1=21 + 1 = 2, curl 00. A pure source.
  • F=(−y,x)\mathbf F = (-y, x): divergence 00, curl 1−(−1)=21 - (-1) = 2. A pure rotation.
  • f=x2+y2f = x^2 + y^2: ∇2f=2+2=4\nabla^2 f = 2 + 2 = 4. Note that the Laplacian is the divergence of the gradient.
📝 Quick check (Level 1)
0/3 answered
  1. 1. ∇·(3x, −y) = ?
  2. 2. The 2-D curl of (−y, x) is…
  3. 3. The divergence of a vector field is a…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 45 minUndergraduate students and practising engineers.

Connections to the Jacobian

For a field F\mathbf F, the Jacobian J=DFJ = D\mathbf F (A3.2-5) contains everything:

  • divergence = tr⁡J\operatorname{tr}J, the rate at which the field expands volumes;
  • curl comes from the antisymmetric part 12(J−J⊤)\tfrac12(J - J^\top), the local rotation;
  • the symmetric traceless remainder is strain: stretching one way while squeezing another, like the saddle in the demo.

That’s why the “river” flow (1−y2/4, 0)(1 - y^2/4,\ 0) has curl even though its streamlines are straight. Its Jacobian is not symmetric. Shear contains rotation.

Rules worth knowing

Identity Why
∇×(∇f)=0\nabla\times(\nabla f) = \mathbf 0 mixed partials commute
∇⋅(∇×F)=0\nabla\cdot(\nabla\times\mathbf F) = 0 mixed partials commute
∇⋅(∇f)=∇2f\nabla\cdot(\nabla f) = \nabla^2 f definition
∇⋅(fF)=∇f⋅F+f ∇⋅F\nabla\cdot(f\mathbf F) = \nabla f\cdot\mathbf F + f\,\nabla\cdot\mathbf F product rule
∇×(∇×F)=∇(∇⋅F)−∇2F\nabla\times(\nabla\times\mathbf F) = \nabla(\nabla\cdot\mathbf F) - \nabla^2\mathbf F used for waves

Vocabulary: ∇×F=0\nabla\times\mathbf F = 0 means irrotational (often a gradient, F=∇ϕ\mathbf F = \nabla\phi). ∇⋅F=0\nabla\cdot\mathbf F = 0 means solenoidal or incompressible. ∇2f=0\nabla^2 f = 0 means harmonic.

On a grid

With spacing hh, central differences give ∂xP≈Pi+1,j−Pi−1,j2h\partial_xP \approx \frac{P_{i+1,j} - P_{i-1,j}}{2h}. The 5-point Laplacian is ∇2f≈fi+1,j+fi−1,j+fi,j+1+fi,j−1−4fi,jh2\nabla^2 f \approx \frac{f_{i+1,j} + f_{i-1,j} + f_{i,j+1} + f_{i,j-1} - 4f_{i,j}}{h^2}. Read it as “neighbours’ average minus me” times 4/h24/h^2.

🐍 Exercise 1: divergence, curl and the Laplacian on a grid
Implement grid divergence, 2-D curl and the 5-point Laplacian. Check them on a source, a rotation, a shear, harmonic and non-harmonic functions, and verify ∇×∇f = 0 numerically.
📝 Quick check (Level 2)
0/3 answered
  1. 1. The divergence equals which feature of the Jacobian?
  2. 2. The shear flow (y, 0) has curl…
  3. 3. ∇·(∇×F) = ?

Level 3: Advanced

★★★★☆ Advanced⏱ 40 minGraduate level, with full derivations and proofs.

Why the identities hold

∇×∇f\nabla\times\nabla f has zz-component ∂x∂yf−∂y∂xf\partial_x\partial_yf - \partial_y\partial_xf, which is 0 by Clairaut/Schwarz for C2C^2 functions (A3.2-6). Likewise ∇⋅(∇×F)=∂x(Ry−Qz)+∂y(Pz−Rx)+∂z(Qx−Py)\nabla\cdot(\nabla\times\mathbf F) = \partial_x(R_y - Q_z) + \partial_y(P_z - R_x) + \partial_z(Q_x - P_y). The six terms cancel in pairs. ∎

The converses hold on nice domains (Poincaré lemma): on a simply connected region, curl-free implies F=∇ϕ\mathbf F = \nabla\phi, and divergence-free implies F=∇×A\mathbf F = \nabla\times\mathbf A. The hole in the domain matters. The vortex (−y,x)/(x2+y2)(-y, x)/(x^2+y^2) is curl-free away from the origin, but it is not a gradient, because its circulation around the origin is 2π2\pi (A3.4-3).

Coordinate-free definitions

Divergence and curl don’t depend on the axes you choose. They are limits:

∇⋅F(p)=lim⁡V→p1∣V∣∮∂VF⋅n dS,(∇×F)⋅n=lim⁡A→p1∣A∣∮∂AF⋅dr\nabla\cdot\mathbf F(\mathbf p) = \lim_{V\to\mathbf p}\frac{1}{|V|}\oint_{\partial V}\mathbf F\cdot\mathbf n\,dS, \qquad (\nabla\times\mathbf F)\cdot\mathbf n = \lim_{A\to\mathbf p}\frac{1}{|A|}\oint_{\partial A}\mathbf F\cdot d\mathbf r

That is, outflow per unit volume and circulation per unit area. The demo’s probe circle computes exactly these quotients.

The Laplacian as an averaging defect

By Taylor’s theorem (A3.2-7), the average of ff over a small sphere of radius rr in Rn\mathbb R^n is f(p)+r22n∇2f(p)+O(r4)f(\mathbf p) + \frac{r^2}{2n}\nabla^2 f(\mathbf p) + O(r^4). So ∇2f>0\nabla^2 f > 0 means the surroundings are higher than the point. Harmonic functions equal their local averages (the mean value property). Hence the maximum principle: a harmonic function has no interior maximum. Heat flow ut=α∇2uu_t = \alpha\nabla^2u pushes every value toward its neighbourhood average.

Exercise 3.1: Is f = eˣ sin y harmonic?

fxx=exsin⁡yf_{xx} = e^x\sin y and fyy=−exsin⁡yf_{yy} = -e^x\sin y, which sum to 00. Yes. (It’s the imaginary part of the analytic function eze^z.)

📝 Quick check (Level 3)
0/3 answered
  1. 1. curl(grad f) = 0 because of…
  2. 2. A harmonic function can have a strict interior maximum?
  3. 3. Curl-free implies gradient on…

Level 4: Expert

★★★★★ Expert⏱ 45 minResearchers: original papers and open problems.

The Helmholtz decomposition

Every sufficiently smooth, decaying (or periodic) field splits uniquely, up to constants, as

F=∇ϕ⏟curl-free+∇×A⏟divergence-free (+ harmonic part)\mathbf F = \underbrace{\nabla\phi}_{\text{curl-free}} + \underbrace{\nabla\times\mathbf A}_{\text{divergence-free}} \ (+\ \text{harmonic part})

The two parts are L2L^2-orthogonal. In Fourier space it’s a projection: the curl-free part of F^(k)\hat{\mathbf F}(\mathbf k) is its component along k\mathbf k.

Fluid simulation. The incompressible Navier–Stokes equations require ∇⋅u=0\nabla\cdot\mathbf u = 0. Stable fluid solvers (Chorin, 1968; Stam, 1999) advect the velocity, then project out the gradient part by solving a Poisson equation for the pressure. That is the Helmholtz decomposition at every time step.

🐍 Exercise 2 (research): Helmholtz–Hodge decomposition with the FFT
Split a periodic 2-D field into curl-free and divergence-free parts by projecting each Fourier mode onto its wavevector. Recover a known potential and stream function exactly, and check that the parts of random noise are orthogonal.

Where these operators appear

  • Physics:
    • Maxwell’s equations are statements about div and curl: ∇⋅B=0\nabla\cdot\mathbf B = 0 and ∇×E=−∂tB\nabla\times\mathbf E = -\partial_t\mathbf B.
    • Gravity outside a planet satisfies ∇2Φ=0\nabla^2\Phi = 0. Spacecraft gravity models expand Φ\Phi in spherical harmonics, the harmonic functions on a sphere (the GRACE mission measured Earth’s to very high degree; Tapley et al., 2004).
  • Robot navigation:
    • Potential-field planners follow −∇U-\nabla U (Khatib, 1986).
    • Harmonic potentials have no local minima in free space (maximum principle), which avoids the classic trap of getting stuck (Connolly et al., 1990).
  • Graphics and geometry processing: Poisson image editing (Pérez et al., 2003), mesh smoothing with the discrete Laplace–Beltrami operator, and Poisson surface reconstruction from lidar scans (Kazhdan et al., 2006).
  • Machine learning:
    • The graph Laplacian L=D−AL = D - A is the discrete Laplacian on a network. It underlies spectral clustering, graph neural networks and diffusion maps (D9).
    • Score-based diffusion models evolve densities with a drift field plus Laplacian diffusion (Fokker–Planck).
    • Divergence-free neural fields build incompressibility in by construction, by outputting a stream function and taking its curl.
    • Hutchinson’s trick (A3.3-6) estimates ∇⋅f=tr⁡J\nabla\cdot\mathbf f = \operatorname{tr}J in continuous normalizing flows.

References

  1. H. M. Schey (2005). Div, Grad, Curl, and All That, 4th ed. Norton.
  2. J. E. Marsden, A. Tromba (2011). Vector Calculus, 6th ed. Freeman.
  3. A. J. Chorin (1968). “Numerical solution of the Navier–Stokes equations.” Mathematics of Computation, 22.
  4. J. Stam (1999). “Stable fluids.” SIGGRAPH.
  5. H. Bhatia, G. Norgard, V. Pascucci, P.-T. Bremer (2013). “The Helmholtz–Hodge decomposition: a survey.” IEEE TVCG, 19(8).
  6. O. Khatib (1986). “Real-time obstacle avoidance for manipulators and mobile robots.” IJRR, 5(1).
  7. C. I. Connolly, J. B. Burns, R. Weiss (1990). “Path planning using Laplace’s equation.” ICRA.
  8. P. Pérez, M. Gangnet, A. Blake (2003). “Poisson image editing.” SIGGRAPH.
  9. M. Kazhdan, M. Bolitho, H. Hoppe (2006). “Poisson surface reconstruction.” Eurographics SGP.
  10. B. Tapley et al. (2004). “GRACE measurements of mass variability in the Earth system.” Science, 305.