This question was asked in my assignment of commutative algebra and I was not able to solve this question. So, I am looking for help here.
Question: Let $I$ be a non-zero ideal in a ring $A$. Suppose that $I$ is a free $A$-module. Show that $I$ is a principal ideal, generated by a non-zero divisor.
Attempt: $I$ is a free $A$-module $\implies$ there exists a basis elements $\{i_1, \dotsc, i_r\}$ such that any $i \in I$ can be written as $i = a_1 i_1 + \dotsb + a_r i_r$ and the representation is unique.
To prove: $I$ is a principal ideal $\implies$ there exists an element $i_x$ which generates $I$. Let on the contrary $r \geq 2$ in a basis.
But unfortunately, I don't know which result I should use to find a contradiction and I am not able to move foreward.
Kindly help.
Motivated by https://mathoverflow.net/questions/136/atiyah-macdonald-exercise-2-11, we make the following observation.
Claim. The rank of $I$ is at most $1$.
Proof. Otherwise, the ideal $I$ would admit an $A$-basis that contains at least two distinct elements $x_1$ and $x_2$. This entails that $x_1$ and $x_2$ are linearly independent, and therefore in parcticular non-zero. (Here we use that the ring $A$ is non-zero since it contains the non-zero ideal $I$.) For $a_1 ≔ x_2$ and $a_2 ≔ -x_1$ we would then have the non-trivial linear combination $$ a_1 x_1 + a_2 x_2 = 0 \,, $$ contradicting the linear independence of $x_1$ and $x_2$. (For this equality, we have used the commutativity of $A$.) ∎
We also know that the rank of $I$ cannot be zero because $I$ is non-zero. Therefore, $I$ is free of rank $1$. This means that there exists an element $x$ of $I$ for which the map $$ A \to I \,, \quad a \mapsto ax $$ is bijective. The surjectivity of this map tells us that $A$ is a principal ideal with generator $x$, and the injectivity of the map tells us that $x$ is not a zero-divisor.