We first suppose that
\(D\) is a unique factorization domain. By the first item in the definition of a
UFD, every non-zero element
\(x\) of
\(D\) can be factored as
\(x=up_1\cdots p_r\text{.}\) If
\(x\) is not a unit, then
\(r\) must be at least
\(1\text{,}\) so
\(x = (up_1) \cdots p_r\) is a factorization of
\(x\) into irreducibles.
Now suppose that
\(p\) is an irreducible element of a
UFD \(D\) and we want to show that
\(p\) is prime. Suppose that
\(p\) divides
\(ab\text{,}\) say
\(pc = ab\text{.}\) From definition of a distinguished set of irreducibles, there is an associate of
\(p\) in
\(S\text{,}\) meaning that
\(p = u_1 p'\) for
\(u_1\) a unit and
\(p' \in S\text{.}\) From the existence part of the definition of a
UFD, we can factor
\(a = u_2 q_1 \cdots q_n\text{,}\) \(b = u_3 r_1 \cdots r_m\text{,}\) and
\(c = u_4 s_1 \cdots s_k,\) where
\(u_1, u_2, u_3\) are units and
\(q_1,\ldots,q_n,r_1,\ldots,r_m,s_1, \ldots, s_k\) are in
\(S\text{.}\) Thus,
\((u_1 p') (u_4 s_1 \cdots s_k) = (u_2 q_1 \cdots q_n)(u_3 r_1 \cdots r_m)\text{,}\) and by rearranging and regrouping the factors, we have that
\begin{equation*}
(u_1 u_4) p' s_1 \cdots s_k = (u_2 u_3) q_1 \cdots q_n s_1 \cdots s_k\text{.}
\end{equation*}
By the uniqueness part of the definition of a
UFD,
\(p'\) is equal to one of
\(q_1, \ldots, q_n, r_1, \ldots, r_m\text{.}\) If
\(p'\) equals one of one of
\(q_1, \ldots, q_n\text{,}\) then
\(p'\) divides
\(a\) and since
\(p' = u^{-1}p\text{,}\) \(p\) also divides
\(a\text{.}\) If
\(p'\) is equals one of
\(r_q, \ldots, r_m\text{,}\) then
\(p'\) divides
\(b\text{,}\) and, so, similarly,
\(p\) divides
\(b\text{.}\) Since
\(p\) divides either
\(a\) or
\(b\text{,}\) then
\(p\) is prime.
To show the converse, we suppose that every non-unit in
\(D\) has a factorization into irreducibles, and every irreducible element of
\(D\) is prime. Let
\(S\) be any set consisting of one representative from each equivalence class of irreducibles up to associates, which will be our distinguished class of irreducibles. Any unit satisfies existence part of a
UFD with
\(r=0\text{.}\) Let
\(x \in D\) be a non-unit. By assumption,
\(x\) can be written as a product of irreducibles
\(x=p_1 \cdots p_n\text{.}\) Since each
\(p_i\) is an associate of an irreducible in
\(S\text{,}\) we can write
\(p_i = u_i q_i\text{,}\) where
\(u_i\) is a unit and
\(q_i \in S\text{.}\) Thus,
\(x=(u_1 \cdots u_n)q_1 \cdots q_n\text{,}\) which is a product of a unit and elements of
\(S\text{,}\) as in the definition of a
UFD.
Let \(a = u p_1 \cdots p_r = u' q_1 \cdots q_s\) be two different factorizations of an element \(a \in D\) with \(u\) and \(u'\) units and \(p_1, \ldots, p_r,q_1,\ldots, q_s \in S\text{.}\) We use induction on \(r\text{.}\) If \(r = 0\text{,}\) then \(u = u' q_1 \cdots q_s\text{,}\) but since irreducible elements can’t divide a unit, then \(s = 0\) as well. Now suppose that \(r > 0\text{.}\) By assumption, the irreducible \(p_1\) is prime, and it can’t divide \(u'\text{,}\) so \(p_1\) must divide \(q_i\) for some \(i\text{.}\) If we write \(q_i = b p_1\text{,}\) then, since \(q_i\) is irreducible, \(b\) must be a unit, so \(p_1\) and \(q_i\) are associates, and since both are in \(S\text{,}\) then \(p_1 = q_i\text{.}\) Now, by dividing by \(p_1=q_i\text{,}\) we have \(u p_2 \cdots p_r = u' q_1 \cdots q_{i-1} q_{i+1} \cdots q_s\text{.}\) By our inductive hypothesis, \(r-1 = s-1\text{,}\) and, after reordering, \(p_2, \ldots, p_r\) are associates of \(q_1,\ldots, q_{i-1}, q_{i+1}, \ldots q_s\text{.}\) Therefore, \(r = s\text{,}\) an, after reordering \(p_1, \ldots, p_r\) are associates of \(q_1, \ldots, q_s\text{.}\)