Zariski topology closure of image of a homomorphism Just started dealing with Zariski's topology on specta, and encountered the following question:

$R,S$ commutative rings with unit and $\phi:R\rightarrow S$ homomorphism. Prove that the induced map $\psi:\operatorname{Spec(S)}\rightarrow\operatorname{Spec(R)}$ is continuous and $\text{Cl}(Im(\psi))=V(\text{ker}(\phi))$.

So I proved continuity: Assume $V(I)\subseteq\operatorname{Spec(R)}$ is some closed set, so:
$\psi^{-1}(V(I))=\{p\in\operatorname{Spec(S)}:\psi(p)\in V(I)\}=\{p\in\operatorname{Spec(S)}:I\subseteq \psi(p)\}=\{p\in\operatorname{Spec(S)}:\psi^{-1}(I)\subseteq p\}=V(\psi^{-1}(I))$ which is closed in $\operatorname{Spec(S)}$. So this proves continuity.
The part I'm having trouble with is the second part. I know that for $X\subseteq\operatorname{Spec(S)}, \text{Cl}(X)=V(\bigcap_{P\in X}P)$, but I'm not able to prove that $\text{ker}(\phi)=\bigcap_{P\in Im(\psi)}P$.
Any help would be appreciated.
 A: $\text{ker}(\phi)=\bigcap_{P\in Im(\psi)}P$ is not true in general but you can still prove that $V\left(\text{ker}(\phi)\right)=V(\bigcap_{P\in Im(\psi)}P)$.
Note that $Im(\psi)=\{ \phi^{-1}(Q) : Q\in \operatorname{Spec(S)} \}$ so $$V\left(\bigcap_{P\in Im(\psi)}P\right) = V\left(\bigcap_{Q\in \operatorname{Spec(S)}}\phi^{-1}(Q) \right) = V\left( \phi^{-1} \left(\bigcap_{Q\in \operatorname{Spec(S)}} Q \right) \right) =V\left( \phi^{-1}(\operatorname{Nil(S)}) \right)$$
where $\operatorname{Nil(S)}$ is the nilradical of $S$.
Now we can show that $V\left( \phi^{-1}(\operatorname{Nil(S)}) \right)=V\left(\text{ker}(\phi)\right)$. One inclusion is immediate: $V\left( \phi^{-1}(\operatorname{Nil(S)}) \right)\subseteq V\left(\text{ker}(\phi)\right)$ since $\text{ker}(\phi) \subseteq \phi^{-1}(\operatorname{Nil(S)})$.
For the other inclusion, let $P\in V\left(\text{ker}(\phi)\right)$ and we want to show that $\phi^{-1}(\operatorname{Nil(S)}) \subseteq P$. In fact, take an element $x\in \phi^{-1}(\operatorname{Nil(S)})$ then $\phi(x^n)=0$, which implies that $x^n\in \text{ker}(\phi) \in P$, hence, $x\in P$.
