# Being dense in the Zariski topology.

I need to prove that if $R$ and $S$ are integral domains, $\varphi \colon R \longrightarrow S$ is a ring homomorphism and $f\colon \text{Spec}(S) \longrightarrow \text{Spec}(R)$ is the induced map with respect to the Zariski topology, then:

The image of $f$ is dense in $\text{Spec}(R)$ if and only if $\varphi$ is injective.

The hint is to show that $V(\varphi^{-1}(0))=\overline{f(V(0))}$. I have obtained that $\overline{f(V(0))} \subseteq V(\varphi^{-1}(0))$, but I have troubles proving the other inclusion.

Proving the inclusion is the same as proving that if $P$ is a prime ideal with $\varphi^{-1}(\{0\}) \subseteq P$, then $P=\varphi^{-1}(Q)$ for some prime ideal $Q$ in $S$. I have tried to prove that the extension of $P$ to $S$ is prime in that case, but I have not obtained anything.

$\overline{fV(0))}$ is the smallest closed subset which contains $f(V(0))$, we can write $\overline{fV(0))}=V(I)$, this implies that for every $P\in Spec(S)$, $I\subset \varphi^{-1}(P)$ we deduce that $I\subset \cap_{P\in Spec(S)}\varphi^{-1}(P)=\phi^{-1}(\cap_{P\in Spec(S)}P)=\varphi^{-1}(rad(P))=\varphi^{-1}(0)$. Remark that since $S$ is integral, $Rad(S)=0$ since $S$ does not have divisors of zero, and henceforth does not have nilpotent elements.
This implies that $V(\varphi^{-1}(0))\subset V(I)=\overline{f(V(0))}$.