TExcelTAD
Home › Calculus in Depth › Arc Length

Arc Length

How long is a curved path? This lesson defines the length of a curve as the limit of inscribed polygon lengths, derives the integral formula L=∫1+f′(x)2 dxL = \int \sqrt{1 + f'(x)^2}\,dx with the Mean Value Theorem, introduces the arc length function s(x)s(x), and shows how code measures curves and walks along them at a steady speed.

Length as a limit of polygons

A ruler only measures straight segments, so we approximate. Split [a,b][a, b] into nn pieces a=x0<x1<…<xn=ba = x_0 < x_1 < \ldots < x_n = b, put the points Pi=(xi,f(xi))P_i = (x_i, f(x_i)) on the curve and join them with straight segments. The polygon's length is

Ln=∑i=1n∣Pi−1Pi∣L_n = \sum_{i=1}^{n} \lvert P_{i-1}P_i \rvert

Every chord is at most as long as the arc it cuts off (a straight line is the shortest path), so refining the partition can only make LnL_n grow. Definition: the curve's length is L=lim⁡LnL = \lim L_n as the largest piece shrinks to 0, when that limit exists. A curve with a finite length is called rectifiable.

The integral formula

Theorem. If f′f' is continuous on [a,b][a, b], the length of y=f(x)y = f(x) from x=ax = a to x=bx = b is

L=∫ab1+[f′(x)]2 dxL = \int_a^b \sqrt{1 + [f'(x)]^2}\,dx

Proof sketch. Write Δxi=xi−xi−1\Delta x_i = x_i - x_{i-1} and Δyi=f(xi)−f(xi−1)\Delta y_i = f(x_i) - f(x_{i-1}). By the Mean Value Theorem there is an xi∗x_i^* in each piece with Δyi=f′(xi∗) Δxi\Delta y_i = f'(x_i^*)\,\Delta x_i. Then

∣Pi−1Pi∣=Δxi2+Δyi2=1+[f′(xi∗)]2⋅ΔxiLn=∑1+[f′(xi∗)]2 Δxi\begin{aligned} \lvert P_{i-1}P_i \rvert &= \sqrt{\Delta x_i^2 + \Delta y_i^2} = \sqrt{1 + [f'(x_i^*)]^2} \cdot \Delta x_i \\ L_n &= \sum \sqrt{1 + [f'(x_i^*)]^2}\,\Delta x_i \end{aligned}

That is exactly a Riemann sum of the continuous function 1+(f′)2\sqrt{1 + (f')^2}, so it converges to the integral. ∎

If the curve is easier as x=g(y)x = g(y), swap the roles: L=∫1+[g′(y)]2 dyL = \int \sqrt{1 + [g'(y)]^2}\,dy. Both are cases of the symmetric memory aid ds2=dx2+dy2ds^2 = dx^2 + dy^2, the Pythagorean theorem for an infinitesimal piece of curve.

Note: Arc length integrals are rarely elementary. The square root only simplifies when 1+(f′)21 + (f')^2 is a perfect square, which is why textbook examples are carefully chosen. In practice you integrate numerically, as in Approximate Integration.

Two curves that do simplify

For y=23x3/2y = \frac{2}{3} x^{3/2} on [0,3][0, 3], f′(x)=xf'(x) = \sqrt{x}, so 1+(f′)2=1+x1 + (f')^2 = 1 + x and

L=∫031+x dx=23(1+x)3/2∣03=23(8−1)=143L = \int_0^3 \sqrt{1 + x}\,dx = \frac{2}{3}(1 + x)^{3/2} \Big|_0^3 = \frac{2}{3}(8 - 1) = \frac{14}{3}

For the catenary y=cosh⁡xy = \cosh x (a hanging cable), 1+sinh⁡2x=cosh⁡2x1 + \sinh^2 x = \cosh^2 x, so the length from 0 to tt is sinh⁡t\sinh t. On [0,ln⁡2][0, \ln 2] that is (2−1/2)/2=3/4(2 - 1/2)/2 = 3/4.

python · try it yourself
import sympy as sp

x = sp.symbols("x", nonnegative=True)

def arc_length(f, a, b):
    integrand = sp.sqrt(sp.simplify(1 + sp.diff(f, x) ** 2))   # simplify first: 1 + sinh² → cosh²
    return sp.simplify(sp.integrate(integrand, (x, a, b)))

print("y = (2/3)x^(3/2) on [0, 3]:", arc_length(sp.Rational(2, 3) * x**sp.Rational(3, 2), 0, 3))
L = arc_length(sp.cosh(x), 0, sp.log(2))
print("y = cosh x on [0, ln 2]:", sp.simplify(L.rewrite(sp.exp)))
y = (2/3)x^(3/2) on [0, 3]: 14/3
y = cosh x on [0, ln 2]: 3/4

Polygons converge to the integral

The parabola y=x2y = x^2 on [0,1][0, 1] has an exact length (25+asinh⁡2)/4≈1.478943(2\sqrt{5} + \operatorname{asinh} 2)/4 \approx 1.478943. The inscribed polygons approach it from below, and the error shrinks roughly by a factor of 4 each time nn doubles (it is O(1/n2)O(1/n^2)):

python · try it yourself
import numpy as np
from scipy.integrate import quad

f = lambda t: t**2
exact = (2 * np.sqrt(5) + np.arcsinh(2)) / 4

for n in [4, 8, 16, 32]:
    xs = np.linspace(0, 1, n + 1)
    Ln = np.sum(np.hypot(np.diff(xs), np.diff(f(xs))))
    print(f"n={n:2d}  polygon={float(Ln):.6f}  error={float(exact - Ln):.2e}")

L, _ = quad(lambda t: np.sqrt(1 + (2 * t) ** 2), 0, 1)
print(f"quad: {L:.6f}  exact: {float(exact):.6f}")
n= 4  polygon=1.474280  error=4.66e-03
n= 8  polygon=1.477778  error=1.16e-03
n=16  polygon=1.478652  error=2.91e-04
n=32  polygon=1.478870  error=7.28e-05
quad: 1.478943  exact: 1.478943

The arc length function

Measuring from a fixed start aa, the arc length function is

s(x)=∫ax1+[f′(t)]2 dt,so by FTC 1:dsdx=1+[f′(x)]2≥1s(x) = \int_a^x \sqrt{1 + [f'(t)]^2}\,dt, \qquad \text{so by FTC 1:}\quad \frac{ds}{dx} = \sqrt{1 + [f'(x)]^2} \ge 1

ss is strictly increasing, so it has an inverse x(s)x(s): "where am I after travelling distance ss?" That inverse is what animation code needs.

In software

  • Constant-speed motion along a path. Moving a sprite or camera with x += speed·dt along a curved track makes it rush through flat parts and crawl on steep ones, because equal steps in xx are unequal steps along the curve. The fix is arc-length reparameterisation: tabulate s(x)s(x) once, then invert it by interpolation (or Newton's method) each frame. Calculus with Parametric Curves does this for general paths and Bézier curves (Bézier curves).
  • Measuring polylines. GPS tracks, SVG paths and vector fonts store curves as many points; their length is the polygon sum ∑hypot⁡(Δx,Δy)\sum \operatorname{hypot}(\Delta x, \Delta y) from the example above.
  • Dashed lines and textures on roads or ropes are spaced by arc length, not by parameter, so the dashes stay even.
python · try it yourself
import numpy as np

# Walk y = x^2 on [0, 2] at constant speed: invert s(x) with a lookup table
xs = np.linspace(0, 2, 2001)
seg = np.hypot(np.diff(xs), np.diff(xs**2))
s = np.concatenate([[0.0], np.cumsum(seg)])
total = float(s[-1])
print(f"total length ≈ {total:.4f}")

for frac in [0.25, 0.5, 0.75]:
    x_at = float(np.interp(frac * total, s, xs))
    print(f"{int(frac * 100)}% of the way: x = {x_at:.4f}")
total length ≈ 4.6468
25% of the way: x = 0.8491
50% of the way: x = 1.3326
75% of the way: x = 1.6967

Half the distance is reached at x≈1.33x \approx 1.33, not at x=1x = 1: the steep right part of the parabola is longer than its width suggests.

For a gentler first look, see Area Under and Between Curves in the survey course; arc length of parametric curves continues in Calculus with Parametric Curves.

Exercises

Exercise 1: A straight line

Use the formula to find the length of y=3x+1y = 3x + 1 from x=0x = 0 to x=2x = 2, and check it with the distance formula.

Answer

210≈6.32462\sqrt{10} \approx 6.3246

Solution
f′(x)=3,1+9=10L=∫0210 dx=210Distance formula: (0,1) to (2,7):22+62=40=210✓\begin{aligned} &f'(x) = 3, \qquad \sqrt{1 + 9} = \sqrt{10} \\ L &= \int_0^2 \sqrt{10}\,dx = 2\sqrt{10} \\ &\text{Distance formula: } (0, 1) \text{ to } (2, 7){:}\quad \sqrt{2^2 + 6^2} = \sqrt{40} = 2\sqrt{10} \quad \checkmark \end{aligned}

Exercise 2: An exact cubic-type curve

Find the length of y=x3/6+1/(2x)y = x^3/6 + 1/(2x) on [1,2][1, 2]. Hint: 1+(f′)21 + (f')^2 is a perfect square.

Answer

1712\frac{17}{12}

Solution
f′(x)=x22−12x21+(f′)2=1+x44−12+14x4=(x22+12x2)2L=∫12(x22+12x2)dx=[x36−12x]12=(86−14)−(16−12)=1312+13=1712\begin{aligned} f'(x) &= \frac{x^2}{2} - \frac{1}{2x^2} \\ 1 + (f')^2 &= 1 + \frac{x^4}{4} - \frac{1}{2} + \frac{1}{4x^4} = \left(\frac{x^2}{2} + \frac{1}{2x^2}\right)^2 \\ L &= \int_1^2 \left(\frac{x^2}{2} + \frac{1}{2x^2}\right) dx = \left[\frac{x^3}{6} - \frac{1}{2x}\right]_1^2 = \left(\frac{8}{6} - \frac{1}{4}\right) - \left(\frac{1}{6} - \frac{1}{2}\right) = \frac{13}{12} + \frac{1}{3} = \frac{17}{12} \end{aligned}
python · try it yourself
import sympy as sp

x = sp.symbols("x", positive=True)
f = x**3 / 6 + 1 / (2 * x)
print(sp.integrate(sp.sqrt(sp.factor(1 + sp.diff(f, x) ** 2)), (x, 1, 2)))
17/12

Exercise 3: Numerically only

The length of y=sin⁡xy = \sin x on [0,π][0, \pi] has no elementary formula. Compute it to 6 decimals with scipy.integrate.quad.

Answer

≈3.820198\approx 3.820198

Solution

f′=cos⁡xf' = \cos x, so L=∫0π1+cos⁡2x dxL = \int_0^{\pi} \sqrt{1 + \cos^2 x}\,dx (an elliptic integral).

python · try it yourself
import numpy as np
from scipy.integrate import quad

L, _ = quad(lambda t: np.sqrt(1 + np.cos(t) ** 2), 0, np.pi)
print(f"{L:.6f}")
3.820198

Exercise 4: Arc length function of the catenary

For y=cosh⁡xy = \cosh x find s(x)s(x) measured from x=0x = 0, then the xx where the arc length reaches 1.

Answer

s(x)=sinh⁡xs(x) = \sinh x; x=asinh⁡1=ln⁡(1+2)≈0.8814x = \operatorname{asinh} 1 = \ln(1 + \sqrt{2}) \approx 0.8814

Solution
s(x)=∫0x1+sinh⁡2t dt=∫0xcosh⁡t dt=sinh⁡xsinh⁡x=1⇒x=asinh⁡1=ln⁡(1+2)≈0.8814\begin{aligned} s(x) &= \int_0^x \sqrt{1 + \sinh^2 t}\,dt = \int_0^x \cosh t\,dt = \sinh x \\ \sinh x = 1 \quad &\Rightarrow \quad x = \operatorname{asinh} 1 = \ln(1 + \sqrt{2}) \approx 0.8814 \end{aligned}

Test yourself

Which step in the derivation of L=∫1+(f′)2 dxL = \int \sqrt{1 + (f')^2}\,dx uses the Mean Value Theorem?

  1. Replacing Δy\Delta y by f′(x∗)⋅Δxf'(x^*) \cdot \Delta x on each piece
  2. Showing the polygon lengths increase
  3. Taking the square root
  4. Swapping xx and yy

A sprite moves with x += speed·dt along y=x2y = x^2. What goes wrong?

  1. Nothing, its speed is constant
  2. It moves faster along the curve where the curve is steep
  3. It moves slower where the curve is steep
  4. It leaves the curve

Why is the arc length function s(x)s(x) always invertible (for f′f' continuous)?

  1. Because ff is invertible
  2. Because s(0)=0s(0) = 0
  3. Because ds/dx=1+(f′)2≥1>0ds/dx = \sqrt{1 + (f')^2} \ge 1 > 0, so ss is strictly increasing
  4. It is not always invertible