This is, admittedly, not that interesting a question, but it's a small piece of a number theory problem I'm working on, and it's been rather frustrating. As it is technically "homework," feel free to just give suggestions, unless of course it's something really obvious.
I want to prove that for a general integer matrix, $A\in M_n(\mathbb{Z})$, there exist $U,V\in GL_n(\mathbb{Z})$ such that $UAV = \left[ \begin{array}{rrrrrr} d_1 & & & & & 0\\\ & \ddots & & & & \\\ & & d_r & & &\\\ & & & 0& &\\\ & & & & \ddots &\\\ 0 & & & & & 0 \end{array} \right]$, where $r=\mathrm{rank}A$, $d_i\in\mathbb{N}$ and $d_i\vert d_{i+1}$.
I feel like this should be just a linear algebra thing. I tried to just break it down into elements for just a 2 by 2, and it got so messy, so I'm thinking that's not the way to do it, and I'm wondering if maybe it's just a well known theorem (the issue here of course being that everything is integers, so I can't really apply stuff about diagonalizing matrices over a field). Any assistance on this would be dearly appreciated.
Thanks!