TExcelTAD
Home › Calculus in Depth › Calculus with Parametric Curves

Calculus with Parametric Curves

Once a curve is given as x=f(t)x = f(t), y=g(t)y = g(t), the usual questions of calculus (slopes, areas, lengths) have answers written entirely in terms of tt. This lesson derives those formulas, proves the arc-length formula from inscribed polygons, and uses arc length to solve a practical problem: moving an object along a curve at constant speed, as game cameras and path followers must.

Start with Curves Defined by Parametric Equations if parametric curves are new.

Tangents

Suppose ff and gg are differentiable and f′(t)≠0f'(t) \ne 0 near t0t_0. Then ff is strictly monotone there, so it has a differentiable inverse and, locally, yy is a function of xx: y=g(f−1(x))y = g(f^{-1}(x)). The chain rule gives dydt=dydxdxdt\frac{dy}{dt} = \frac{dy}{dx}\frac{dx}{dt}, hence

dydx=dy/dtdx/dtprovided dxdt≠0\frac{dy}{dx} = \frac{dy/dt}{dx/dt} \qquad \text{provided } \frac{dx}{dt} \ne 0
  • Horizontal tangent: dy/dt=0dy/dt = 0 and dx/dt≠0dx/dt \ne 0.
  • Vertical tangent: dx/dt=0dx/dt = 0 and dy/dt≠0dy/dt \ne 0.
  • If both vanish, the point needs a closer look (it may be a cusp, as for the cycloid).

The second derivative is the derivative of dy/dxdy/dx with respect to xx, so the same rule applies again:

d2ydx2=ddt(dydx)dx/dt(not d2y/dt2d2x/dt2!)\frac{d^2y}{dx^2} = \frac{\frac{d}{dt}\left(\frac{dy}{dx}\right)}{dx/dt} \qquad \left(\text{not } \frac{d^2y/dt^2}{d^2x/dt^2}\text{!}\right)
python · try it yourself
import sympy as sp

t = sp.symbols("t", real=True)
x, y = t**2 - 3*t, t**3 - 3*t

dydx = sp.simplify(y.diff(t) / x.diff(t))
d2 = sp.factor(sp.simplify(dydx.diff(t) / x.diff(t)))
print("dy/dx   =", dydx)
print("d2y/dx2 =", d2)
print("horizontal tangents at t =", sp.solve(y.diff(t), t))
print("vertical tangent at t =", sp.solve(x.diff(t), t),
      "point", (x.subs(t, sp.Rational(3, 2)), y.subs(t, sp.Rational(3, 2))))
print("slope at t = 2:", dydx.subs(t, 2))
dy/dx   = 3*(t**2 - 1)/(2*t - 3)
d2y/dx2 = 6*(t**2 - 3*t + 1)/(2*t - 3)**3
horizontal tangents at t = [-1, 1]
vertical tangent at t = [3/2] point (-9/4, -9/8)
slope at t = 2: 9

The curve is concave up exactly where d2ydx2\frac{d^2y}{dx^2} is positive. Here the sign can change at the roots t=3±52t = \frac{3 \pm \sqrt{5}}{2} of the numerator (inflection points) and at t=3/2t = 3/2, the vertical tangent, where the curve turns back in xx.

Areas

If the curve is traced once as tt goes from α\alpha to β\beta, substituting x=f(t)x = f(t), dx=f′(t) dtdx = f'(t)\,dt into A=∫y dxA = \int y\,dx gives

A=∫aby dx=∫αβg(t) f′(t) dtA = \int_a^b y\,dx = \int_\alpha^\beta g(t)\,f'(t)\,dt

The orientation matters: if xx decreases as tt increases, the integral comes out negative and you take its absolute value (or swap the limits). For a closed curve traced once anticlockwise, A=−∮y dx=∮x dyA = -\oint y\,dx = \oint x\,dy, a special case of Green's theorem.

Arc length

Theorem. If f′f' and g′g' are continuous on [α,β][\alpha, \beta] and the curve is traversed exactly once, its length is

L=∫αβ(dxdt)2+(dydt)2 dtL = \int_\alpha^\beta \sqrt{\left(\frac{dx}{dt}\right)^2 + \left(\frac{dy}{dt}\right)^2}\,dt

Proof sketch. Split [α,β][\alpha, \beta] into nn pieces at t0<t1<…<tnt_0 < t_1 < \ldots < t_n and join the points Pi=(f(ti),g(ti))P_i = (f(t_i), g(t_i)) by straight segments. The length of the curve is defined as the limit of the polygon lengths as the pieces shrink. By the mean value theorem, f(ti)−f(ti−1)=f′(ti∗)Δtf(t_i) - f(t_{i-1}) = f'(t_i^*)\Delta t and g(ti)−g(ti−1)=g′(ti∗∗)Δtg(t_i) - g(t_{i-1}) = g'(t_i^{**})\Delta t for some points ti∗t_i^*, ti∗∗t_i^{**} in the ii-th piece, so

∣Pi−1Pi∣=f′(ti∗)2+g′(ti∗∗)2⋅Δt\lvert P_{i-1}P_i \rvert = \sqrt{f'(t_i^*)^2 + g'(t_i^{**})^2} \cdot \Delta t

This is almost a Riemann sum for f′2+g′2\sqrt{f'^2 + g'^2}; the two sample points differ, but because f′f' and g′g' are uniformly continuous on the closed interval, the difference vanishes in the limit. ∎

The integrand ∣r′(t)∣=f′2+g′2\lvert \mathbf{r}'(t) \rvert = \sqrt{f'^2 + g'^2} is the speed, so length is the integral of speed: distance travelled. If the curve is traversed twice, the integral counts it twice, which is why "traversed once" matters. The length does not depend on which once-through parametrisation you use (a change of variables in the integral shows it). For graphs y=F(x)y = F(x) the formula reduces to ∫1+F′(x)2 dx\int \sqrt{1 + F'(x)^2}\,dx from Arc Length.

python · try it yourself
import sympy as sp

th, r = sp.symbols("theta r", positive=True)
x, y = r * (th - sp.sin(th)), r * (1 - sp.cos(th))

area = sp.integrate(y * x.diff(th), (th, 0, 2 * sp.pi))
print("area under one arch:", sp.simplify(area))

speed = sp.sqrt(sp.simplify(x.diff(th)**2 + y.diff(th)**2))
print("speed:", speed, " =  2r·sin(θ/2) on [0, 2π]")
length = sp.integrate(2 * r * sp.sin(th / 2), (th, 0, 2 * sp.pi))
print("length of one arch:", length)
area under one arch: 3*pi*r**2
speed: r*sqrt(2 - 2*cos(theta))  =  2r·sin(θ/2) on [0, 2π]
length of one arch: 8*r

One cycloid arch has area 3πr23\pi r^2, three times the rolling circle, and length 8r8r, a rational multiple of rr with no π\pi, which Christopher Wren proved in 1658.

In software: constant-speed motion along a curve

A game camera on a spline, a train on a track or a UI element following a Bézier path is usually given as P(t)P(t) for 0≤t≤10 \le t \le 1. Advancing tt at a constant rate does not give constant speed: ∣P′(t)∣\lvert P'(t) \rvert varies, so the object speeds up and slows down. The fix is arc-length reparameterisation:

  1. Compute the arc-length function s(t)=∫0t∣P′(u)∣ dus(t) = \int_0^t \lvert P'(u) \rvert\,du. It is strictly increasing when the speed is positive.
  2. Invert it: for a desired distance ss, find t(s)t(s).
  3. Move by distance, not by parameter: at time τ\tau, place the object at P(t(vτ))P(t(v\tau)).

The curve P(t(s))P(t(s)) has speed exactly 1, since ddsP(t(s))=P′(t)dtds=P′(t)∣P′(t)∣\frac{d}{ds} P(t(s)) = P'(t)\frac{dt}{ds} = \frac{P'(t)}{\lvert P'(t) \rvert}. Engines approximate step 1 with a lookup table of cumulative chord lengths and do step 2 with binary search plus linear interpolation.

python · try it yourself
import numpy as np

P = np.array([[0, 0], [1, 3], [4, 3], [5, 0]], float)     # cubic Bézier controls

def bez(t):
    t = np.asarray(t)[:, None]
    return ((1-t)**3 * P[0] + 3*(1-t)**2*t * P[1] + 3*(1-t)*t**2 * P[2] + t**3 * P[3])

# lookup table: t samples and cumulative chord length
ts = np.linspace(0, 1, 2001)
pts = bez(ts)
s = np.concatenate([[0], np.cumsum(np.linalg.norm(np.diff(pts, axis=0), axis=1))])
L = s[-1]
print(f"curve length ≈ {L:.4f}")

def t_of_s(target):                 # invert s(t) by interpolation in the table
    return np.interp(target, s, ts)

steps = 8
uniform_t = bez(np.linspace(0, 1, steps + 1))
uniform_s = bez(t_of_s(np.linspace(0, L, steps + 1)))
seg = lambda q: np.round(np.linalg.norm(np.diff(q, axis=0), axis=1), 3).tolist()
print("step lengths, equal t:", seg(uniform_t))
print("step lengths, equal s:", seg(uniform_s))
curve length ≈ 7.1906
step lengths, equal t: [1.087, 0.925, 0.813, 0.755, 0.755, 0.813, 0.925, 1.087]
step lengths, equal s: [0.897, 0.896, 0.894, 0.892, 0.892, 0.894, 0.896, 0.897]

With equal tt steps the object covers about 45% more ground per frame near the ends of this curve than in the middle. With equal arc-length steps every frame covers the same arc length; the printed straight-line chords differ only in the third decimal because a chord is slightly shorter than its arc where the curve bends more.

Exercises

Exercise 1: Tangent to an ellipse

Find the slope and the point of tangency on x=2cos⁡tx = 2\cos t, y=3sin⁡ty = 3\sin t at t=π/4t = \pi/4.

Answer

Slope −3/2-3/2 at the point (2,322)\left(\sqrt{2}, \frac{3\sqrt{2}}{2}\right).

Solution
dydx=3cos⁡t−2sin⁡t=−32cot⁡t,cot⁡π4=1  ⇒  −32point: (2⋅22, 3⋅22)=(2,322)\begin{aligned} \frac{dy}{dx} &= \frac{3\cos t}{-2\sin t} = -\tfrac{3}{2}\cot t, \qquad \cot\tfrac{\pi}{4} = 1 \;\Rightarrow\; -\tfrac{3}{2} \\ \text{point: } &\left(2 \cdot \tfrac{\sqrt{2}}{2},\ 3 \cdot \tfrac{\sqrt{2}}{2}\right) = \left(\sqrt{2}, \tfrac{3\sqrt{2}}{2}\right) \end{aligned}

Exercise 2: An exact arc length

Find the length of x=t2x = t^2, y=t3y = t^3 for 0≤t≤10 \le t \le 1.

Answer

1313−827≈1.4397\frac{13\sqrt{13} - 8}{27} \approx 1.4397

Solution
(2t)2+(3t2)2=t4+9t2(t≥0)u=4+9t2, du=18t dt:∫01t4+9t2 dt=118⋅23⋅[u3/2]413=1313−827\begin{aligned} &\sqrt{(2t)^2 + (3t^2)^2} = t\sqrt{4 + 9t^2} && (t \ge 0) \\ &u = 4 + 9t^2,\ du = 18t\,dt{:} \quad \int_0^1 t\sqrt{4 + 9t^2}\,dt = \tfrac{1}{18} \cdot \tfrac{2}{3} \cdot \Big[u^{3/2}\Big]_4^{13} = \frac{13\sqrt{13} - 8}{27} \end{aligned}
python · try it yourself
import sympy as sp

t = sp.symbols("t", nonnegative=True)
L = sp.integrate(sp.sqrt((2*t)**2 + (3*t**2)**2), (t, 0, 1))
print(sp.simplify(L), round(float(L), 4))
-8/27 + 13*sqrt(13)/27 1.4397

Exercise 3: Area of an ellipse

Use A=∣∫y dx∣A = \left\lvert \int y\,dx \right\rvert with x=acos⁡tx = a\cos t, y=bsin⁡ty = b\sin t, 0≤t≤2π0 \le t \le 2\pi, to find the area enclosed by the ellipse.

Answer

πab\pi ab

Solution
∫02π(bsin⁡t)(−asin⁡t) dt=−ab∫02πsin⁡2t dt=−abπ\int_0^{2\pi} (b\sin t)(-a\sin t)\,dt = -ab\int_0^{2\pi} \sin^2 t\,dt = -ab\pi

The minus sign appears because the parametrisation runs anticlockwise (along the top half xx decreases), so the area is πab\pi ab.

Exercise 4: Half-way along a parabola

On the path P(t)=(t,t2)P(t) = (t, t^2), 0≤t≤10 \le t \le 1, find the parameter value at which an object moving at constant speed has covered half the length. Use a lookup table as in the lesson.

Answer

Total length ≈1.478943\approx 1.478943; half-way is at t≈0.6107t \approx 0.6107, not at t=0.5t = 0.5.

Solution

s(t)=∫0t1+4u2 dus(t) = \int_0^t \sqrt{1 + 4u^2}\,du; the exact total is 52+asinh⁡(2)4≈1.478943\frac{\sqrt{5}}{2} + \frac{\operatorname{asinh}(2)}{4} \approx 1.478943. Because speed grows with tt, the first half of the distance takes more than half the parameter range.

python · try it yourself
import numpy as np

ts = np.linspace(0, 1, 100001)
speed = np.sqrt(1 + 4 * ts**2)
s = np.concatenate([[0], np.cumsum((speed[1:] + speed[:-1]) / 2 * np.diff(ts))])
print(f"L = {s[-1]:.6f}, exact {np.sqrt(5)/2 + np.arcsinh(2)/4:.6f}")
print(f"t at half length = {np.interp(s[-1] / 2, s, ts):.4f}")
L = 1.478943, exact 1.478943
t at half length = 0.6107

Test yourself

For x=f(t)x = f(t), y=g(t)y = g(t), where is the tangent vertical?

  1. Where dy/dt=0dy/dt = 0 and dx/dt≠0dx/dt \ne 0
  2. Where dx/dt=0dx/dt = 0 and dy/dt≠0dy/dt \ne 0
  3. Where d2y/dt2=0d^2y/dt^2 = 0
  4. Where t=0t = 0

Which formula gives d2ydx2\frac{d^2y}{dx^2} for a parametric curve?

  1. d2y/dt2d2x/dt2\frac{d^2y/dt^2}{d^2x/dt^2}
  2. ddt(dy/dx)dx/dt\frac{\frac{d}{dt}(dy/dx)}{dx/dt}
  3. (dy/dt)2(dy/dt)^2
  4. ddt(dy/dx)\frac{d}{dt}(dy/dx)

A camera moves along a Bézier path by increasing tt at a constant rate, but its speed varies. What fixes it?

  1. Increasing the frame rate
  2. Reparameterising by arc length: build an s(t)s(t) table and invert it
  3. Normalising the control points
  4. Using a quadratic Bézier