Modular arithmetic is a type of arithmetic on finite subsets of the natural numbers
For
then
iff ![{\displaystyle n|(a-b)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/a02b5fa3842e25fb6b67f61a986035bd1e386b46)
This is read as "a is congruent modulo n to b".
If
then
![{\displaystyle 13=1\mod {6}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/f943254892175deed75c96c84ed46f2059dfee2e)
![{\displaystyle 10=4\mod {6}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/05911b4c5f766571714db1005b637f57dd2a42a9)
![{\displaystyle 1=13\mod {6}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/13f5562c791ba223262c1d101c932a2735053327)
If
then
![{\displaystyle 26=0\mod {13}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/349299087923be6b96f68e93f2b4e32b94ae6e71)
![{\displaystyle 42=3\mod {13}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/011f5e2b5bb05335f323d449767cf0a706fc17a4)
An easy way to calculate in mod{n} is
they have the same remainder when divided by
.
Congruence modulo n is an equivalence relation.
Let
.
Then
and
so
.
Thus
.
Let
such that
.
Then
.
Since
.
Thus
.
Let
such that
.
Then
.
Then
.
Thus
and
.