$\mathbb Z\times\mathbb Z$ is principal but is not a PID
I need to find an example of a ring that is not a PID but every ideal is principal. I know that $\mathbb Z\times\mathbb Z$ is not an integral domain, so certainly is not a PID, but here every ideal is principal. I already proved that if $R$ and $S$ are ring every ideal in $R \times S$ is $I \times J$ with ideals in the original ring. But I cant follow from that that $\mathbb Z\times\mathbb Z$ has only principal ideals.
Explicitly, if $I$ is an ideal $(a)\times(b)$ which would be its generator $(c,d)$ in $\mathbb Z\times\mathbb Z$?
Thanks.
Suppose $\def\ZZ{\mathbb Z}I\subseteq\ZZ\times\ZZ$ is an ideal.
If $(x,y)\in I$, then $(x,0)=(1,0)(x,y)$ and $(0,y)=(0,1)(x,y)$ are also in $I$. If we write $I_1=\{x\in\ZZ:(x,0)\in I\}$ and $I_2=\{y\in\ZZ:(0,y)\in I\}$. then it follows easily from this that $I=I_1\times I_2$. Now $I_1$ and $I_2$ are ideals of $\ZZ$, so that there are $a$, $b\in\ZZ$ such that $I_1=(a)$ and $I_2=(b)$, and then $I$ is generated by $(a,b)$.
We will prove that every ideal of $\mathbb{Z}\times\mathbb{Z}$ is principal as a corollary of a more general proposition.
Lemma Let $A$ be a commutative ring. Let $I$ be an ideal of $A$. Suppose $A/I$ is Noetherian and every ideal contained in $I$ is finitely generated. Then $A$ is Noetherian.
Proof: Let $J$ be an ideal of $A$. Let $x_1,\cdots,x_n$ be generators of $I \cap J$. Let $\psi\colon A \rightarrow A/I$ be the canonical homomorphism. Since $A/I$ is Noetherian, $\psi(J)$ is finitely generated. Let $\psi(y_1),\cdots, \psi(y_m)$ be generators of $\psi(J)$, where $y_1,\cdots,y_m \in J$. It suffices to prove that $x_1,\cdots,x_n, y_1,\cdots,y_m$ generate $J$. Let $x \in J$. There exist $b_1,\cdots,b_m \in A$ such that $\psi(x) = \sum_j \psi(b_j)\psi(y_j)$. Since $\psi(x - \sum_j b_jy_j) = 0, x - \sum_j b_jy_j \in I \cap J$. Hence there exist $a_1, \cdots, a_n \in A$ such that $x - \sum_j b_jy_j = \sum_i a_ix_i$. Hence $x = \sum_i a_ix_i + \sum_j b_jy_j$ as desired. QED
Corollary Let $A, B$ be Noetherian rings. Then $A\times B$ is also Noetherian.
Proof: Let $\psi\colon A\times B \rightarrow B$ be the projection. Let $I$ be the kernel of $\psi$. It is easy to see that $\psi$ and $I$ satisify the conditions of the lemma. QED
Definition A commutative ring is called a principal ideal ring if every ideal of it is principal.
Proposition Let $A, B$ be principal ideal rings. Then $A\times B$ is also a principal ideal ring.
Proof: Let $I$ be an ideal of $A\times B$. By the corollary of the lemma, $I$ is finitely generated. Let $(a_1,b_1),\cdots,(a_n,b_n)$ be generators of $I$. Since $A$ is a principal ideal ring, there exists $c \in A$ such that $cA$ is the ideal generated by $a_1\cdots, a_n$. Similarly there exists $d \in B$ such that $dB$ is the ideal generated by $b_1\cdots, b_n$. Since every element of $I$ is of the form $\sum_i (x_i, y_i)(a_i, b_i) = (\sum_i x_ia_i, \sum_i y_ib_i)$, $I$ is generated by $(c, d)$. QED
Corollary Every ideal of $\mathbb{Z}\times\mathbb{Z}$ is principal.
Observe that every ideal in $R= \Bbb Z/n\Bbb Z$ is principal but, for $n$ not prime, $R$ has zero divisors, so it's not a PID.