Discrete

Multiplying every number on the dial at once

Join every residue on a dial to twice itself and the chords draw a heart-shaped curve with one cusp; join each to three times itself and the curve has two. The picture is the whole multiplication map at once, and it holds three facts: the map splits the dial into cycles whose lengths are orders, those cycles on a dial of 2ⁿ − 1 are the binary necklaces of length n, and the curve is the caustic light draws inside a cup.

Worth reading first: Numbers that wrap · Two dials at once.

Numbers that wrap followed a single number round a dial as it was multiplied by 2 over and over: 1,2,4,8,3,6,12,11,9,5,10,71, 2, 4, 8, 3, 6, 12, 11, 9, 5, 10, 7 and back to 11 on a dial of thirteen. That is one orbit, traced from one starting point. Multiplication by 2 does something to every residue at once, and the natural picture of that is not a path but a map: every point on the dial joined to the point it is sent to.

Draw it and something appears that no single orbit shows. On a large dial the chords from kk to 2k2k crowd together along a heart-shaped curve with one cusp, and the chords from kk to 3k3k along a kidney-shaped curve with two. Each multiplier has its own curve, and the curve has exactly one cusp fewer than the multiplier. This essay explains the curve, and on the way finds that the picture holds three separate pieces of arithmetic: when multiplication is reversible, how it splits the dial into cycles, and why those cycles are necklaces.

Every residue joined to 2 times itself, on a dial of 199. A circle with 199 equally spaced points and a chord from each point k to the point 2k mod 199, with the 1-cusped curve the chords envelope drawn dashed.
Fig. 1 A dial of 199 places, with each residue k joined by a straight chord to 2k modulo 199. Since 2 and 199 share no factor, the chords are a permutation of the dial. They crowd along a heart-shaped curve with one cusp, the cardioid, drawn dashed: the path of the point a third of the way along each chord from k towards 2k.

A small dial first, and a collapse

On a dial small enough to read, the chords can be followed one at a time. With twenty-four places and the multiplier 2, residue 11 goes to 22, 55 to 1010, 1313 to 26226 \equiv 2, and 2020 to 401640 \equiv 16.

Every residue joined to 2 times itself, on a dial of 24. A circle with 24 equally spaced points and a chord from each point k to the point 2k mod 24.
Fig. 2 A dial of 24 with each residue k joined to 2k modulo 24. The chords land on only the twelve even residues: 2 and 24 share the factor 2, so k and k + 12 always go to the same place, and every even residue receives two chords while every odd one receives none.

The chords land only on even residues, and each even residue receives two of them: 11 and 1313 both go to 22, 55 and 1717 both go to 1010. The reason is that 2×12=2402 \times 12 = 24 \equiv 0, so adding 1212 to anything does not change its double. Multiplying by mm on a dial of NN collapses the dial onto N/gcd(m,N)N/\gcd(m, N) residues, each hit gcd(m,N)\gcd(m, N) times, and the collapse is visible as pairs of chords converging.

When mm and NN share no factor the collapse vanishes. Then mm has an inverse on the dial — a number that undoes multiplication by mm, found by running Euclid’s algorithm backwards — and so multiplication by mm can be undone, which means no two residues go to the same place. The chords are then a permutation of the dial: every residue sends one chord out and receives exactly one. On the dial of 199 in the first figure that is automatic, since 199 is prime.

A permutation splits into cycles

A permutation of a finite set, followed from any starting point, must eventually return, because there are only finitely many places to go and nowhere is visited twice without closing a loop. So the permutation breaks the dial into disjoint cycles. For multiplication those cycles have lengths that can be predicted from the arithmetic alone.

Multiplying by 2 on a dial of 21, cut into its cycles. A dial of 21 residues with the permutation k ↦ 2k drawn as closed polygons, one per cycle, of lengths 1, 6, 3, 6, 2, 3.
Fig. 3 Multiplication by 2 on a dial of 21, drawn as closed polygons, one for each cycle. There are six cycles, of lengths 1, 6, 3, 6, 2 and 3. The two cycles of residues sharing no factor with 21 (shaded) both have length 6, the order of 2 modulo 21. The multiples of 3 cycle with length 3, the order of 2 modulo 7; the multiples of 7 with length 2, the order of 2 modulo 3; and 0 stays put.

The cycle through 11 is 1,2,4,8,16,111, 2, 4, 8, 16, 11 and back, of length 66 — the smallest number of doublings that returns 11 to itself, which is the order of 22 modulo 2121. Every residue that shares no factor with 2121 lies on a cycle of exactly that length, because the cycle through kk is just the cycle through 11 multiplied by kk, and multiplying by kk is itself a permutation of those residues. So the twelve residues coprime to 2121 fall into two cycles of six.

That observation is Euler’s theorem, drawn. The residues coprime to NN — there are φ(N)\varphi(N) of them, twelve on the dial of twenty-one — are cut by the permutation into cycles that all have the same length, the order of mm. Cycles of equal length that exactly fill a set of twelve must have a length that divides twelve. So the order of mm divides φ(N)\varphi(N), and multiplying by mm a full φ(N)\varphi(N) times returns every unit to itself: mφ(N)1m^{\varphi(N)} \equiv 1. On a prime dial, where φ(p)=p1\varphi(p) = p - 1, it is Fermat’s little theorem, and the proof is a count of polygons of equal size.

The other residues behave like residues on a smaller dial. The multiples of 333,6,9,12,15,183, 6, 9, 12, 15, 18 — are three times the residues of a dial of seven, and doubling them is doubling on that dial, where 22 has order 33. So they fall into two cycles of three. The multiples of 7777 and 1414 — are seven times the residues of a dial of three, where 22 has order 22, and they swap. Zero is fixed. In general, the residue kk lies on a cycle whose length is the order of mm modulo N/gcd(k,N)N/\gcd(k, N), and every such length divides the order of mm modulo NN itself. The figure checks both statements on every cycle it draws.

Counted up, the number of cycles is a sum over the divisors dd of NN: each divisor contributes the residues whose “own dial” has size dd — there are φ(d)\varphi(d) of them — in cycles of length equal to the order of mm modulo dd. That formula looks like a curiosity, and it is the formula for counting necklaces.

Doubling on a dial of 2n12^n - 1 turns necklaces

Take the dial of 2n12^n - 1 and write each residue in binary with exactly nn digits. Doubling a number shifts its binary digits one place to the left, and on this dial the digit that falls off the top reappears at the bottom, because 2n12^n \equiv 1. So doubling modulo 2n12^n - 1 is rotation of an nn-bit string, and its cycles are the sets of strings that are rotations of one another — the necklaces.

Multiplying by 2 on a dial of 15, cut into its cycles. A dial of 15 residues with the permutation k ↦ 2k drawn as closed polygons, one per cycle, of lengths 1, 4, 4, 2, 4.
Fig. 4 Doubling on a dial of 15=24115 = 2^4 - 1. The five cycles are {0}, {1, 2, 4, 8}, {3, 6, 12, 9}, {5, 10} and {7, 14, 13, 11}. In four-digit binary they are the rotations of 0000, 0001, 0011, 0101 and 0111 — the binary necklaces of length four, with 1111 missing because on this dial it is the same number as 0000.

On the dial of fifteen the cycles are the rotation classes of four-bit strings: {1,2,4,8}\{1, 2, 4, 8\} are 0001,0010,0100,10000001, 0010, 0100, 1000; {3,6,12,9}\{3, 6, 12, 9\} are 00110011 and its rotations; {5,10}\{5, 10\} are 01010101 and 10101010, a necklace with only two distinct rotations; {7,14,13,11}\{7, 14, 13, 11\} are the strings with three ones. The sixth binary necklace of length four, 11111111, is fifteen, which the dial identifies with 00000000. So the count of cycles, five, is the count of binary necklaces, six, less one.

The count works at every length. The number of binary necklaces of length nn is 1ndnφ(d)2n/d\frac1n\sum_{d\mid n}\varphi(d)\,2^{n/d} — each rotation class counted by averaging, over the nn rotations, the number of strings each rotation leaves unchanged — and doubling modulo 2n12^n - 1 has exactly one cycle fewer than that. On the dial of 3131 there are 77 cycles and 88 necklaces of length five; on 6363, 1313 cycles and 1414 necklaces of length six; on 255255, 3535 and 3636; on 10231023, 107107 and 108108. The one necklace lost is always the same: the string of all ones, which the dial cannot tell from the string of all zeros.

That identification is what makes the arithmetic of necklaces and the arithmetic of multiplicative orders the same subject. Fermat’s little theorem proved by counting necklaces runs the correspondence in one direction; the cycle count above runs it in the other. And the necklace that returns after fewer than nn rotations, like 01010101, is a residue whose own dial is smaller: 55 shares the factor 55 with 1515, and on the dial of three, doubling has order 22.

The curve the chords crowd onto

On a dial of a few hundred places the chords stop reading as individual lines and start reading as a shape, and the shape is the envelope of the family: a curve that touches every chord. It is easiest to find by letting the dial become a continuous circle, with a chord from each angle θ\theta to the angle mθm\theta.

Put the circle in the complex plane, so the chord joins eiθe^{i\theta} to eimθe^{im\theta}. The point

P(θ)=meiθ+eimθm+1P(\theta) = \frac{m\,e^{i\theta} + e^{im\theta}}{m + 1}

is a weighted average of the chord’s two ends, so it lies on the chord, a fraction 1/(m+1)1/(m+1) of the way from eiθe^{i\theta} towards eimθe^{im\theta}. Differentiating, P(θ)P'(\theta) is a multiple of i(eiθ+eimθ)i\big(e^{i\theta} + e^{im\theta}\big), and for two points on the unit circle the sum of their positions is perpendicular to their difference, so i(eiθ+eimθ)i\big(e^{i\theta} + e^{im\theta}\big) runs along the chord. The curve PP therefore touches every chord where it crosses it: PP is the envelope. The figures check both facts — on the chord, and along it — at a spread of chords.

PP is an epicycloid: the path of a point on a small circle rolling round the outside of a larger one. Its cusps are where it stops moving, where P(θ)=0P'(\theta) = 0, which needs eiθ=eimθe^{i\theta} = -e^{im\theta} — the chord’s two ends diametrically opposite — or ei(m1)θ=1e^{i(m-1)\theta} = -1. That happens m1m - 1 times round the circle. So the chords from kk to mkmk envelope an epicycloid with m1m - 1 cusps: one for doubling, the cardioid; two for tripling, the nephroid; and one more for each step up.

Every residue joined to 3 times itself, on a dial of 199. A circle with 199 equally spaced points and a chord from each point k to the point 3k mod 199, with the 2-cusped curve the chords envelope drawn dashed.
Fig. 5 Tripling on the dial of 199, with the envelope the chords approach drawn dashed: an epicycloid with two cusps, the nephroid. Each cusp sits where a chord from k to 3k passes through the centre — where 3k is directly opposite k on the dial.
Multiplying round a dial, for six multipliers. Six dials of 180 points, each with chords from k to m·k for m = 2, 3, 4, 5, 6, 7, showing envelopes with 1 to 6 cusps.
Fig. 6 The same drawing on a dial of 180 for the multipliers 2 to 7, with one cusp for doubling and six for multiplying by seven. The number of residues each multiplier leaves in place is also checked: k is fixed by m exactly when (m − 1)k is a whole number of turns, and on a dial of 180 that happens gcd(m − 1, 180) times.

The small multiples make the pattern plain, and they show something the formula does not dwell on: a residue kk with mkkmk \equiv k gives a chord of length zero, and those fixed points are where the chords are shortest and densest, near the cusps. On a dial of NN there are gcd(m1,N)\gcd(m - 1, N) of them, since (m1)k(m - 1)k must be a multiple of NN.

The same curve is drawn by light in a cup

The envelope has a physical reading that makes the multiplication tables less arbitrary than they look. A ray of light inside a circular mirror, travelling along a chord from angle α\alpha to angle β\beta, reflects off the mirror and leaves along the chord to 2βα2\beta - \alpha: the angle of incidence equals the angle of reflection, and on a circle that is a statement about arcs.

Put a point source of light on the rim at angle 00. A ray that first strikes the mirror at angle θ\theta reflects along the chord from θ\theta to 2θ2\theta. The reflected rays are the chords of the doubling table, and where they crowd together the light is brightest: the bright curve, the caustic, is the cardioid. With the source infinitely far away instead, so that the incoming rays are parallel, the reflected chords run from θ\theta to 3θ3\theta plus a fixed half-turn, and the caustic is the two-cusped nephroid — the bright curve that sunlight draws on the surface of coffee in a round cup.

That is the same family of curves, drawn by the same geometry, that a billiard ball in a round table traces out as its caustic circle when it keeps bouncing at a fixed angle. There the chords are θθ+c\theta \to \theta + c, all the same length, and the envelope is a circle; here they are θmθ\theta \to m\theta, of every length, and the envelope has cusps.

The dial is a window onto a chaotic map

There is one more reading of the chords, and it connects the dial to dynamics. Divide every residue by NN and the dial of NN becomes the NN equally spaced fractions 0,1/N,,(N1)/N0, 1/N, \ldots, (N-1)/N on a circle of circumference one. Multiplying by mm modulo NN becomes multiplying the fraction by mm and discarding the whole part — the map xmxmod1x \mapsto mx \bmod 1 on the circle.

That map, for m=2m = 2, is the doubling map, one of the simplest chaotic systems there is: it doubles every distance, its orbits are the binary expansions of xx read one digit at a time, and almost every orbit wanders over the whole circle with no pattern. The fractions with denominator NN are a finite set it maps to itself, and on them every orbit is periodic. So the cycles drawn on the dial are periodic orbits of a chaotic map, and the periodic orbits of the doubling map are exactly the fractions with odd denominators, since those are the ones whose binary expansions repeat. The dial of fifteen shows the periodic points of period dividing four; the dial of twenty-one, those whose periods divide six.

Seen that way, the chord pictures show both halves of the doubling map’s character. The cycles are its orderly part, the periodic orbits, finitely many at each denominator. The envelope is its disorderly part: as NN grows the chords fill in densely, every residue’s image lies far from the residue itself, and nothing in the picture stays still except the one fixed point the cusp marks.

What the chords cannot show

They cannot show the envelope exactly. On a finite dial there are finitely many chords, and the dashed curve is drawn from its formula, not traced from the chords. The chords approach it as the dial grows, and the figures check that the formula’s curve touches every chord it is compared with; they do not, and cannot, show a limit.

They cannot show which multipliers generate. Whether some mm has a single cycle through all the units — a primitive root — is visible only as a cycle of full length in a picture like the one on the dial of twenty-one, and the question of which dials have such an mm is a theorem about counting that no chord picture decides.

And they cannot show large dials’ cycles. On a dial of 199 the cycles of doubling have length 99, the order of 22 modulo 199199, and the two long cycles are drawn together as one tangle of chords. The cycle structure is computed and checked; it is only legible on small dials.

Where the dials go next: powers of one prime

The cycle lengths are orders, and orders behave in a striking way on dials whose size is a power of a single prime. On a dial of three, doubling has order 22; on a dial of nine, order 66; on twenty-seven, 1818; on eighty-one, 5454; on two hundred and forty-three, 162162. Each step up the powers of three multiplies the order by three. The doubling chords on a dial of 3k3^k form one long cycle through every residue coprime to three, and that cycle grows by a factor of three each time the dial does.

The reason is one line of the binomial theorem. Suppose 2r2^r is 11 on the dial of 3k3^k, so that 2r=1+3kt2^r = 1 + 3^k t for some whole number tt. Cubing,

23r=(1+3kt)3=1+3k+1t+32k+1t2+33kt3,2^{3r} = (1 + 3^k t)^3 = 1 + 3^{k+1} t + 3^{2k+1} t^2 + 3^{3k} t^3,

and every term after the 11 is a multiple of 3k+13^{k+1}. So 23r2^{3r} is 11 on the next dial up. The order there is therefore a divisor of 3r3r and a multiple of rr — since anything that is 11 on the larger dial is 11 on the smaller — which leaves exactly two possibilities: it stays rr, or it becomes 3r3r. It stays only if 2r2^r was already 11 on the dial of 3k+13^{k+1}, which is a coincidence of one extra digit, and the same argument works for every odd prime in place of three. For most primes and most multipliers the order multiplies at every step. The rare primes where it stalls at the first step are the subject of two primes where Fermat holds twice, and they are genuinely rare: for the multiplier 2, only two are known.

The same lifting, done not to orders but to roots — solving an equation on a dial of pp and then on p2p^2, p3p^3 and beyond, one digit at a time — is where the next essay goes. It turns a finite dial into an infinite sequence of ever finer dials, and the sequence into a new kind of number.

One map, drawn whole

Multiplying by mm on a dial of NN, drawn as a chord from every residue to its multiple, is a two-to-one collapse wherever mm shares a factor with NN and a permutation where it does not. The permutation breaks the dial into cycles whose lengths are the orders of mm on the dial and on the smaller dials of its divisors, and on the dial of 2n12^n - 1 doubling rotates binary strings, so its cycles are the necklaces.

As the dial grows the chords crowd onto an epicycloid with m1m - 1 cusps, the curve a point on a rolling circle traces, because the point a fraction 1/(m+1)1/(m+1) of the way along each chord moves along the chord itself. The same curves are the caustics of light reflected in a circle, and the same cycles are the periodic orbits of the chaotic map xmxmod1x \mapsto mx \bmod 1.

Drawing a map whole, rather than following one point through it, turns its algebra into geometry — and the geometry keeps turning up elsewhere.

What links here

Computed from the collection, not written here: the essays that point at this one.

Reads more easily once this is understood

Essays that name this one as worth reading first.

Shares its objects with

Essays that name at least two of the same things, and that neither author linked.

Named objects

A dashed tag is an object no other essay names yet.

CausticDoubling mapEnvelopeEpicycloidModular arithmeticNecklaceOrbitOrderPermutation