Vakil 14.2.E: $\mathcal L \cong \mathcal O_X(\mathrm{div}(s))$ for $s$ a rational section.

I did not know how to lift the obvious isomorphism $\mathcal O_X(D)_Y \cong \mathcal O_{X,Y}$ at a codimension-1 point $Y$ to an isomorphism of a neighborhood of $Y$. Ultimately, it is possible to do this because the total ring of fractions gives a single realm for considering functions coming from different sources.

Replace $X$ by one of its affine neighborhoods of $p.$ Since $X$ is regular in codimension 1, $\mathcal O_{X,Y}$ is a DVR. Any uniformizer $f_Y$ can be considered in $K(X).$ It can be shown that the prime Weil divisors of $X$ through $p$ correspond bijectively to inject into the prime Weil divisors of $Spec(\mathcal O_{X,p}),$ so $Y$ is the only component of the divisor of $f_Y$ considered as a function on $X$. Let $$U_Y := X\setminus \{\text{all components of $div(f)$ except $Y$}\}.$$ Then, letting $e_Y := v_Y(s),$ the open set $U := \bigcap_{Y\ni p} U_Y$ is a neighborhood of $p$ on which $$t\longmapsto t\prod_{Y\ni p}f_Y^{-e_Y}$$ is an isomorphism $\mathcal O_X(D)(U)\longrightarrow \mathcal O_X(U).$ From here it is straightforward to prove that in fact $\mathcal O_X(D)\rvert_U \cong \mathcal O_U$ for all $U$ in a base for the topology on $X$, and the rest of the exercise follows.


Since I've been asking myself the same question, I'll add another, hopefully easier answer: We want to show that $\mathfrak U := \{ U \ \mid \ \mathcal O(D)|_U \cong \mathcal O_U\}$ forms a base for the Zariski topology of X.

Replacing $\mathcal O(D)$ by $\mathcal L$, this statement is obviously true since $\mathcal L$ is a line bundle.

It hence suffices to show that $\mathcal O(D)$ is trivial on any open subset $U$ on which $\mathcal L$ is trivial.

Let $U$ be such an open subset and choose an isomorphism $\mathcal \phi : \mathcal L|_U \to \mathcal O_U$.

Then $s|_U$ gives rise to a rational section $f := \phi(s|_U)$ of $\mathcal O_U$ and furthermore (by definition) $D|_U = \mathrm{div}|_U f$.

Then the map $\mathcal O(D)|_U = \mathcal O_U(D|_U) = \mathcal O_U(\mathrm{div}|_U f) \to \mathcal O_U$ given on sections by $t \mapsto f\cdot t$ is well-defined and gives the required isomorphism:

$\mathrm{div}|_U(f\cdot t) = \mathrm{div}|_U t + \mathrm{div}|_U f = \mathrm{div}|_U t + D|_U \geq 0$ since $t$ is a section of $\mathcal O(D)$ and hence $f\cdot t$ is a regular section by the normality hypothesis (using that $A = \cap_{\mathrm{ht}(\mathfrak p) = 1}A_{\mathfrak p}$ for a normal Noetherian ring $A$).

Starting with a regular section $t \in \mathcal O_U$, one has that $\begin{align} \mathrm{div}|_U (\frac{t}{f}) + D|_U = \mathrm{div}|_U t - \mathrm{div}|_U f + \mathrm{div}|_U f = \mathrm{div}|_U t \geq 0 \end{align}$ since $t$ is regular.

Hence dividing a regular section by $f$ gives the required inverse $\mathcal O_U \to \mathcal O(D)|_U$.

Note that we essentially made use of the fact that $D = \mathrm{div} s$ is a locally principle divisor and the same line of thought shows that $\mathcal O(D)$ is a line bundle, whenever $D$ is a locally principle divisor in the given setting.