You're reading: Blackboard Bold

The Mathematics of Spirograph

Travel Spirograph kit, with blue and red pens

If you’re the kind of person who’s interested in doodling and/or fun toys, you might have encountered the fun doodling toy Spirograph, or some unbranded equivalent. It sits somewhere on the continuum between an artistic drawing tool and a neat mathematical gadget.

If you’re not familiar, the apparatus involves a plastic cog, placed inside a circular hole with teeth, which has holes in it to place a pen/pencil through. Placing a pen in one of the holes and moving it around allows you to draw interesting patterns – the teeth of the circle and teeth on the cog will mesh to make the circle move and turn at the same time, and with the right pressure applied in the right direction, you can roll it around the inside of the circle, making interesting shapes.

While many will have played with it and produced some interesting patterns, and presumably also had a vague sense that some maths is happening, I suspect many won’t have thought about it too hard. I certainly didn’t, until recently when someone gave me a mini-Spirograph kit as a gift. This inspired me to dig a little deeper into how this thing works, and what kind of shapes you can make with it.

Looping the loop

The first thing to notice is that any line you draw with a Spirograph will eventually join back onto itself. Assuming you don’t mess up while drawing, or move the pen in a way that isn’t constrained by the motion of the cog moving around the outside of the hole, they will eventually match up. This is because the number of teeth on the cog, and the number of teeth on the hole, are both (hopefully) finite whole numbers, so there’s only a finite number of places and orientations the cog can be in. Eventually, you’ll end up with the pen in the same spot you started with, even if it takes a lot of goes around the circle.

In its simplest form, Spirograph consists of a circle moving around inside another circle. This means its motion can be predicted, and the line you get will, or may, depend on a few factors:

  • The relative sizes of the big and small circles
  • Where inside the small circle the pen-hole is
  • Where the small circle starts off inside the large circle.

After a little more thought, it becomes apparent that the last of these is irrelevant – if you start with the small circle elsewhere in the big circle, and keep everything else the same, you’ll end up with the same design – possibly rotated around to a different angle; the main effect of moving where the small circle starts is to change how far through the motion you are when you start, and since the line joins up to itself, you can start from anywhere and draw the whole thing.

The second one of these – where inside the small circle the pen-hole is – is also a bit more information than we need. Since the orientation of the small circle will change as it goes round the big circle, the only thing that matters about the position of the pen is how far away from the centre it is. That is, if you have two holes on the cog which are the same distance from the centre of the cog, they’ll both draw the same pattern, even if you start from the same place – again, it just might be rotated around, as you’ll be starting from a different point along the line.

So our actual important factors are:

  • The distance from the centre of the cog to the pen-hole, which we’ll call $p$
  • The relative sizes of the big hole and the cog – let’s call their radiuses $R$ and $r$.

Simple cases

One way to try to make sense of something complex is to pick a thing to simplify, and see what happens. Let’s consider our first variable – pen-hole distance from the centre of the cog, $p$. One way to simplify this would be to make the pen-hole distance $p = 0$ – that is, put our pen at the centre of the cog, so when the cog turns as it goes round the circle, the pen doesn’t move relative to the small circle.

Diagram showing the single circle drawn by placing the pen at the centre of the cog

This would result in a spirograph drawing that was just a single circle, centred at the centre of the big hole. The radius of this circle would be the radius of the big hole minus the radius of the cog, as the pen-hole stays a fixed distance away from the outside edge of the big hole.

If we vary this slightly – bring the pen slightly away from the centre of the cog – the range of movement will still be almost a circle – it’ll be restricted to an annulus of points around the centre, and form a wavy line – and you go round enough times so the lines overlap a lot, it’ll just look like a thick band.

What about the other extreme? If the pen-hole were somehow on the very edge of the cog ($p = r$), assuming doing that wouldn’t interfere with the mechanism? In that case, the shape it draws is called a hypocycloid – a set of curves which bounce off the outside edge of the circle, moving in towards the middle then back out to the edge. These shapes look like curved pointed stars. You might wonder what determines how many points the star has – we’ll come back to that later.

Hypocycloids animation made in Geogebra, based on one from Wolfram Mathworld


These are the simple cases. Let’s make it more interesting! What happens if the pen-hole isn’t in the centre, or at the edge, of the cog? Then the motion will depend on the values of $p$ and $r/R$.

There’s one special case to consider, which is when the small circle is exactly half the size of the big one: $R=2r$. In this case, it’ll roll around the inside and complete one full turn as it does so. This means the pen-hole will consistently be closer to the edge at the sides of the big hole, and further away at the top and bottom: the pen-hole will trace out an ellipse shape. This happens because the small circle completes a full turn every time it rolls around, and so the line matches back up again straight away. The value of $p$ determines how pointy the ellipse is. (They don’t tend to include cogs of this size with Spirograph kits, as people would probably complain they’re boring.)

So what about the general case? When you have $0 < p < r$, and the relative sizes of the two circles are something interesting? Well, there’ll still be limits on where your pen can draw. The pen-hole will remain a fixed distance away from the centre of the cog; as the cog moves around the circle, the pen-hole will never be closer to the outside or the centre of the big hole than $r-p$, meaning all of its motion will occur in an annulus of width $2p$ around the centre.

Depending on the relative circle sizes and the pen-hole distance, you’ll get various different types of shape – some closer to the pointy hypocycloid, and some closer to a circle; when the hole is near to, but not on the edge, the pointy ends become thin loops; when the hole is close to, but not at the centre, it’s like drawing a circle but slightly missing where you started, so you get something fairly smooth but that wiggles in and out from the centre gently.

A range of spirograph drawings using different holes on the same cog
Spirograph drawings from the outside hole to the middle hole, on the same size cog

These types of shapes are called hypotrochoids, and they can range from pointy to smooth. (The hypocycloid above is a special case of a hypotrochoid, as is the circle, for extreme values of $p$). They can also have different numbers of points, depending on your relative circle sizes (although, as discussed, pointiness may vary). In fact, one way to classify these is by their symmetry.

How many points?

Any Spirograph image will have rotational symmetry – that is, you can turn it through an angle and get the same shape. The degree of the rotation tells you how many times you can do this before you’re just turning it all the way round (or, what fraction of 360 degrees the smallest angle you turn it through and get the same thing is). For instance, an equilateral triangle has rotational symmetry of degree (or, order) 3.

The degree of symmetry your spirograph drawing has – whether it’s a pointy star or a smooth wavy thing – will depend on R and r, and in particular on the relationship between them, $\frac{r}{R}$. If you’d like to have a play with a Spirograph now, and try to work out what this relationship is, please do – I had a lot of fun counting teeth and playing with Geogebra animations to work it out.

One way to start might be to try simplifying again. A bad example of this would be to make the big circle and the small circle the same size: $R = r$. Since they’re gears, this would just mean it doesn’t turn. Maybe that’s too simple!

If the size of the small circle is a nice fixed fraction, say $R = 3r$, a third of the size of the big one, your drawing will have degree symmetry – a three-pointed star, or something with the symmetry of a triangle. If it’s a quarter ($R = 4r$), it’ll have square symmetry, and so on. So far, so simple.

If the two aren’t in a neat fractional ratio, say $R = \frac{7}{2} r$, you’ll find that the shape doesn’t join up the first time you get back to where you started. It’ll bounce off and keep going round, until you’ve done two full revolutions, and there’ll be a total of 7 lobes, or points, or whatever the repeated shape is.

In general, if you take the two values of $R$ and $r$ and write them in their lowest terms as a fraction $\frac{r}{R}$, the larger of the two numbers will be the degree of the symmetry. This is equivalent to taking the least common multiple of the two numbers $R$ and $r$, then dividing it by the larger one ($R$).

Since the circumference of a circle is just 2π times the radius, this also works if you take a fraction of the two numbers representing the circumference of the circles (the 2π on top and bottom cancels out). A measure of the circumference can actually be found by counting the number of teeth. So, if you have a big hole with $60$ teeth and a small cog with $20$ teeth, $20 / 60 = 2/6 = 1/3$, so the symmetry would have degree $3$; if they’re $65$ and $25$, that’s $5/13$ in lowest terms, so it’d have degree $13$.

Spirograph drawings using four different sizes of cog
For each size of cog, a different number of spokes emerges. These drawings used cogs with 40, 60, 52 and 80 teeth respectively. How many teeth does my spirograph hole have? (click to enlarge image)

Maths allows us to make predictions about what will happen, given a particular Spirograph cog and choice of pen-hole. Grab your nearest Spirograph or equivalent, make a prediction and check it works. And you’re welcome for this new fun game you can play with your already-excellent fun toy.

If you’d like to hear me chatting through some of this with Peter, you can listen to our Mathematical Objects podcast on the spirograph.

4 Responses to “The Mathematics of Spirograph”

  1. Avatar Andy

    There is also the curve generated from taking two small cogs and running one round the other, generating an epicycloid or epitrochoid.

    Other sets had hoop-shaped cogs with teeth on both sides for generating the epicycloid or epitrochoid curves using the outside of the cog rather than the inside:

    Or from that set, using one of the shapes that isn’t circular, like the long thin extended one, or the rugby-ball shaped cog.

  2. Avatar Drew

    Very interesting and informative! Thanks for your simple explanations and clear illustrations. A couple of small issues:
    1) Should it not be ‘R = 7/2 r’ in the 5th paragraph of the ‘How Many Points?’ section? Otherwise R < r
    2) In your final illustration, I believe your 52- and 60-tooth patterns are swapped if the outer gear is the same throughout.


(will not be published)

$\LaTeX$: You can use LaTeX in your comments. e.g. $ e^{\pi i} $ for inline maths; \[ e^{\pi i} \] for display-mode (on its own line) maths.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>