Lemma 31.28.3. Let $X$ be a locally Noetherian scheme. Let $U \subset X$ be an open and let $\mathcal{L}$ be an invertible $\mathcal{O}_ U$-module. If $\mathcal{O}_{X, x}$ is a UFD for all $x \in X \setminus U$, then there exists an invertible $\mathcal{O}_ X$-module $\mathcal{L}'$ with $\mathcal{L} \cong \mathcal{L}'|_ U$.

Proof. Choose $x \in X$, $x \not\in U$. We will show there exists an affine open neighbourhood $W \subset X$, such that $\mathcal{L}|_{W \cap U}$ extends to an invertible sheaf on $W$. This implies by glueing of sheaves (Sheaves, Section 6.33) that we can extend $\mathcal{L}$ to the strictly bigger open $U \cup W$. Let $W = \mathop{\mathrm{Spec}}(A)$ be an affine open neighbourhood. Since $U \cap W$ is quasi-affine, we see that we can write $\mathcal{L}|_{W \cap U}$ as $\mathcal{O}(D_1) \otimes \mathcal{O}(D_2)^{\otimes -1}$ for some effective Cartier divisors $D_1, D_2 \subset W \cap U$, see Lemma 31.15.12. Then $D_1$ and $D_2$ extend to effective Cartier divisors of $W$ by Lemma 31.28.2 which gives us the extension of the invertible sheaf.

If $X$ is Noetherian (which is the case most used in practice), the above combined with Noetherian induction finishes the proof. In the general case we argue as follows. First, because every local ring of a point outside of $U$ is a domain and $X$ is locally Noetherian, we see that the closure of $U$ in $X$ is open. Thus we may assume that $U \subset X$ is dense and schematically dense. Now we consider the set $T$ of triples $(U', \mathcal{L}', \alpha )$ where $U \subset U' \subset X$ is an open subscheme, $\mathcal{L}'$ is an invertible $\mathcal{O}_{U'}$-module, and $\alpha : \mathcal{L}'|_ U \to \mathcal{L}$ is an isomorphism. We endow $T$ with a partial ordering $\leq$ defined by the rule $(U', \mathcal{L}', \alpha ) \leq (U'', \mathcal{L}'', \alpha ')$ if and only if $U' \subset U''$ and there exists an isomorphism $\beta : \mathcal{L}''|_{U'} \to \mathcal{L}'$ compatible with $\alpha$ and $\alpha '$. Observe that $\beta$ is unique (if it exists) because $U \subset X$ is dense. The first part of the proof shows that for any element $t = (U', \mathcal{L}', \alpha )$ of $T$ with $U' \not= X$ there exists a $t' \in T$ with $t' > t$. Hence to finish the proof it suffices to show that Zorn's lemma applies. Thus consider a totally ordered subset $I \subset T$. If $i \in I$ corresponds to the triple $(U_ i, \mathcal{L}_ i, \alpha _ i)$, then we can construct an invertible module $\mathcal{L}'$ on $U' = \bigcup U_ i$ as follows. For $W \subset U'$ open and quasi-compact we see that $W \subset U_ i$ for some $i$ and we set

$\mathcal{L}'(W) = \mathcal{L}_ i(W)$

For the transition maps we use the $\beta$'s (which are unique and hence compose correctly). This defines an invertible $\mathcal{O}$-module $\mathcal{L}'$ on the basis of quasi-compact opens of $U'$ which is sufficient to define an invertible module (Sheaves, Section 6.30). We omit the details. $\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).