I need help to the following problem:
Problem: Let $R$ be a Unique Factorization Domain such that each maximal ideal of $R$ is a principal ideal.
Then $R$ is a Principal Ideal Domain.
Solution(my attempt): Let a proper ideal $I$ of $R$, then there is maximal ideal $M$ of $R$ such that $I \subseteq M$.
Since $M$ is maximal ideal of $R$, then there is an element $m$ which generates $M$, i.e. $M=(m)$.
Since $R$ is a UFD, then we can write $m=p_{1} p_{2} \ldots p_{k}$ where $p_{j}$ is irreducible(and also is prime) element for all $j \in \{ 1 , 2 , \ldots , k \}$.
So, every element of $I$ divided by $m$, i.e. $\forall i \in I$ we have $m$ divides $i$, thus $p_{j}$ divides $i$ for all $j \in \{ 1 , 2 , \ldots , k \}$.
How can we prove that $I$ is principal ideal?
First of all, the generator of a maximal ideal is necessary irreducible. (why?) Let $0\ne I\subsetneq R$ be an ideal. Every nonzero element can be uniquely written as a product $p_1p_2...p_n$ of irreducibles, not necessary distinct. We say $n$ is the length of the element $p_1p_2...p_n$. Let:
$n_I=\min\{n\in\mathbb{N}: \text{$I$ contains an element of length $n$}\}$
We prove $I$ is principal by induction on $n_I$. If $n_I=1$ then $I$ contains some irreducible element $p$. Choose any maximal ideal $m=(q)$ which contains $I$. Since $I\subseteq m$, the element $q$ divides all the elements of $I$. In particular $q|p$, and since $p$ is irreducible, $q=p$. Thus $p$ divides all the elements of $I$, i.e $I=(p)$.
Now the induction step. Let $a=p_1p_2...p_{n_I}\in I$ be any element of length $n_I$. Just as before, choose a maximal ideal $m=(q)$ that contains $I$. In particular, $q|a$, and since $q$ is irreducible, it must be equal to one of the factors $p_1,...,p_{n_I}$ up to a multiple by a unit. So without loss of generality we may assume $q=p_1$. Now let:
$(I:p_1)=\{r\in R: rp_1\in I\}$
This is trivially an ideal of $R$, and it contains an element of length less than $n_I$. (why?) Thus, by induction, this ideal is principal, say $(I:p_1)=(b)$. By definition, we have $bp_1\in I$. I'll leave it to you to verify that $I=(bp_1)$. (Hint: Remember, all the elements of $I$ are divisible by $p_1=q$)