Introduction

images/Spirograph Examples.jpg

Spirographs are something we’ve played with since we were kids, with two gears inside of each other. After placing your pencil in one of the gears, you would rotate the inner gear along the inner edge of the outer gear.

An example is shown here:

images/Spirograph Example.png

There are two things we can change. We can ch2ange the number of teeth in the inner gear, and the distance from the center of the circle of the point where our pencil is located in the inner gear.

The first thing to note is that when the pencil is located at the center of the smaller gear, it would create a circle (obviously).

However, when we start increasing the radius of the pencil on the inner circle, we get a new type of diagram.

images/IncreaseRad1.png

Increasing the radius even more, we get

images/MaxRad2.png

In terms of intuition, it seems as though when the radius of pen at the inner gear increases, the spirograph becomes less circular and begins to form spokes.

Spokes

First, we can look at the number of spokes. We can define a spoke as one loop, and they are clearly distinct. Spokes also indicate another degree of symmetry.

The following example is a 32 tooth gear inside of a 96 toothed gear, with a variety of different inner radii, getting the following result.

images/Spokes.png

The most obvious trend is that there are three spokes (or three points on the edges of the triangle). Perhaps this could be due to the fact that 323=96.32 * 3 = 96.

We could continue looking at this with an inner-toothed gear with 6464 gears.

images/Gear72.png

This also had 33 spokes.

The next piece of intuition comes from the idea that 6496{96} is equal to 23⁠,{3}, which still has a denominator of 3.3.

We can generalize this to a formula saying that the number of loops or spikes or degrees of symmetry is equal to the lcm(r1⁠,r2)r2(r_1, r_2)}{r_2} where r1r_1 is the number of teeth in the outer gear and r2r_2 in the inner gear.

To explain this, note that each revolution of the inner gear creates a new loop. When the end of the new loop coincides with the beginning of the first loop, the rotation is complete. Then, imagine cutting open both of the circles and laying them flat on the same line. The number of times the inner gear repeats to make the outer gear is the number of revolutions.

Thus, we can guess at the shape of a spirograph based solely on the gear sizes.

Credit to https://nathanfriend.io/inspiral-web for the beginning diagrams.

Spirograph

First, note that the rotation matrix for plotting a circle based on the unit circle (so in a case where the inner radius is 00) would be

x=cos(θ)sin(θ)y=sin(θ)+cos(θ) x = \cos(\theta) - \sin(\theta) y = \sin(\theta) + \cos(\theta)

However, we want to plot a point on the inner circle, not the outer circle. As a result, we can multiply the values of xx and yy by their distance from the origin, which would be r1r2r_1 - r_2 from the below diagram.

images/Angle Diagram (1).png

So the system of equations for the smaller circle is x=(r1r2)(cos(ϕ)sin(ϕ))y=(r1r2)(sin(ϕ)+cos(ϕ)) x = (r_1 - r_2) \left( \cos(\phi) - \sin(\phi) \right) y = (r_1 - r_2) \left( \sin(\phi) + \cos(\phi) \right)

The pen is the red path drawn.

Further, when we look at just the inner gear, the pen is moving in a circle with angle ϕ.\phi. However, it is also moving around with radius r2r_2 relative to the center of the inner circle.

As a result, we can add in the inner movement of the first gear.

So, the new point’s parametric equations are xi=r2(cos(ϕ)sin(ϕ))yi=r2(sin(ϕ)+cos(ϕ)) x_i = r_2 \left( \cos(\phi) - \sin(\phi) \right) y_i = r_2 \left( \sin(\phi) + \cos(\phi) \right)

Then, we can subtract the second set of equations from the first to get the location of the pen;

x=(r1r2)(cos(θ)sin(θ))r2(cos(ϕ)sin(ϕ))y=(r1r2)(sin(θ)+cos(θ))+r2(sin(ϕ)+cos(ϕ)) x = (r_1 - r_2) \left(\cos(\theta) - \sin(\theta) \right) - r_2 \left( \cos(\phi) - \sin(\phi) \right) y = (r_1 - r_2)(\sin(\theta) + \cos(\theta)) + r_2 (\sin(\phi) + \cos(\phi))

To complete this, we want to find a way to relate θ\theta to ϕ⁠,\phi, where both are in terms of radians.

We can do that through noticing that the total distance travelled in terms of teeth for the inner gear and the outer gear is the same, or in other words, arcs A and B are the same length.

Thus, we can say that arc A, expressed as r1θ⁠,r_1 \theta, is equal to arc B, or r2(θ+ϕ).r_2 (\theta + \phi). We have to add θ\theta to the measurement of BB because the pen was not the only part that was moving, so was the gear itself.

Then, we have r1θ=r2(θ+ϕ)r_1 \theta = r_2 (\theta + \phi)

Or ϕ=r1r2r1θ \phi = {r_1} \theta

Now we can plug these in and we have parametric equations that represent spirographs!

x=(r1r2)(cos(θ)sin(θ))r2(cos(r1r2r1θ)sin(r1r2r1θ))y=(r1r2)(sin(θ)+cos(θ))+r2(sin(r1r2r1θ)+cos(r1r2r1θ)) x = (r_1 - r_2) (\cos(\theta) - \sin(\theta)) - r_2 \left( \cos\left({r_1} \theta \right) - \sin\left({r_1} \theta \right) \right) y = (r_1 - r_2) \left(\sin(\theta) + \cos(\theta) \right) + r_2 \left(\sin\left({r_1} \theta \right) + \cos\left({r_1} \theta \right) \right)

Now that we have our parametric equations, we can graph spirographs, as shown below.

images/Spirograph.png

Then, to simulate three gears, we can repeat the exact same process again.

Note that from the perspective of the inner gear in our two diagram setup, the same process occurs with the smaller gear. As a result, we can write that for the inner gear, it’s equations are

x=(r2r3)(cos(ϕ)sin(ϕ))r3(cos(r2r3r2ϕ)sin(r2r3r2ϕ))y=(r2r2)(sin(ϕ)+cos(ϕ))+r3(sin(r2r3r2ϕ)+cos(r2r3r2ϕ)) x = (r_2 - r_3) (\cos(\phi) - \sin(\phi)) - r_3 \left( \cos\left({r_2} \phi \right) - \sin\left({r_2} \phi \right) \right) y = (r_2 - r_2) \left(\sin(\phi) + \cos(\phi) \right) + r_3 \left(\sin\left({r_2} \phi \right) + \cos\left({r_2} \phi \right) \right)

Then, we can add this back to our initial set of equations, but negative. This also makes sense because the third gear would be rotating in the same direction as the first, outer gear, so it should be added back to the overall equation.

Additionally, note that this is ϕ.\phi. Substituting in θ\theta for ϕ\phi using te equations we previously had, we get x=kcos(t)ksin(t) k2cos(ct)+k2sin(ct)+r3cos(cc2t)r3sin(cc2t)y=ksin(t)+kcos(t)k2sin(ct)k2cos(ct)+r3sin(cc2t)+r3cos(cc2t) x &= k\cos\left(t\right)-k\sin\left(t\right)\ -k_{2}\cos\left(ct\right)+k_{2}\sin\left(ct\right) + r_{3}\cos\left(c \cdot c_{2}t\right)-r_{3}\sin\left(c \cdot c_{2}t\right) y &= k\sin\left(t\right)+k\cos\left(t\right) -k_{2}\sin\left(ct\right)-k_{2}\cos\left(ct\right)+r_{3}\sin\left(c \cdot c_{2}t\right)+r_{3}\cos\left(c\cdot c_{2}t\right) Where k=r1r2r1⁠,k = {r_1}, and k2=r2r3r2⁠,k_2 = {r_2}, c=r1r2r1⁠,c = {r_1}, and c2=r2r3r2c_2 = {r_2}.

This gives

images/3-Gear Spiro.png

We can continue extrapolating this process to get 4 and any number of gear spirographs.

Here is a four gear spirograph, similarly derived.

images/4 Gear Spiro.png

Its equations are x= kcos(t)ksin(t)  k2cos(ct)+k2sin(ct) + k3cos(cc2t)k3sin(cc2t)  r4cos(cc2c3t)+r4sin(cc2c3t)y= ksin(t)+kcos(t)  k2sin(ct)k2cos(ct)+ k3sin(cc2t)+k3cos(cc2t) r4sin(cc2c3t)r4cos(cc2c3t) x = &\ k\cos\left(t\right)-k\sin\left(t\right)\ - &\ k_{2}\cos\left(ct\right)+k_{2}\sin\left(ct\right)\ + &\ k_{3}\cos\left(cc_{2}t\right) - k_{3}\sin\left(cc_{2}t\right)\ - &\ r_{4}\cos\left(cc_{2}c_{3}t\right)+r_{4}\sin\left(cc_{2}c_{3}t\right) y = &\ k\sin\left(t\right)+k\cos\left(t\right)\ - &\ k_{2}\sin\left(ct\right) - k_{2}\cos\left(ct\right) + &\ k_{3}\sin\left(cc_{2}t\right) + k_{3}\cos\left(cc_{2}t\right)-& &\ r_{4}\sin\left(cc_{2}c_{3}t\right)-r_{4}\cos\left(cc_{2}c_{3}t\right) We can keep going, making 5, 6, and more geared spirographs.