Extending a given element of a free abelian group to a basis Let $V$ be a free $\mathbb{Z}$-module (or a free abelian group) with basis $(v_1$, $v_2$, $v_3)$. Denote by $x$ an arbitrary nonzero element of $V$, say $x=mv_1+nv_2+kv_3 \in V \setminus \{0\}$; here $m,n,k \in \mathbb{Z}$.  
It is known that the element $x$ can be extended to a basis iff $\gcd(m,n,k)=1$. I am trying to understand this statement (which of course can be generalized for free modules of an arbitrary finite rank), but first I would like to know how does it work in practice -- given particular integers $m,n,k,$ not all zero, how do I extend the element $x$ to a basis? Further, given a candidate for a basis, how do I verify that it is indeed a basis? Could you give a particular example? If possible, I would like to see matrix interpretation of this problem -- probably this would enable me to get one step closer to this question.
The proof of the above statement (or its generalized version) would be also appreciated, albeit at the moment I am more interested in an example.
 A: You want to find two vectors which, together with $(m,n,k)$ make a matrix with determinant $\pm 1$. Then the three vectors will form a free basis of ${\mathbb Z}^3$.
One way of doing that is to perform some elementary unimodular column operations on $(m,n,k)$ to transform it to $(1,0,0)$. This you can easily extend to a free basis of ${\mathbb Z}^3$. Then, reverse your column operations on the resulting $3 \times 3$ matrix, to bring the first row back to $(m,n,k)$. The determinant of the new matrix will still be$\pm 1$, so its rows will give you the required free basis.
For example, let $(m,n,k) = (4,6,15)$. The column operations $c_2 \to c_2-c_1$, $c_1\to c_1-2c_2$, $c_3\to c_3-7c_2$, $c_2 \to c_2-2c_3$ in that order, transfors this vector to $(0,0,1)$, which we can extend to the matrix $$\left(\begin{array}{rrr}0&0&1\\0&1&0\\1&0&0\end{array}\right)$$ with determinant $-1$.
Now reversing the column operations on this matrix, we do $c_2\to c_2+2c_3$, $c_3\to c_3+7c_2$, $c_1 \to c_1+2c_2$, $c_2 \to c_2+c_1$, which transforms it to $$\left(\begin{array}{rrr}4&6&15\\2&3&7\\1&1&0\end{array}\right)$$
which still has determinant $-1$, and its rows form a free basis of ${\mathbb Z}^3$.
In practice you might be able to shorten the calculation by extending the first vector to a free basis as soon as you can do this easily. In the exampe above you might have stopped one step earlier and extended $(0,2,1)$ to a free basis.
