Let $f : Spec(A) \rightarrow Spec(B)$ correspond to a ring homomorphism $\phi : B \rightarrow A$. Let $I$ be an ideal of $A$. Then, $\overline{f(V(I))} = V(\phi^{-1}(I))$.
This theorem is stated in the Wikipedia article but without proof. I've attempted to prove it as follows:
If $p \in Spec(A)$ contains $I$, then $f(p) = \phi^{-1}(p)$ contains $\phi^{-1}(I)$, as for $b \in B$, $b \in \phi^{-1}(I) \leftrightarrow \phi(b) \in I \rightarrow \phi(b) \in p \leftrightarrow b \in \phi^{-1}(p)$ . Therefore, $f(V(I)) \subseteq V(\phi^{-1}(I))$ .
But I'm stuck on the part where we finish the proof by taking closures and showing they're equal. Can you please help me?
Let $C$ be a closed subset of $\operatorname{Spec} B$ containing $f(V(I))$. We can write $C = V(J)$ for some ideal $J$ of $B$. Since $V(J) \supset f(V(I))$ then $f^{-1}(V(J)) \supset V(I)$, i.e., $V(\phi(J)) \supset V(I)$. So $\phi(J) \subset I$, which implies $J \subset \phi^{-1}(I)$. Therefore $V(J) \supset V(\phi^{-1}(I))$, that is, $C\supset V(\phi^{-1}(I))$. Since $C$ was arbitrary, $\overline{f(V(I))} \supset V(\phi^{-1}(I))$. On the other hand, $V(\phi^{-1}(I))$ is already a closed subset of $\operatorname{Spec}A$ containing $f(V(I))$: $$f^{-1}[V(\phi^{-1}(I))] = V(\phi(\phi^{-1}(I))) \supset V(I)$$ so $V(\phi^{-1}(I)) \supset f(V(I))$. Consequently, $\overline{f(V(I))} = V(\phi^{-1}(I))$.