Lemma 28.29.7. Let $X$ be a quasi-affine scheme. Let $\mathcal{L}$ be an invertible $\mathcal{O}_ X$-module. Let $E \subset W \subset X$ with $E$ finite and $W$ open. Then there exists an $s \in \Gamma (X, \mathcal{L})$ such that $X_ s$ is affine and $E \subset X_ s \subset W$.

Proof. The proof of this lemma has a lot in common with the proof of Algebra, Lemma 10.15.2. Say $E = \{ x_1, \ldots , x_ n\}$. If $E = W = \emptyset$, then $s = 0$ works. If $W \not= \emptyset$, then we may assume $E \not= \emptyset$ by adding a point if necessary. Thus we may assume $n \geq 1$. We will prove the lemma by induction on $n$.

Base case: $n = 1$. After replacing $W$ by an affine open neighbourhood of $x_1$ in $W$, we may assume $W$ is affine. Combining Lemmas 28.27.1 and Proposition 28.26.13 we see that every quasi-coherent $\mathcal{O}_ X$-module is globally generated. Hence there exists a global section $s$ of $\mathcal{L}$ which does not vanish at $x_1$. On the other hand, let $Z \subset X$ be the reduced induced closed subscheme on $X \setminus W$. Applying global generation to the quasi-coherent ideal sheaf $\mathcal{I}$ of $Z$ we find a global section $f$ of $\mathcal{I}$ which does not vanish at $x_1$. Then $s' = fs$ is a global section of $\mathcal{L}$ which does not vanish at $x_1$ such that $X_{s'} \subset W$. Then $X_{s'}$ is affine by Lemma 28.26.4.

Induction step for $n > 1$. If there is a specialization $x_ i \leadsto x_ j$ for $i \not= j$, then it suffices to prove the lemma for $\{ x_1, \ldots , x_ n\} \setminus \{ x_ i\}$ and we are done by induction. Thus we may assume there are no specializations among the $x_ i$. By either Lemma 28.29.5 or Lemma 28.29.6 we may assume $W$ is affine. By induction we can find a global section $s$ of $\mathcal{L}$ such that $X_ s \subset W$ is affine and contains $x_1, \ldots , x_{n - 1}$. If $x_ n \in X_ s$ then we are done. Assume $s$ is zero at $x_ n$. By the case $n = 1$ we can find a global section $s'$ of $\mathcal{L}$ with $\{ x_ n\} \subset X_{s'} \subset W \setminus \overline{\{ x_1, \ldots , x_{n - 1}\} }$. Here we use that $x_ n$ is not a specialization of $x_1, \ldots , x_{n - 1}$. Then $s + s'$ is a global section of $\mathcal{L}$ which is nonvanishing at $x_1, \ldots , x_ n$ with $X_{s + s'} \subset W$ and we conclude as before. $\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).