Let $f: R \rightarrow S$ be a ring homomorphism, with $R$ and $S$ commutative and $f(1)=1$. If $P$ is a prime ideal of $S$, show that the preimage $f^{-1}(P)$ is a prime ideal of $R$.
Define $g: S \rightarrow S/P$ with kernel $s$. Let $h = g \circ f: R \rightarrow S/P$. Since $h$ is a ring homomorphism, the kernel is an ideal of $R$. Also, from the first isomorphism theorem, we know that $R/\ker(h) \cong S/P$. Since $P$ is a prime ideal of $S$, we know that $S/P$ is an integral domain. Since $R/\ker(h)$ is isomorphic to $S/P$, it must also be an integral domain, which implies that the kernel of $h$ (which is the preimage of $P$) is a prime ideal of $R$.
Do you think my answer is correct? The reason why I was a bit skeptical of my answer is because I did not use the fact that $R$ and $S$ are commutative. So I'm wondering if I missed something $\dots$
Thank you in advance.
What you've done is correct. The definition for prime ideals in commutative rings relies on commutativity.
For a non-commutative ring $R$, we have a different definition, and say that $P$ is a prime ideal if whenever the product of two ideals $IJ\subset P$, then either $I\subset P$ or $J\subset P$.