Structure theorem for modules implies Smith Normal Form I am working on a homework problem for an undergrad abstract algebra course and I have been stuck on something for a while. I am not looking for a full proof, but any help would be much appreciated. Apologies if this is something simple!
The problem: Show that for any matrix $B \in M_{n,m}(R)$, the orbit $GL_n(R) \cdot B \cdot GL_m(R)$ contains a matrix $A$ in Smith normal form, and moreover the integer $k$ and the ideals $(A_{11}),\ldots,(A_{kk})$ are uniquely determined. Edit: $R$ is a PID, and $k$ is the highest integer $i$ such that $A_{ii} \neq 0$.
I have the structure theorem at my disposal, and I have shown that $GL_n(R) \cdot B \cdot GL_m(R)$ corresponds to the set of matrices for the linear transformation $f: R^m \to R^n$ given by $f(m) = Bm$ for all possible bases of $R^m$ and $R^n$.
It is suggested that I start with the $\ker(B) = \{0\}$ case and modify from there; I have figured out how to prove the full theorem assuming this case. Does anyone have any suggestions for going about this case? Again, I am not necessarily looking for a full proof, just something to help me get unstuck. Thank you for your time!
 A: This can be solved in a rather laborious way by taking gcd's and applying matrix operations. 
First consider column operations in $2 \times 2$ matrices, so take
$M = \begin{bmatrix} x_{11} & x_{12} \\ x_{21} & x_{22} \end{bmatrix}$.
Let $d$ be the gcd of $x_{11}$ and $x_{12}$, then there are $\lambda_1,\lambda_2$ such that $d = \lambda_{1}x_{11} + \lambda_{2}x_{12}$. 
Clearly $\lambda_1,\lambda_2$ are relatively prime, so there are $\mu_1,\mu_2$ such that $\lambda_1 \mu_1 + \lambda_2 \mu_2 = 1$.
We get
$$
\begin{bmatrix}x_{11} & x_{12} \\ x_{21} & x_{22} \end{bmatrix} \begin{bmatrix} \lambda_1 & -\mu_{2} \\ \lambda_{2} & \mu_{1} \end{bmatrix} = \begin{bmatrix} d & m \\ ? & ? \end{bmatrix},
$$
where the second matrix is clearly invertible. Hence we have extracted the greatest common divisor of the coefficients in the first row.
For a larger matrix we can repeat this process, taking the gcd of the upper left coefficient with each coefficient in the first row until we have an upper left coefficient that divides all of the first row. (If some of the leading coefficients are zero we can just ignore them and swap columns if necessary).
Of course we can do the analogous thing to make the upper left coefficient divide the all coefficients in the first column. But if we do this we do not really control what happens in the first row, so what we have in the upper left corner might no longer divide the leading coefficient of all the column vectors. But if that is not the case we can repeat the process for the column and so on. This gives us an ascending chain of ideals. Since $R$ is noetherian we eventually get a coefficient that divides every coefficient in the first row and the first column. Then finally we use that coefficient to clear the first row and column.
After that we can proceed by using induction. I hope there is a better way to do this.
