Prove $ax \equiv b \mod m \iff b \equiv 0 \mod gcd(m, a)$.
I have been stuck for quite some time, but here is my proof so far:
Let $gcd(m, a) = d$. Then $b = dk$.
$ax \equiv b \mod m \implies ax - qm = b$.
A solution exists if and only if $x \in \mathbb{Z}$. So solving for $x$, we find that $x = \frac{b+qm}{a}$. Because $d | m \land d | a$, it can be said that $x = d(\frac{k + qj}{i})$ where $m = dj$ and $a = di$.
I have a feeling that I can show that $x$ is an integer by doing something like this, but I'm not quite sure how.