A proof that shows surjective homomorphic image of prime ideal is prime
Solution 1:
Suppose $x,y \in B$ and $xy \in \phi(\mathfrak{p})$. Choose $a, b \in A$ such that $a \mapsto x$, $b \mapsto y$, and choose $c \in \mathfrak{p}$ such that $c \mapsto xy$. Then $ab -c \in ker(\phi)$, so $ab \in \mathfrak{p}$. Thus, either $a$ or $b$ is in $\mathfrak{p}$, which means either $x$ or $y$ is in $\phi(\mathfrak{p})$.
Why is surjectivity necessary? Take $\mathbb{Z} \rightarrow \mathbb{Q}$, where the map is inclusion. Why is $\mathfrak{p}$ containing the kernel necessary? Take $\mathbb{Z} \rightarrow \mathbb{Z}/(2)$; $(3)$ does not map to a prime ideal.
Solution 2:
Yet another, more abstract proof.
If $\phi : A \to B$ is a surjective homomorphism, then for every ideal $\mathfrak{b} \subseteq B$ we get an isomorphism $\overline{\phi} : A/\phi^{-1}(\mathfrak{b}) \to B/\mathfrak{b}$. In particular, if $\phi^{-1}(\mathfrak{b}) \subseteq A$ is a prime (primary, maximal, reduced, etc.) ideal, then the same holds for $\mathfrak{b}$. Now, if $\mathfrak{a} \subseteq A$ is an ideal, then $\phi^{-1}(\phi(\mathfrak{a}))=\mathfrak{a} + \ker(\phi)$. Hence, if $\mathfrak{a}+\ker(\phi)$ is prime, then also $\phi(\mathfrak{a})$ is prime. The claim is for the special case $\ker(\phi)\subseteq \mathfrak{a}$.
Solution 3:
Adding to BenjaLim's answer, if $\mathfrak{p}$ does not contain $\operatorname{ker} \phi$, then $\phi(P)$ is not in general a prime ideal because $\phi^{-1}(\phi(P)) = \operatorname{ker} \phi + P$ and the latter need not be a prime ideal, since $\operatorname{ker} \phi + P \neq P$ and the inverse image of a prime ideal is always a prime ideal. (I am assuming that $\phi$ is still surjective)
Let $\phi:A \rightarrow B$ be surjective homomorphism of rings. Then $B \cong A/ \operatorname{ker} \phi$. We know that the prime ideals of $A / \operatorname{ker} \phi$ are in one to one correspondence with the prime ideals of $A$ that contain $\operatorname{ker} \phi$. In view of $B \cong A/\operatorname{ker} \phi$ you can think of the prime ideals of $B$ as the prime ideals of $ A/\operatorname{ker} \phi$.
Solution 4:
Firstly it is clear that $\varphi(\mathfrak{p})$ is an ideal. Now suppose $xy \in \varphi(\mathfrak{p})$. By surjectivity of $\varphi$ we can write $x = \varphi(x')$ and $y = \varphi(y')$ for some $x',y' \in A$. Now $xy$ can be written as $\varphi(z)$ for some $z \in \mathfrak{p}$. Thus we can write
$$\varphi(z) = \varphi(x')\varphi(y') = \varphi(x'y')$$
and hence $z - x'y' \in \ker \varphi$. Since $\mathfrak{p}$ contains $\ker\varphi$ this implies that $x'y' \in \mathfrak{p}$ since $z \in\mathfrak{p}$. By primality of $\mathfrak{p}$ this implies that $x'$ or $y'$ is in $\mathfrak{p}$ and so $x$ or $y$ is in $\varphi(\mathfrak{p})$. Thus $\varphi(\mathfrak{p})$ is a prime ideal.