For context, this question comes from Joseph Gallian's Contemporary Abstract Algebra (9 ed.):
Let $r \in U(n)$. Prove that the mapping $\alpha: \mathbb{Z}_n → \mathbb{Z}_n$ defined by $\alpha(s) = sr\bmod n$ for all $s$ in $\mathbb{Z}_n$ is an automorphism of $\mathbb{Z}_n$.
With this, I naturally wanted to show injectivity first, so I started by supposing $\alpha(x) = \alpha(y)$ for some $x, y \in \mathbb{Z}_n$. This means $xr\text{ mod } n = yr\bmod n$, which (correct me if I'm wrong) is the same as saying $xr \equiv yr\pmod{n}$. From here, I want to show that $x \equiv y\pmod{n}$, which is equivalent to the question asked in the title since $r \in U(n)$ implies $\gcd(n, r) = 1$.
So, because $xr \equiv yr\pmod{n}$, we have that $xr - yr = nq$ for some $q \in \mathbb{Z}$, and overall $$r(x - y) = nq$$ From here, I claim that because $\gcd(n, r) = 1$, $n$ cannot divide $r$, so $n \mid x - y$ and so $x \equiv y\pmod{n} and we are done.
I am posting this question to ask whether this solution is correct, since I feel that the implication I used from $n$ and $r$ being coprime is a little hand-wavy--can't we also say that $x - y$ can divide $n$? My best argument against this is that if we divide both sides by $n$, we see that $$ \frac{r(x - y)}{n} = r\frac{x - y}{n} = q \neq \frac{r}{n}(x - y) $$ because the overall quotient must be an integer, $n$ must divide either $r$ or $x - y$, and $n$ cannot divide $r$, so $n$ must divide $x - y$. Similar logic for dividing both sides by $x - y$ wouldn't apply since we have no information about $q$, so we can't necessarily say that $x - y$ divides $n$.
However, I don't know if this is the best argument, since (1) we are working in the context of a group under addition, so an argument using division seems shaky to me, and (2) although the logic seems fine, it doesn't seem "formal" enough. Is my logic or my result correct?
solution-verificationquestion to be on topic you must specify precisely which step in the proof you question, and why so. This site is not meant to be used as a proof checking machine. – Bill Dubuque Apr 02 '24 at 15:42