Line Integrals

Picture pushing a heavy cart along a winding garden path. The path climbs, dips and curls, and a gusty crosswind keeps changing how hard — and in what direction — you have to shove. There is no single "force times distance" here, because neither the force nor your direction of travel stays fixed for a second. The only honest way to total up the work is to chop the path into tiny straight steps, work out how much the force helps or hinders you on each tiny step, and add every contribution together. Shrink the steps to nothing and that sum becomes an integral — a line integral, because it is a sum built up all along a line, or curve, rather than at a single point.

An ordinary integral \int_a^b f\,dx sums a function along a straight stretch of the x-axis. A line integral does the same thing along a curve C winding through the plane. There are two flavours, and the difference is everything.

For a scalar field f(x, y) we sum its values against arc length ds — think of laying a wire along C whose density at each point is f, and weighing it:

\int_C f \, ds.

For a vector field field \mathbf{F} we sum the part of \mathbf{F} that points along the curve — its tangential component — against displacement d\mathbf{r}. This is the work the field does on a particle dragged along C:

\int_C \mathbf{F} \cdot d\mathbf{r}.

Reducing a vector line integral to an ordinary integral

The trick that makes line integrals computable is parametrisation: describe the curve by a moving point \mathbf{r}(t) as t runs over an interval, and everything collapses to a single integral in t. Here is the reduction, line by line.

Step 1 — parametrise the curve. Write the curve as

\mathbf{r}(t) = \big(x(t),\; y(t)\big), \qquad a \le t \le b,

a single point sliding from the start \mathbf{r}(a) to the end \mathbf{r}(b).

Step 2 — express the displacement. A tiny step along the curve is the velocity times dt:

d\mathbf{r} = \mathbf{r}'(t)\, dt = \big(x'(t),\; y'(t)\big)\, dt.

Step 3 — substitute into the integral. Replace \mathbf{F} by its value on the curve and d\mathbf{r} by the expression above:

\int_C \mathbf{F} \cdot d\mathbf{r} = \int_a^b \mathbf{F}\big(\mathbf{r}(t)\big) \cdot \mathbf{r}'(t)\, dt.

Step 4 — expand the dot product. With \mathbf{F} = (P, Q) the integrand is an ordinary scalar function of t:

= \int_a^b \Big[\, P\big(x(t), y(t)\big)\, x'(t) + Q\big(x(t), y(t)\big)\, y'(t) \,\Big]\, dt.

The vector line integral has become a plain single-variable integral — one you already know how to do.

Worked example: work along a path

Let the field be \mathbf{F}(x, y) = (y,\; x) and let C be the quarter-circle from (1, 0) to (0, 1). Find the work \int_C \mathbf{F}\cdot d\mathbf{r}.

Step 1 — parametrise. The unit circle is \mathbf{r}(t) = (\cos t,\; \sin t), and t runs from 0 (the point (1,0)) to \tfrac{\pi}{2} (the point (0,1)).

Step 2 — velocity.

\mathbf{r}'(t) = (-\sin t,\; \cos t).

Step 3 — field on the curve. Substitute x = \cos t, y = \sin t into \mathbf{F} = (y, x):

\mathbf{F}\big(\mathbf{r}(t)\big) = (\sin t,\; \cos t).

Step 4 — dot product.

\mathbf{F}\cdot\mathbf{r}' = (\sin t)(-\sin t) + (\cos t)(\cos t) = \cos^2 t - \sin^2 t = \cos 2t.

Step 5 — integrate.

\int_0^{\pi/2} \cos 2t \, dt = \left[ \tfrac12 \sin 2t \right]_0^{\pi/2} = \tfrac12(\sin\pi - \sin 0) = 0.

The total work is 0: along this path the field pushes forward as much as it pushes back. (As it happens \mathbf{F} = (y, x) = \nabla(xy) is a gradient field, and that is no accident — the next page explains why such fields care only about the endpoints.)

The vector line integral is the mathematician's definition of work. A force \mathbf{F} dragging an object along C does work W = \int_C \mathbf{F}\cdot d\mathbf{r} — only the component of the force along the motion counts, which is exactly what the dot product \mathbf{F}\cdot\mathbf{r}' extracts. Push perpendicular to the path and you do no work; that is why carrying a suitcase horizontally costs (ideally) no work at all.

And the path genuinely matters. Take the rotation field \mathbf{F} = (-y, x) from (1,0) to (-1,0). Going over the top semicircle gives +\pi; going under gives -\pi; the straight chord through the origin gives 0. Three routes, three answers — because this field is not a gradient field. Friction is the everyday culprit: the longer the road, the more work lost, which is precisely path-dependence. When the field is a gradient field, this dependence miraculously vanishes — the cliff-hanger for the next page.

Worked example: the same field, a different route

Keep the field \mathbf{F}(x, y) = (y,\; x) from above, but this time travel from (1, 0) to (0, 1) along the straight segment joining them, not the arc. Does the work come out the same?

Step 1 — parametrise the segment. A straight line from (1,0) to (0,1) is

\mathbf{r}(t) = (1 - t,\; t), \qquad 0 \le t \le 1.

Step 2 — velocity.

\mathbf{r}'(t) = (-1,\; 1).

Step 3 — field on the curve, and the dot product. Substituting x = 1-t, y = t into \mathbf{F} = (y, x) gives \mathbf{F}(\mathbf{r}(t)) = (t,\; 1-t), so

\mathbf{F}\cdot\mathbf{r}' = t(-1) + (1-t)(1) = 1 - 2t.

Step 4 — integrate.

\int_0^1 (1 - 2t)\, dt = \big[\, t - t^2 \,\big]_0^1 = (1 - 1) - 0 = 0.

Once again the work is 0 — the exact same answer as the quarter-arc route. That is not a coincidence: \mathbf{F} = (y,x) is the gradient of xy, and gradient fields don't feel the shape of the road at all, only where it starts and ends. The next page turns this observation into a theorem.

Worked example: when the path really does matter

Now swap in the rotation field \mathbf{F}(x,y) = (-y,\; x) — at every point it points at right angles to the line from the origin, like water swirling round a drain. Compute the work from (1,0) to (-1,0) two ways.

Route A — the upper semicircle. Parametrise by \mathbf{r}(t) = (\cos t, \sin t), 0 \le t \le \pi, so \mathbf{r}'(t) = (-\sin t, \cos t) and \mathbf{F}(\mathbf{r}(t)) = (-\sin t, \cos t). Then

\mathbf{F}\cdot\mathbf{r}' = \sin^2 t + \cos^2 t = 1, \qquad \int_0^{\pi} 1\, dt = \pi.

Route B — the straight chord through the origin. Parametrise by \mathbf{r}(t) = (1 - 2t,\; 0), 0 \le t \le 1, so y(t) \equiv 0 and \mathbf{r}'(t) = (-2, 0). Since \mathbf{F}(\mathbf{r}(t)) = (0,\; 1-2t), the dot product is (0)(-2) + (1-2t)(0) = 0 at every instant, so

\int_0^1 0 \, dt = 0.

Same field, same two endpoints, same distance travelled in a loose sense — yet \pi \ne 0. The rotation field is not a gradient field, so it has no potential to shield it from caring about the road taken. Genuine path-dependence, seen in the arithmetic.

Worked example: a scalar line integral — the mass of a wire

Bend a wire into the quarter-circle \mathbf{r}(t) = (\cos t, \sin t), 0 \le t \le \tfrac{\pi}{2}, and suppose it was cast so that its density (mass per unit length) grows with height: \delta(x, y) = 1 + y. What is the total mass?

Step 1 — set up the scalar line integral. Mass is density integrated against arc length,

m = \int_C \delta \, ds = \int_0^{\pi/2} \delta\big(\mathbf{r}(t)\big) \, \big\|\mathbf{r}'(t)\big\| \, dt.

Step 2 — the speed factor. Here \mathbf{r}'(t) = (-\sin t, \cos t), and

\big\|\mathbf{r}'(t)\big\| = \sqrt{\sin^2 t + \cos^2 t} = 1,

so — because this particular curve is traced at unit speed — the arc-length element is simply ds = dt.

Step 3 — substitute the density. On the curve y = \sin t, so \delta = 1 + \sin t, and

m = \int_0^{\pi/2} (1 + \sin t) \, dt.

Step 4 — integrate.

m = \Big[\, t - \cos t \,\Big]_0^{\pi/2} = \left(\tfrac{\pi}{2} - 0\right) - (0 - 1) = \tfrac{\pi}{2} + 1 \approx 2.571.

Notice this integral could never have come out negative — density is being weighed against pure (positive) arc length, with no dot product and no sense of direction to flip its sign. That is the fundamental character of a scalar line integral, and it is exactly what the next callout is about.

\int_C f\, ds and \int_C \mathbf{F}\cdot d\mathbf{r} look like cousins, but they behave very differently:

Two forces act on you climbing a mountain trail: gravity, which pulls straight down, and wind and friction, which push back against whichever way you happen to be moving. The work gravity does against you turns out to depend only on your net change in height — start and finish, full stop — no matter how the trail zig-zags to get there. (That's a preview of the next page: gravity is a conservative field.) But the work spent fighting the wind and the ground genuinely depends on the exact shape of the path — a longer, gustier route costs strictly more, exactly the path-dependence you just saw with the rotation field.

This is precisely why a hiking or cycling app cannot just look at your start and end pins on the map — it samples elevation and terrain data along your actual route, second by second, and adds up the tiny contributions. That is a line integral computed numerically. The same trick powers road-network route planners: each stretch of road carries a "cost" (time, fuel, tolls), and the total cost of a route is a sum — a discretised line integral — along the specific path chosen, which is exactly why the shortest route by distance is not always the cheapest route by cost.

Watch the work accumulate

A particle (the dot) slides along the path C through the field's arrows as you sweep the parameter t. The little gauge shows the running total \int \mathbf{F}\cdot d\mathbf{r} so far: it climbs where the field points along the motion and falls where it opposes it.

A path through space

A line integral adds up a quantity along a curve — and that curve need not lie flat in the plane. Here the path C is a rising spiral (a helix) climbing through space; the dots mark evenly spaced stations along it, in the direction you travel. To integrate, you slide from one end to the other and total the contributions as you go. Drag the figure to follow the three-dimensional path from any angle.

See it explained