Geometry

The Hypotrochoid: The Math Behind the Spirograph

The Hypotrochoid is the looping, flower-like curve you get from a Spirograph: fix a pen at distance d from the center of a small disc of radius r, let that disc roll without slipping around the inside of a large fixed ring of radius R, and trace where the pen goes. What makes it remarkable is that a single number — the ratio R/r — dictates everything: whether the pattern is a tidy rosette of a few petals or a tangle of hundreds, and whether it ever closes at all. If R/r is a simple fraction the curve snaps shut into a symmetric flower; if it is irrational the pen wanders forever, never repeating, slowly shading in an entire ring.

  • Parametric formx = (R−r)cos t + d·cos((R−r)/r · t)
  • Closure ruleR/r = p/q (lowest terms) → p petals, closes in q laps
  • AstroidR/r = 4 (4 cusps)
  • DeltoidR/r = 3 (3 cusps)
  • Tusi coupleR/r = 2 → straight line (al-Tusi, ~1247)
  • Spirograph toyDenys Fisher, 1965

Interactive visualization

Press play, or step through manually. The visualization is yours to drive — try it before reading on.

Open visualization fullscreen ↗

Watch the 60-second explainer

A condensed visual walkthrough — narrated, captioned, under a minute.

The construction: a wheel inside a wheel

Take a large circle of radius R and hold it fixed. Inside it, roll a smaller circle of radius r so that its rim stays in contact with the big circle and never slips. Now attach a pen rigidly to the small circle at some distance d from its center — like the hole in a Spirograph wheel — and watch the ink. The trail is a hypotrochoid (from Greek hypo-, “under, inside,” and trochos, “wheel”). Three numbers fix the design completely: the fixed radius R, the rolling radius r, and the pen offset d.

Because the rolling circle stays inside, the center of the small disc can never reach the boundary; it is pinned to a circle of radius R − r about the middle. The pen sits a further distance d out from that moving center, so its distance from the origin oscillates between a minimum of |(R − r) − d| and a maximum of (R − r) + d. Every hypotrochoid therefore lives inside a fixed annulus (a ring) with those inner and outer radii — the pen can never escape it, and when d = r it just grazes the outer circle of radius R.

The parametric equations and the frequency ratio

Let t be the angle of the small circle's center as seen from the middle. That center sits at ((R − r)cos t, (R − r)sin t). The subtle part is how fast the small disc spins about its own axis. Rolling without slipping means the arc length swept along the big circle equals the arc rolled off the small one: advancing the center by angle t drags the contact point through arc R t, which must equal r times the disc's rotation relative to the line joining the two centers. That forces the spin frequency to be (R − r)/r, turning in the retrograde sense. The pen's position is the moving center plus the spinning arm:

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

Written with complex numbers this is startlingly clean: z(t) = x + iy = (R − r) ei t + d e−i ((R−r)/r) t. It is a sum of two rotating arrows — one long, slow phasor for the center and one short, fast phasor (spinning the opposite way) for the pen. That is exactly the language of epicycles and of a two-term Fourier series, a point we return to below.

When does it close? The rational-ratio theorem

Does the pen ever return to its start and retrace its own path? Write the ratio in lowest terms, R/r = p/q, with p and q sharing no common factor. The two phasors have frequencies 1 and (R − r)/r = (p − q)/q. The whole curve repeats only when the parameter t has advanced through a whole number of turns of both phasors at once — their least common value. Because gcd(p, q) = 1, a short calculation shows the curve first closes at t = 2πq: the rolling circle must make exactly q full laps around the inside before the ink meets itself.

The finished figure has a beautiful symmetry. Shifting the parameter by 2πq/p rotates the entire curve by the same angle, so the pattern is invariant under rotation by 2π/p — a rosette with exactly p petals (or cusps). A classic Spirograph pairs a 96-tooth ring with a 36-tooth wheel: R/r = 96/36 = 8/3, so the pen sweeps out an eight-lobed star and closes after three trips around. Switch to 90/36 = 5/2 and you get a five-petal flower in two laps. The smaller the reduced denominator q, the faster and simpler the pattern; a large q means many laps and a dense, busy figure.

Irrational ratios: curves that never close

If R/r cannot be written as a fraction — if it is irrational — the two frequencies are incommensurate and the pen never returns to its start. The curve is an open path that keeps threading new gaps between old strokes. By Weyl's equidistribution theorem, the successive turning angles behave like an irrational rotation of a circle: they are not merely dense but uniformly spread, so given enough time the pen shades the entire annulus evenly, coming arbitrarily close to every point in it. In dynamical terms the motion is a straight-line flow on a torus, and an irrational slope makes every orbit dense.

How quickly an irrational ratio “almost” closes is governed by continued fractions: rational approximations p/q with small q produce near-repeats that look like a slightly blurred p-petal rosette. Ratios that are hard to approximate close very reluctantly. The hardest of all is the golden ratio φ ≈ 1.618, whose continued fraction is all 1s — a Spirograph tuned to R/r = φ produces the most stubbornly non-repeating, most uniformly filled pattern of any ratio, the same “most irrational” number that governs optimal seed packing in sunflowers and phyllotaxis.

Special cases: hypocycloid, astroid, deltoid, the Tusi couple

Setting d = r — pen exactly on the rolling rim — gives the hypocycloid. Here something sharp happens: at the p contact points the pen momentarily sits on the instantaneous center of rotation, where its speed drops to zero, so the smooth loops pinch into cusps that touch the outer circle. Two are famous. For R/r = 4 the equations collapse (via the identities for cos 3t and sin 3t) to x = R cos3t, y = R sin3t — the four-cusped astroid, x2/3 + y2/3 = R2/3, with perimeter 6R and enclosed area (3/8)πR2. It is also the envelope of a ladder of length R sliding down a wall. For R/r = 3 you get the three-cusped deltoid, or Steiner curve, which turns up in the caustics of light and in Morley's triangle.

The most surprising special case is R/r = 2. Then R − r = r, the spin frequency equals 1, and the two phasors cancel in one coordinate: a rim point traces a perfectly straight line — a full diameter of the big circle, swept back and forth. This is the Tusi couple, described by the Persian astronomer Nasir al-Din al-Tusi around 1247 as a way to build straight-line motion out of two circular motions, a device he used to reform Ptolemy's planetary models centuries before the Spirograph existed.

Epicycles, gears, and the Spirograph

The complex form z(t) = (R − r) ei t + d e−i ωt reveals the hypotrochoid's deepest kinship: it is a two-term epicyclic motion, a big “deferent” circle carrying a small “epicycle,” precisely the machinery Ptolemy and Copernicus used to model planetary orbits — and the first two terms of a Fourier series that draws a shape with rotating vectors. Add more circles, each a term of the series, and you can trace any closed curve at all; the modern “Fourier epicycle” animations that draw portraits are simply hypotrochoids with extra rotating arms.

The same curves are everywhere in engineering. Roll the small circle on the outside of the fixed one instead and you get the epitrochoid; the combustion-chamber housing of the Wankel rotary engine is exactly a two-lobed epitrochoid. Cycloidal curves shape gear-tooth flanks (cycloidal gearing, proposed for clock gears by Ole Rømer in 1674) and the eccentric discs of cycloidal-drive speed reducers. And in 1965 the British engineer Denys Fisher packaged the whole family of hypotrochoids into a toy of plastic rings and wheels — the Spirograph — turning a theorem about incommensurate frequencies into millions of drawings.

The roulette family: curves traced by a pen fixed to one circle rolling on another. R = fixed radius, r = rolling radius, d = pen offset.
CurveRolling circlePen offset dSignature examples
HypotrochoidRolls inside the fixed circled ≠ r (off-center)Spirograph rosettes
HypocycloidRolls inside, pen on the rimd = rAstroid (R/r=4), deltoid (R/r=3), Tusi line (R/r=2)
EpitrochoidRolls outside the fixed circled ≠ r (off-center)Wankel rotary-engine chamber
EpicycloidRolls outside, pen on the rimd = rCardioid (R=r), nephroid (R=2r)
CycloidRolls along a straight lined = rBrachistochrone / tautochrone

Frequently asked questions

What is the difference between a hypotrochoid and a hypocycloid?

A hypocycloid is the special hypotrochoid where the pen sits exactly on the rolling circle's rim, so d = r; it has sharp cusps that touch the outer circle. Any other pen offset gives a general hypotrochoid, whose lobes are smooth when d < r and become self-crossing loops when d > r.

How do I know how many petals my Spirograph pattern will have?

Reduce the ratio of the ring's teeth to the wheel's teeth to lowest terms, p/q. The pattern then has exactly p petals and finishes after q laps around the ring. A 96-tooth ring with a 36-tooth wheel gives 96/36 = 8/3, so 8 petals in 3 laps.

Why do some Spirograph patterns never seem to line up?

If the tooth ratio does not reduce to a small fraction, or is effectively irrational, the curve never exactly closes. It keeps laying down slightly shifted copies of itself that gradually fill a ring, which the eye reads as a dense, shimmering band rather than a crisp flower.

Does the pen offset d change the number of petals?

No. The petal count depends only on the ratio R/r. Changing d reshapes each lobe — making it pointier, rounder, or looped — and changes the width of the ring the curve occupies, but it never changes how many lobes there are or how many laps it takes to close.

What exactly are the astroid and the deltoid?

They are the hypocycloids for R/r = 4 and R/r = 3, with four and three cusps respectively. The astroid satisfies x^(2/3) + y^(2/3) = R^(2/3) and is the envelope traced by a sliding ladder; the deltoid, or Steiner curve, appears in optical caustics and in the geometry of Morley's triangle.

How is the hypotrochoid related to Fourier series and epicycles?

The curve is a sum of two rotating vectors of different speeds — the deferent-and-epicycle model of ancient astronomy and the first two terms of a Fourier series. Adding more rotating vectors lets you trace any closed curve, which is why the popular “Fourier drawing” animations are really just elaborate spirographs.