Modular arithmetic, explained
5 min read
Short answer
means divides : and leave the same remainder after division by . Congruences can be added, subtracted and multiplied like equations, so you can reduce at every step and keep the numbers small.
The rules
If and , then , and . Division is the exception: you can cancel only when .
Where it is used
Clocks (), days of the week (), check digits, hash functions and public-key cryptography all rely on arithmetic modulo . Divisibility by : a number is congruent to the sum of its digits mod .
Worked example
Find the remainder of when divided by .
Powers of mod cycle: (period ). Since , . The remainder is .
Try it yourself
What is mod , reducing before you multiply?
Show the answer
and , so . Then . The result is (check: ).
Keep going with practice
Vidi's study guides remind you to check answers by an independent route; remainders are a quick sanity check.