TITLE: If L is a subgroup of $\mathbb{Z}^{3}$, linearly independent, linear equations
QUESTION [5 upvotes]: This exercise is from a book called "Introduction a L'Algebre et L'Analyse Modernes" de M.Zamansky, I attempted to solve. But I don't know if my solutions are correct (they seem too short to be correct). I am very grateful if somebody could take a look at it. 

Let L be a subgroup of $\mathbb{Z}^{3}$. Let $ q_{1}\mathbb{Z}$, $(q_{1}\ge 0)$ be the group of all $ x_{1} \in \mathbb{Z}$ with $ (x_{1},0,0) \in L$ and let $\displaystyle u_{1}=(q_{1},0,0)$. Let  $q_{2}\mathbb{Z}$, $(q_{2}\ge 0)$ be the group of all $x_{2} \in \mathbb{Z}$ so that there exists $x_{21} \in \mathbb{Z}$ with $(x_{21},x_{2},0) \in L$. If $q_{2}>0$ then $ u_{2}=(q_{21},q_{2},0) \in L$; otherwise $u_{2}=0$. Let $ q_{3}\mathbb{Z}$, $(q_{3}\ge 0)$ be the group of all $x_{3} \in \mathbb{Z}$ so that there are $x_{31},x_{32} \in \mathbb{Z}$ with $ (x_{31},x_{32},x_{3}) \in L$. If $ q_{3} > 0$ then $ u_{3} = (q_{31},q_{32},q_{3}) \in L$ otherwise $u_{3}=0$
  i) It holds that: $L= \mathbb{Z}u_{1} + \mathbb{Z}u_{2}+ \mathbb{Z} u_{3}$
  ii) If $L\ne \{0\}$ then the $u_{i}$ with $q_{i}>0 $ are $\mathbb{Z}$ linearly independent.
  iii) There are $q_{1},q_{2},q_{3}$ for $L= \{(x_{1},x_{2},x_{3}) \in \mathbb{Z}^{3}; 2x_{1}+4x_{2} + 5x_{3} = 0 \}$  

 Attempt ( with Dylan Moreland's hints) : 
i) Let $x=(x_{1},x_{2},x_{3})$ be an element of L, because $u_{3}=(q_{31},q_{32},q_{3})$ and the third coordinate is only found in $u_{3}$ and not in $u_{1}, u_{2}$, there $\exists a_{3} \in \mathbb{Z}$ so that $a_{3}u_{3} = x_{3}$. Similarly, there are $a_{1},a_{2} \in \mathbb{Z}$ so that $a_{1}q_{1}+a_{2}q_{21}+a_{3}q_{31} = x_{1}$ and $a_{2}q_{2}+a_{3}q_{32} = x_{2}$. But this is the same as saying $a_{1}u_{1}+a_{2}u_{2}+a_{3}u_{3} = (x_{1},x_{2},x_{3})$, so $L= \mathbb{Z}u_{1} + \mathbb{Z}u_{2} + \mathbb{Z} u_{3}$
ii) Suppose we have $a_{i} \in \mathbb{Z}$ such that:$$a_{1}u_{1}+a_{2}u_{2}+a_{3}u_{3}=0$$ 
If u_{3}=0, then we can ignore it, otherwise we must have $a_{3}=0$. If $u_{2}=0$, then we can ignore it, otherwise we must have $a_{2}=0$. If $u_{1}=0$, then we can ignore it, otherwise we must have $a_{1}=0$. So $u_{i}$ with $q_{i}$ must be $\mathbb{Z}$linearly independent. 
Can't we  just write the 3 vectors into a  matrix like : $\begin{pmatrix}q_{1} & 0&  0 \\ q_{21} &  q_{2}  & 0 \\ q_{31} & q_{32} & q_{3} \end{pmatrix}$
This matrix is a 3x3 matrix with rank 3, so its vectors must be linearly independent! 
iii) If $(x_{1},0,0) \in L$, then $2x_{1} = 0$, so we can put $u_{1}=0$. If $(x_{1},x_{2},0) \in L$,then $2x_{1}+4x_{2}=0$, so $x_{1}=-2x_{2}$ and we can put $u_{2}= (-2,1,0)$. If $(x_{1},x_{2},x_{3}) \in L$, then $2x_{1}+4x_{2}= + 5x_{3} = 0$. If we put $x_{3} = x_{1}+x_{2}$, then we get $7x_{1}+9x_{2} = 0$, and this has solutions for $x_{1}=-9$ and $x_{2}= 7$ , so $u_{3} = (-9, 7, 2)$
 These are my old attempts  : 
 i)  Assume  $L=(l_{1},l_{2},l_{3}) $If one can show that  $\mathbb{Z}(q_{1},0,0)+\mathbb{Z}(q_{21},q_{2},0)+ \mathbb{Z}(q_{31},q_{32},q_{3}) - (l_{1},l_{2},l_{3})=0$, then $L=\mathbb{Z}u_{1} + \mathbb{Z}u_{2}+ \mathbb{Z} u_{3}$. Now one can fix $\mathbb{Z}_{1}, \mathbb{Z}_{2}, \mathbb{Z}_{3}$ so that $\mathbb{Z}_{1}u_{1} + \mathbb{Z}_{2}u_{2}+\mathbb{Z}_{3}u_{3}-L$ = 0  with $L=(\mathbb{Z}_{1}q_{1}+\mathbb{Z}_{2}q_{21}+\mathbb{Z}_{3}q_{31}, \mathbb{Z}_{2}q_{2}+\mathbb{Z}_{3}q_{32}, \mathbb{Z}_{3}q_{3})$, so $L=\mathbb{Z}u_{1} + \mathbb{Z}u_{2}+ \mathbb{Z} u_{3} $ 
 ii)   Assume $u_{i}$ with $q_{i}>0$ are $\mathbb{Z}$ linearly dependent. Then all possible combinations are: $\mathbb{Z}u_{2} = \mathbb{Z}u_{1}$ or $\mathbb{Z}u_{3};  \mathbb{Z}u_{1}=\mathbb{Z}u_{2}$or $\mathbb{Z}u_{3}, \mathbb{Z}u_{3}=\mathbb{Z}u_{1}$ or $\mathbb{Z}u_{2}$; $\mathbb{Z}u_{1} - \mathbb{Z}u_{2} = \mathbb{Z} u _{3}; \mathbb{Z}u_{1}- \mathbb{Z}u_{3}= \mathbb{Z}u_{2}; \mathbb{Z}u_{3}- \mathbb{Z}u_{2} = \mathbb{Z}u_{1}$
and one of them has to be true. Since no one is, the $u_{i}$ must be  independent.
 iii) One can set $x_{21},x_{32},x_{31}$ to 0 and let : $x_{3}=x_{1}+x_{2}$, which is the same as $7x_{1}+9x_{2}=0$ and this has solutions for $x_{1}=-9n, x_{2}=7n $ where $n\in \mathbb{Z}$

REPLY [2 votes]: (i) Let $l = (l_1, l_2, l_3)$ be an element of $L$; we'd like to write this as a linear combination of $u_1, u_2, u_3$. Since $u_3$ is the only purported generator that has anything to do with the third coordinate in $\mathbf Z^3$, let's begin there. From the construction of $u_3$, we see that there exists an $a_3 \in \mathbf Z$ such that the third coordinate of $a_3q_3$ is $l_3$. In other words, $l - a_3u_3$ has a zero in the third coordinate. Let's write it out:
\[
(l_1 - a_3q_{31}, l_2 - a_3q_{32}, 0).
\]
Note that $l - a_3u_3$ is also in $L$, so on it you could try to run this argument again, working with the second coordinate and $u_2$. Does this help?
(ii) Suppose we have $a_1, a_2, a_3 \in \mathbf Z$ such that
\[
a_1u_1 + a_2u_2 + a_3u_3 = 0.
\]
If $u_3 = 0$, then ignore it; otherwise, we must have $a_3 = 0$. Continue in this way.
(iii) Use the given recipe. If $(l_1, 0, 0) \in L$, then $2l_1 = 0$ and hence $u_1 = 0$. If $(l_1, l_2, 0) \in L$ then $2l_1 + 4l_2 = 0$, and so $l_1 = -2l_2$. Thus $l_2$ can be anything, so $u_2 = (-2, 1, 0)$. Can you find a $u_3$?
[I'd like to add some words on matrices and Smith normal form later. Also, a similar proof shows the more general fact that a submodule of a rank $n$ free module over a PID is also free of rank $\leq n$.]