Given the following theorem
(Smith normal form) Let $R$ be a PID and $A$ an $m \times n$ matrix over $R$. Then there exist square invertible $R$-matrices $P$ and $Q$ such that $A'=PAQ$ is a diagonal matrix of the form $$A'= \left( \begin{matrix} d_1 & & & 0 \\ & \ddots & & \vdots \\ & & d_r & 0 \\ 0 & \dots & 0 & 0 \end{matrix} \right),$$ where each diagonal element divides the following, $d_1 | d_2 | \dots | d_r$. Moreover, the elements $d_1,\dots,d_r$ are uniquely determined apart from some units.
I would like to solve following exercise.
Let $\phi: \mathbb{Z}^k \to \mathbb{Z}^k$ be a morphism given by left multiplication with a matrix $A$.
(i) Prove that $\mathrm{im}(\phi)$ has finite index if and only if $A$ is non-singular.
(ii) Show that in this case the index is equal to $|\det(A)|$.
My approach: by changing the bases one can bring $A$ in Smith normal form. I believe that one can see that $\mathbb{Z}^k/im(\phi) \cong \mathbb{Z}/d_1\mathbb{Z} \oplus \dots \oplus \mathbb{Z}/d_r\mathbb{Z} \oplus \mathbb{Z}^{k-r}$ but I don't have a rigorous argument yet. The matrices $P$ and $Q$ don't affect the absolute value of the determinant of $A$ since they are unimodular. Therefore if A is non singular ($r=k$), $\det(A)=d_1 \cdots d_r$.
You need to show that $A$ is non-singular if and only if $A'$ has no $0$'s on the diagonal. Since $R$ is a PID, there are no $0$ divisors. Thus $\det(A')\neq 0$ if it has all nonzero entries on the diagonal.