Vector Fields and Line Integrals

Arrows at every point: flows, the work done along a path, and fields where the path does not matter

Vector Fields and Line Integrals

Wind, water currents, gravity and electric force all attach an arrow to every point of space. A vector field is that collection of arrows. Release particles and they trace the flow; send an object along a path and the field helps or hinders it at every step, and adding up that help gives the work done, a line integral. For some fields the route makes no difference at all.

A Field in Motion

Choose a field, or type your own P and Q, and watch the particles flow. Click to drop a blob of dye, or switch the click to trace streamlines. Colour the background by divergence or curl to see where the flow spreads out and where it swirls.

div F = ∂P/∂x + ∂Q/∂y = 0
curl F = ∂Q/∂x − ∂P/∂y = −1.6sin(x) sin(y)
—
point under the pointer
—
F there
—
divergence there
—
curl there
A steady current with a chain of eddies: the stream function y − 0.8 sin x sin y, so divergence is exactly zero. Drop dye and watch how the flow stretches and folds it.

Arrows all have the same length, so they show direction; colour shows |F| relative to its typical size in the window. Particles move at a speed proportional to |F| (scaled so the flow is visible), by midpoint steps capped near singularities, and respawn at random when they leave or age. Streamlines are traced with RK4 along F/|F| in both directions and stop at zeros, singularities and the edge. Divergence and curl are differentiated symbolically; colours are scaled to the 95th percentile in view.

Go deeper:Vector Fields, Flow Lines and Two Derivatives

A vector field in the plane assigns to each point (x, y) a vector F(x, y) = (P(x, y), Q(x, y)). Read as a velocity, it moves particles: a flow line or streamline is a curve r(t) with r′(t) = F(r(t)) at every moment, a system of two differential equations. Through every point where F is smooth and nonzero there is exactly one, and streamlines never cross. Points where F = 0 are equilibria, like the centre of the rotation or the middle of the saddle.

Two combinations of the partial derivatives describe the flow near a point:

div F = ∂P/∂x + ∂Q/∂y, curl F = ∂Q/∂x − ∂P/∂y

The divergence is the rate at which a tiny patch of fluid expands (positive at a source, negative at a sink), and the scalar curl is twice the rate at which it spins. The river field comes from a stream function ψ as F = (∂ψ/∂y, −∂ψ/∂x), which makes its divergence exactly zero: incompressible flow. The gradient of a hill has zero curl, and the pendulum’s phase plane has zero divergence, the planar case of Liouville’s theorem that Hamiltonian flows preserve area. These two derivatives are what Green’s theorem is built from.

Work Along a Path

Drag the four control points to shape the path, or choose a segment, circle or spiral, and play the bead. Green stretches are where the field pushes the bead along, red where it pushes back. The strip below adds it all up; reverse the direction and watch every sign flip.

−2.1440
work so far ∫ F · T ds
0.1260
total (Simpson, 600 steps)
0.126000
∫_C F · dr (Gauss–Legendre)
5.830
length of C
Right now F · T = −0.037: the field is almost perpendicular to the motion and does next to no work. Over the whole path the field does 0.126 units of work.

The F arrow is drawn at a fixed scale relative to the field’s typical size in the window. The strip chart uses arc length s, so its area is ∫ F · T ds; the parameter of the curve does not matter, only its direction. The running total uses Simpson’s rule on 600 steps; the reference value uses 256 panels of 8-point Gauss–Legendre on F(r(t)) · r′(t) dt. For the vortex, a path through the origin passes through a singularity, and the integral there is meaningless.

Go deeper:The Line Integral of a Vector Field

Moving a small step dr through a force F does work F · dr: only the component of F along the motion counts. Writing dr = T ds, with T the unit tangent and ds a small piece of arc length, and adding up along the curve C gives

W = ∫_C F · dr = ∫_C F · T ds = ∫ₐᵇ F(r(t)) · r′(t) dt = ∫_C P dx + Q dy

The last form is how it is computed: parametrise C by r(t) for a ≤ t ≤ b, substitute, and do an ordinary integral in t. The answer does not depend on the parametrisation, only on the curve and its direction; going backwards replaces T by −T and flips the sign. For a closed curve one writes ∮.

For the rotation field F = (−y, x) round a circle of radius R, F is always tangent with length R, so the work is R times the circumference: 2πR², twice the area enclosed. That is no coincidence, and it is the seed of Green’s theorem.

When the Path Does Not Matter

Drag the two paths into any shapes you like. For a gradient field their works stay equal to φ(B) − φ(A). Then try the rotation, where they differ, and the vortex, where they agree until the paths straddle the origin.

F = (y, x)
φ = xy
curl check ∂Q/∂x − ∂P/∂y = 0
0.1200
∫ along path 1
0.1200
∫ along path 2
0.1200
φ(B) − φ(A)
0.0000
loop ∮ = path 1 − path 2
Both paths do the same work, φ(B) − φ(A) = 0.1200, however you drag them: the integral of a gradient only depends on where you start and finish. Drag B onto A and each path becomes a loop that does no work.

Drag A, B and the coloured control points: each path is a cubic Bézier curve. Integrals use 256 panels of 8-point Gauss–Legendre. The curl is differentiated symbolically and also evaluated on a grid avoiding the origin. For the vortex, a path through the origin itself passes through the singularity and its integral is meaningless; keep the paths clear of the red dot.

Go deeper:Conservative Fields and the Vortex

If F = ∇φ for some function φ, the chain rule gives d/dt φ(r(t)) = ∇φ · r′(t), and integrating along the path proves the fundamental theorem for line integrals:

∫_C ∇φ · dr = φ(B) − φ(A)

So the work depends only on the endpoints, and is zero round every closed loop. Such fields are called conservative, because a particle moving under a conservative force conserves kinetic plus potential energy; physics usually writes the force as −∇U with U the potential energy. George Green coined the term “potential function” in his essay of 1828.

To test for a potential, note that mixed partial derivatives agree: if P = φ_x and Q = φ_y then ∂Q/∂x = ∂P/∂y, so a conservative field has zero curl. The converse holds on a simply connected region, one with no holes, and fails otherwise. The vortex F = (−y, x)/(x² + y²) has zero curl everywhere except the origin, where it is not defined. Near any point away from the origin it is the gradient of the polar angle θ, but θ cannot be defined continuously all the way round: going once round the origin it increases by 2π. That is exactly the work round any loop that encircles the origin once, however large or small, and it is why the vortex has no global potential. The domain has a hole, and the integral detects it. The same idea, counting how often a loop winds round a point, underlies Cauchy’s integral formula in complex analysis.

Key Takeaways

  • A vector field puts an arrow at every point; its streamlines are the paths of particles that follow it.
  • The line integral ∫_C F · dr = ∫ F · T ds adds up the component of F along the path: the work done. It flips sign when the direction is reversed.
  • For a gradient field, ∫_C ∇φ · dr = φ(B) − φ(A): the path does not matter, and loops give zero.
  • Zero curl implies a potential only on a region without holes: the vortex has zero curl, but a loop round the origin picks up 2π.

Spot a mistake or have an idea?

Search