modular arithmetic

In mathematics, modular arithmetic is a type of arithmetic involving only integers whose numbers “wrap around” when they reach a prescribed value called the modulus.

A simple example of a modular arithmetic system is a twelve hour clock. If it is 2 o’clock and 4 hours pass then it is 6 o’clock. This math is the same as traditional arithmetic: 2 + 4 = 6. But if is 2 o’clock and 14 hours elapse, it is not 16 o’clock, but it is 4 o’clock. When a clock reaches 12:59, it “wraps around” to 1 o’clock instead of continuing upward to 13 o’clock. This is arithmetic modulo 12.

Counting modulo 12 looks like:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, …

Notice that the clock analogy appears to fall apart here since 0 follows 11, not 12. In reality, the clock analogy holds since 0 and 12 are congruent to one another.  Two numbers are congruent modulo a modulus (in this case 12) if their difference is a multiple of the modulus. Since (12-0)/12 = 1, 12 and 0 are congruent. This is written:

12 \equiv 0 \mod{12}

This is read, “12 is congruent to 0 modulo 12.”

« Back to Glossary Index