If $f: V \to W$ is a surjective homomorphism of vector spaces, and we have fixed a basis for $V$, it is always possible to find a basis for $W$ such that the matrix associated to $\phi$ in the two bases is triangular with ones on the "diagonal" (what I mean with this is explained more precisely later, in the case of abelian groups), up to possibly permuting the chosen basis of $V$. This motivates the following question, in the realm of finite abelian groups.


Let $H$ be a finite abelian group with a fixed basis $h\_1, \ldots, h\_n$, with "basis" here we mean elements that satisfy the property $\langle h\_1 \rangle \oplus \ldots \oplus \langle h\_n \rangle=H$. Let $\phi:H \to G$ be a homomorphism of finite abelian groups. Let us assume that $\phi$ is surjective, so $\phi(h\_1), \ldots, \phi(h\_n)$ generate $G$.


Is it possible to find a basis for $G$, and a permutation of the elements $h\_1, \ldots, h\_n$, such that the matrix associated with $\phi$ in the two given basis has a triangular form with $1$ on the diagonal? 


More precisely, can we find a basis $g\_1, \ldots, g\_m$ for $G$, with $m \leq n$, and a permutation $\sigma \in \mathfrak{S}\_n$ such that we can write 


$\phi(h\_{\sigma(i)}) = a\_{i,1} g\_1 + \ldots+ a\_{i,m} g\_m$


with $a\_{i,j}=0$ when $j>i$, and $a\_{i,i}=1$?


(I asked a similar question on math.stackexchange, but I spelled it differently and in a silly/wrong way so that the answer in that case was trivial)



Linear algebra of finite abelian groups
I think I can prove this in the case when $G$ is a $p$-group. Assume $\phi(h\_1), \ldots, \phi(h\_m)$ are irredundant generators: if any of them is removed they are no longer a generating set for $G$. There must be an element of maximal order, and assume after possibly permuting that it is $\phi(h\_1)$. Then the cyclic group generated by $\phi(h\_1)$ is a direct summand of $G$, thus we can take $\phi(h\_1)$ as the first element of the basis for $G$ and pass to the quotient $G/\langle \phi\_(h\_1) \rangle$. Consider now the projection of $\phi(h\_2), \ldots, \phi(h\_m)$, and suppose $\phi(h\_2)$ has maximal order in the quotient (thus again it is a direct summand in the quotient): then take $\phi(h\_2)$ as second element element of the basis for $G$, and so on.


To my big surprise, I think this property need not be true when $G$ is not a $p$-group, although I am not sure I have a complete proof for this. My example is in the case $G=\mathbb{Z}\_2 \oplus \mathbb{Z}\_8$ $\oplus \mathbb{Z}\_3 \oplus \mathbb{Z}27$ with the elements $\phi(h\_1)= (1,2,0,1)$ and $\phi(h\_2)=(0,1,1,3)$.


