Clock (or Modulo) Arithmetic
Created | Updated Nov 13, 2002
What time is it four hours after ten o'clock? Two o'clock, right? Well done, you show some understanding of modulo arithmetic - to whit 10 + 4 is 2 working modulo 12. A mathematician might write
__ 10 | + | _ 4 | = | _ 2 | or 10 + 4 ≡ 2 (mod 12)1 |
and this entry will use the latter notation2. Said mathematician would also say that 14 ≡ 2 (mod 12), even though we wouldn't use 14 o'clock when telling the time. Also 26, 38 and -10 are equivalent (denoted ≡) to 2 (and to each other) modulo 12.
The general rule we are using here is that a number is equivalent (written ≡) modulo 12 to another number if the difference between them is a multiple of 12. Of course it makes sense to use the smallest positive numbers we can as representatives of the equivalence classes3. So we would work with 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 and 11 rather than 73, 74, 75, 76, 77, 78, 79, 80, 81, 82 and 83. What about 12 itself, though? Well we use 0 instead. Just makes things easier, you know?
By the same rule, -31 ≡ 1 (mod 2) and 86 ≡ 0 (mod 2) and 48 ≡ 0 (mod 2). In fact working modulo 2 just divides the integers into odd and even numbers.
Multiplication
So we can add numbers modulo a number. Can we also multiply them? Well