In this series, we’ve spent considerable space playing with operators, which we’ve pictured as black boxes with inputs and outputs, often as part of a machine with state. In more recent posts, e.g. this one , we’ve looked at operators that we likened to moving around on a contour line, towards a representative value in an equivalence class.
In the prior post, we looked at a number line on a slinky, and picked an equivalence relationship simply based on which numbers are vertically aligned. We’re going to take a closer look at slinky arithmetic,
mapping numbers onto the slinky as below – so that 5 ends up directly above 1, and 6 directly above 2, etc.:
It may be helpful to think as the “1” position as South, the “2” position as East, the “3” position as North and the “4” position as West. As you move around the spiral, you keep coming back to South etc, but you’ll be a little higher up.
Now let’s look at arithmetic on the slinky, starting with addition. We can take some well-known addition fact, like
5 + 10 = 15, and then note the compass positions of the numbers involved. 5 is South, 10 is East, and 15 is North. The question I’m now curious about is: If I start with a number in the South and add a number in the East, will I always end up with a sum in the North? After all, the compass directions seem to have nothing to do with how high up we are. On this number line, East comes after South, and North comes after East, and West comes after North, and after West comes South again.
In the diagram above, the top line shows the compass marks for the numbers from 0-18. The diagram at the bottom left shows a normal addition table. In the table on the right, all the numbers from the left have been replaced by their compass markings. As you can see, the pattern on the right is completely regular and repeats after 4 rows, after 4 columns and after 4 diagonals.
From that table on the right, we extract a four-by-four core piece, and show it below. It is this piece that repeats over and over. We can translate the compass marks back into numbers, as shown below on the right. We used the numbers 0-3 as representatives of the equivalence classes – unlike the situation in the prior post, we now have at least some reason to pick this set of numbers over other numbers.
In some regards, the table on the right does look like an addition table: most of the entries match what we would expect. It is only where we would normally expect a sum of 4 or greater that the table looks somewhat strange. Instead of 4, we find 0; instead of 5, we find 1, and instead of 6, we find 2. This is at least consistent with the equivalence relationship we’re looking at here: 4 is directly above 0, 5 is directly above 1, and 6 is directly above 2 in our slinky.
The style of addition in this last table has a fancy name: it is known as addition modulo 4. The same phrase, modulo 4, is used to talk about equivalence classes for whole numbers: when any two numbers that are 4 apart are considered equivalent. For example, people would say that 5 and 9 are equivalent modulo 4, and that 9 and 13 are equivalent modulo 4. By extension, 5 and 13 are also equivalent modulo 4. Some people would describe equivalence modulo 4 in terms of division: two numbers are equivalent modulo 4 if they have the same remainder after dividing by 4. Yet another way to talk about it is in terms of multiples: two numbers are equivalent modulo 4 if they differ by a multiple of 4. All these ways of talking about it amount to the same thing, but that may not be immediately obvious. “Two numbers are equivalent modulo 4 if they point in the same compass direction on the slinky” also expresses the same idea.
So far, we’ve talked about modulo 4 and only looked at the operation of addition modulo 4. We can extend in both directions: we could look at subtraction, multiplication, and division modulo 4. We could also extend in a different way and look at equivalence modulo 5 or modulo 6 etc. We will take this up in future posts.