The idea: a times table drawn on a circle
Put N points on a circle and number them 0, 1, 2, …, N − 1. Pick a multiplier k. From every point i draw a straight line (a chord) to the point k·i. When k·i is N or more, go round the circle again: keep only the remainder after dividing by N. That is k·i mod N, clock arithmetic.
With 10 points it is a tangle. With 200 points the chords crowd together and a curve appears that nobody drew: for k = 2 a heart-shaped cardioid. The page colours chord i by where i sits on the circle, from red at 0 through green and blue back to red, so you can follow the chords from one part of the circle.
The rule, step by step
For N = 10 and k = 2 (Demo: the rule chord by chord, or the Draw chord by chord button with N = 10 or 50):
| i | k·i | k·i mod 10 | chord |
|---|---|---|---|
| 0 | 0 | 0 | 0 → 0, just a dot |
| 3 | 6 | 6 | 3 → 6 |
| 5 | 10 | 0 | 5 → 0, a diameter |
| 7 | 14 | 4 | 7 → 4 |
| 9 | 18 | 8 | 9 → 8 |
Point 0 always goes to 0. A point that goes to itself, k·i ≡ i (mod N), gives a chord of length 0; it is called a fixed point. The same mod-N arithmetic, done fast, is what Modular Exponentiation and Toy RSA is built on.
k = 2 is a cardioid, k = 3 a nephroid: k − 1 cusps
No chord is curved, but the edge of the crowd of chords is. That edge is the envelope of the chords: a curve that touches every one of them. Its shape depends on k:
| k | envelope | cusps | cusp distance from the centre |
|---|---|---|---|
| 2 | cardioid (a heart) | 1 | R/3 |
| 3 | nephroid (a kidney) | 2 | R/2 |
| 4 | epicycloid | 3 | 3R/5 |
| k | epicycloid | k − 1 | R·(k − 1)/(k + 1) |
A cusp is a sharp point where the curve turns back on itself. Between two cusps the curve bulges out and touches the big circle; it touches it exactly where k·p ≡ p, the fixed points, so for k = 2 at point 0. (Demo: k = 2, N = 200: a cardioid, Demo: k = 3: a nephroid, Demo: k = 2, 3, 4, 5, 6: k − 1 cusps.) Another way to draw a cardioid is the polar curve r = 1 − sin θ: see Polar Coordinates, and for a heart drawn by a sine wave see The Heart Curve.
Why an epicycloid
Forget the points for a moment and think of every angle θ: the chord joins the point at angle θ to the point at angle kθ. As θ grows, the far end runs k times as fast as the near end. The envelope of those chords is an epicycloid: the path of a point on a small circle rolling round the outside of a fixed circle.
fixed circle radius R·(k − 1)/(k + 1) rolling circle radius R/(k + 1)
cusps = fixed / rolling = k − 1 farthest reach = fixed + 2·rolling = R
For k = 2 both circles have radius R/3, and a circle rolling round an equal circle traces a cardioid. The rolling circle touches the fixed one at each cusp, so the cusps sit on the fixed circle, at R·(k − 1)/(k + 1) from the centre, and the curve reaches out to radius R in between. Rolling circles are what a Spirograph draws.
The N points only sample this picture. When k − 1 gets close to N the cusps are less than a few points apart and the envelope falls apart: the page draws the cusp dots only while k − 1 ≤ N/10.
Only k mod N matters
k·i and (k + N)·i differ by N·i, a whole number of turns, so they land on the same point. k = 102 with N = 100 draws exactly what k = 2 draws. That gives a few special values:
| k (N = 100) | because | picture |
|---|---|---|
| 101 = N + 1 | 101·i ≡ i | every point is fixed: nothing at all, like k = 1 |
| 99 = N − 1 | 99·i ≡ −i | i joins its mirror image N − i: parallel chords |
| 51 = N/2 + 1 | 51·i = i + 50·i | even i are fixed, odd i go to i + 50: 50 diameters |
| 34 | 3 × 34 = 102 ≡ 2 | with i = 3j, chord 3j → 2j: the k = 3/2 picture, walked round twice |
The last row is a trick worth knowing: 3 has an inverse mod 100 (3 × 67 = 201 ≡ 1), so i = 3j runs through every point once as j does. Then the chords of k = 34 are the chords from 3j to 2j, and a chord has no direction, so they are the chords of the "times 3/2" table. In the same way k = 67 draws the k = 3 nephroid. Whether 3 has an inverse is a question about gcd(3, N): see Euclidean Algorithm. (Demo: N = 100, k = 51 then k = 34, Demo: k = N + 1 looks like k = 1.)
Between whole numbers
k does not have to be whole. For k = 2.5 the chord from 3 ends at 7.5, half way between points 7 and 8: the page puts the end at the real position k·i mod N on the circle. Stepping k by 0.1 then moves every chord end a little, and the picture flows from one shape to the next instead of jumping. Press Play k 2 → 100: 981 frames, k up by 0.1 each time. (Demo: play k from 2 to 100.) Watch the cardioid grow a second cusp on the way to k = 3, then a third, until near k ≈ N/10 the cusps crowd together and the mod-N patterns take over. Every whole k up to 100 is visited, so k = 34, 51, 67 and 99 flash past. The speed choice sets the frames per step: about 100 s, 65 s or 33 s for the whole run.
Other pictures made by stepping round a circle in fixed jumps: the Maurer rose joins points of a rose curve the same way.
Another picture where one number and how close it is to a fraction decide the pattern: The Sunflower Spiral: Vogel's Model and the Golden Angle.
What the page leaves out
The proof that the envelope is an epicycloid (the derivative of the chord family), N other than 10, 50, 100, 200 and 360, negative k (use k + N), k above 101, the chord-by-chord drawing for N above 50 (it would take hundreds of steps), and pictures where the end of chord i is a power k^i mod N instead of a product. The cusp dots are only drawn for whole k with k − 1 ≤ N/10.