Let $n$ be an integer and $i\in \{1,\cdots,n-1\}$. I want to show that $i$ is invertible in $\mathbb Z_n$ if and only if $i$ is coprime to $n$.
One way is easy. suppose $i$ is coprime to $n$ then $\alpha i +\beta n=1$ for some $\alpha,\beta \in \mathbb Z$, so $\alpha i =1 - \beta n$ hence $\alpha i \equiv 1 (mod\; n)$ and $i$ is invertible.
the other way is less obvious to me. suppose that $i$ is invertible in $\mathbb Z_n$. Why it must be coprime to $n$? my guess: suppose they are not coprime then $i=da$ and $n=db$ for some $d>1,a,b$ but since $i$ is invertible then $li=1+mn$ for some $l,m$ hence $lda=1+mdb$ so $d(la-mb)=1$ this implies that $d=\pm 1$ which is impossible since $d>1$
is this correct and is there more conceptual argument for this?