Modular Arithmetic and Congruences
Problem
Compute 37 mod 5 and 123 mod 7. Show clock arithmetic and the number wheel visualization.
Explanation
What is modular arithmetic?
Modular arithmetic is "clock arithmetic" — numbers wrap around after reaching a certain value (the modulus). When we write , we mean the remainder when is divided by .
Step-by-step: Compute
Step 1 — Divide: remainder .
Step 2 — The remainder is the answer: .
Alternatively: , so the remainder is .
Interpretation: On a clock with 5 positions (0, 1, 2, 3, 4), counting to 37 lands you at position 2.
Step-by-step: Compute
remainder . So .
Check: , and ✓.
Congruence notation
We write (read " is congruent to mod ") when and have the same remainder when divided by . Equivalently, divides .
Examples: , , .
Arithmetic with mods
You can add, subtract, and multiply before or after taking the mod — the result is the same:
Example: .
Check: . remainder ... let me recalculate. . . So . And . Wait — (not 4, that was mod 7). Let me redo: because . So ✓.
Real-world uses
- Clock time: Hours are mod 12 (or 24). 15:00 = 3:00 PM = .
- Days of the week: mod 7. If today is Wednesday (day 3), what day is it in 100 days? = Friday.
- ISBN check digits, credit card validation (Luhn algorithm), cryptography (RSA).
Try it in the visualization
Enter a number and modulus. The "number wheel" shows positions 0 to , and an arrow points to . Animate counting around the wheel to see the wrapping. Toggle arithmetic operations to see how mod distributes over addition and multiplication.
Interactive Visualization
Parameters
Got your own math or physics problem?
Turn any problem into an interactive visualization like this one — powered by AI, generated in seconds. Free to try, no credit card required.