Divisor -- line bundle correspondence in algebraic geometry

I know a little bit of the theory of compact Riemann surfaces, wherein there is a very nice divisor -- line bundle correspondence.

But when I take up the book of Hartshorne, the notion of Cartier divisor there is very confusing. It is certainly not a direct sum of points; perhaps it is better to understand it in terms of line bundles. But Cartier divisors do not seem to be quite the same thing as line bundles. The definition is hard to figure out. Can someone clear the misunderstanding for me and explain to me how best to understand Cartier divisors?


When discussing divisors, a helpful distinction to make at the beginning is effective divisors vs. all divisors. Normally effective divisors have a more geometric description; all divisors can then be obtained from the effective ones by allowing some minus signs to come into the picture.

An irreducible effective Weil divisor on a variety $X$ is the same thing as an irreducible codimension one subvariety, which in turn is the same thing as a height one point $\eta$ of $X$. (We get $\eta$ as the generic point of the irred. codim'n one subvariety, and we recover the subvariety as the closure of $\eta$.)
An effective Weil divisor is a non-negative integral linear combination of irreducible ones, so you can think of it as a non-negative integral linear combination of height one points $\eta$.

Typically, one restricts to normal varieties, so that all the local rings at height one points are DVRs. Then, given any pure codimension one subscheme $Z$ of $X$, you can attach a Weil divisor to $Z$, in the following way: because the local rings at height one points are DVRs, if $Z$ is any codimension one subscheme of $X$, cut out by an ideal sheaf $\mathcal I_Z$, and $\eta$ is a height one point, then the stalk $\mathcal I_{Z,\eta}$ is an ideal in the DVR $\mathcal O_{X,\eta}$, thus is just some power of the maximal ideal $\mathfrak m_{\eta}$ (using the DVR property), say $\mathcal I_{Z,\eta} = \mathfrak m_{\eta}^{m_{Z,\eta}},$ and so the multiplicity $m$ of $Z$ at $\eta$ is well-defined.
Thus the effective Weil divisor $$div(Z) := \sum_{\eta \text{ of height one}} m_{Z,\eta}\cdot \eta$$ is well-defined.

Note that this recipe only goes one way: starting with the Weil divisor, we can't recover $Z$, because the Weil divisor does not remember all the scheme structure (i.e. the whole structure sheaf, or equivalently, the whole ideal sheaf) of $Z$, but only its behaviour at its generic points (which amounts to the same thing as remembering the irreducible components and their multiplicities).

An effective Cartier divisor is actually a more directly geometric object, namely, it is a locally principal pure codimension one subscheme, that is, a subscheme, each component of which is codimension one, and which, locally around each point, is the zero locus of a section of the structure sheaf. Now in order to cut out a pure codimension one subscheme as its zero locus, a section of the structure sheaf should be regular (in the commutative algebra sense), i.e. a non-zero divisor. Also, two regular sections will cut out the same zero locus if their ratio is a unit in the structure sheaf. So if we let $\mathcal O_X^{reg}$ denote the subsheaf of $\mathcal O_X$ whose sections are regular elements (i.e. non-zero divisors in each stalk), then the equation of a Cartier divisor is a well-defined global section of the quotient sheaf $\mathcal O_X^{reg}/\mathcal O_X^{\times}$.

Now suppose that we are on a smooth variety. Then any irreducible codimension one subvariety is in fact locally principal, and so given a Weil divisor $$D = \sum_{\eta \text{ of height one}} m_{\eta} \cdot\eta,$$ we can actually canonically attach a Cartier divisor to it, in the following way: in a n.h. of some point $x$, let $f_{\eta}$ be a local equation for the Zariski closure of $\eta$; then if $Z(D)$ is cut out locally by $\prod_{\eta} f_{\eta}^{m_{\eta}} = 0,$ then $Z(D)$ is locally principal by construction, and, again by construction, $div(Z(D)) = D.$

So in the smooth setting, we see that $Z \mapsto div(Z)$ and $D \mapsto Z(D)$ establish a bijection between effective Cartier divisors and effective Weil divisors.

On the other hand, on a singular variety, it can happen that an irreducible codimension one subvariety need not be locally principal in the neighbourhood of a singular point (e.g. a generating line on the cone $x^2 +y^2 + z^2 = 0$ in $\mathbb A^3$ is not locally principal in any neighbourhood of the cone point). Thus there can be Weil divisors that are not of the form $div(Z)$ for any Cartier divisor $Z$.

To go from effective Weil divisor to all Weil divisors, you just allow negative coefficients.

To go from effective Cartier divisors to all Cartier divisors, you have to allow yourself to invert the functions $f$ that cut out the effective Cartier divisors, or equivalently, to go from the sheaf of monoids $\mathcal O_X^{reg}/\mathcal O_X^{\times}$ to the associated sheaf of groups, which is $\mathcal K_X^{reg}/\mathcal O_X^{\times}.$ (Here, it helps to remember that $\mathcal K_X$ is obtained from $\mathcal O_X$ by inverting non-zero divisors.)

Finally, for the connection with line bundles: if $\mathcal L$ is a line bundle, and $s$ is a regular section (i.e. a section whose zero locus is pure codimension one, or equivalently, a section which, when we choose a local isomorphism $\mathcal L_{| U} \cong \mathcal O_U$, is not a zero divisor), then the zero locus $Z(s)$ of $s$ is an effective Cartier divisor, essentially by definition.

So we have a map $(\mathcal L,s) \mapsto Z(s)$ which sends line bundles with regular sections to effective Cartier divisors. This is in fact an isomorphism of monoids (where on the left we consider pairs $(\mathcal L,s)$ up to isomorphism of pairs): given an effective Cartier divisor $D$, we can define $\mathcal O(D)$ to be the subsheaf of $\mathcal K_X$ consisting (locally) of sections $f$ such that the locus of poles of $f$ (a well-defined Cartier divisor) is contained (as a subscheme)in the Cartier divisor $D$ (perhaps less intuitively, but more concretely: if $D$ is locally cut out by the equation $g = 0$, then $\mathcal O(D)$ consists (locally) of sections $f$ of $\mathcal K_X$ such that $fg$ is in fact a section of $\mathcal O_X$).

The constant function $1$ certainly lies in $\mathcal O(D)$, and (thought of as a section of $\mathcal O(D)$ -- not as a function!) its zero locus is exactly $D$.

Thus $D \mapsto (\mathcal O(D), 1)$ is an inverse to the above map $(\mathcal L,s) \mapsto Z(s)$.

Finally, if we choose two different regular sections of the same line bundle, the corresponding Cartier divisors are linearly equivalent. Thus we are led to the isomorphism "line bundles up to isomorphism = Cartier divisors up to linear equivalence". But, just to emphasize, to understand this it is best to restrict first to line bundles which admit a regular section, and then think of the corresponding Cartier divisor as being the zero locus of that section. This brings out the geometric nature of the Cartier divisor quite clearly.