Spirograph — Hypotrochoids & Epitrochoids

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.

Frequently Asked Questions

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.

When does a spirograph curve close?

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.

What is a cardioid and how is it related?

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.

What is a rose curve and how do I get one?

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.

What mathematics underpins the spirograph?

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.

Why does GCD matter for spirograph patterns?

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.

What happens when the pen distance d is larger than r?

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.

Are spirograph curves related to Lissajous figures?

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.

About this simulation

Written by MySimulator Team · Reviewed by MySimulator Editorial Review

Last updated: 5 July 2026

This simulation is a digital spirograph: it plots the path traced by a pen mounted on a small circle of radius r that rolls, without slipping, either inside or outside a larger fixed circle of radius R. The pen sits a distance d from the rolling circle's centre. Whilst the mechanics are simple, the resulting hypotrochoid and epitrochoid curves range from tidy roses and stars to the heart-shaped cardioid, all governed by a handful of parametric equations updated live as you drag the sliders.

🔬 What it shows

Two families of roulette curves. In Hypotrochoid mode the small circle rolls inside the fixed ring, giving x(t) = (R−r)cos(t) + d·cos((R−r)/r·t); in Epitrochoid mode it rolls outside, giving x(t) = (R+r)cos(t) − d·cos((R+r)/r·t), with the matching sine term for y(t). Setting r = R and d = r in Epitrochoid mode produces a true cardioid, and the drawing always closes after a period of 2π·r/gcd(R, r).

🎮 How to use

Toggle Hypotrochoid / Epitrochoid to switch rolling mode, then drag Outer radius R (50–200), Rolling radius r (5–100) and Pen offset d (1–200) to reshape the curve. Draw speed (1–20) sets how many angle steps are plotted per frame, and Hue shift (0–360°) rotates the stroke colour. Pause/Play freezes the drawing, Reset clears the canvas and redraws from t = 0, and Info opens a panel with the full equations.

💡 Did you know?

When the radius ratio R/r is exactly 2, a hypotrochoid degenerates into a straight line segment — the pen appears to move back and forth through the centre, even though it is still following the same rolling-circle equations that produce loops elsewhere.

Frequently asked questions

What is the difference between a hypotrochoid and an epitrochoid?

A hypotrochoid is traced by a circle rolling inside a fixed ring, using 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). An epitrochoid is traced by a circle rolling outside a fixed circle, using the same form with plus signs: x(t) = (R+r)cos(t) − d·cos((R+r)/r·t). Switching between the two changes which side of R the rolling circle sits on.

How do I draw a cardioid with this tool?

Switch to Epitrochoid mode, then set the rolling radius r equal to the outer radius R and set the pen offset d equal to r as well. With r = R and d = r the epitrochoid equations simplify to the classic cardioid, the heart-shaped curve also seen in microphone pickup patterns and the main bulb of the Mandelbrot set.

Why does the curve sometimes never quite close?

The drawing repeats after a period of 2π·r/gcd(R, r) in the parameter t. If R and r share a large common factor the curve closes quickly with few loops; if their greatest common divisor is small, the pen must sweep round many more times before the pattern joins back onto itself.

What controls the number of petals in a rose-like pattern?

Rose-like hypotrochoids appear when the pen offset d equals R − r and r divides evenly into R. The petal count then equals R/r when that ratio is odd, or twice R/r when it is even. Try R = 120, r = 40 and d = 80 for a clean three-petal rose.

What happens if I set the pen offset d larger than the rolling radius r?

When d exceeds r the pen sits beyond the edge of the rolling circle, so the traced curve grows extra loops instead of staying smooth. When d equals r the curve passes cleanly through the centre of the rolling path, and when d is smaller than r the whole curve stays within a narrow ring around radius R − r.