A condition for a subgroup of a finitely generated free abelian group to have finite index
Solution 1:
Here is Steve D's argument (see comments). I hope Steve will post his own answer. This is a community wiki. [It's very possible of course that Steve's argument is correct but the way I "understood" it is not.]
I'll keep the notation $p$ but I'll only use the hypothesis $p > 1$ (and $p$ integer).
The group $C:=A/B$ is finitely generated. To prove that it is finite it suffices to show that its elements have finite order. Assume by contradiction there is a subgroup $D\subset C$ isomorphic to $\mathbb Z$. The multiplication by $p$ is surjective on $C$, since its image is exactly $p(A/B) = (pA + B)/B = A/B$. Let $E\subset C$ be the subgroup of all those $c$ in $C$ such that $p^nc$ is in $D$ for $n$ large enough. Then $E$ is a nonzero finitely generated torsion free abelian group on which the multiplication by $p$ is bijective. But no such group exists.
EDIT 1. Observation of Pete L. Clark (see Pete's comment below): Steve's argument shows that
(1) if $A$ is a finitely generated abelian group and $n > 1$ an integer satisfying $nA=A$, then $A$ is finite.
Of course this is obvious if one knows that a finitely generated abelian group is the direct sum of a free abelian group with a finite group.
My comment: One can also derive (1) from the result (2) below, stated as Corollary 2.5 in Atiyah-MacDonald, and as Theorem 47(a) in Pete's commutative algebra notes:
(2) Let $R$ be a ring, $J$ an ideal of $R$, and $M$ a finitely generated $R$-module such that $JM = M$. Then there exists $x\in R$ with $x\equiv 1\ (\bmod J)$ such that $xM = 0$.
As you can see in Pete's notes, (2) follows immediately from Cayley-Hamilton.
EDIT 2. Minor variation of the above: state the Nakayama Lemma as follows:
Let $R$ be a ring, $J$ an ideal, $M$ a finitely generated $R$-module and $N$ a submodule of $M$ such that $JM + N = M$. Then there exists $x\in R$ with $x\equiv 1\ (\bmod J)$ such that $xM\subset N$.
In particular, if $A$ is a finitely generated abelian group, $B$ a subgroup, $n > 1$ an integer satisfying $nA+B=A$, then there is a $k$ with $k\equiv 1\ (\bmod n)$ such that $kA\subset B$, showing that the index of $B$ is finite.
EDIT 3. For the sake of completeness, here is a proof of the structure theorem for finitely generated modules over a principal ideal domain, essentially taken from Algebraic Theory of Numbers by Pierre Samuel.
Let $A$ be a PID, $K$ its field of fractions, and $S$ a submodule of $A^n$. The maximum number of linearly independent elements of $S$ is also the dimension of the vector subspace of $K^n$ generated by $S$. Thus this integer, called the rank of $S$, only depends on the isomorphism class of $S$ and is additive with respect to finite direct sums.
Theorem. (a) $S$ is free of rank $r\le n$.
(b) There is a basis $u_1,\dots,u_n$ of $A^n$ and there are nonzero elements $a_1,\dots,a_r$ of $A$ such that $a_1u_1,\dots,a_ru_r$ is a basis of $S$ and $a_1 | a_2 | \cdots | a_r$, where $a | b$ means “$a$ divides $b$”.
We'll need the
Proposition. Let $f$ be an $A$-valued bilinear map defined on a product of two $A$-modules. Then the image of $f$ is an ideal.
Proof of the Proposition. Let $T$ be the set of all ideals of the form $A f(x,y)$, let $A f(x,y)$ and $A f(u,v)$ be two elements of $T$, and suppose that $A f(x,y)$ is maximal in $T$. It suffices to show that $f(x,y) | f(u,v)$.
Claim: $f(x,y) | f(x,v)$ and $f(x,y) | f(u,y)$. Indeed, any generator of $Af(x,y)+Af(x,v)$ is of the form $$a f(x,y)+bf(x,v)=f(x,ay+bv),$$ and the maximality of $A f(x,y)$ implies $f(x,y) | f(x,v)$. The proof of $f(x,y) | f(u,y)$ is similar.
We can assume $f(x,v)=0=f(u,y)$. [Write $f(x,v)=a f(x,y)$ and replace $v$ by $v-ay$. Similarly for $u$.] Using the equality $$f(a x+b u,y+v)=a f(x,y)+b f(u,v)$$ for all $a$ and $b$ in $A$, and arguing as in the proof of the claim, we see that $f(x,y) | f(u,v)$. QED
Proof of the Theorem. We assume (as we may) that $S$ is nonzero, we let $f$ be the bilinear form on $A^n$ whose matrix with respect to the canonical basis is the identity matrix, and we pick a generator $a_1=f(s_1,y_1)$ of $f(S\times A^n)$. [Naively: $a_1$ is the gcd of the coordinates of the elements of $S$.] Clearly, $u_1:=s_1/a_1$ is in $A^n$, and we have $$A^n=Au_1\oplus y_1^\perp,\quad S=As_1\oplus(S\cap y_1^\perp),$$ where $y_1^\perp$ is the orthogonal of $y_1$. Then (a) follows by induction on $r$. In particular $y_1^\perp$ and $S\cap y_1^\perp$ are free of rank $n-1$ and $r-1$, and (b) follows also by induction. [Note that if $x$ belongs to a basis of $A^n$, then $f(x,y)=1$ for some $y$ in $A^n$.] QED
I don’t know if there is a simple characterization of the rings for which the Proposition holds. (See the Wikipedia entry for Principal ideal rings.)
PDF version of this edit
EDIT 4. A nice application of Nakayama's Lemma (see Theorem 52 p. 48 in Pete L. Clark's commutative algebra notes):
Let $B$ be a commutative ring and $V$ a finitely generated $B$-module.
We start with the following form of Nakayama's Lemma:
If $J$ is an ideal of $B$ satisfying $JV=V$, then $xV=0$ for some $x$ in $B$ with $x\equiv 1$ mod $J$.
Corollary:
If in addition $v$ is in $V$ and satisfies $Jv=0$, then $v=0$.
Subcorollary:
The action of $b\in B$ on $V$ is injective if surjective.
To see this, put $J:=Bb$.
Subsubcorollary:
Let $A$ be a commutative ring, $V$ a finitely generated $A$-module, and $b$ an endomorphism of $V$. Then $b$ is injective if surjective.
To see this, put $B:=A[b]$.
This gives a solution to Exercise 3.15 in Introduction to Commutative Algebra by Atiyah and MacDonald.
Solution 2:
My answer will be slightly more general: $p$ does not have to be a prime number, but may in fact be any integer greater than one.
As the commenters have said, it is difficult to give a good answer to this question without knowing something about what sort of prerequisite knowledge can be assumed. I will sketch out several approaches, to the limit of my time and patience.
Here are two facts that I want to use in the proof(s).
Lemma 1: Let $R$ be a nonzero commutative ring. For any $R$-module $M$, we define the rank of $M$ to be the least cardinality of a generating set for $M$ as an $R$-module. Then for all $n \in \mathbb{Z}^+$, the rank of $R^n$ is $n$.
Proof: Since the standard basis vectors $e_1,\ldots,e_n$ generate $R^n$, the rank of $R^n$ is at most $n$. Conversely, let $x_1,\ldots,x_m$ be a set of generators for $M$. Suppose that $m < n$. Then we may fill out the set to a (still generating) set consisting of $n$ elements by choosing further elements $x_{m+1},\ldots,x_n$ arbitrarily. (We have already verified that $\# R^n \geq n$!) Then there is a unique $R$-linear endomorphism of $R^n$ given by $e_i \mapsto x_i$ for all $i$. But any finitely generated $R$-module is Hopfian, i.e., any surjective endomorphism must in fact be an isomorphism. (For this see e.g. $\S 3.8.2$ of my commutative algebra notes. We are using the result for free $R$-modules, and this has been discussed recently on this site.) Thus $x_1,\ldots,x_n$ is also a basis for $R^n$ and in particular an $R$-linearly independent set. But this contradicts our assumption that for some $m < n$, $x_1,\ldots,x_m$ is a generating set: if so, $x_n$ would have to be a linear combination of $x_1,\ldots,x_m$.
Comment: I will be using this result for $R = \mathbb{Z}$ -- in which case it can also be proved using structure theory of modules over a PID -- and for $R = \mathbb{Z}/p\mathbb{Z}$. Note that when $p$ is prime, as in the OP's statement of the problem, $\mathbb{Z}/p\mathbb{Z}$ is a field and this is just standard linear algebra.
Lemma 2: Let $n \in \mathbb{Z}^+$ and $B \subset A \cong \mathbb{Z}^+$. The following are equivalent:
(i) $B$ has finite index in $A$.
(ii) The rank of $B$ as a $\mathbb{Z}$-module is $n$.
(ii) $B \cong \mathbb{Z}^n$.
Proof: First recall that for any PID $R$, if $A \cong R^n$ and $B$ is an $R$-submodule of $R$ then $B \cong R^m$ for some $m \leq n$. This famously follows from structure theory; for an alternate proof (and generalization to infinitely generated modules) see $\S 3.9.2$ of the same notes. Having established this, (ii) $\iff$ (iii) follows immediately from Lemma 1.
Suppose that $[A:B] = m < \infty$. Then $B \supset mA \cong m \mathbb{Z}^n$, so $B$ both contains and is contained in a free $R$-module of rank $n$. It follows from the previous paragraph that $B$ itself has rank $n$.
Suppose that $[A:B]$ is infinite, and consider the short exact sequence
[0 \rightarrow B \rightarrow A \rightarrow A/B \rightarrow 0. ]
Then $A/B$ is an infinite, finitely generated $\mathbb{Z}$-module, so contains an element of infinite order and thus a subgroup $Q$ isomorphic to $\mathbb{Z}$. The complete preimage of $Q$ in $A$ is isomorphic to $B \oplus \mathbb{Z} \cong \mathbb{Z}^m \oplus \mathbb{Z} \cong \mathbb{Z}^{m+1}$. Since this is a submodule of $A \cong \mathbb{Z}^n$ we have $m+1 \leq n$ and thus $m < n$.
Proposition: Let $A \cong \mathbb{Z}^n$ be an abelian group, and let $B$ be a subgroup of $A$. Suppose there exists $p > 1$ such that $B + pA = A$. Then $[A:B]$ is finite and prime to $p$.
Proof: If $B$ had infinite index in $A$, then by Lemma 2, $B \cong \mathbb{Z}^m$ for some $m < n$ and thus has an $m$ element generating set $x_1,\ldots,x_m$. Consider the quotient map $q: A \rightarrow A/pA$. Our hypothesis implies that $q(B) = (B+pA)/pA = A/pA$; in other words, $q$ restricted to $B$ is a surjection and thus $A/pA$ is generated by $q(x_1),\ldots,q(x_m)$. But $A/pA \cong (\mathbb{Z}/p\mathbb{Z})^n$ is a free rank $n$ module over $R = \mathbb{Z}/p\mathbb{Z}$, so cannot be generated as an $R$-module (equivalently, as an abelian group) by any set with less than $n$ elements: contradiction. Therefore the index is finite. If the index were not prime to $p$, then there would exist $B'$ with $B \subset B' \subset A$ and $[A:B'] = p$ (the quotient $A/B$ is a finite abelian group, and finite abelian groups have subgroups of all orders permitted by Lagrange's Theorem). Since $B' \supset B$, we have $B' + pA = A$. But also $B' \supset pA$ and thus $A = B' + pA \subset B' + B' = B'$, contradiction.
If the hypotheses of the Proposition hold for every prime $p$, then the index $[A:B]$ is not divisible by any prime $p$, i.e., $[A:B] = 1$ and $B = A$.
Final Comment: I seem to have reached the limit of my patience for now, so I will leave it to someone else to explain how every invocation of my commutative algebra notes or use of algebra beyond the undergraduate level can be replaced by an appeal to the structure theory of finitely generated modules over a PID, at least when $p$ is prime.