Prove that the congruence $ax \equiv b $ mod $m$ has a solution if and only if $d | b$, where $d = $gcd$(a,m)$
I thought about proving using the contrapositive that $d$ does not divide $b$, but i'm not sure that would really help and am stumped as to where to start.
Some help would be great!
The congruence means $$m\mid ax-b$$ which means that integers $x$ and $y$ exist such that $my=ax-b$ , hence $b=ax-my$. This diophantine equation has integer solutions if and only if $\gcd(a,m)$ divides $b$