# Difference is Rational is Equivalence Relation

## Theorem

Define $\sim$ as the relation on real numbers given by:

- $x \sim y \iff x - y \in \Q$

That is, that the difference between $x$ and $y$ is rational.

Then $\sim$ is an equivalence relation.

## Proof

Checking in turn each of the criteria for equivalence:

### Reflexive

\(\displaystyle \) | \(\) | \(\displaystyle \forall x \in \R: x - x = 0 \in \Q\) | $\quad$ | $\quad$ | |||||||||

\(\displaystyle \) | \(\leadsto\) | \(\displaystyle x \sim x\) | $\quad$ | $\quad$ |

So $\sim$ is reflexive.

$\Box$

### Symmetric

\(\displaystyle x\) | \(\sim\) | \(\displaystyle y\) | $\quad$ | $\quad$ | |||||||||

\(\displaystyle \) | \(\leadsto\) | \(\displaystyle x - y \in \Q\) | $\quad$ | $\quad$ | |||||||||

\(\displaystyle \) | \(\leadsto\) | \(\displaystyle x - y = \frac p q\) | $\quad$ for some integers $p, q$ | $\quad$ | |||||||||

\(\displaystyle \) | \(\leadsto\) | \(\displaystyle -\paren {x - y} = \frac {-p} q\) | $\quad$ Definition of Diagonal Relation | $\quad$ | |||||||||

\(\displaystyle \) | \(\leadsto\) | \(\displaystyle y - x \in \Q\) | $\quad$ as $-p$ is an integer | $\quad$ | |||||||||

\(\displaystyle \) | \(\leadsto\) | \(\displaystyle y \sim x\) | $\quad$ | $\quad$ |

So $\sim$ is symmetric.

$\Box$

### Transitive

\(\displaystyle \) | \(\) | \(\displaystyle \forall x, y, z \in \R: x \sim y \land y \sim z\) | $\quad$ | $\quad$ | |||||||||

\(\displaystyle \) | \(\implies\) | \(\displaystyle x - y = \frac p q \land y - z = \frac r s\) | $\quad$ for some integers $p, q, r, s$ | $\quad$ | |||||||||

\(\displaystyle \) | \(\leadsto\) | \(\displaystyle x - z = \frac p q - \frac r s\) | $\quad$ adding the second equality to the first | $\quad$ | |||||||||

\(\displaystyle \) | \(=\) | \(\displaystyle \frac {s p - q r} {q s} \in \Q\) | $\quad$ as $s p - q r$ and $q s$ are integers | $\quad$ | |||||||||

\(\displaystyle \) | \(\leadsto\) | \(\displaystyle x \sim z\) | $\quad$ | $\quad$ |

So $\sim$ is transitive.

$\Box$

Thus $\sim$ has been shown to be reflexive, symmetric and transitive.

Hence by definition it is an equivalence relation.

$\blacksquare$