Modular Arithmetic
You already do modular arithmetic every day — you just call it telling the time. Four
hours after 10 o'clock it is 2 o'clock, not 14: the numbers wrap around once they reach
12. Modular arithmetic takes this "clock" idea and
makes it a precise, powerful tool — arguably the single most important one in number theory.
Congruence
Fix a positive integer n, the modulus. Two integers
are congruent modulo n if they leave the same
remainder
on division by n — equivalently, if their difference is a multiple of
n:
a \equiv b \pmod{n} \iff n \mid (a - b).
On a 12-hour clock 15 \equiv 3 \pmod{12},
because 15 - 3 = 12. Step the dial below to see numbers wrap.
It's an equivalence relation
Congruence behaves just like equality: it is reflexive
(a \equiv a), symmetric, and transitive. So all the
integers leaving a given remainder collapse into one residue class. Modulo
5 there are exactly five of them:
\{\dots,-5,0,5,10,\dots\},\ \{\dots,-4,1,6,11,\dots\},\ \dots,\ \{\dots,-1,4,9,\dots\}.
Each class is named by its remainder, 0, 1, 2, 3, 4. Working modulo
n means working with these n classes instead
of the infinitely many integers — a colossal simplification.
Why it's the right idea
Congruence isn't just a notation; it respects arithmetic. If
a \equiv a' and b \equiv b' modulo
n, then their sums and products are congruent too. That single fact —
explored next — is what lets us add and multiply remainders as if they were ordinary numbers, and
it underlies divisibility tricks, check digits, hashing, and all of cryptography.