Introduction

If you grew up with a Spirograph set, you know the ritual: place a toothed ring on the paper, fit a smaller gear inside, push a pen through one of its holes, and roll. The result is a looping, petal-covered curve that looks far too elegant to come out of a toy.

What you were really doing is tracing a hypotrochoid — the path swept by a point attached to a circle that rolls inside a larger circle. Every loop, every petal, every gap in the design follows directly from two numbers: the radius of the outer ring and the radius of the rolling gear.

The ratio of those two numbers — whether it reduces to 35\frac{3}{5} or 712\frac{7}{12} or 14\frac{1}{4} — decides how many petals appear, how many full rotations the pen makes before returning to the start, and whether it ever returns at all. This article unpacks that arithmetic so the next time you watch a Spirograph fill the page you can read it like a clock.

Draw Your Own

Drag the sliders to choose the outer radius RR and the inner radius rr, then watch the hypotrochoid draw itself in real time. The pen offset dd moves the tracing point closer to or farther from the centre of the rolling gear — try extreme values for looped vs pointy petals.

<!-- {{c_html_comment}} -->
<div class="controls">
  <label>{{label_R}} <span id="R-val">9</span>
    <input type="range" id="R-range" min="3" max="12" value="9" step="1">
  </label>
  <label>{{label_r}} <span id="r-val">4</span>
    <input type="range" id="r-range" min="1" max="11" value="4" step="1">
  </label>
  <label>{{label_d}} <span id="d-val">3.5</span>
    <input type="range" id="d-range" min="0.5" max="6" value="3.5" step="0.5">
  </label>
</div>
<canvas id="canvas" width="340" height="280" aria-label="{{canvas_aria}}"></canvas>
<div id="info" class="info">{{info_default}}</div>
<div class="btns">
  <button id="btn-animate" type="button">{{btn_draw}}</button>
  <button id="btn-reset" type="button" class="ghost">{{btn_reset}}</button>
</div>
/* {{c_css_comment}} */
* { box-sizing: border-box; }
body { font-family: system-ui, sans-serif; color: #222; margin: 0; padding: .6rem; }
.controls { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .6rem; }
label { font-size: .85rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
label span { font-weight: 700; min-width: 2.5ch; text-align: right; color: #1d3557; }
input[type=range] { flex: 1; min-width: 120px; accent-color: #1d3557; }
canvas { display: block; border: 1px solid #cdd9e3; border-radius: 8px; background: #f7f9fc;
         max-width: 100%; }
.info { font-size: .88rem; color: #444; margin: .5rem 0; min-height: 1.3em; }
.info strong { color: #1d3557; }
.btns { display: flex; gap: .5rem; flex-wrap: wrap; }
button { font: 600 14px system-ui, sans-serif; padding: .45rem .9rem; border: 1px solid #1d3557;
         background: #1d3557; color: #fff; border-radius: 8px; cursor: pointer; }
button.ghost { background: #fff; color: #1d3557; }
// Code not found

Notice that the curve closes — returns exactly to where it started — only when Rr\frac{R}{r} is a rational number, which it always is for whole-number gear sizes. When R/r=p/qR/r = p/q in lowest terms, the curve needs exactly pp full turns of the outer circle (equivalently qq full rotations of the inner gear) to close, and it draws exactly Rr/gcd(R,r)|R - r|/\gcd(R, r) lobes. Try R=5,r=3R = 5, r = 3 for two lobes; R=7,r=3R = 7, r = 3 for four lobes; R=9,r=4R = 9, r = 4 for a star-like five-pointed figure.

The Real Maths

The parametric equations of a hypotrochoid with outer radius RR, inner radius rr, and pen offset dd are:

x(t)=(Rr)cost+dcos ⁣(Rrrt)x(t) = (R - r)\cos t + d\cos\!\left(\frac{R-r}{r}\,t\right)

y(t)=(Rr)sintdsin ⁣(Rrrt)y(t) = (R - r)\sin t - d\sin\!\left(\frac{R-r}{r}\,t\right)

where tt advances as the inner circle rolls. Three facts follow purely from arithmetic:

  • Closing condition. The curve closes after t=2πkt = 2\pi k for the smallest integer kk such that k(Rr)/rk \cdot (R-r)/r is also an integer. Writing R/r=p/qR/r = p/q in lowest terms (so gcd(p,q)=1\gcd(p,q) = 1), the curve closes after exactly k=qk = q turns of the outer arc, which equals pp full rotations of the inner gear.
  • Petal count. The number of distinct lobes equals pq=(Rr)/gcd(R,r)p - q = (R - r)/\gcd(R, r). With R=9,r=4R = 9, r = 4 we get gcd(9,4)=1\gcd(9,4)=1, so p=9,q=4p = 9, q = 4, giving 94=59 - 4 = 5 petals — matching the star you see in the demo.
  • Period. The total arc length traced before closing is 2πlcm(R,r)/r2\pi \cdot \text{lcm}(R, r) / r, because lcm(R,r)=Rr/gcd(R,r)\text{lcm}(R,r) = Rr/\gcd(R,r).

All three facts reduce to the same two operations: greatest common divisor and least common multiple — elementary number theory that any calculator can compute, yet powerful enough to generate an infinite family of distinct symmetric curves. The same GCD/LCM reasoning appears throughout discrete mathematics and even in modular arithmetic.

Where It Matters

The mathematics of rolling circles is not confined to toy boxes:

  • Wankel rotary engine: the rotor inside a Wankel engine traces an almost-hypotrochoid (technically an epitrochoid). The three-lobe shape follows directly from the gear ratio between the rotor and the eccentric shaft — the same arithmetic as the demo above.
  • Gear design and hobbing: the involute profiles used on most modern gear teeth are limiting cases of roulette curves; choosing the pressure angle is choosing a point on a rolling circle.
  • Antenna arrays: phased arrays and mechanically steered antennas exploit the fact that a point on a rolling circle sweeps predictable angular velocities — useful when designing scanning patterns.
  • Computer graphics and fonts: PostScript and TrueType bezier curves approximate roulettes to render smooth circular arcs efficiently; the same parametric thinking drives path-animation tools in SVG and CSS.
  • Orbital mechanics: epicyclic models of planetary motion (Ptolemy's deferents and epicycles) are exactly roulette curves — the Greeks had the geometry right, only the physics wrong.

Whenever you need a curve that is almost circular but richer, closed but not a circle, symmetric but varied, a rolling-circle roulette is the first tool to reach for.

Conclusion

A Spirograph looks like magic — a mechanical pen tracing intricate flowers without a single conscious decision about where to go. But the design was always completely determined: by the ratio R/rR/r, reduced to lowest terms, the number of petals was fixed before the first tooth engaged.

That is the deeper lesson. The GCD of two integers is one of the simplest things in mathematics, yet it controls the entire symmetry group of the resulting curve. Add the constraint that both radii must be whole numbers and you get a discrete family of patterns — infinitely many, but not all patterns are reachable. The gaps between reachable patterns are just as interesting as the curves themselves.

If you want to keep exploring, try the same reasoning with a circle rolling outside another (an epicycloid — the path that draws a cardioid or nephroid), or ask what happens when d>rd > r, pushing the pen beyond the rolling circle's edge. The arithmetic stays the same; only the shape changes.

Share this article

Pick a channel — or use your device's native share sheet.

Comments

Loading comments...

https://www.kipuhub.com/en/article/spirograph-roulettes/Content licensed under CC BY-NC 4.0.