## A finitely generated torsion-free module A over a PID R is free

A finitely generated torsion-free module $A$ over a PID $R$ is free.
Proof
(Hungerford 221)

If $A=0$, then $A$ is free of rank 0. Now assume $A\neq 0$. Let $X$ be a finite set of nonzero generators of $A$. If $x\in X$, then $rx=0$ ($r\in R$) if and only if $r=0$ since $A$ is torsion-free.

Consequently, there is a nonempty subset $S=\{x_1,\dots,x_k\}$ of $X$ that is maximal with respect to the property: $\displaystyle r_1x_1+\dots+r_kx_k=0\ (r_i\in R) \implies r_i=0\ \text{for all}\ i.$

The submodule $F$ generated by $S$ is clearly a free $R$-module with basis $S$. If $y\in X-S$, then by maximality there exist $r_y,r_1,\dots,r_k\in R$, not all zero, such that $r_yy+r_1x_1+\dots+r_kx_k=0$. Then $r_yy=-\sum_{i=1}^kr_ix_i\in F$. Furthermore $r_y\neq 0$ since otherwise $r_i=0$ for every $i$.

Since $X$ is finite, there exists a nonzero $r\in R$ (namely $r=\prod_{y\in X-S}r_y$) such that $rX=\{rx\mid x\in X\}$ is contained in $F$:

If $y_i\in X-S$, then $ry=r_{y_1}\dots r_{y_n}y_i\in F$ since $r_{y_i}y_i\in F$. If $x\in S$, then clearly $rx\in F$ since $F$ is generated by $S$.

Therefore, $rA=\{ra\mid a\in A\}\subset F$. The map $f:A\to A$ given by $a\mapsto ra$ is an $R$-module homomorphism with image $rA$. Since $A$ is torsion-free $\ker f=0$, hence $A\cong rA\subset F$. Since a submodule of a free module over a PID is free, this proves $A$ is free.