What is the rank of a subgroup $H$ of finite index $e$ of a free abelian group $G$ of rank $n$?
I've recently been thinking, as it was an implicit corollary to a result in our elementary Abstract Algebra course, about the fact that every subgroup of a free abelian group is also free abelian, which is the commutative analogue of the Nielsen-Schreier Theorem originally due to Dedekind. However, on the page they also mention the result that if $H$ is a subgroup of a free group $G$ on $n$ generators of finite index $[G:H]=e$ the "Nielsen-Schreier formula" tells you the rank of $H$ is $1+e(n-1)$. The proof given uses simplicial homology and is far from elementary group theory!
Is there an analogue of this result for free abelian groups, i.e. what is the rank of a subgroup $H$ of a free abelian group $G$ (of rank $n$) of finite index $e$ in terms of $n,e$? Does it have an elementary/simple group theory proof?
I feel it must do, using Smith Normal Form or something similar, as abelian groups are so often much more amenable to simpler reasoning than the nonabelian case.
I realised just now that my idea that it follows from Smith Normal Form is correct. A consequence of it and some basic facts about unimodular operations on matrices in $\mathbb{Z}^{n\times m}$ is that if $H\leq \mathbb{Z}^n$ then there exists a free basis of $\mathbb{Z}^n$ $y_1,\ldots, y_m$ so that $$H = \left<d_1y_1, \ldots, d_ry_r\right>$$ where $d_i>0$ for all $i$ and $d_i\mid d_{i+1}$ for $1\leq i < r$. Now suppose that $H$ is of rank $<n$: this means that some $y_j$ for $j>r$ is not in $H$. But then $H+ny_j$ for $n\in\mathbb{Z}$ are each distinct cosets because $$H+ny_j = H+my_j \iff (n-m)y_j \in H \iff n=m$$ So if $H$ has rank $<n$ then it has infinite index in $G$.
I just thought I'd add a little remark, though this isn't really important, that it's interesting the answer is always $n$ for abelian groups: this corresponds to taking $e=1$ in the non-abelian case! Thus in some sense, the formula is the same up to some "twisting factor" and I'm sure this probably has an interpretation in simplicial homology.