Suppose f cannot be written as a product of irreducibles and build complementary chains of ascending and descending ideals as follows. Let f0 = f. Since f0 is not irreducible, write it as x1f1, where f1 cannot be written as a product of irreducibles. Then write f as x1x2f2, where f2 cannot be written as a product of irreducibles. Next write f as x1x2x3f3, then x1x2x3x4f4, and so on.
Let yj be shorthand for the product of x1 through xj. Clearly yj spans yj+1. As principal ideals, the former contains the latter. If the latter contains the former then yj = cyj+1, hence yj = cxj+1yj, and xj+1 becomes a unit. This is a contradiction, hence the ideals generated by yj form an infinite descending chain. At the same time, the ideals generated by fj form an infinite ascending chain. each fj+1 properly spans fj; the proof is essentially the same.
Therefore, a ring that is noetherian or artinian, i.e. no infinite ascending or descending chains of ideals, is a factorization domain. A pid is noetherian, hence every pid is automatically a factorization domain.