I am having trouble understanding division in modular arithmetic. I didn't manage to find any good resources online on that.
Usually it is explained like this:
If we have $a \equiv b$ (mod $n$) with $a = ka'$ and $b = kb'$. Then by definition we have $k(a' - b') = qn$ for some integer $q$. Then they say that from this last equation we are sure that $n$ divides $(a' - b')$, but not $k$. Why is that?
Also it is said that one should divide $n$ with the $GCD(n,k)$, but I can not see how that comes into play.
Can anyone show modular division more generally or provide a good resource to study it?
$\begin{align} \bmod n&\!:\ kx\equiv ka\\[.2em] \iff\ \ \ \, n&\mid k\,(x-a)\\[.2em] \iff \color{#c00}{n/d}&\mid (\color{#c00}{k/d})(x-a),\ \ {\rm by\ cancelling}\ \ d = \gcd(n,k)\ \ {\rm from\ prior}\\[.2em] \iff n/d&\mid x-a,\ \ {\rm by}\ \ {\rm Euclid's\ Lemma}\ \ \&\ \gcd(\color{#c00}{n/d,k/d}) = \gcd(n,k)/d = \color{#c00}1\\[.2em] \iff \bmod n/d&\!:\, x\equiv a \end{align}$