Arithmetic That Wraps Around
Modular arithmetic is arithmetic with remainders — the mathematics of things that cycle, like clocks, days of the week, and digital registers. We say is congruent to modulo , written when and leave the same remainder on division by — equivalently, when . On a 12-hour clock, : 15:00 shows as 3 o'clock.
Congruence modulo is an equivalence relation (Unit 1): it partitions the integers into residue classes, one per possible remainder . All integers in a class are interchangeable for mod- purposes.
The power of the notation is that congruence is compatible with arithmetic. If and , then: You may add, subtract, and multiply congruences just like equations — which means you can reduce as you go, replacing any number by its remainder at any step. To find , note , so — no need to compute 289. This is what makes modular arithmetic computationally tame even for huge numbers.
Division is the exception. You cannot freely divide congruences: does not always let you cancel a common factor. Division mod works only via multiplicative inverses, which exist only when the number is coprime to — the reason coprimality (Lesson 4) matters here.
Common pitfall: assuming you can divide or cancel in congruences as freely as you add and multiply. Addition, subtraction, and multiplication respect congruence, but cancellation does not in general: but you cannot cancel the common factor 2 to get (which is false). Division mod requires a multiplicative inverse, available only for numbers coprime to .