A spirograph draws beautiful mathematical curves by rolling a circle inside or outside a fixed circle. The pen is attached at some distance from the rolling circle's centre, tracing out a parametric path called a hypotrochoid (inner rolling) or epitrochoid (outer rolling).
2π · r / gcd(R, r).Hypotrochoid (inner rolling):
x(t) = (R−r)·cos(t) + d·cos((R−r)/r · t)
y(t) = (R−r)·sin(t) − d·sin((R−r)/r · t)
Epitrochoid (outer rolling):
x(t) = (R+r)·cos(t) − d·cos((R+r)/r · t)
y(t) = (R+r)·sin(t) − d·sin((R+r)/r · t)
Period: T = 2π · r / gcd(R, r)
When R = 2r in a hypotrochoid, the rolling circle fits inside the fixed circle exactly twice, and the pen traces a straight-line diameter — seemingly impossible from a mechanical toy! Setting r = R and d = r in epitrochoid mode gives a cardioid, the iconic heart-shaped curve found in the Mandelbrot set's main bulb and in coffee-cup caustics.
Explore parametric rolling-circle curves interactively. A hypotrochoid is traced when a small circle rolls inside a fixed ring; an epitrochoid when it rolls outside. By adjusting the outer radius R, rolling radius r, and pen offset d, you can produce an endless variety of roses, stars, looping petals, and the famous cardioid — all from one simple mechanical principle.
What is a hypotrochoid?
A hypotrochoid is a curve traced by a point attached to a small circle rolling inside a larger fixed circle. The parametric equations are x(t) = (R−r)cos(t) + d·cos((R−r)/r · t) and y(t) = (R−r)sin(t) − d·sin((R−r)/r · t), where R is the outer radius, r the rolling circle radius, and d the pen distance from the rolling circle's centre.
What is an epitrochoid?
An epitrochoid is traced by a point on a circle rolling outside a fixed circle. Its equations are x(t) = (R+r)cos(t) − d·cos((R+r)/r · t) and y(t) = (R+r)sin(t) − d·sin((R+r)/r · t). Famous examples include the cardioid (d = r, r = R) and the limaçon.
How does a spirograph toy work?
A spirograph toy uses toothed plastic rings and gears. A smaller gear is placed inside (or outside) the fixed ring, and a pen is inserted in one of the holes. As the gear rolls around, the pen traces a hypotrochoid or epitrochoid. The ratio R/r and the hole position d determine the pattern.
The curve closes after a full period of 2π · r / gcd(R, r) in t, which corresponds to r / gcd(R, r) full rotations of the rolling circle and R / gcd(R, r) trips around the fixed circle. If R/r is irrational the curve never exactly closes and fills an annulus densely.
A cardioid is an epitrochoid with r = R and d = r. Its name comes from the Greek word for heart. It appears in many physical contexts: the microphone pickup pattern, the boundary of the main bulb of the Mandelbrot set, and in optics as a caustic in a coffee cup.
A rose curve (rhodonea) appears when d = R − r (the pen is on the circumference of the rolling circle) and r divides R. The number of petals equals R/r if R/r is odd, or 2R/r if R/r is even. Try R = 120, r = 40, d = 80 for a three-petal rose.
Spirograph curves are Fourier epicycles in disguise: each sinusoidal term in the parametric sum corresponds to one harmonic frequency. Hypotrochoids and epitrochoids are also special cases of Roulettes — curves generated by rolling one curve along another — studied by Euler and Bernoulli.
The greatest common divisor (GCD) of R and r determines the curve's period. Only the reduced ratio (R − r)/r matters for the shape. Curves with the same ratio but different absolute radii look identical. A GCD of 1 means the smallest gear must make R revolutions before the pattern repeats.
When d > r the pen extends beyond the rolling circle's edge, producing looping or prolate curves with inner loops. For hypotrochoids with d > r the curve can extend outside the fixed ring region. When d = r the curve passes through the centre of the rolling path, and when d < r the curve stays within the annulus between radii |R−r−d| and R−r+d.
Both are parametric curves with sinusoidal components but differ in structure. Lissajous figures use x = A·sin(at + δ), y = B·sin(bt) with independent amplitudes and frequencies, while spirograph curves couple amplitude and frequency through the rolling geometry. When R/r = 2 the hypotrochoid degenerates into a straight line, a degenerate Lissajous, showing the deep connection.