TITLE: Prove that the multiplicative inverse of $a$ modulo $m$ exists if and only if $a$ and $m$ are coprime.
QUESTION [13 upvotes]: Prove that the multiplicative inverse of $a$ modulo $m$ exists if and only if $a$ and $m$ are coprime.
Can someone help me with this?

REPLY [5 votes]: Suppose there exists a multiplicative inverse q such that
$aq \equiv 1\ (mod\ m) \implies aq - 1 = mk \implies aq + mk_1 = 1 \implies gcd(a,m) = 1$ can be easily proven I will leave it as excerise to you how I reached that last step.
Now going the other side
Suppose that $gcd(a,m) = 1 \implies ay_1 + mq_1 = 1 \implies ay_1 \equiv 1 \ (mod\ m)$, so multiplicative inverse exists.
I have taken few short-cuts since some steps are trivial to complete but if you don't see it right away I can modify my answer.