Prime ideals in a finite direct product of rings

It is clear that any ideal of $S$ of the form stated above is prime. Let $P$ be a prime ideal of $S$. For $1\leq k\leq n$, let $e_k$ be the element of $S$ whose $k$th coordinate is $1$ and all other coordinates are $0$. $P$ is proper, so some $e_j$ (say $e_1$) is not in $P$. For $k\neq 1$ we have $e_{1}e_k=0\in P$, so $e_k\in P$. Thus $0\times \prod_{i=2}^{n}{R_i}\subseteq P$. Let $\pi_1\colon S\to R_1$ be the canonical projection. Then $\pi_1(P)$ is a prime ideal of $R_1$ and $P=\pi_1(P)\times \prod_{i=2}^{n}{R_i}.$


Let $R_{1}$ and $R_{2}$ be two commutative rings with unity.

Let $P$ be a prime ideal in $S=R_{1} \times R_{2}$.

Let $ P= P_{1} \times P_{2}$ where $P_{1}$ is a ideal in $R_{1}$ and $P_{2}$ is a ideal in $R_{2}$.

Then $S/P \simeq R_{1}/P_{1} \times R_{2}/P_{2} $.

Since product of two integral domains is not an integral domain, it must be the case that $R_1/P_1 =0$ or $R_2/P_2 =0$.

Therefore only one of the $P_{1}$ or $P_{2}$ is a prime ideal and other should be corresponding ring.