It’s said that the world was created in 7 days (technically 6 + 1, but bear with me). That’s how we got 1 week = 7 days. If today is Sunday, tomorrow is Monday again. Nobody ever questions why a week has 7 days. Except that one guy on bodybuilding.com.
Let’s try this: if today is Monday, what day will it be 100 days from now?
We don’t count Monday Tuesday Wednesday 100 times. We know that 7 × 7 = 49, 49 × 2 = 98, and we can skip those 98 days. We only need the remainder, so 100 days later = 2 days later = Wednesday.
Mathematicians write it like this: 100 ≡ 2 mod 7. “Mod” is short for modulo, I think Gauss invented the notation. Programmers write it like this: 100 % 7 == 2. I think Ken Thompson invented the operator.
Let’s try again: if today is Monday, what day will it be 10000 days from now?
We could calculate the remainder like before, but there’s an even simpler trick. Since we know 100 ≡ 2 mod 7, and 10000 = 100 × 100, we can just do 2 × 2 = 4. 10000 days later is a Friday.
Why does the trick work? Because if an equation is true, it stays true no matter what number you mod it by. But the reverse is not true. If a modded equation is true, that doesn’t mean the original one is. Programmatically, you can think of it as if (mod3 && mod5 && mod7 && mod11 && mod13 && …), one false and the whole thing is false.
Let’s try something else: can you find any whole number solutions to x2 + y2 = 1000003?
We don’t have to test numbers 1 by 1 like a caveman. We just need to simplify the equation with modulo, then test if the simplified version is true. Let’s use mod 4 because 4 is small. In mod 4, there are only 4 possible squares:
0 × 0 = 0
1 × 1 = 1
2 × 2 = 4 (≡ 0)
3 × 3 = 9 (≡ 1)
So in mod 4, a square can only be 0 or 1. Which means if we add 2 squares together, we can only get 0, 1, or 2. But 1000003 ≡ 3 mod 4, so the equation has no whole number solutions. Modulo is a cheap way to test if an equation is false.
Test if an equation is false? Doesn’t that sound like a certain Last Theorem we’ve been talking about? Yes! A lot of people thought of it too. Let’s try solving x3 + y3 = z3 with mod 7.
In mod 7, cubes can only be 0, 1, or 61. Other than 0 + 0 = 0, 1 + 6 = 0, 0 + 1 = 1, and 0 + 6 = 6, none of these values add up to 0, 1 or 6. What does it mean? It means if there’s a solution for x3 + y3 = z3, at least 1 of x, y, or z has to be a multiple of 7.
Now how does this prove n = 3 in FLT? It… doesn’t. We found something interesting but pretty useless for answering the question. If you wrote this down in an exam, you’d get an E for effort.
You silly sod! You got us all worked up! I hear you say. Why waste time talking about modulo if it doesn’t solve Fermat’s Last Theorem? Well, you can’t solve FLT with modulo alone, but it plays an important part. The post is getting long so here’s one last trick. Instead of using modulo to check whether an equation has a solution, we can check how many solutions are there.
Take this circle for example: x2 + y2 = 1. In the mod-5 world, x and y can only be 0, 1, 2, 3, 4. The squares can only be 0, 1, 42. So there are 4 solutions: (0, 1), (0, 4), (1, 0), (4, 0). If we do the same thing in other mod worlds, we get3:
| mod | 3 | 5 | 7 | 11 | 13 | 17 | 19 | 23 | 29 | 31 | … |
|---|---|---|---|---|---|---|---|---|---|---|---|
| solutions | 4 | 4 | 8 | 12 | 12 | 16 | 20 | 24 | 28 | 32 | … |
Do you notice anything strange? The number of solutions is always either mod + 1 or mod − 14. You can think of this list as the curve’s signature, and it’s relevant to proving FLT. In the next part, we’ll calculate the signature of a different kind of curve. Hope I haven’t bored you to death!
-
Here are all the possible cubes in mod 7:
0 × 0 × 0 = 0
1 × 1 × 1 = 1
2 × 2 × 2 = 8 (≡ 1)
3 × 3 × 3 = 27 (≡ 6)
4 × 4 × 4 = 64 (≡ 1)
5 × 5 × 5 = 125 (≡ 6)
6 × 6 × 6 = 216 (≡ 6) ↩ -
The squares in mod 5 are:
0 × 0 = 0
1 × 1 = 1
2 × 2 = 4
3 × 3 = 9 (≡ 4)
4 × 4 = 16 (≡ 1) ↩ -
We only care about the primes because we only need primes to prove FLT. ↩
-
When do you get mod + 1 and when do you get mod − 1? Yo dawg, I heard you like modulo. You can tell which is which by modding the mod by 4. If it’s 1, the answer is mod − 1. If it’s 3, the answer is mod + 1. There’s a branch in math called number theory, and number theorists go gaga for things like this. ↩