Let $m$ and $n$ be positive integers and let $F : \mathbb{Z}_n \to \mathbb{Z}_n$ be given by $F(\overline{x}) = m \overline{x} = \overline{mx}$. I am struggling to show the fact that $\ker F$ has precisely $d$ elements, where $d = gcd(m,n)$.
I know $\ker F$ is a cyclic group of $\mathbb{Z}_n$, so that $|\ker F|$ divides $n$. I also know that $\ker F$ is generated by the least integer $x \in \{ 1, \dots, n \}$ such that $n$ divides $mx$. How do I show that this integer is in fact $n/d$?
For notational convenience, I will identify the abelian group $\mathbb Z_n \stackrel{\text{def}}{=} \mathbb Z / n \mathbb Z$ with the group of least non-negative residues $\{0, 1, \dots, n - 1 \}$ modulo $n$ under addition modulo $n.$ Consider the map $f : \mathbb Z_n \to \mathbb Z_n$ defined by $f(x) = mx$ for some positive integer $m$ such that $\gcd(m, n) = d.$
Given that $d = 1,$ Bézout's Theorem implies that there exist integers $a$ and $b$ such that $am + bn = 1.$ Consequently, the least non-negative residue of $am$ is $1$ modulo $n$ so that $f$ is injective. Explicitly, given any least non-negative residue $x$ modulo $n$ such that $mx = 0,$ multiplying both sides by $a$ yields $x = 0.$ Consequently, we have that $\ker f = \{0\}$ so that $|\ker f| = d.$
We will assume therefore that $d \geq 2.$ We may write $m = dk$ and $n = d \ell$ for some positive integers $k$ and $\ell$ such that $\gcd(m, k) = 1$ and $\gcd(n, \ell) = 1.$ Observe that $\ell \in \ker f.$ Explicitly, we have $$f(\ell) = m \ell = (dk) \ell = (d \ell) k = nk \equiv 0 \text{ modulo } n.$$ Consequently, we have that $\{0, \ell, 2 \ell, \dots, (d - 1) \ell\} \subseteq \ker f.$ We claim that the reverse containment holds, as well. Given any least non-negative residue $x$ modulo $n$ such that $mx = 0,$ we must have that $n \,|\, mx.$ Certainly, this implies that $\frac n d \,|\, \frac m d x.$ (We have that $mx = nj$ for some integer, so we may divide both sides of the equation $mx = nj$ by $d.$) Considering that $\frac n d$ and $\frac m d$ are relatively prime, we conclude that $\frac n d \,|\, x$ so that $\ell \,|\, x$ and $\ker f = \{0, \ell, 2 \ell, \dots, (d - 1) \ell \},$ as desired.