## Nonprincipal ideals of an integral domain have rank 1 but are not free

Let $R$ be an integral domain, and let $M \subseteq R$ be a nonprincipal ideal of $R$, considered as a (left, unital) $R$-module. Prove that $M$ has rank 1 over $R$ but is not free as an $R$-module.

Let $\{x,y\} \subseteq M$ be a subset containing two nonzero elements. Since $x \cdot y + (-y) \cdot x = 0$, $\{x,y\}$ is not linearly independent. Thus the rank of $M$ as an $R$-module is at most 1. Since $R$ is an integral domain, every (nonzero) singleton set is linearly independent; hence $M$ has rank 1.

Suppose $M$ is free. Then $M$ must have free rank 1, since any free generating set is linearly independent. That is, $M = R\alpha$ for some $\alpha$. But then $M$ is principal, a contradiction.