Modular Arithmetic: The Mathematics of Remainders
What is Modular Arithmetic?
Modular arithmetic is a system of arithmetic where numbers "wrap around" after reaching a certain value, called the modulus. Think of it like a clock — after 12, we go back to 1!
$$a \equiv b \pmod{n}$$
which reads "$a$ is congruent to $b$ modulo $n$" if and only if $n$ divides $(a - b)$. Equivalently, $a$ and $b$ have the same remainder when divided by $n$.
Real-World Examples
- 🕐 Clocks: mod 12
- 📅 Days of the week: mod 7
- 📆 Months: mod 12
- 🔐 Cryptography (RSA encryption)
- 📊 ISBN/barcode check digits
🕐 The Clock Analogy
Imagine a clock that only shows hours 0 through 11 (we use 0 instead of 12 for mathematical convenience). If it's currently 9 o'clock and we add 5 hours, we don't get 14 o'clock — we get 2 o'clock!
Mathematically: $9 + 5 = 14$, and $14 \equiv 2 \pmod{12}$ because $14 \div 12 = 1$ remainder $2$.
Drag the slider to add hours to 9 o'clock and see how the clock wraps around!