Finding solutions to congruence equations In my notes it has a theorem, stating: $ax\equiv b\mod m$ has solutions if and only if $\gcd(a,m)|b$. 
The proof going from right to left is:
If $d=\gcd(a,m)$, $d|b \Rightarrow b=td$. We write $d=ra+sm$ for $r,s\in\mathbb{Z}$ so $b=t(ra+sm)=tra+tsm\equiv (tr)a\mod m$, so $x=tr$ is a solution.
Why is $x=tr$ a solution?
 A: You want to find $x$ such that $ax+km=b$ for some $k$.
$d=ra+sm$ is a divisor of $b=td$, 
Since $tsm\equiv 0$ mod $m$, we see that $ra+sm\equiv ra$ mod $m$.
Therefore, as wanted, $ax=a(tr)\equiv b$ mod $m$.
A: Viewed $\bmod m\,$ the proof amounts simply to the fact that multiples of $\,a\,$ are closed under scaling, i.e. $\,a\mid d\,\Rightarrow\, a\mid nd\,\pmod m.\,$ Eliminating the notion of $\rm\color{#0a0}{modular\  divisibility}\,$ it is more simply viewed as $\color{#c00}{\text{scaling}}$ the Bezout identity for the gcd, namely
$\qquad\qquad\begin{align} 
            &\ \ \ \  \gcd(a,\ m)= d\\
\Rightarrow &\ \ \ \ \ \ ja\ +\ km=d\quad\ \text{by Bezout, for some } j,k\in\Bbb Z\\
\Rightarrow & \ \ \ nja + nkm= nd\ \ \ {\rm by}\ \color{#c00}{\text{scaling}}\ {\rm by}\ n\\
\Rightarrow &\ \ \ \color{#c00}{nj}a \equiv nd\!\!\!\pmod{\! m}\\
\Rightarrow &\ \ \ \ \,a\color{#c00}x \equiv nd \!\!\!\!\pmod m\ \ \text{is solvable for } x
\end{align}$
i.e. $ $ Bezout $\,\Rightarrow\, aj\equiv d\,\Rightarrow\, a(nj)\equiv nd\pmod{\!m}\,  $ by $\color{#c00}{\text{scaling}}$ by $\,n$
i.e. $\ \ \ {\rm mod}\,\ m\!:\ \ a\mid d\,\ \Rightarrow\,\ a\mid nd\,\ $ viewed in terms of $\color{#0a0}{\,\rm divisibility\ {\rm mod}\ m}$

If you are familiar with ideal arithmetic then the proof is even more concise
$\qquad\begin{align} &\ \exists\, x\!:\ b\equiv ax\!\!\!\pmod{\! m}\\
\iff&\ \exists\, x\!:\ b-ax \in m\Bbb Z\\ \
\iff&\qquad\ \ b\in a\Bbb Z+m\Bbb Z = \gcd(a,m)\Bbb Z\ \ \ {\rm by\ Bezout}\\ 
\iff&\ \gcd(a,m)\mid b\end{align}$
