The existence of irreducible factorizations is the trickier argument. Letβs look at uniqueness, assuming existence. Let \(a=\prod_{i\in I}p_i\) be an irreducible factorization of the nonzero, non-unit element \(a\text{.}\) We prove the uniqueness property of this factorization by induction on \(\abs{I}\text{.}\) If \(\abs{I}=1\text{,}\) then \(a=p\) is irreducible. Suppose we have another factorization
\begin{align*}
p \amp =p_1p_2\cdots p_n\text{.}
\end{align*}
First observe that we must have \(n=1\text{.}\) Otherwise, we would have \(p=p_1c\text{,}\) where \(p_1\) and \(c=\prod_{i\ne 1}p_i\) are both non-units, contradicting the fact that \(p\) is irreducible.
Assume now that the uniqueness property holds for all irreducible factorizations into \(n\) irreducible factors, and assume \(a=\prod_{i=1}^{n+1}p_i\text{,}\) with \(n\geq 1\text{.}\) If we have another factorization
\begin{align*}
a= \amp \prod_{i=1}^m q_i\text{,}
\end{align*}
then by induction we must have \(m\geq n+1\text{.}\) Since \(p_1\) divides the product of the \(q_i\text{,}\) and since \(p_1\) is prime (irreducible implies prime in PIDs), \(p_1\) must divide one of the \(q_i\text{.}\) Without loss of generality, we may assume that \(p_1\mid q_1\text{.}\) Since \(q_1\) is irreducible and \(p_1\) is not a unit, we conclude that \(q_1=up_1\) for some unit. But then we can cancel \(p_1\) from both sides to obtain
\begin{align*}
a' \amp = \prod_{i=2}^np_i=u\prod_{i=2}^{m+1}q_j\\
\amp =(uq_2)q_3\cdots q_m\text{.}
\end{align*}
Since \(a'\) is a product of \(n\) irreducible elements, we may apply induction to conclude that \(n=m-1\text{,}\) and after a reordering, \(p_i\) is associate to \(q_i\) for all \(2\leq i\leq n\text{.}\) (Note that the presence of \(uq_2\) instead of \(q_2\) here is not an issue here, since being associates is an equivalence relation.) But then we have \(n+1=m\text{,}\) and \(p_i\) is associate to \(q_i\) for all \(1\leq i\leq n\text{,}\) as desired.