MODULAR ARITHMETIC
Reasoning about remainders to solve divisibility, units-digit, and large-exponent problems without heavy computation.
Overview
We write to mean " and have the same remainder when divided by ," or equivalently, divides . For example, because .
Modular arithmetic turns problems about huge numbers into problems about small residues. Instead of computing exactly, you only track what it looks like mod 10, shrinking billions of digits down to a single digit.
AMC 10 problems love modular arithmetic because it appears in at least three guises: units-digit questions (work mod 10), remainder questions (work mod the given divisor), and divisibility tests (mod 9 for digit sums, mod 4 for last two digits, etc.). Recognizing which modulus to use is often the key step.
Key facts
- Congruence rule: if and only if .
- Addition and multiplication: If and , then and . You can reduce before multiplying.
- Powers cycle: The residues of mod eventually repeat. Find the period and reduce the exponent by that period.
Common cycles mod 10 (units digits):
| base mod 10 | cycle | period | |------------|-------|--------| | 1 | 1 | 1 | | 2 | 2, 4, 8, 6 | 4 | | 3 | 3, 9, 7, 1 | 4 | | 4 | 4, 6 | 2 | | 5 | 5 | 1 | | 6 | 6 | 1 | | 7 | 7, 9, 3, 1 | 4 | | 8 | 8, 4, 2, 6 | 4 | | 9 | 9, 1 | 2 | - Euler's theorem: If then , where is Euler's totient. For prime, this reduces to Fermat's little theorem: .
- Chinese Remainder Theorem (CRT) — light version: If and are coprime, then knowing and uniquely determines . Use this when a problem gives two separate remainder conditions.
- Division warning: You can divide both sides by only if . Dividing by 2 gives , which is false.
Worked example 1
What is the units digit of ?
Work mod 10. The powers of 7 cycle through units digits with period 4.
Divide the exponent: , so .
Therefore has the same units digit as , which is .
Worked example 2
Find the remainder when is divided by 8.
Work mod 8. Note . Compute the cycle of : The cycle has period 2. Since 40 is even, .
Now for : Period 2 again. Since 40 is even, .
So . The remainder is .
Common traps
- Forgetting to reduce the base first. Always reduce each factor mod before multiplying; e.g., to work with , use .
- Off-by-one in cycle position. When the exponent is a multiple of the period, the answer is the last element of the cycle, not the first. E.g., , not 7.
- Dividing without checking . You cannot cancel a common factor unless it is coprime to the modulus.
- Mixing up "remainder" and "residue". Remainders are always non-negative. If you compute , the remainder is , not .
- Applying CRT when moduli share a factor. CRT requires the moduli to be pairwise coprime. If they are not, check consistency and adjust.