I'm working on Atiyah-Macdonald Exercise 5.1:
Let $f:A\to B$ be an integral homomorphism of rings. Show that $f^*:\mathrm{Spec}(B)\to\mathrm{Spec}(A)$ maps closed sets to closed sets.
Here $f^*$ takes the prime ideal $\mathfrak q\subset B$ to the prime ideal $f^{-1}(\mathfrak q)\subset A$.
So far I've shown that for any ideal $I\subset B$ we have $f^*(V(I))\subseteq V(f^{-1}(I))$, where $V(I)$ denotes the set of prime ideals of $B$ containing $I$, and likewise for $V(f^{-1}(I))$ and primes containing $f^{-1}(I)$ in $A$. Thus $f^*$ takes $V(I)$ into $V(f^{-1}(I))$. Now I want to show that $f^*$ maps $V(I)$ onto $V(f^{-1}(I))$. To this end, I've shown that given any prime $\mathfrak p\in V(f^{-1}(I))$ there exists a prime $\mathfrak q\subset B$ such that $f^*(\mathfrak q) = \mathfrak p$.
However, I'm stuck trying to show that $\mathfrak q$ is actually in $V(I)$, that is, that $I\subset\mathfrak q$. I've seen a number of worked solutions to this problem that don't mention this at all, so I'm not sure if it's 1) obvious or 2) unnecessary, and I'm having trouble seeing why in either case. How can we prove this, or why is it not necessary to do so?
If it would help to know how I constructed $\mathfrak q$: Suppose $\mathfrak p\in V(f^{-1}(I))$, and note that $f(\mathfrak p)$ is prime in $f(A)$ since $f$ is surjective onto $f(A)$ and $\ker f\subset f^{-1}(I)\subset\mathfrak p$. Since $f$ is integral, $B$ is integral over $f(A)$, so by the going-up theorem there is some prime ideal $\mathfrak q$ of $B$ such that $\mathfrak q\cap f(A)=f(\mathfrak p)$. And now $f^*(\mathfrak q) = f^{-1}(\mathfrak q) = f^{-1}(\mathfrak q\cap f(A)) = f^{-1}(f(\mathfrak p)) = \mathfrak p + \ker f = \mathfrak p$.