Learning path

Full curriculum

Full curriculum

Unit content

Modular arithmetic

Two integers are congruent modulo $n$ when they leave the same remainder upon division by $n$. We write

$$a\equiv b\pmod n$$

when

$$n\mid(a-b).$$

For example,

$$17\equiv5\pmod{12}$$

because $12$ divides $17-5$.

Congruence respects addition and multiplication:

$$a\equiv b\pmod n,\quad c\equiv d\pmod n$$

implies

$$a+c\equiv b+d\pmod n$$

and

$$ac\equiv bd\pmod n.$$

This lets computations be reduced to representatives such as $0,1,\ldots,n-1$ without changing their congruence class.

Modular arithmetic models periodic quantities and finite cyclic state: clocks, checksums, hashing, number-theoretic algorithms and cryptography all rely on the same structure.