Show $Z_{ab}\simeq Z_a\oplus Z_b$ by elementary row and column operations Let $a,b\in\mathbb N$ be coprime. By manipulating with the matrix $\operatorname{diag}(a,b)$, prove that the cyclic group $Z_{ab}$ is isomorphic to the direct sum $Z_a\oplus Z_b$.
I guess I should obtain the matrix $\operatorname{diag}(1,ab)$ from the matrix $\operatorname{diag}(a,b)$ by elementary (integer) row and column operations (which can be done by a theorem on Smith's normal form), but I don't know how to do that since $a,b$ needn't be invertible, so I cannot multiply rows/columns by them.
 A: You can certainly multiply rows and columns by $a$ and $b$, if all you do is add that multiple to another row or column. Less cryptically put:
$$
\det\begin{pmatrix}
1 & a \\ 0 & 1
\end{pmatrix} = 1
$$
so it is safe to multiply by it. First however, let $s,t\in\Bbb Z$ be so that $sa+tb=1$, which you can do because they are coprime. So, consider 
$$
 \begin{pmatrix} s & -t \\ b & a \end{pmatrix}
 \begin{pmatrix} a &  0 \\ 0 & b \end{pmatrix}
 \begin{pmatrix} 1 & 0 \\ -1 & 1\end{pmatrix}
 \begin{pmatrix} 1 & tb \\0  & 1 \end{pmatrix}
=\begin{pmatrix} sa & -tb \\ ba & ab \end{pmatrix}
 \begin{pmatrix} 1 & 0 \\ -1 & 1\end{pmatrix}
 \begin{pmatrix} 1 & tb \\0  & 1 \end{pmatrix}
=\begin{pmatrix} 1 & -tb \\ 0 & ab \end{pmatrix}
 \begin{pmatrix} 1 & tb \\0  & 1 \end{pmatrix}
=\begin{pmatrix} 1 & 0 \\ 0 & ab \end{pmatrix} 
$$
where we have multiplied from the left and from the right only by invertible matrices.
A: Hint: To obtain that $1$ in the diagonal, use Bezout's identity: there are integers $u, v$ such that $ua+vb=1$. 
