Let $R ≠ 0$ be a principal ideal domain that is not a field. Let $0 ≠ x \in R.$
Show that if $x = yz$ for $y, z \in R \backslash R^\times$ with $\text{gcd}(y, z) = 1$, then there exists an idempotent $e \in R/x$ with $e ≠ 0, 1$ such that $e \cdot R/x \cong R/y$ and $(1 - e) \cdot R/x \cong R/z.$
I think I almost have this solved myself; the Chinese remainder theorem tells us that $R/x \cong R/y \oplus R/z$. In general, I also know that we have $R/x \cong e \cdot R/x \oplus (1 - e) \cdot R/x$ for an idempotent. But struggle in showing that indeed $e \cdot R/x \cong R/y$ and that $e$ can be non trivial.