Guides / Integrals

Line integrals and Green's theorem: ds = |r′(t)| dt, check for a potential first, and go counterclockwise

A line integral adds something up along a curve: the mass of a wire from its density, or the work a force does on an object moving along a path. Every one is computed the same way, by parametrizing the curve and doing an ordinary integral in the parameter. Two shortcuts save most of the work, a potential function when the field has one and Green's theorem when the curve is closed, and most mistakes come from a missing speed factor, a curve traced the wrong way, or a shortcut used on a field that doesn't allow it.

Short answer

Parametrize the curve as r(t), a ≤ t ≤ b. Density along a wire: ∫C f ds = ∫ab f(r(t)) |r′(t)| dt. Work: ∫C F · dr = ∫ab F(r(t)) · r′(t) dt. Potential: if F = (P, Q) has Qx = Py on a region with no holes, then F = ∇f and the work is f(end) − f(start) along any path. Green: for a closed curve traced counterclockwise, ∮C P dx + Q dy = ∬D (Qx − Py) dA.

Why it works

Cut the curve into short pieces. A piece traced during a small step dt has length about |r′(t)| dt, the speed times the time, so a density contributes f |r′(t)| dt there. A force does work F · Δr on a short displacement, and Δr ≈ r′(t) dt, so the speed is already inside the dot product and no extra factor is needed. The work integral also has a direction: tracing the curve backward flips the sign of r′(t) and of the answer.

If F = ∇f, then F(r(t)) · r′(t) is the chain rule's (d/dt) f(r(t)), and integrating a derivative leaves the endpoint values. Since P = fx and Q = fy, the mixed partials force Qx = Py, which is the test. Green's theorem is the same idea for closed curves: Qx − Py measures how much the field circulates around each point, and adding it up over the region inside gives the circulation around the edge, because the circulations of neighboring tiny squares cancel along their shared sides. The orientation is counterclockwise, with the region on the left.

Example 1: a density along a segment

A wire runs straight from (0, 0) to (3, 4) and has density f(x, y) = x + y. Find its mass.

  1. r(t) = (3t, 4t), 0 ≤ t ≤ 1Start plus t times the displacement (3, 4).
  2. |r′(t)| = |(3, 4)| = 5The wire is 5 long and the parameter runs over an interval of length 1, so ds = 5 dt.
  3. f(r(t)) = 3t + 4t = 7tWrite the density in terms of t.
  4. ∫01 7t · 5 dt = 35/2Check: the density runs from 0 to 7 along the wire, so its average is 3.5, and 3.5 · 5 = 17.5.

Example 2: work along a quarter circle

Find the work done by F(x, y) = (−y, x) on an object moving counterclockwise along the circle of radius 2 from (2, 0) to (0, 2).

  1. r(t) = (2 cos t, 2 sin t)With 0 ≤ t ≤ π/2: the angle t runs a quarter turn, from (2, 0) up to (0, 2).
  2. r′(t) = (−2 sin t, 2 cos t)Differentiate each coordinate.
  3. F(r(t)) = (−2 sin t, 2 cos t)On this circle the field is exactly the velocity: it pushes along the direction of motion.
  4. F · r′ = 4 sin2 t + 4 cos2 t = 4The dot product is constant.
  5. ∫0π/2 4 dt = 2πThe field has strength 2 and pushes along a path of length π, the quarter of a circumference 4π.

Example 3: a potential function turns the work into two evaluations

Find the work done by F(x, y) = (2x + y, x + 3y2) along any path from (0, 0) to (1, 2).

  1. Py = 1, Qx = 1The cross-partials agree and F is defined on the whole plane, which has no holes, so F has a potential.
  2. f = x2 + xy + g(y)Integrate P = 2x + y in x. The constant of integration can still depend on y.
  3. fy = x + g′(y) = x + 3y2Match Q. So g′(y) = 3y2 and g = y3.
  4. f = x2 + xy + y3Check: fx = 2x + y and fy = x + 3y2.
  5. f(1, 2) − f(0, 0) = 11f(1, 2) = 1 + 2 + 8 and f(0, 0) = 0. The same along every path: the straight line r = (t, 2t) and the parabola r = (t, 2t2) both give 11 when integrated directly.

Example 4: Green's theorem on a triangle

Compute ∮C xy dx + x2 dy, where C is the boundary of the triangle with corners (0, 0), (1, 0) and (1, 1), traced counterclockwise.

  1. Qx − Py = 2x − x = xP = xy and Q = x2.
  2. ∬D x dA = ∫01 ∫0x x dy dxThe triangle lies under the line y = x.
  3. = ∫01 x2 dx = 1/3The inner integral is x · x.
  4. ∮C xy dx + x2 dy = 1/3Directly, the three sides give 0 along the bottom (y = 0 and dy = 0), 1 up the right side (x = 1, so ∫ dy), and −2/3 back down the diagonal, which add to 1/3.

Common mistakes, and the exact line they happen on

1. Dropping |r′(t)| from ds

The mass of the wire in Example 1.

  1. f(r(t)) = 7tRight so far.
  2. ∫01 7t dt = 7/2This is the mistake. dt is not ds: the parameter covers an interval of length 1 while the wire is 5 long, so every piece must be stretched by |r′(t)| = 5. The right mass is 35/2.

2. Going around the boundary clockwise

Example 4, with the triangle traced from (0, 0) up the diagonal first.

  1. Qx − Py = xRight so far.
  2. ∮C xy dx + x2 dy = 1/3This is the mistake. The route (0, 0) → (1, 1) → (1, 0) → (0, 0) keeps the triangle on the right, which is clockwise, and its line integral is −1/3. Green's theorem gives the counterclockwise value; for a clockwise curve, flip the sign.

3. Treating every field as path-independent

The work in Example 2, along the straight segment instead because it looks easier.

  1. F = (−y, x)Right so far.
  2. Warc = Wsegment = 4This is the mistake. The segment from (2, 0) to (0, 2) is easier to integrate along, but here Qx − Py = 2, so F has no potential and the path matters. The segment gives 4 and the arc gives 2π. Their difference, 2π − 4, is Green's theorem on the region between them: 2 times its area, π − 2.

Practice

  1. Compute ∫C x2 ds around the whole unit circle.

    Show answer

    With r = (cos t, sin t), |r′| = 1 and ∫02π cos2 t dt = π.

  2. Find the work done by F = (y, x) along any path from (1, 0) to (2, 3).

    Show answer

    F = ∇(xy), so the work is 2 · 3 − 1 · 0 = 6.

  3. Use Area = ½∮ x dy − y dx to find the area of the disk of radius 3.

    Show answer

    With r = (3 cos t, 3 sin t) the integrand is 9 dt, so the area is ½ · 9 · 2π = 9π.

  4. Compute ∮ −y dx + x dy counterclockwise around the square with corners (0, 0), (1, 0), (1, 1), (0, 1).

    Show answer

    Qx − Py = 2, so the integral is twice the area: 2.

  5. Is F = (y2, 2xy + 1) conservative? If so, find a potential.

    Show answer

    Yes: Py = 2y = Qx, and f = xy2 + y.