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 $p$ is irreducible iff $\left({p}\right)$ is a maximal ideal of $D$.

Necessary Condition
Let $p$ be irreducible in $D$.

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 exists 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 \mathop \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 $\left({p}\right)$ is a maximal ideal of $D$.

Sufficient Condition
Let $\left({p}\right)$ be a maximal ideal of $D$.

Let $p = f g$ be any factorization of $p$.

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

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


 * Claim: $\left({p}\right) \subsetneqq \left({f}\right)$


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


 * Then $x = f g q \in \left({f}\right)$, so $\left({p}\right) \subseteq \left({f}\right)$.


 * Now suppose $f \in \left({p}\right)$.


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


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


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

Therefore, since $\left({p}\right)$ is maximal, we must have $\left({f}\right) = D$.

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

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

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

This completes the proof.