Finding invariant factors of finitely generated Abelian group There is this question that I wasn't sure how to do but somehow got the answers partially correct (maybe).
Suppose that the abelian group $M$ is generated by three elements $x,y,z$ subject to the relations $4x+y+2z=0, 5x+2y+z=0,6y-6z=0$. Determine the invariant factors of $M$.
My attempt:
I wasn't sure what theorem or reasoning to use, but I have a feeling to write the equations in matrix form and find the equivalent matrix. My question is normally if we write in matrix form, we should be priorly given a map or homomorphism, but this question did not, or whether somehow we can interpret the equations as map? if so, what is the map?
Let me try to make one. Let $M$ be the $\mathbb{Z}$-module $F/N$ where $F=\mathbb{Z}^3$ and $N=\langle(4,5,0),(1,2,6),(2,1,-6)\rangle\le\mathbb{Z}^3$. Consider the homomorphism $\varphi:\mathbb{Z}^3\to\mathbb{Z}^3$ given by $(x,y,z)\to x(4,5,0)+y(1,2,6)+z(2,1,-6)$. Am I correct? Please correct me if I am wrong.
Then I find the equivalent matrix:
$\begin{bmatrix}4 & 1 & 2\\5 & 2 & 1\\0 & 6 & -6\end{bmatrix}$ $4R_2-5R_1$ $\begin{bmatrix}4 & 1 & 2\\0 & 3 & -6\\0 & 6 & -6\end{bmatrix}$ $R_3-2R_2$ $\begin{bmatrix}4 & 1 & 2\\0 & 3 & -6\\0 & 0 & 6\end{bmatrix}$ $3R_1+R_2$ $\begin{bmatrix}12 & 6 & 0\\0 & 3 & -6\\0 & 0 & 6\end{bmatrix}$ $R_2+R_3$ $\begin{bmatrix}12 & 6 & 0\\0 & 3 & 0\\0 & 0 & 6\end{bmatrix}$ $R_1-2R_2$ $\begin{bmatrix}12 & 0 & 0\\0 & 3 & 0\\0 & 0 & 6\end{bmatrix}$. Then by performing column and row swaps, the matrix becomes $\begin{bmatrix}3 & 0 & 0\\0 & 6 & 0\\0 & 0 & 12\end{bmatrix}$. Since 3,6,12 are non-units in $\mathbb{Z}$, then the invariant factors of M are 3, 6, 12.
However, the solution says that the invariant factors are 1,3,6. 
Was my method correct? Where did I make the mistake?
Thanks!
 A: When you do the operation $4 R_2 - 5 R_1$, you are altering the determinant by a factor of $4$, since you are multiplying your matrix on the left by
$$
\begin{bmatrix}1 & 0 & 0\\-5&4&0\\0&0&1\end{bmatrix}.
$$
Ditto for $3 R_1 + R_2$, which alters the determinant by a factor of $3$. These two operations have introduced the spurious factor $12$.
I don't have the time to post the correct calculations (which are a lengthier alternative to the use of the determinant in this case), perhaps later.

So here's how you do it:
$$\begin{align}
&\begin{bmatrix}4 & 1 & 2\\5 & 2 & 1\\0 & 6 & -6\end{bmatrix} C_1 \leftrightarrow C_2 \begin{bmatrix}1 & 4 & 2\\2 & 5 & 1\\6 & 0 & -6\end{bmatrix} R_2 - 2 R_1 \begin{bmatrix}1 & 4 & 2\\0 & -3 & -3\\6 & 0 & -6\end{bmatrix} R_3 - 6 R_1\\& \begin{bmatrix}1 & 4 & 2\\0 & -3 & -3\\0 & -24 & -18\end{bmatrix} C_2 - 4 C_1, C_3 - 2 C_1 \begin{bmatrix}1 & 0 & 0\\0 & -3 & -3\\0 & -24 & -18\end{bmatrix} R_3 - 8 R_2\\& \begin{bmatrix}1 & 0 & 0\\0 & -3 & -3\\0 & 0 & 6\end{bmatrix}  C_3 - C_2 \begin{bmatrix}1 & 0 & 0\\0 & -3 & 0\\0 & 0 & 6\end{bmatrix} {-R_2} \begin{bmatrix}1 & 0 & 0\\0 & 3 & 0\\0 & 0 & 6\end{bmatrix}
\end{align}$$
A: There is a bit of theory to go through to explain how the invariant factors of the matrix you wrote down is actually related to $M,$ you will have to go through your notes to see the precise connection.
As for the calculation, perhaps recheck your operations, or post them here so we might we able to say where you went wrong. 
It turns out that for this matrix, we can get away with doing no work by using the fact that the product of the invariant factors is equal to the determinant of the matrix, which we can compute is $18 = 2\cdot 3^2.$ Since each invariant factor must divide the next, the only possibility is $1,3,6.$
