TExcelTAD
Home › Calculus in Depth › Curves Defined by Parametric Equations

Curves Defined by Parametric Equations

A parametric curve gives xx and yy as separate functions of a third variable, usually thought of as time. That one change lets you describe loops, self-crossings and motion along a path, none of which a single formula y=f(x)y = f(x) can do. This lesson defines parametric curves carefully, eliminates parameters, derives the cycloid, and shows how games use parametric equations for paths and particle effects.

For a first look, including Bézier curves, see Parametric and Bézier Curves.

Definitions

Let ff and gg be functions defined on an interval II. The equations

x=f(t),y=g(t),t∈Ix = f(t), \qquad y = g(t), \qquad t \in I

are parametric equations with parameter tt, and the set of points C={(f(t),g(t)):t∈I}C = \{(f(t), g(t)) : t \in I\} is a parametric curve. If I=[α,β]I = [\alpha, \beta], the points (f(α),g(α))(f(\alpha), g(\alpha)) and (f(β),g(β))(f(\beta), g(\beta)) are the initial and terminal points, and the curve has an orientation: the direction of increasing tt.

It is important to separate two things:

  • the curve CC, a set of points, and
  • a parametrisation of it, a particular way of tracing it.

The unit circle is traced by (cos⁡t,sin⁡t)(\cos t, \sin t) for 0≤t≤2π0 \le t \le 2\pi (once, anticlockwise), by (cos⁡2t,sin⁡2t)(\cos 2t, \sin 2t) for the same tt (twice, twice as fast) and by (sin⁡t,cos⁡t)(\sin t, \cos t) (once, clockwise, starting at the top). Same set of points, three different motions. Every graph y=F(x)y = F(x) is a parametric curve, x=t,y=F(t)x = t, y = F(t), so parametric curves include everything you had before.

Eliminating the parameter

To find a Cartesian equation, solve one equation for tt and substitute, or use an identity such as cos⁡2+sin⁡2=1\cos^2 + \sin^2 = 1. Keep track of restrictions: the Cartesian equation may describe more points than the parametric curve.

python · try it yourself
import sympy as sp

t, x, y = sp.symbols("t x y", real=True)

# ellipse: x = 1 + 2cos t, y = -2 + 3 sin t
X, Y = 1 + 2 * sp.cos(t), -2 + 3 * sp.sin(t)
print("ellipse check:", sp.simplify(((X - 1) / 2)**2 + ((Y + 2) / 3)**2))

# x = t², y = t³: resultant eliminates t from x - t², y - t³
print("cusp curve:", sp.resultant(x - t**2, y - t**3, t), "= 0")

# x = cos t, y = cos 2t  →  y = 2x² − 1, but only for −1 ≤ x ≤ 1
print("y in terms of x:", sp.expand_trig(sp.cos(2 * t)).subs(sp.cos(t), x))
ellipse check: 1
cusp curve: x**3 - y**2 = 0
y in terms of x: 2*x**2 - 1

The second curve, y2=x3y^2 = x^3, is a semicubical parabola with a cusp at the origin even though t2t^2 and t3t^3 are perfectly smooth: a smooth parametrisation can stop (x′(0)=y′(0)=0x'(0) = y'(0) = 0) and turn around. The third traces only an arc of the parabola, back and forth, because x=cos⁡tx = \cos t never leaves [−1,1][-1, 1].

The cycloid

A circle of radius rr rolls along the x-axis without slipping. Follow a point PP on its rim that starts at the origin. After the circle turns through angle θ\theta, it has rolled a distance equal to the arc rθr\theta, so its centre is at (rθ,r)(r\theta, r). Relative to the centre, PP is at angle θ\theta clockwise from straight down, i.e. at offset (−rsin⁡θ,−rcos⁡θ)(-r \sin \theta, -r \cos \theta). Adding:

x=r(θ−sin⁡θ),y=r(1−cos⁡θ)x = r(\theta - \sin \theta), \qquad y = r(1 - \cos \theta)

One arch corresponds to 0≤θ≤2π0 \le \theta \le 2\pi. At θ=2πk\theta = 2\pi k the velocity (r(1−cos⁡θ),rsin⁡θ)(r(1 - \cos \theta), r \sin \theta) is zero, and the curve has cusps. The cycloid answers two famous problems: it is the brachistochrone (curve of fastest frictionless descent between two points) and the tautochrone (a bead released anywhere on an inverted arch reaches the bottom in the same time).

Lissajous curves x=sin⁡(at+δ)x = \sin(at + \delta), y=sin⁡(bt)y = \sin(bt) close up exactly when a/ba/b is rational; an irrational ratio fills a rectangle densely.

python · try it yourself
import numpy as np
import matplotlib.pyplot as plt

fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(9, 3.5))
th = np.linspace(0, 6 * np.pi, 1000)
r = 1.0
ax1.plot(r * (th - np.sin(th)), r * (1 - np.cos(th)))
ax1.set_aspect("equal"); ax1.set_title("cycloid, r = 1, three arches")

t = np.linspace(0, 2 * np.pi, 1000)
ax2.plot(np.sin(3 * t + np.pi / 2), np.sin(2 * t))
ax2.set_aspect("equal"); ax2.set_title("Lissajous a = 3, b = 2, δ = π/2")
plt.tight_layout(); plt.show()
print("arch width 2πr =", round(2 * np.pi * r, 4), ", height 2r =", 2 * r)
arch width 2πr = 6.2832 , height 2r = 2.0

In software: paths and particles

Game code is full of parametric curves, because a parametrisation is literally "where is it at time tt".

  • Paths: enemies following a figure-eight (Asin⁡t,Asin⁡tcos⁡t)(A \sin t, A \sin t \cos t), orbiting pickups (cx+Rcos⁡ωt,cy+Rsin⁡ωt)(c_x + R \cos \omega t, c_y + R \sin \omega t), cameras on rails along Bézier or Catmull-Rom splines. A linear segment from PP to QQ is the parametric curve P+t(Q−P)P + t(Q - P), the lerp.
  • Particle effects: each particle's position is an explicit function of its age, p(t)=p0+v0t+12gt2p(t) = p_0 + v_0 t + \tfrac{1}{2}gt^2 for sparks, plus (R(t)cos⁡ωt,R(t)sin⁡ωt)(R(t) \cos \omega t, R(t) \sin \omega t) for swirls. Evaluating a formula per particle (often in a shader) is cheaper and more stable than integrating forces each frame.
  • Easing: an easing function reparametrises a path, changing how fast it is traced without changing its shape.
python · try it yourself
import numpy as np

rng = np.random.default_rng(3)
n = 5
angles = rng.uniform(0, 2 * np.pi, n)
speeds = rng.uniform(4, 8, n)
v0 = np.column_stack([speeds * np.cos(angles), speeds * np.sin(angles)])
g = np.array([0.0, -9.8])

def burst(t):                       # positions of all sparks at age t
    return v0 * t + 0.5 * g * t**2

for t in (0.25, 0.5, 0.75):
    pts = burst(t)
    print(f"t = {t:.2f}:", [(round(float(px), 2), round(float(py), 2)) for px, py in pts])

def swirl(t, R0=1.0, grow=0.5, w=4.0):    # spiral emitter
    R = R0 + grow * t
    return (R * np.cos(w * t), R * np.sin(w * t))
print("swirl at t = 1:", tuple(round(float(c), 4) for c in swirl(1.0)))
t = 0.25: [(1.23, 0.43), (0.12, 1.17), (0.37, -1.41), (-1.51, -1.16), (0.92, 0.31)]
t = 0.50: [(2.46, 0.24), (0.24, 1.72), (0.73, -3.43), (-3.02, -2.94), (1.85, 0.02)]
t = 0.75: [(3.69, -0.55), (0.37, 1.67), (1.1, -6.06), (-4.53, -5.32), (2.77, -0.89)]
swirl at t = 1: (-0.9805, -1.1352)

Exercises

Exercise 1: Eliminate the parameter

Find a Cartesian equation for x=etx = e^t, y=e2t+1y = e^{2t} + 1, and say which part of that graph is traced.

Answer

y=x2+1y = x^2 + 1 for x>0x > 0 (the right half of the parabola).

Solution
e2t=(et)2=x2⇒y=x2+1x=et>0 for every t, so only the branch x>0 appears, traced left to right as t increases.\begin{aligned} &e^{2t} = (e^t)^2 = x^2 \quad \Rightarrow \quad y = x^2 + 1 \\ &x = e^t > 0 \text{ for every } t, \text{ so only the branch } x > 0 \text{ appears, traced left to right as } t \text{ increases.} \end{aligned}

Exercise 2: A segment

Give parametric equations for the segment from (1,2)(1, 2) to (7,−1)(7, -1) with 0≤t≤10 \le t \le 1, and find the point at t=1/3t = 1/3.

Answer

x=1+6tx = 1 + 6t, y=2−3ty = 2 - 3t; at t=1/3t = 1/3 the point is (3,1)(3, 1).

Solution
P+t(Q−P)=(1,2)+t(6,−3)t=1/3:(1+2,2−1)=(3,1)\begin{aligned} &P + t(Q - P) = (1, 2) + t(6, -3) \\ &t = 1/3{:}\quad (1 + 2, 2 - 1) = (3, 1) \end{aligned}

Exercise 3: Top of the cycloid

For the cycloid with radius rr, where is the highest point of the first arch, and what is the speed of PP there if the circle turns at 1 radian per second?

Answer

(πr,2r)(\pi r, 2r), speed 2r2r (twice the speed of the centre).

Solution
y=r(1−cos⁡θ) is maximal at θ=π:(r(π−0),r(1+1))=(πr,2r)velocity=(r(1−cos⁡θ),rsin⁡θ)=(2r,0) at θ=π⇒speed 2r\begin{aligned} &y = r(1 - \cos \theta) \text{ is maximal at } \theta = \pi{:}\quad (r(\pi - 0), r(1 + 1)) = (\pi r, 2r) \\ &\text{velocity} = (r(1 - \cos \theta), r \sin \theta) = (2r, 0) \text{ at } \theta = \pi \quad \Rightarrow \quad \text{speed } 2r \end{aligned}

The centre moves at speed rr; the top of a rolling wheel moves twice as fast and the contact point is momentarily at rest.

Exercise 4: When does a Lissajous curve close?

The curve x=sin⁡(3t)x = \sin(3t), y=sin⁡(5t)y = \sin(5t) is periodic. Find its smallest period numerically by checking which multiples of π/4\pi/4 bring both coordinates and both velocities back to their starting values, then explain the result.

Answer

2π2\pi

Solution

sin⁡(3t)\sin(3t) has period 2π/32\pi/3 and sin⁡(5t)\sin(5t) period 2π/52\pi/5; the curve's period is the least common multiple, 2π2\pi.

python · try it yourself
import math

def state(t):
    return (math.sin(3*t), math.sin(5*t), 3*math.cos(3*t), 5*math.cos(5*t))

s0 = state(0)
for k in range(1, 17):
    T = k * math.pi / 4
    if all(abs(a - b) < 1e-9 for a, b in zip(state(T), s0)):
        print(f"smallest period found: {k}π/4 = {T:.4f}")
        break
smallest period found: 8π/4 = 6.2832

Test yourself

Which parametrisation traces the unit circle clockwise?

  1. (cos⁡t,sin⁡t)(\cos t, \sin t)
  2. (cos⁡2t,sin⁡2t)(\cos 2t, \sin 2t)
  3. (sin⁡t,cos⁡t)(\sin t, \cos t)
  4. (−cos⁡t,−sin⁡t)(-\cos t, -\sin t)

The curve x=t2x = t^2, y=t3y = t^3 has a cusp at the origin because…

  1. t2t^2 is not differentiable
  2. Its velocity (2t,3t2)(2t, 3t^2) is zero at t=0t = 0, so the point can stop and turn
  3. It is a circle
  4. It is not a function

In a particle system, why evaluate p(t)=p0+v0t+12gt2p(t) = p_0 + v_0 t + \tfrac{1}{2}gt^2 instead of integrating velocity every frame?

  1. It is exact and independent of frame rate, and easy to run in a shader
  2. It uses less memory for textures
  3. It makes particles collide
  4. It is required by OpenGL