TITLE: Simple proof of: if $ax\equiv ay \pmod{m}$, and $\gcd(a,m)=1$, then $x\equiv y$
QUESTION [5 upvotes]: I'm working on a proof of: "if $ax\equiv ay \pmod{m}$, and $\gcd(a,m)=1$, then $x\equiv y\pmod{m}$". Here's what I have so far:
Suppose $ax\equiv ay\pmod{m}$, and $\gcd(a,m)=1$
By definition, $ax = ay + mp$ for some $p\in\mathbb{Z}$
By definition, $ay = ax + mr$ for some $r\in\mathbb{Z}$
By Bezout's identity, it must be that $\gcd(a,m) = ax$
Similarly, it must be that $\gcd(a,m) = ay$
Therefore, $ax = ay$
Obviously, $x=y$
Q.E.D.
Is this ok?

REPLY [2 votes]: The quick proofs all use that $ax \equiv ay \pmod m$ is equivalent to $m | (ax - ay) = a(x - y)$.
If $m$ divides $a(x - y)$, and $m$ has no factors in common with $a$ (by hypothesis $\gcd(a, m) = 1$), then it must be that $m | (x - y)$.
But that's equivalent to $x \equiv y \pmod m$. QED.