Equivalence Relation/Examples/Congruence Modulo Natural Number

Theorem
Let $m \in \N$ be a natural number.

Let $n \in \N_{>0}$ be a non-zero natural number.

Let $\RR_{m, n}$ be the relation on $\N$ defined as:


 * $\forall x, y \in \N: x \mathrel {\RR_{m, n} } y \iff \begin {cases} x = y \\ m \le x < y \text { and } n \divides \paren {y - x} \\ m \le y < x \text { and } n \divides \paren {x - y} \end {cases}$

Then $\RR_{m, n}$ is an equivalence relation which is compatible with both addition and multiplication.

Proof
First let it me noted that $\RR_{m, n}$ can be written as:


 * $\forall x, y \in \N: x \mathrel {\RR_{m, n} } y \iff \begin {cases} x = y \\ m \le x, y \text { and } n \divides \size {x - y} \end {cases}$

where $\size {x - y}$ denotes the absolute value of $x - y$.

Checking in turn each of the criteria for equivalence:

Reflexivity
We have that:
 * $\forall x \in \N: x = x$

and so:
 * $x \mathrel {\RR_{m, n} } x$

Thus $\RR_{m, n}$ is seen to be reflexive.

Symmetry
Let $x, y \in \N$ such that $x \mathrel {\RR_{m, n} } y$.

If $x = y$ then trivially $y = x$ and so:
 * $y \mathrel {\RR_{m, n} } x$

Otherwise note that:
 * $n \divides \size {x - y} \iff n \divides \size {y - x}$

and it follows directly that:
 * $y \mathrel {\RR_{m, n} } x$

Thus $\RR_{m, n}$ is seen to be symmetric.

Transitivity
Let $x, y, z \in \N$ such that $x \mathrel {\RR_{m, n} } y$ and $y \mathrel {\RR_{m, n} } z$.

First suppose $x = y$ or $y = z$ or $x = z$.

Then trivially $x \mathrel {\RR_{m, n} } z$.

Otherwise we have that:
 * $x \ne y \ne z \ne x$

and:
 * $x, y, z \ge m$

, let $x < y < z$.

If not, then as $\RR_{m, n}$ is symmetric we can rename $x$, $y$ and $z$ as necessary.

Then:

Thus $\RR_{m, n}$ is seen to be transitive.

Thus $\RR_{m, n}$ has been shown to be reflexive, symmetric and transitive.

Hence by definition it is an equivalence relation.

Compatibility with Addition
In order to show that $\RR_{m, n}$ is compatible with addition, we need to show that:


 * $\forall x, y, z \in \N: x \mathrel {\RR_{m, n} } y \implies \paren {x + z} \mathrel {\RR_{m, n} } \paren {y + z}$

and:


 * $\forall x, y, z \in \N: x \mathrel {\RR_{m, n} } y \implies \paren {z + x} \mathrel {\RR_{m, n} } \paren {z + y}$

Because Natural Number Addition is Commutative, it is sufficient to demonstrate the first of these only.

So, let $x, y \in \N$ be such that:
 * $x \mathrel {\RR_{m, n} } y$

First let $x = y$.

We have that:
 * $x = y \implies x + z = y + z$

and so:
 * $\paren {x + z} \mathrel {\RR_{m, n} } \paren {y + z}$

Otherwise, we have that:
 * $x \ne y$ and $x, y \ge m$

, let $x < y$.

If not, then as $\RR_{m, n}$ is symmetric we can rename $x$ and $y$ as necessary.

Compatibility with Multiplication
Similarly, because Natural Number Multiplication is Commutative, in order to show that $\RR_{m, n}$ is compatible with multiplication, it is sufficient to demonstrate that:


 * $\forall x, y, z \in \N: x \mathrel {\RR_{m, n} } y \implies \paren {x z} \mathrel {\RR_{m, n} } \paren {y z}$

First let $x = y$.

We have that:
 * $x = y \implies x z = y z$

and so:
 * $\paren {x z} \mathrel {\RR_{m, n} } \paren {y z}$

Otherwise, we have that:
 * $x \ne y$ and $x, y \ge m$

, let $x < y$.

If not, then as $\RR_{m, n}$ is symmetric we can rename $x$ and $y$ as necessary.

First note that if $z = 0$, then:
 * $\paren {x z} = \paren {y z}= 0$

and so:
 * $\paren {x z} \mathrel {\RR_{m, n} } \paren {y z}$

Otherwise we have that $z \ge 1$ and so both $x z \ge m$ and $y z \ge m$.

Then:

Hence the result.