Modular Arithmetic
Congruences, Modular Inverses, and Fermat's Little Theorem — A TLDR Primer
Modular arithmetic shows up on your next exam before you feel ready for it — and most textbooks bury the useful parts under pages of proof-heavy theory before you ever work a real problem.
This TLDR primer cuts straight to what matters. Starting with the clock-arithmetic intuition behind congruences, it builds quickly through the rules for adding, subtracting, and multiplying mod n, then tackles the part that trips most students up: why division requires a modular inverse, when that inverse exists, and how to find it with the Extended Euclidean Algorithm. From there, repeated squaring makes large-power problems tractable, and Fermat's Little Theorem — one of the genuinely beautiful results in elementary number theory — shows you how to collapse an exponent that looks impossible into one you can handle by hand.
The final section connects all of it to the real world: the check-digit schemes behind ISBNs and credit cards, the logic of hash functions, and the core mathematics of RSA public-key cryptography. These aren't decorative applications — they're the reason number theory for competition math and computer science students has exploded in popularity.
Short by design, with every definition in plain English and every technique shown through worked examples before it's stated as a rule. Whether you're prepping for a competition, a discrete math course, or just want to finally understand how RSA actually works, this guide gets you there without the bloat.
Scroll up and grab your copy.
- Read and write congruences fluently and reduce expressions mod n
- Add, subtract, multiply, and exponentiate in modular arithmetic without errors
- Find modular inverses using the Extended Euclidean Algorithm
- Apply Fermat's Little Theorem and Euler's theorem to compute large powers mod n
- Recognize where modular arithmetic shows up: divisibility rules, check digits, and RSA cryptography
- 1. Clock Arithmetic: What 'mod' Actually MeansIntroduces the modulus, the congruence relation a ≡ b (mod n), and the intuition of wrapping around a clock.
- 2. Arithmetic Mod n: Adding, Subtracting, MultiplyingShows that addition, subtraction, and multiplication respect congruence, with worked examples and the standard tricks for reducing as you go.
- 3. Division and Modular InversesExplains why division is tricky mod n, when an inverse exists (gcd(a, n) = 1), and how to find it with the Extended Euclidean Algorithm.
- 4. Powers Mod n: Fast Exponentiation and Fermat's Little TheoremDevelops repeated squaring for large powers and introduces Fermat's Little Theorem and Euler's theorem for collapsing exponents.
- 5. Where This Shows Up: Check Digits, Hashing, and RSAConnects modular arithmetic to ISBN/credit card check digits, hash functions, and the core idea behind RSA public-key cryptography.