Let be a positive integer.
We denote the set by .
We consider two integers to be the same if and differ by a
multiple of , and we write this as , and say that
and are congruent modulo . The is sometimes
omitted when it is clear from the context.
Every integer is the congruent some in . When we add or
subtract multiples of from an integer to reach some \mathbb{Z}_nn\{0,...,n-1\}\mathbb{Z}_n38 = 3 \pmod{5}38 = 7\times 5 + 3-3 = 11 \pmod{14}-3 = (-1)\times 14 + 11\mathbb{Z}_nx, y \in \mathbb{Z}_n\mathbb{Z}_n6 + 7 = 1 \pmod{12}3 \times 20 = 10 \pmod{50}12 - 14 = 16 \pmod{18}0 \lt 4 \pmod{8}44 \lt 0 \pmod{8}n12yx10 = 4 \pmod{6}25 = 2 \pmod{6}xyzyzxz\mathbb{Z}_64 / 252xynz \in \mathbb{Z}_nx = y zyz_1 y = z_2 y \pmod {n}ky(z_1 - z_2) = k ndnyn/dz_1 - z_2y$, thus we have
Thus a unique exists modulo only if the greatest common
divisor of and is 1.
How do we know if exists, and if it does, how do we find it?
Since there are only elements in ,
we can multiply each element in turn by and see if we get 1.
If none of them work then we know does not have an inverse.
In some sense, modular arithmetic is easier than integer
artihmetic because there are only finitely many elements,
so to find a solution to a
problem you can always try every possbility.
We now have a good definition for division: divided by , is
multiplied by if the inverse of exists, otherwise the answer
is undefined.
To avoid confusion with integer division,
many authors avoid the symbol completely in modulo arithmetic and
if they need to divide by , they write .
Also some approaches to number theory start with inversion, and define division
using inversion without discussing how it relates to integer division,
which is another reason is often avoided.
We will follow convention, and reserve the symbol for integer
division.
Example: .