Problem. Give an example of a finitely generated free module \( M \) having a submodule which is neither free nor finitely generated.
Proof. Let \( K \) be a field and let
\[ R = K[X_1, X_2, X_3, \dots] \]
be the polynomial ring in infinitely many variables over \( K \). Then \( R \) is a commutative ring.
Take \( M = R \) as a module over itself.
Since \( R \) has a unity, it follows that \( R \) is a free \( R \)-module with basis \( \{1\} \), and hence \( M \) is finitely generated and free.
Now define
\[ N = (X_1, X_2, X_3, \dots), \]
the ideal generated by all variables.
Then \( N \) consists of all polynomials in \( R \) having zero constant term.
Since submodules of \( R \) (as an \( R \)-module) are precisely the ideals of \( R \), it follows that \( N \) is a submodule of \( M \).
Claim: \( N \) is not finitely generated.
Suppose, on the contrary, that \( N \) is finitely generated. Then there exist polynomials
\[ f_1, f_2, \dots, f_r \in R \]
such that
\[ N = (f_1, f_2, \dots, f_r). \]
Each \( f_i \) involves only finitely many variables, so there exists a positive integer \( n \) such that
\[ f_i \in K[X_1, X_2, \dots, X_n] \quad \text{for all } i = 1,2,\dots,r. \]
Since \( X_{n+1} \in N \), there exist polynomials \( a_1, a_2, \dots, a_r \in R \) such that
\[ X_{n+1} = \sum_{i=1}^{r} a_i f_i. \]
Now substitute \( X_1 = X_2 = \cdots = X_n = 0 \). Since each \( f_i \) has zero constant term, we get
\[ f_i(0,0,\dots,0) = 0 \quad \text{for all } i. \]
Therefore,
\[ \begin{aligned} X_{n+1} &= \sum_{i=1}^{r} a_i(0,0,\dots,0,X_{n+1},\dots)\, f_i(0,0,\dots,0) \\ &= \sum_{i=1}^{r} a_i(0,0,\dots,0,X_{n+1},\dots) \cdot 0 \\ &= 0, \end{aligned} \]
which is a contradiction, since \( X_{n+1} \) is a nonzero polynomial. Hence, \( N \) is not finitely generated.
Since every free ideal of \( R \) must be principal, and \( N \) is not finitely generated, it follows that \( N \) is not principal and hence not free.
Thus, \( M = R \) is a finitely generated free module having a submodule \( N \) which is neither free nor finitely generated. ∎