Chapter
Modular Arithmetic
Remainders, congruences, arithmetic modulo m, power cycles, and modular contradiction.
Theory
1. Remainders
When an integer \(a\) is divided by a positive integer \(m\), we can write
\[
a=mq+r,\qquad 0\le r The number \(r\) is the remainder. Modular arithmetic is a way to work with remainders without carrying the full number. We write \[
a\equiv b\pmod m
\] if \(a\) and \(b\) have the same remainder when divided by \(m\). Equivalently, \[
m\mid a-b.
\] For example, \(17\equiv 2\pmod 5\), because \(17-2=15\) is divisible by \(5\). If \[
a\equiv b\pmod m,\qquad c\equiv d\pmod m,
\] then \[
a+c\equiv b+d\pmod m,
\] \[
ac\equiv bd\pmod m.
\] This means we can add, subtract, and multiply remainders. Powers often repeat modulo \(m\). For example, modulo \(10\), \[
2^1\equiv2,\quad 2^2\equiv4,\quad 2^3\equiv8,\quad 2^4\equiv6,\quad 2^5\equiv2.
\] So the last digit of powers of \(2\) repeats with cycle length \(4\): \(2,4,8,6\). To prove that an equation has no integer solutions, look at both sides modulo a small number. If the possible remainders cannot match, the equation is impossible. Example: no integer square is congruent to \(2\pmod 4\), because squares are only \(0\) or \(1\pmod 4\). Digit rules come from modular arithmetic. Since \[
10\equiv1\pmod 9,
\] every power of \(10\) is congruent to \(1\pmod 9\). Therefore a number has the same remainder modulo \(9\) as the sum of its digits.2. Congruence
3. Arithmetic with Congruences
4. Powers and Cycles
5. Modular Contradiction
6. Divisibility Tests as Modular Arithmetic
Examples
Example 1. Remainder of a Number
This example connects ordinary division with remainders: write the number as \(mq+r\) with \(0\le r
Example 2. Write a Congruence
This example shows how congruence notation records the remainder after division by the modulus.
Example 3. Add Remainders
This example shows that congruences let us add remainders first and reduce only at the end.
Example 4. Last Digit of a Power
This example shows how powers repeat in cycles modulo \(10\), which controls the last digit.
Example 5. Power Modulo Seven
This example shows how to use a power cycle modulo \(7\) instead of computing a huge power.
Example 6. Squares Modulo Four
This example shows a standard modular fact: every square has only certain possible residues modulo \(4\).
Example 7. No Square of This Form
This example shows how modular arithmetic can prove that an equation has no integer solutions.
Example 8. Always Divisible by Five
This example shows how checking residues modulo \(5\) proves a divisibility statement for every integer.
Problems
Problems
Ladders