Principal Ideal of Principal Ideal Domain is of Irreducible Element iff Maximal

Theorem
Let $\left({D, +, \circ}\right)$ be a principal ideal domain.

Let $\left({p}\right)$ be the principal ideal of $D$ generated by $p$.

Then $\left({p}\right)$ is a maximal ideal of $D$ if and only if $p$ is irreducible.

Proof
Suppose that $p$ is irreducible.

Let $U_D$ be the group of units of $D$.


 * By definition, an irreducible element is not a unit.

So from Principal Ideals in Integral Domain, $\left({p}\right) \subset D$.


 * Suppose the principal ideal $\left({p}\right)$ is not maximal.

Then there is an ideal $K$ of $D$ such that $\left({p}\right) \subset K \subset R$.

Because $D$ is a principal ideal domain, $\exists x \in R: K = \left({x}\right)$.

Thus $\left({p}\right) \subset \left({x}\right) \subset D$.

Because $\left({p}\right) \subset \left({x}\right)$, $x \backslash p$ by Principal Ideals in Integral Domain. That is: $\exists t \in D: p = t \circ x$.

But $p$ is irreducible in $D$ so $x \in U_D$ or $t \in U_D$.

That is, either $x$ is a unit or $x$ is an associate of $p$.

But since $K \subset D$, $\left({x}\right) \ne D$ so $x \notin U_D$ by Principal Ideals in Integral Domain.

Also, since $\left({p}\right) \subset \left({x}\right)$, $\left({p}\right) \ne \left({x}\right)$ so $x$ is not an associate of $p$, by Principal Ideals in Integral Domain.

This contradiction shows that $(p)$ is maximal.

Conversely, suppose that $(p)$ is maximal.

Let $p = fg$ be any factorisation of $p$.

We must show that one of $f,g$ is a unit.

Suppose that neither of $f,g$ is a unit.


 * Claim: $(p) \subsetneqq (f)$


 * Proof: Let $x \in (p)$, i.e. $x = pq$ for some $q \in D$.


 * Then $x = fgq \in (f)$, so $(p) \subseteq (f)$.


 * Now suppose $f \in (p)$.


 * Then there is $r \in D$ such that $f = rp$, and $f = rgf$.


 * Therefore $rg = 1$, and $g$ is a unit, a contradiction.


 * Thus $f \notin (p)$, and clearly $f \in (f)$, so $(p) \subsetneqq (f)$ as claimed.

Therefore, since $(p)$ is maximal, we must have $(f) = D$.

But we assumed that $f$ is not a unit, so there is no $h \in D$ such that $fh = 1$.

Therefore $1 \notin (f) = \{ fh : h \in D \}$, and $(f) \subsetneqq D$.

This is a contradiction, so at least one of $f,g$ must be a unit.

This completes the proof.