Modular arithmetic is the mathematics of remainders — and it shows up everywhere from clock arithmetic to computer science to number theory problems in JEE. Once you understand the core idea, you’ll find it surprisingly powerful for solving problems that look impossibly complex at first glance. Finding the last digit of ? Finding the remainder when is divided by 7? Modular arithmetic handles these in seconds.
Key Terms & Definitions
Modulo operation: is the remainder when is divided by . For example, because .
Congruence: We say (read: “a is congruent to b modulo m”) if divides . This means and give the same remainder when divided by .
Examples:
- (both give remainder 2 when divided by 5)
- (25 is divisible by 5)
- (since , divisible by 7)
Note on negative numbers: In modular arithmetic, we typically prefer positive remainders. (since ).
Modulus (or modulo): The number in .
Residue: The remainder itself — the value of .
Complete Residue System modulo m: The set — one representative from each congruence class.
Methods and Concepts
Properties of Congruences
If and , then:
- Addition:
- Subtraction:
- Multiplication:
- Powers: for any positive integer
These properties are the engine of all modular arithmetic calculations. They let us reduce large numbers to small residues at each step.
Finding Last Digits (mod 10)
The last digit of any number is its remainder when divided by 10 — that’s .
The last digit of powers of 7:
, (last digit 9), (last digit 3), (last digit 1), (last digit 7)
The pattern repeats every 4 powers: 7, 9, 3, 1, 7, 9, 3, 1, …
Last digit of : remainder 0, so has same last digit as .
Last digit of is 1.
This cyclicity of last digits is fundamental. Powers of 2 cycle with period 4 (2, 4, 8, 6). Powers of 3 cycle with period 4 (3, 9, 7, 1). Powers of 4 cycle with period 2 (4, 6). Powers of 5 always end in 5.
Fermat’s Little Theorem
For a prime and integer with :
Immediate application:
Example: Find
is prime, , so (Fermat’s)
Remainder is 4.
Euler’s Theorem (Generalisation)
For :
where is Euler’s totient function (count of integers from 1 to coprime to ).
For prime : , recovering Fermat’s theorem.
For calculation:
- when (multiplicative)
Example: . The integers 1–12 coprime to 12 are: 1, 5, 7, 11 — indeed 4 of them.
Chinese Remainder Theorem (CRT)
If are pairwise coprime and , then for any , there is a unique with 0 \leq x < N such that:
Example: Find such that and .
List multiples: (satisfying first condition) Check which gives remainder 3 when divided by 5: . ✓
Answer: (and for any integer )
Solved Examples
Easy — CBSE Level
Q: What is the remainder when is divided by 3?
Remainder = 1. (No need to compute ; just work with the residue.)
Medium — JEE Main Level
Q: Find the last two digits of (i.e., )
Use Euler:
, so
Last two digits of are 01.
Hard — JEE Advanced Level
Q: If is a prime and , prove that .
Suppose . Then (since is prime, its only divisors are 1 and ). But , meaning . Since is a field (for prime ), it has no zero divisors. So implies , i.e., . Contradiction. Hence .
This result is the key lemma in the standard proof that is irrational for any prime .
Exam-Specific Tips
JEE Main: Remainder problems are almost guaranteed. Key: know the cyclicity patterns for powers (units digits cycle with period dividing 4 for most digits). For mod 7, 11, 13, use Fermat’s Little Theorem. For mod 6, use direct computation since .
CBSE Class 10: “Divisibility and remainders” questions often ask: is divisible by 8 for odd ? Answer: Yes — for odd , and for all of these.
Common Mistakes to Avoid
Mistake 1: does NOT mean . It means they have the same remainder. , but .
Mistake 2: You cannot divide freely in modular arithmetic. does NOT mean after dividing by 2. Division is allowed only when the divisor is coprime to the modulus.
Mistake 3: Forgetting that powers cycle — computing by brute force instead of recognising the cycle of length 4 in the units digit.
Mistake 4: Applying Fermat’s Little Theorem with non-prime. FLT requires to be prime. For composite moduli, use Euler’s theorem with .
Mistake 5: Getting the remainder of a negative number wrong. (not -1). In modular arithmetic, remainders are always non-negative.
Practice Questions
Q1. Find the remainder when is divided by 101.
101 is prime. By Wilson’s Theorem: for prime . So . Remainder = 100.
Q2. What is the units digit of ?
Powers of 3 cycle: 3, 9, 7, 1 (period 4). remainder 1. So has same units digit as . Units digit = 3.
Q3. Show that is always even.
. Among any two consecutive integers, one is even. So is always even. Alternatively: or . In either case, .
Q4. Find the last digit of .
Units digit depends on (since has units digit 3). Cycle of 3: period 4. remainder 0. Same as , units digit 1. Last digit = 1.
Q5. Find such that and , with 0 \leq x < 12.
From first: . Check mod 3: . ✓ x = 5.
Q6. Prove that and find the smallest such that .
, so . ✓ By Fermat: , so . Check: . So order of 2 mod 7 is 3. Smallest : n = 3.
Q7. What is the remainder when is divided by 10?
for (contains factors 2 and 5). So remainder = .
Q8. If and are primes and , find all possible pairs.
One of or must be 2 (since if both are odd, their sum is even only if both odd — but , so either both even or both odd; both even means both = 2, impossible for two primes summing to 60). So one is 2: . Not prime. OR: both can be odd, and sum to even (60). Try systematically: (7, 53) — both prime ✓; (11, 49) — 49 = 7², not prime; (13, 47) — both prime ✓; (17, 43) — both prime ✓; (19, 41) — both prime ✓; (23, 37) — both prime ✓; (29, 31) — both prime ✓. Pairs: (7,53), (13,47), (17,43), (19,41), (23,37), (29,31).
FAQs
Q: What’s the difference between mod and remainder in programming?
In mathematics, is always non-negative. In many programming languages, the % operator can return negative values for negative inputs. In Python, (matches mathematical modulo). In C/Java, (truncated division). This matters when translating maths to code.
Q: Why does Fermat’s Little Theorem have in the exponent?
Because the nonzero elements of form a multiplicative group of order . By Lagrange’s theorem, the order of any element divides the group order. So . This is a clean algebraic reason.
Q: Is modular arithmetic used in real life?
Absolutely. RSA encryption — which secures every HTTPS connection — is based on Euler’s theorem in modular arithmetic. ISBN barcodes use mod 10. Credit card validation uses mod 10 (Luhn algorithm). GPS error correction uses modular codes.
Q: How do I find quickly?
Factorise into prime powers: . Then over distinct prime factors. Example: .
Q: When can we cancel in modular arithmetic?
If and , then . If , we can only cancel if we also reduce the modulus: .