Lemma 40.14.9. Let $j : V \to \mathop{\mathrm{Spec}}(A)$ be a quasi-compact immersion of schemes. Let $f \in A$ be such that $j^{-1}D(f)$ is affine and $j(V) \cap V(f)$ is closed. Then $V$ is affine.

Proof. This follows from Morphisms, Lemma 29.11.14 but we will also give a direct proof. Let $A' = \Gamma (V, \mathcal{O}_ V)$. Then $j' : V \to \mathop{\mathrm{Spec}}(A')$ is a quasi-compact open immersion, see Properties, Lemma 28.18.4. Let $f' \in A'$ be the image of $f$. Then $(j')^{-1}D(f') = j^{-1}D(f)$ is affine. On the other hand, $j'(V) \cap V(f')$ is a subscheme of $\mathop{\mathrm{Spec}}(A')$ which maps isomorphically to the closed subscheme $j(V) \cap V(f)$ of $\mathop{\mathrm{Spec}}(A)$. Hence it is closed in $\mathop{\mathrm{Spec}}(A')$ for example by Schemes, Lemma 26.21.11. Thus we may replace $A$ by $A'$ and assume that $j$ is an open immersion and $A = \Gamma (V, \mathcal{O}_ V)$.

In this case we claim that $j(V) = \mathop{\mathrm{Spec}}(A)$ which finishes the proof. If not, then we can find a principal affine open $D(g) \subset \mathop{\mathrm{Spec}}(A)$ which meets the complement and avoids the closed subset $j(V) \cap V(f)$. Note that $j$ maps $j^{-1}D(f)$ isomorphically onto $D(f)$, see Properties, Lemma 28.18.3. Hence $D(g)$ meets $V(f)$. On the other hand, $j^{-1}D(g)$ is a principal open of the affine open $j^{-1}D(f)$ hence affine. Hence by Properties, Lemma 28.18.3 again we see that $D(g)$ is isomorphic to $j^{-1}D(g) \subset j^{-1}D(f)$ which implies that $D(g) \subset D(f)$. This contradiction finishes the proof. $\square$

In your comment you can use Markdown and LaTeX style mathematics (enclose it like $\pi$). A preview option is available if you wish to see how it works out (just click on the eye in the toolbar).