Determining the structure of the $\mathbb{Z}$-module $\mathbb{Z}^3/K$, with $K=\langle (2,1,-3),(1,-1,2)\rangle$ Well, this is the exercise:

Determine the structure of $\mathbb{Z}^{(3)}/K$ where $K$ is generated by $f_1=(2,1,-3)$, $f_2=(1,-1,2)$. 

Looking at the proof of the fundamental structure theorem for finitely generated modules over a PID, I tried to find the normal form of 
$$
A=\begin{pmatrix}
2 & 1 &-3 \\
1 & -1 & 2
\end{pmatrix}
$$
then,  by multiplications with elementary matrices (in each $\rightarrow$ I multiplied $A$ by elementary matrices, so A is equivalent with all these matrices)
$$
A \rightarrow\begin{pmatrix}
1 & -1 & 2 \\
2 & 1 &-3
\end{pmatrix}\rightarrow \begin{pmatrix}
1 & 0 & 0 \\
2 & 3 & -7
\end{pmatrix} \rightarrow\begin{pmatrix}
1 &0 & 0\\
0 & 3&-7
\end{pmatrix}\rightarrow \begin{pmatrix}
1&0&0 \\
0&3&-1
\end{pmatrix}\rightarrow \begin{pmatrix}
1&0&0 \\
0&-1&3
\end{pmatrix}\rightarrow \begin{pmatrix}
1 & 0 &0\\
0&-1&0
\end{pmatrix}
$$
and I got that
$$
A\sim \begin{pmatrix}
1 & 0 & 0\\
0 & -1 & 0 
\end{pmatrix}
$$
But, I found this. So, Where is my mistake? And, I'd appreciate if someone could explain me the reasoning in the above link.
EDIT: I have to add that, if my calculations were correct, I still don't get how can be that both invariant factors were units. I think (please correct me If I'm wrong) that if both were units implies that $\mathbb{Z}^3/K$ would be isomorphic to $\{0\}$, and that can not be. 
 A: You are right and something in the calculation in the linked question went wrong.
Observe that $A$ has a $2\times2$ minor
$$
\left|\begin{array}{rr}2&-3\\1&2\end{array}\right|=7.
$$
The g.c.d. of the $2\times2$ minors is equal (up to sign) to the product of two smallest invariant factors. But $3\nmid7$, so $3$ cannot appear in the Smith normal form, i.e. the other poster (or I!) made an error.

The role of the diagonal entries in the Smith normal form appears in the theorem (aka the stacked bases theorem): Assume that $R$ is a PID and $M\subseteq N$ are finitely generated free $R$-modules. Let $u_1,u_2,\ldots,u_n$ be a basis of $N$, $v_1,v_2,\ldots,v_m, m\le n,$ be generators of $M$. Let $A=(a_{ij})$ be the $m\times n$ matrix $A$ determined by the equations¹
$$
v_i=\sum_{j=1}^na_{ij}u_j.
$$
If the diagonal entries of the Smith normal form of $A$ are $d_1\mid d_2\mid\cdots\mid d_m$, then there exist bases (these are the stacked bases) $e_1,e_2,\ldots,e_n$ of $N$ and $f_1,f_2,\ldots,f_m$ of $M$ such that
$$
f_i=d_ie_i\quad\text{for all $1\le i\le m$}.
$$
Consequently
$$
N/M\cong (R/d_1R)\oplus (R/d_2R)\oplus\cdots (R/d_mR)\oplus R^{n-m}.
$$

¹In other words, the $k$-th row of the matrix $A$ is the element $v_k$ written in the basis given by $u_1, u_2, \dots, u_n$ (just like a coordinate vector in the context of vector spaces).

There is a proof of this result in at least Jacobson Basic Algebra I, and probably at most other textbooks. It does follow relatively easily from the characterization of Smith normal form.
In your case this implies that
$$
\mathbb{Z}^3/K\cong \mathbb{Z}/(1\cdot\mathbb{Z})\oplus\mathbb{Z}/((-1)\cdot\mathbb{Z})\oplus\mathbb{Z}^{3-2}\cong\mathbb{Z}.
$$
