Modular arithmetic

Modular arithmetic is the study of addition, subtraction, and multiplication modulo some number $n$. This means that we are only concerned with taking integer remainders when a number is divided by $n$.

For integers $a$ and $b$, we write $a \equiv b \mod n$, read "a is congruent to b modulo n", to mean that when we divide $a$ and $b$ by $n$, the remainders are equal. For example, $14 \equiv 23 \mod 3$ because when we divide both 14 and 23 by 3, the remainder is 2 in both cases.

Three fundamental facts in modular arithmetic are that if $a \equiv b \mod n$ and $c \equiv d \mod n$, then $a+c \equiv b+d \mod n$, $a-c \equiv b-d \mod n$, and $a \times c \equiv b \times d \mod n$.