An integer $a \pmod m$ has inverse if and only if $\gcd(a,m)=1$? An integer $a \pmod m$ has inverse if and only if $\gcd(a,m)=1$?
Why is this? I tried understanding it from my notes but I don't get it.
A thorough explanation would be greatly welcome.
Thanks for all the answers so far. I think my biggest problem is understanding why $\gcd(a,m)\neq1 \Longrightarrow \not\exists a^{-1}$.

Everything is based on Bézout's theorem: 
$$\gcd(a,m)=1\iff \exists\, u,v\in\mathbf Z\enspace \text{such that}\enspace ua+vm=1$$
This theorem shows that, if $\gcd(a,m)=1$, then $vm\equiv 1\mod a$.
Conversely, if  $\,vm\equiv 1\mod a$, it means there exists $u\in\mathbf Z$  such that $vm=1+ua$, whence $-ua+vm=1$, so that $\gcd(a,m)=1$.
