Basis of a free module consists of exactly n elements I' ve found the following theorem while preparing for an Algebra exam:
Let $R$ be the ring $\Bbb Z/p^k$ with a prime ideal $p$ and $k\ge2$, $M$ a free $R$-module of rank $n$ (i.e. $M\cong R^n$).
Futhermore, let $(p)$ be the ideal in $R$ generated by the class of $p$ and $\pi : M \rightarrow M/(p)M;\,\, x \mapsto \overline x$ the canonical homomorphism.
Then, every basis of M consists of exactly $n$ elements.

Is $X = \{x_1,..., x_n\} \subseteq M$ so that $\overline X =\{\overline x_1,..., \overline x_n\}$ is a $R/(p)$-basis of $M/(p)M$,
  then $X$ is a $R$-Basis of $M$.

Unfortunately, I just cannot see why this is true.
Does anyone know a proof for that?
 A: If $M\cong R^n$ for some $n$, it has bases of cardinal $n$, e.g. the image of the canonical basis of $R^n$ by the inverse isomorphism. Conversely, the image of a basis of $M$ is a basis of $R^n$.
So the problem comes down to proving the assertion for $M=R^n$. Let $\mathcal{B}=(e_1,\dots e_r)$ be a basis of $R^n$. Its image $\bar{\mathcal{B}}=(\bar{e}_1,\dots \bar e_r)$ in $\bigl(R/(p)\bigr)^n\cong \mathbf F_p^n\;$ is in any case a system of generators, hence $r\ge n$. 
It is also a system of linearly independent vectors. Indeed, if,   say, 
$\;\bar e_r\in \langle \bar e_1,\dots,\bar e_{r-1}\rangle$, we lift this relation in $R^n$ to
$$e_r\in\langle e_1,\dots, e_{r-1}\rangle+ p\mkern1.5mu\langle e_1,\dots, e_{r}\rangle.$$
By Nakayama's lemma, this implies there exists $\lambda \in R$ such that
$$(1+\lambda p)e_r\in\langle e_1,\dots, e_{r-1}\rangle. $$
Now $R$ is a local ring, with maximal ideal generated by $p$, hence $1+\lambda p$ is a unit in $R$, so that $\;
e_r\in\langle e_1,\dots, e_{r-1}\rangle$. This is impossible, since  $\;(e_1,\dots e_r)$ is a basis.
Thus $r\le n$, and finally $r=n$.
A: In my opinion, the problem as stated hides the bulk of the argument.

Let $R$ be a commutative ring and let $M=R^n$. Then any basis of $M$ consists of $n$ elements.

Let $I$ be a maximal ideal of $R$. In your case the maximal ideal is already given, in general one needs Zorn's lemma to get one.
Then $M/IM$ is a vector space over the field $R/I$. If we prove that, given a basis $\{x_1,x_2,\dots,x_m\}$ of $M$, also $\{\pi(x_1),\dots,\pi(x_m)\}$ is a basis for $M/IM$ (where $\pi\colon M\to M/IM$ is the canonical map), invariance of dimension for fields will give the result.
It is clear that $\{\pi(x_1),\dots,\pi(x_m)\}$ is a spanning set for $M/IM$, so we just need to check it is linearly independent. Assume
$$
(a_1+I)\pi(x_1)+(a_2+I)\pi(x_2)+\dots+(a_m+I)\pi(x_m)=\pi(0)
$$
We want to prove $a_1+I=a_2+I=\dots=a_m+I=0+I$.
The relation can be rewritten as
$$
\pi(a_1x_1+a_2x_2+\dots+a_mx_m)=\pi(0)
$$
that translates to
$$
a_1x_1+a_2x_2+\dots+a_mx_m\in IM
$$
Now we note that an element of $IM$ has the form $b_1x_1+b_2x_2+\dots+b_mx_m$ with $b_1,b_2,\dots,b_m\in I$ (use the fact that $\{x_1,x_2,\dots,x_m\}$ is a basis to work out the details) so we get
$$
(a_1-b_1)x_1+(a_2-b_2)x_2+\dots+(a_m-b_m)x_m=0
$$
and linear independence gives $a_1,a_2,\dots,a_m\in I$, ending the proof.
