Inverse image of closed subset of quasiprojective variety is closed

There's something in the following passage in "Basic Algebraic Geometry" by Shafarevich that I don't understand.

We prove in addition that the inverse image $$f^{-1}(Z)$$ under any regular map $$f:X\rightarrow Y$$ ($$X$$ and $$Y$$ are quasiprojective varieties) of any closed subset $$Z\subset Y$$ is closed in $$X$$.

By definition of a regular map $$f:X\rightarrow Y$$, for any point $$x\in X$$ there are neighbourhoods $$U$$ of $$x$$ in $$X$$ and $$V$$ of $$f(x)$$ in $$Y$$ such that $$f(U)\subset V \subset \mathbb{A}^m$$ and the map $$f:U\rightarrow V$$ is regular. By Lemma 2 we can assume that $$U$$ is an affine variety. By Lemma 1 it is enough to check that $$f^{-1}(Z)\cap U=f^{-1}(Z\cap V)$$ is closed in U...

I don't understand why $$f^{-1}(Z)\cap U=f^{-1}(Z\cap V)$$. In fact I think $$f^{-1}(Z\cap V)$$ is bigger than $$f^{-1}(Z)\cap U$$.

• Thanks for accepting the answer. To be honest, I found Shafarevich a difficult read. Vakil is a bit deep into the category theory, but at least he has exercises thrown into his text. There is a fantastic post on here by one of my cohorts in graduate school on books for algebraic geometry. Might be worth reading if you're finding Shafarevich difficult. Will go find the link. Apr 28 '18 at 1:21
• Actually just check out a few of the posts by him: math.stackexchange.com/users/4058/javier-%C3%81lvarez Apr 28 '18 at 1:22
• @TannerStrunk Thanks. I do find Shafarevich imprecise at times and it takes a lot of time for me to try to figure out what he means.
– Jiu
Apr 28 '18 at 1:26
• No problem. Definitely check out his answer in this one in particular: math.stackexchange.com/questions/255063/… Also, I think you meant "figure" rather than "finger" above. Apr 28 '18 at 1:27
• @TannerStrunk oops, corrected that. Hehe
– Jiu
Apr 28 '18 at 1:31

Let $x\in f^{-1}(Z)\cap U = f^{-1}(Z)\cap f^{-1}(V)$. We then have that $x\in f^{-1}(Z)$ and $x\in f^{-1}(V)$. Hence $f(x)\in Z$ and $f(x)\in V$. Thus we have that $f(x)\in Z\cap V$, meaning that $x\in f^{-1}(Z\cap V)$.
Conversely, suppose that $x\in f^{-1}(Z\cap V)$. We then have that $f(x)\in Z\cap V$. Hence $f(x)\in Z$ and $f(x)\in V$, so $x\in f^{-1}(Z)$ and $x\in f^{-1}(V)$, giving $x\in f^{-1}(Z)\cap f^{-1}(V)$.
Thus $f^{-1}(Z)\cap f^{-1}(V) = f^{-1}(Z\cap V)$.
Notice that Shafarevich restricts the map $f$ to $U$, which is what gives us that $f^{-1}(V) = U$ in the first sentence. Beyond that, it's just set theory, I think.