HomeArticlesMathematics

Spirograph: The Mathematics of Rolling Circles

A childhood toy's petalled patterns connect gear ratios, greatest common divisors, and Fourier series in one unified picture.

mysimulator teamUpdated July 2026≈ 8 min read▶ Open the simulation

From cycloids to hypotrochoids

Roll a circle along a straight line and a point on its rim traces a cycloid — famous as the brachistochrone (fastest descent curve) and tautochrone (equal-time curve, Huygens 1659). Roll that circle inside a fixed outer circle instead and you get a hypocycloid, with cusps whenever R/r is an integer: R/r=3 gives a deltoid, R/r=4 gives the astroid (x^(2/3)+y^(2/3)=R^(2/3)). Move the tracing point off the rim to distance d from the rolling circle's centre and the hypocycloid generalises to a hypotrochoid — d<r gives smooth rounded petals, d>r gives self-intersecting loops. This is exactly the curve the 1965 Spirograph® toy draws.

Petal counting with the GCD

How many petals does a spirograph curve have? Reduce k = R/r to lowest terms p/q, where gcd(p,q)=1. A hypotrochoid (rolling inside) produces p − q petals; an epitrochoid — rolling outside the fixed circle, the family that includes the cardioid (R/r=1) and nephroid (R/r=2) — produces p + q petals. Given R=60, r=24, gcd=12, so the ratio reduces to 5/2, producing 5−2 = 3 petals; R=60, r=16 gives ratio 15/4 and 11 petals. This is why real Spirograph gears print their tooth counts — the pattern is fully predictable before you draw it.

x(t) = (R−r)·cos(t) + d·cos((R−r)t/r)
y(t) = (R−r)·sin(t) − d·sin((R−r)t/r)

Reduce R/r = p/q, gcd(p,q)=1:
  hypotrochoid petals = p − q      epitrochoid petals = p + q
  full period: t goes from 0 to 2π·p

Lissajous figures: the R → ∞ limit

As the outer radius R grows toward infinity while r stays fixed, rolling inside a circle locally approximates rolling along a line, and the hypotrochoid becomes a Lissajous figure — x(t)=A·sin(at+δ), y(t)=B·sin(bt), the curve seen on an oscilloscope when two sinusoidal voltages drive the X and Y deflection plates. A frequency ratio a/b of 1 with a quarter-turn phase gives a circle; 2:1 gives a figure-eight. Just like a spirograph, a Lissajous curve only closes if a/b is rational — both are two circular (or oscillatory) motions superposed.

Fourier epicycles: any curve from circles

A spirograph combines exactly two circular motions. Fourier epicycles generalise this to any number of circles: z(t) = Σ cₙ·e^(inωt), where each term is a circle of radius |cₙ| rotating at rate n, and the coefficients cₙ are the Discrete Fourier Transform of a target curve sampled at N points. Chain fifty or so of these rotating arms together and the tip traces almost any closed shape — a portrait, a national border, a handwritten letter — the same mathematics as decomposing a sound wave into frequency components, applied to a 2D curve instead of a 1D signal.

Frequently asked questions

How many petals will a spirograph curve have?

Reduce the gear ratio R/r to lowest terms p/q, where gcd(p,q) = 1. An inner hypotrochoid (pen distance less than the rolling gear's radius) produces p − q petals; an epitrochoid (rolling outside) produces p + q petals. For example R=60, r=24 reduces to 5/2, giving 5 − 2 = 3 petals for a hypotrochoid.

What is the difference between a hypotrochoid and a hypocycloid?

Both come from a circle rolling inside a fixed outer circle. A hypocycloid traces a point exactly on the rim of the rolling circle, producing cusps — for example the 4-cusped astroid. A hypotrochoid generalises this by placing the tracing point at any distance d from the centre: d < r gives smooth rounded petals (the classic Spirograph look), and d > r gives self-intersecting loops.

What are Fourier epicycles and how do they relate to spirographs?

A spirograph curve combines two circular motions — one of radius (R−r) and one of radius d. Fourier epicycles generalise this to a chain of any number of rotating circles, each with radius |cn| and rate n, computed from the Discrete Fourier Transform of a target curve. With enough circles in the chain, the tip can trace almost any closed shape, not just algebraic spirograph curves.

Try it live

Everything above runs in your browser — open Spirograph and drag the R, r, and d sliders to watch hypotrochoid and epitrochoid patterns build in real time. Nothing is installed, nothing is uploaded.

▶ Open Spirograph simulation

What did you find?

Add reproduction steps (optional)