Structure preview

Modular arithmetic: the remainders laboratory

From clocks to enormous powers: an intuitive guide to congruences with 25 problems and an interactive laboratory.

Section: Number theory Updated:
Articles /modular-arithmetic-remainders-laboratory
Modular arithmetic: the remainders laboratory

7 min

If it is 10 o’clock and five hours pass, a 12-hour clock shows 3. We have found the remainder of 15 on division by 12: 15≡3 (mod 12). Modular arithmetic grows out of this observation. In the interactive laboratory, you can see residues on a circle, discover power cycles and solve 25 progressive problems.

Congruence and Euclidean division

We write a≡b (mod n) when n divides a−b. Equivalently, a and b have the same remainder modulo n. Every integer has a unique representation a=nq+r with 0≤r<n when n>0. For example, −17=5×(−4)+3: even for a negative number we choose a nonnegative remainder. Modulo 1 the only remainder is 0; modulo 0 is undefined.

Operations that preserve remainders

If a≡b and c≡d modulo n, we may add, subtract and multiply: a±c≡b±d and ac≡bd. Why? The differences between corresponding expressions are multiples of n. Thus 123×456 mod 7 becomes 4×1 mod 7=4, without multiplying the original large numbers first.

Powers return: discover a cycle

Powers of 7 modulo 10 give 7,9,3,1,7,…, a cycle of length 4. To find the last digit of 7^2026, observe that 2026≡2 (mod 4); the answer is 9. The laboratory reveals the cycle one step at a time. For the last digit and the last two digits it uses modulo 10 and modulo 100, computing huge powers by repeated squaring without constructing them in full.

Divisibility, clocks and calendars

Since 10≡1 (mod 9), a number has the same remainder modulo 9 as its digit sum. Since 10≡−1 (mod 11), the test for 11 uses an alternating digit sum. Weekdays work modulo 7: one hundred days after Monday is Wednesday, because 100≡2 (mod 7). The laboratory tools let you check these examples.

Equations and systems

The congruence ax≡b (mod n) has solutions exactly when GCD(a,n) divides b. An inverse of a exists for n>1 when GCD(a,n)=1. With pairwise coprime moduli, the Chinese remainder theorem combines conditions: x≡2 (mod 3), x≡3 (mod 5) and x≡2 (mod 7) yield x≡23 (mod 105). The laboratory shows the intermediate steps, not just the answer.

Your turn

The path includes fifteen lessons, ten tools, exploration of squares and cubes, twenty-five problems with hidden hints and solutions, and randomly generated practice. The problem (1234567+9876543) mod 9 deserves care: the correct remainder is 7. Open the modular-arithmetic laboratory →