Modular multiplication

inspired by the work of mathematician Simon Plouffe

In mathematics, a multiplication table or times table defines a multipli-cation operation for an algebraic system. In the States, many educators teach elementary decimal multiplication with times tables up to 9 × 9.

Fig. 1: Decimal multiplication table for the integers between 0–9

In modular arithmetic, for a positive integer n, two numbers a and b are said to be congruent modulo n, if their difference ab is an integer multiple of n (that is, there is an integer k such that ab = nk). This congruence relation is typically denoted ab (mod n).

A familiar example of modular arithmetic is the 12-hour clock where numbers "wrap around" upon reaching the modulus (12). We can determine congruence between a certain hour on the 24-hour clock with an hour on the 12-hour clock using modular arithmetic: 15:00 is congruent to 3:00 because 15 - 3 is 12, an integer multiple 12.

Fig. 2: ab (mod 12) multiplication table for the integers between 0–12

By relating points on a unit circle, modular multiplication can be visualized another way. In the figure below, b and n remain constant at b = 2 and n = 12, while a is incremented from zero. For each a, we take the product of ab (mod n) and trace a line from a on the unit circle to the product ab (mod n).

Fig. 3: Modular multiplication for ab (mod 12) where b = 2

As a is incremented, the same relations are repeated. Because of this, all values of a when b = 2 and n = 12 can be displayed simultaneously. This is akin to displaying a single row or column in a times table.

Fig. 4: Visualizing 2a (mod 12) for all a

Staying within this single row/column, we can still vary the modulus n. For b = 2 and all a, increasing the modulus has the effect of revealing better and better approximations of a cardioid.

Fig. 5: Visualizing 2a (mod n) for all a and n from 2–75

The resulting cardioid occurs in many places: in the epicycloid of two circles with equal radii where (R + r) / r = 2, in elliptical catacaustics, and as the main continent in the Mandelbrot set where fc(z) = z2 + c

Fig. 6: Examples of cardioids

Moving to the next column for b = 3 and for all a, increasing the modulus has the effect of revealing a nephroid.

Fig. 7: Emergence of nephroid in 3a (mod n) for all a and n from 2–75

The resulting nephroid occurs in many similar places: in the epicycloid of two circles where (R + r) / r = 3, in circular catacaustics, and as the main continent in the Multibrot set where fc(z) = z3 + c.

Fig. 8: Examples of nephroids

Predictably, the relations hold for the next column as well where b = 4.

Fig. 9: Emergence of epicycloid in 4a (mod n) for all a and n from 2–75

This epicycloid appears when (R + r) / r = 4. It also appears as the main continent in the Multibrot set where fc(z) = z4 + c.

Fig. 10: Examples of other epicycloids

The most obvious method for constructing the full multiplication table in this visual style is to concatenate each row/column, creating a figure very much like the tables above:

Fig. 11: Visual modular-multiplication table

But we can also pan across columns or rows in the multiplication table by continuously varying b for constant a and constant n.

Fig. 12: Visualizing 2b(mod 200) as b varies continuously from 0–200