Prove that the preimage of a prime ideal is also prime.
I want to point out there's a far easier way of doing this: let $f\colon R\rightarrow S$ be a ring homomorphism and let $x,y\in R$ such that $xy\in f^{-1}(P)$. Then $f(x)f(y)=f(xy)\in P\implies f(x)\in P$ or $f(y)\in P$, since $P$ is prime, i.e. $x\in f^{-1}(P)$ or $y\in f^{-1}(P)$ and we are done.
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$.