\documentclass[a4paper]{article}

\def\npart{III}

\def\ntitle{Algebraic Geometry}
\def\nlecturer{M.\ Gross}

\def\nterm{Michaelmas}
\def\nyear{2019}

\input{header}

\renewcommand*{\P}{\mathbb{P}}
\renewcommand{\c}[1]{\mathbf{#1}} % category
\newcommand{\sh}[1]{\mathcal{#1}} % sheaf
\DeclareMathOperator{\Pic}{Pic} % Picard group
\DeclareMathOperator{\codim}{codim} % codimension
\DeclareMathOperator{\Div}{Div} % divisor group
\DeclareMathOperator{\Cl}{Cl} % class group
\DeclareMathOperator{\CaCl}{CaCl} % Cartier class group
\DeclareMathOperator{\Supp}{Supp} % support

\begin{document}

\input{titlepage}

\tableofcontents

\setcounter{section}{-1}

\section{Introduction}

\subsection{Variety vs Scheme}

In classical algebraic geometry, we study varieties which are points where polynomials vanish. Why do we need schemes? Why not varieties?
\begin{enumerate}
\item With varieties, we always work with algebraically closed fields. Otherwise, the ideals are not really classical geometric objects. For example, consider \(I = (x^2 + y^2 + 1) \subseteq \R[x, y]\). \(V(I) = \emptyset\), \(I(V(I)) = \R[x, y]\).
\item Suppose one want to work on number theory. One is usually interested in Diophantine equations, for example if \(I \subseteq \Z[x_1, \dots, x_n]\) then \(V(I) \subseteq \Z^n\).
\item Consider \(X_1 = V(x - y^2) \subseteq \A^2, X_2 = V(x)\). Then
  \[
    X_1 \cap X_2 = V(x, x - y^2).
  \]
  Consider \(I = (x, x - y^2) = (x, y^2) \subseteq k[x, y]\). \(V(I)\) contains exactly one point, namely the origin, but the ideal \(I\) is not radical, reflecting the fact that \(X_2\) is the tangent to \(X_1\). Might it be reasonable to consider \(k[x, y]/(x, y^2)\) as the coordinate ring of \(X_1 \cap X_2\) rather than \(k[x, y]/(x, y)\)? Note \(y \in k[x, y]/(x, y^2)\) is non-zero but \(y^2 = 0\).
\end{enumerate}

\subsection{Categorical philosophy}

What is a point? Let \(\c{Set}\) be the category of sets. Let \(*\) be the set with one element. Then if \(X\) is a set there is an obvious bijection \(X \to \Hom(*, X)\). Put in another way, you know \(X\) if you know \(\Hom(Y, X)\) for all \(Y\).

In the category of affine varieties over \(k\), a point is a point with coordinate ring \(k\). Given \(I \subseteq k[x_1, \dots, x_n]\), giving a morphism from a point to \(V(I) = X\) is the same as giving a \(k\)-algebra homomorphism \(\varphi: k[x_1, \dots, x_n]/I \to k\) given by \(x_i \mapsto a_i \in k\) such that for all \(f \in I\), \(f(a_1, \dots, a_n) = 0\), i.e.\ \((a_1, \dots, a_n) \in V(I)\). \(\varphi\) is surjective so \(k[X]/\ker \varphi \cong k\), so \(\ker \varphi\) is a maximal ideal of \(k[X]\). Conversely, given a maximal ideal \(\mathfrak m \subseteq k[X]\), \(k[X]/\mathfrak m\) is a finite field extension of \(k\) by Hilbert's Nullstellensatz. So if \(k = \overline k\) then \(k[X]/\mathfrak m \cong k\) and the map \(\varphi: k[X] \to k[X]/\mathfrak m \cong k\) gives a point \((a_1, \dots, a_n) = (\varphi(x_1), \dots, \varphi(x_n)) \in X\).

Why not also consider field extensions \(k \subseteq k'\) and consider \(k\)-algebra homomorphisms \(\varphi: k[X] \to k'\)? Same as before we get a set of solutions in \((k')^n\). Note \(k[X]/\ker \varphi \subseteq k'\) and hence \(k[X]/\ker \varphi\) is an integral domain. Thus \(\ker \varphi\) is prime. For example take \(k[X]\) to be \(\R[x, y]/(x^2 + y^2 + 1)\) and \(\R\)-algebra map \(k[X] \to \R\). There does not exist such map, but there is certainly a map \(k[X] \to \C\), for example \(x \mapsto 0, y \mapsto i\). We have \(\ker \varphi = (x, y^2 + 1)\) is a maximal ideal. Note that this ideal corresponds to two points \((0, \pm i)\), a \(\operatorname{Gal}(\C/\R)\)-orbit of points with \(\C\)-coordinates. In fact this also follows from Hilbert's Nullstellensata: if \(A\) is a finitely-generated \(k\)-algebra, \(\mathfrak m \subseteq A\) a maximal ideal then \(A/\mathfrak m\) is a finite field extension of \(k\).

Let \(K\) be the field of fractions of \(A\). Then \(\varphi: A \embed K\) defines a point in \(K\), i.e.\ \((x, y)\) satisfying \(x^2 + y^2 + 1 = 0\) in \(K\). Note \(\ker \varphi = 0\) so this point corresponds not to a maximal ideal but to a prime ideal. This may prompt to us to consider all prime ideals instead of just maximal ideals.

Consider another example \(A = \Z[x_1, \dots, x_n]/I\). We may want to consider solutions to the system of equations \(I\) with coordinates in any ring \(R\). Such is given by a ring homomorphism \(\varphi: A \to R\), i.e.\ \((r_1, \dots, r_n)\) satisfying \(f(r_1, \dots, r_n) = 0\) for \(f \in I\). We may then consider different choices of \(R\). We may take \(R = \Z\), a number ring, \(\Q\), or \(\F_p\).

What we want: give a ring \(A\) (all rings in this course are commutative with \(1\)), we want a geometric object \(X = ``\Spec A''\). For a ring \(R\), the set of ``\(R\)-valued points'' of \(X\) should be
\[
  X(R) = \Hom_{\text{Ring}}(A, R).
\]
A morphism \(X = \Spec A \to Y = \Spec B\) should be determined by a ring homomorphism \(\varphi: B \to A\).

\begin{definition}
  The category of affine scheme is the opposite category to the category of rings.
\end{definition}
This is a purely formal definition and there is no geometry. Instead, we want to study more general objects.

\begin{definition}
  A scheme is an object which is locally an affine scheme.
\end{definition}
This time, we do need geometry to talk about local properties!

\section{Sheaves}

\begin{definition}[spectrum]\index{spectrum}
  Let \(A\) be a ring. Then the \emph{spectrum} of \(A\) is
  \[
    \Spec A = \{\mathfrak p \subseteq A: \mathfrak p \text{ a prime ideal}\}.
  \]

  If \(I \subseteq A\) is an ideal, define
  \[
    V(I) = \{\mathfrak p \subseteq \Spec A: \mathfrak p \supseteq I\}.
  \]
\end{definition}

\begin{proposition}[Zariski topology]\index{Zariski topology}
  The set \(V(I)\) form the closed sets of a topology on \(\Spec A\), called the \emph{Zariski topology}.
\end{proposition}

\begin{proof}
  \(V(0) = \Spec A, V(A) = \emptyset\). If \(\{I_j\}_{j \in J}\) is a collection of ideals then
  \[
    V(\sum_{j \in J} I_j) = \bigcap_{j \in J} V(I_j)
  \]
  and finally
  \[
    V(I_1 I_2) = V(I_1) \cup V(I_2).
  \]
  One direction is trivial. For the other, if \(\mathfrak p \supseteq I_1 \cap I_2\) then \(\mathfrak p \supseteq I_1\) or \(\mathfrak p \supseteq I_2\).
\end{proof}

\begin{eg}
  \(A = k[x_1, \dots, x_n]\) where \(k = \overline k\), \(I \subseteq A\), then the maximal ideals in \(V(I)\) is in one-to-one correspondence with points of the variety \(V(I)\) in affine \(n\)-spece.
\end{eg}

So far we only have a topology. To talk about geometry, we need a good notion of functions. This is where we need \emph{sheaves}. From now on fix a topologial space \(X\).

\begin{definition}[presheaf]\index{presheaf}
  A \emph{presheaf} of abelian groups on \(X\) \(\sh F\) consists of data
  \begin{enumerate}
  \item for every open set \(U \subseteq X\), an abelian group \(\sh F(U)\),
  \item whenever \(V \subseteq U\), a group homomorphism \(\rho_{UV}: \sh F(U) \to \sh F(V)\) such that \(\rho_{UU} = \id, \rho_{VW} \compose \rho_{UV} = \rho_{UW}\) when \(W \subseteq V \subseteq U\).
  \end{enumerate}
\end{definition}

The maps \(\rho_{UV}\) are called the \emph{restriction maps} and for \(V \subseteq U, s \in \sh F(U)\), we often write \(s|_V\) for \(\rho_{UV}(s)\).

\begin{remark}
  This is just a contravariant functor \(\sh F: \text{Open}(X) \to \c{Ab}\) where \(\text{Open}(X)\) is the category of open sets with inclusions.
\end{remark}

\begin{definition}[morphism of presheaves]\index{presheaf!morphism}
  A \emph{morphism} of presheaves \(f: \sh F \to \sh G\) on \(X\) is a collection of homomorphisms \(f_U: \sh F(U) \to \sh G(U)\) with, for \(V \subseteq U\), the commutative diagram
  \[
    \begin{tikzcd}
      \sh F(U) \ar[r, "f_U"] \ar[d, "\rho_{UV}"] & \sh G(U) \ar[d, "\rho_{UV}"] \\
      \sh F(V) \ar[r, "f_V"] & \sh G(V)
    \end{tikzcd}
  \]
\end{definition}

\begin{definition}[sheaf]\index{sheaf}
  A presheaf \(\sh F\) is a \emph{sheaf} if it satisfies
  \begin{enumerate}
  \item if \(U \subseteq X\) has a cover \(\{U_i\}\) and \(s \in \sh F(U)\) such that \(s|_{U_i} = 0\) for all \(i\) then \(s = 0\).
  \item if \(U \subseteq X\) has a cover \(\{U_i\}\) and \(s_i \in \sh F(U_i)\) given with \(s_i|_{U_i \cap U_j} = s_j|_{U_i \cap U_j}\) for all \(i, j\) then exists \(s \in \sh F(U)\) with \(s|_{U_i} = s_i\) for all \(i\).
  \end{enumerate}
\end{definition}

\begin{remark}\leavevmode
  \begin{enumerate}
  \item If \(\sh F\) is a sheaf then \(\emptyset\) has an empty cover and hence \(\sh F(\emptyset) = 0\).
  \item The two axioms S1, S2 together can be described as saying for each open cover \(\{U_i\}\) of \(U\),
    \[
      \begin{tikzcd}
        0 \ar[r] & \sh F(U) \ar[r, "\alpha"] & \displaystyle\prod_i \sh F(U_i) \ar[r, "\beta_1", shift left] \ar[r, "\beta_2"', shift right] & \displaystyle\prod_{i, j} \sh F(U_i \cap U_j)
      \end{tikzcd}
    \]
    is exact, where
    \begin{align*}
      \alpha(s) &= (s|_{U_i}) \\
      \beta_1((s_i)) &= (s_i|_{U_i \cap U_j}) \\
      \beta_2((s_i)) &= (s_j|_{U_i \cap U_j})
    \end{align*}
    Exactness means that \(\alpha\) is injective (S1), and \(\beta_1 \compose \alpha = \beta_2 \compose \alpha\), and for any \((s_i) \in \prod_i \sh F(U_i)\) with \(\beta_1((s_i)) = \beta_2((s_i))\) then exists \(s \in \sh F(U)\) with \(\alpha(s) = (s_i)\), i.e.\ \(\alpha\) is the equaliser of \(\beta_1, \beta_2\).

    The sheaf axioms make sense when \(\c{Ab}\) is replaced by any category with equalisers, for example \(\c{Set}\).
  \end{enumerate}
\end{remark}

\begin{eg}\leavevmode
  \begin{enumerate}
  \item If \(X\) is any topological space, set
    \begin{align*}
      \sh F(U) &= \{f: U \to \R: f \text{ continuous}\} \\
      \rho_{UV}(f) &= f|_V
    \end{align*}
    Then \(\sh F\) is a sheaf.
  \item Let \(X = \C\) with the Euclidean topology. Set
    \[
      \sh F(U) = \{f: U \to \C: f \text{ bounded holomorphic function}\}.
    \]
    Then \(\sh F\) satisfies S1 but not S2. For example take \(U_i = \{z \in \C: |z| < i\}, f_i: U_i \to \C\) the identity map. Take \(i \in \N\), then the glued function is \emph{not} bounded.
  \item Take any group \(G\) and set \(\sh F(U) = G\) for all \(U\), \(\rho_{UV} = \id\). \(\sh F\) is the \emph{constant presheaf}. It is a not a sheaf if \(G \neq 0\) as \(\sh F(\emptyset) = G\). To get a sheaf, give \(G\) the discrete topology and define
    \[
      \sh G(U) = \{f: U \to G: f \text{ continuous}\}.
    \]
    Note if \(U\) is connected then \(\sh G(U) = G\). If \(\{U_i\}_{i \in I}\) are disjoint then
    \[
      \sh G(\coprod U_i) = \prod \sh G(U_i).
    \]
  \item Let \(X\) be an algebraic variety, \(U \subseteq X\) a Zariski open set. Define
    \[
      \sh O_X(U) = \{f: U \to k: f \text{ a regular function}\}.
    \]
    Then \(\sh O_X\) is a sheaf, the \emph{structure sheaf}\index{structure sheaf} of \(X\).
  \end{enumerate}
\end{eg}

\begin{definition}[stalk]\index{stalk}
  Let \(\sh F\) be a presheaf on \(X\), \(p \in X\). Then the \emph{stalk} of \(\sh F\) at \(p\) is
  \[
    \sh F_p = \{(U, s): U \text{ open neighbourhood of } p, s \in \sh F(U)\} / \sim
  \]
  where \((U, s) \sim (V, s')\) if there exists \(W \subseteq U \cap V\) with \(p \in W\) such that \(s|_W = s'|_W\). It can be described as the direct limit
  \[
    \sh F_p = \varinjlim_{p \in U} \sh F(U).
  \]
\end{definition}

Note a morphism \(f: \sh F \to \sh G\) induces a homomorphism
\begin{align*}
  f_p: \sh F_p &\to \sh G_p \\
  (U, s) &\mapsto (U, f_U(s))
\end{align*}
We call \((U, s)\) the \emph{germ}\index{germ} of \(s\) at \(p\).

\begin{proposition}
  Let \(f: \sh F \to \sh G\) be a morphism of sheaves. Then \(f\) is an isomorphism if and only if \(f_p\) is an isomorphism for all \(p \in X\).
\end{proposition}

\begin{proof}
  Only if is obvious. For if, assume \(f_p\) is an isomorphism for all \(p \in X\). Need to show each \(f_U: \sh F(U) \to \sh G(U)\) is an isomorphism as can then construct \(f^{-1}\) via \((f^{-1})_U = (f_U)^{-1}\).
  \begin{itemize}
  \item \(f_U\) injective: suppose \(s \in \sh F(U)\) with \(f_U(s) = 0\). Then \(f_p(U, s) \in \sh G_p\) for any \(p \in U\), and \(f_p(U, s) = (U, f_U(s)) = 0\). Thus \((U, s) = 0 \in \sh F_p\), which means that exists \(p \in V_p \subseteq U\) such that \(s|_{V_p} = 0\). Now \(\{V_p: p \in U\}\) form an open cover of \(U\) so by S1, \(s = 0\).
  \item \(f_U\) surjective: let \(t \in \sh G(U)\). Then \(t_p = (U, t) \in \sh G_p\). By surjectivity of \(f_p\), let \(s_p \in \sh F_p\) with \(f_p(s_p) = t_p\). In other words, exists a neighbourhood \(V_p\) of \(p\) and a germ \((V_p, s_p)\) such that \((V_p, f_{V_p}(s_p)) = (U, t) \in \sh G_p\). By shrinking \(V_p\) if necessary, we can assume \(f_{V_p}(s_p) = t|_{V_p}\). \(\{V_p\}\) is an open cover of \(U\). On \(V_p \cap V_q\),
    \[
      f_{V_p \cap V_q} (s_p|_{V_p \cap V_q} - s_q|_{V_p \cap V_q}) = t|_{V_p \cap V_q} - t|_{V_p \cap V_q} = 0.
    \]
    By injectivity already proved, \(f_{V_p \cap V_q}\) is injective so \(s_p|_{V_p \cap V_q} = s_q|_{V_p \cap V_q}\) for all \(p, q \in U\). By S2, there exists \(s \in \sh F(U)\) with \(s|_{V_p} = s_p\) for all \(p\) so
    \[
      f_U(s)|_{V_p} = f_{V_p}(s|_{V_p}) = f_{V_p}(s_p) = t|_{V_p}
    \]
    so by S1, \(f_U(s) = t\).
  \end{itemize}
\end{proof}
Note the asymmetry: injectivity comes directly from injectivity on stalks, while surjectivity follows from both surjectivity on stalks and injectivity on sections. This will appear often in the future.

\subsection{Sheafification}

Given a presheaf \(\sh F\), there is a sheaf \(\sh F^+\) an a morphism \(\theta: \sh F \to \sh F^+\) satisfying the following universal property: for any sheaf \(\sh G\) and morphism \(\varphi: \sh F \to \sh G\), there exists a unique morphism \(\varphi^+: \sh F^+ \to \sh G\) with \(\varphi = \varphi^+ \compose \theta\).

\(\sh F^+\) is called the \emph{sheaf associated} to \(\sh F\) and \(\theta_p: \sh F_p \to \sh F_p^+\) is an isomorphism for all \(p\).

Define
\[
  \sh F^+(U) =
  \left\{
    \begin{tabular}{c}
      \(s: U \to \coprod_{p \in U} \sh F_p\): \(s(p) \in \sh F_p\), \\
      for each \(p\in U\), exists \(p \in V \subseteq U\), \(t \in \sh F(V)\) \\
      such that \(s(q) = (U, t) \in \sh F_q\) for all \(q \in V\)
    \end{tabular}
  \right\}
\]
We define \(\theta_U(s)\) to be \(p \mapsto (U, s) \in \sh F_p\) for all \(p \in U\).

The verification of the universal property and other properties is left as exercises on example sheet 1.

\begin{definition}
  Let \(f: \sh F \to \sh G\) be a morphism of presheaves.
  \begin{itemize}
  \item The \emph{presheaf kernel} of \(f\) is the presheaf
    \[
      (\ker f)(U) = \ker f_U.
    \]
  \item The \emph{presheaf cokernel} of \(f\) is the presheaf
    \[
      (\coker f)(U) = \coker f_U.
    \]
  \item The \emph{presheaf image} of \(f\) is the presheaf
    \[
      (\im f)(U) = \im f_U.
    \]
  \end{itemize}
\end{definition}

\begin{remark}
  If \(f: \sh F \to \sh G\) is a morphism of sheaves then \(\ker f\) is also a sheaf: any sub-presheaf of a sheaf satisfies S1, and given \(s_i \in (\ker f)(U_i)\) with \(s_i|_{U_i \cap U_j} = s_j|_{U_i \cap U_j}\), we can glue to get \(s \in \sh F(U)\). But then
  \[
    f_U(s)|_{U_i} = f_{U_i}(s|_{U_i}) = f_{U_i}(s_i) = 0
  \]
  so by S1 \(f_U(s) = 0\) so \(s \in (\ker f)(U)\).
\end{remark}

\begin{eg}
  Let \(X\) be the variety \(\P^1_k\). Let \(P, Q \in X\) be distinct points. Let \(\sh G\) be the sheaf of regular functions on \(X\). Let \(\sh F\) be the sheaf of regular functions on \(X\) vanishing at \(P\) and \(Q\). Have an obvious inclusion \(i: \sh F \to \sh G\) and \(\sh F(U) = \sh G(U)\) if \(U \cap \{P, Q\} = \emptyset\). Then
  \begin{align*}
    (\coker i) (\P^1) &= \frac{\sh G (\P^1)}{\sh F(\P^1)} = \frac{k}{0} = k \\
    (\coker i) (\P^1 \setminus \{P\}) &= \frac{\sh G (\P^1 \setminus \{P\})}{\sh F (\P^1 \setminus \{P\})} \cong \frac{k[x]}{(x)} = k
  \end{align*}
  Similarly
  \[
    (\coker i) (\P^1 \setminus \{Q\}) = k
  \]
  and
  \[
    (\coker i) (\P^1 \setminus \{P, Q\}) = 0.
  \]
  Note \(U = \P^1 \setminus \{P\}, V = \P^1 \setminus \{Q\}\) cover \(\P^1\) so if \(\coker i\) were a sheaf, any \(s_U \in (\coker i)(U), s_V \in (\coker i)(V)\) would give an element of \((\coker i)(\P^1)\). In particular
  \[
    (\coker i) (\P^1) = k \oplus k \neq k.
  \]
  Absurd.

  This is not a bug but a feature of the theory. At the end of the course we will find ourselves secretly calculating the sheaf cohomology in this example.
\end{eg}

\begin{definition}[sheaf kernel/image/cokernel]\index{sheaf!kernel}\index{sheaf!image}\index{sheaf!cokernel}
  Let \(f: \sh F \to \sh G\) be a morphism of sheaves. Then the \emph{sheaf kernel} is the presheaf kernel. The \emph{sheaf image} is the sheaf associated to the presheaf image and the \emph{sheaf cokernel} is the sheaf associated to the presheaf cokernel.
\end{definition}

These are the categorical notions of kernel/image/cokernel.

\begin{ex}
  The sheaf image \(\im f\) is a subsheaf of \(\sh G\).
\end{ex}

\begin{definition}[exact sequence of sheaves]
  We say \(f: \sh F \to \sh G\) is \emph{injective} if \(\ker f = 0\), \emph{surjective} if \(\im f = \sh G\).

  We say a sequence of sheaves
  \[
    \begin{tikzcd}
      \cdots \ar[r] & \sh F^{i - 1} \ar[r, "f^i"] & \sh F^i \ar[r, "f^{i + 1}"] & \sh F^{i + 1} \ar[r] & \cdots
    \end{tikzcd}
  \]
  is \emph{exact} if \(\ker f^i = \im f^{i - 1}\) for all \(i\).
\end{definition}

\(f\) is injective if and only if \(f_U\) is injective for all \(U\) but the analogous statement is false for surjectivity.

If \(\sh F' \subseteq \sh F\) is a subsheaf, we write \(\sh F/\sh F'\) for the sheaf associated to the presheaf \(U \mapsto \sh F(U)/\sh F'(U)\). This is \(\coker (\sh F' \embed \sh F)\).

\begin{lemma}
  Let \(f: \sh F \to \sh G\) be a morphism of sheaves. Then
  \begin{align*}
    (\ker f)_p &= \ker f_p \\
    (\im f)_p &= \im f_p
  \end{align*}
  for all \(p \in X\).
\end{lemma}

\begin{proof}
  We have a natural map \((\ker f)_p \to \ker f_p\): if \((U, s) \in (\ker f)_p\) where \(s \in (\ker f)(U)\) then
  \[
    f_p(U, s) = (U, f_U(s)) = (U, 0) = 0
  \]
  so \((U, s) \in \ker f_p\).

  For injectivity, if \((U, s) = 0 \in \ker f_p\) then \((U, s) = 0 \in \sh F_p\). Shrinking \(U\) if necessary, we can assume \(s = 0\). Then \((U, s) = 0 \in (\ker f)_p\). For surjectivity, if \((U, s) \in \ker f_p\) then \((U, f_U(s)) = 0 \in \sh G_p\). Shrinking \(U\) if necessary, we can assume \(f_U(s) = 0\) and hence \((U, s) \in (\ker f)_p\) since \(s \in (\ker f)(U)\).

  Now we prove the statement about image sheaf. Let \(\im' f\) be the presheaf image so \(\im f\) is the associated sheaf. We have an isomorphism \((\im ' f)_p = (\im f)_p\), so enough to show the natural map \((\im' f)_p \to \im f_p\) is an isomorphism.

  For injectivity, if \((U, s) = 0 \in \sh G_p\) then shrinking \(U\) we can assume \(s = 0\). Then \((U, s) = 0 \in (\im' f)_p\). For surjectivity, if \((U, s) \in \im f_p\) then exists \((V, t) \in \sh F_p\) such that \(f_p(V, t) = (U, s)\) so exists a neighbourhood \(W \subseteq U \cap V\) of \(p\) such that \(f_V(t)|_W = f_W(t) = s|_W\). Thus \((W, s|_W) \in (\im' f)_p\).
\end{proof}

\begin{proposition}
  Let \(f: \sh F \to \sh G\) be a morphism of sheaves. Then \(f\) is injective (surjective respectively) if and only if \(f_p: \sh F_p \to \sh G_p\) is injective (surjective respectively) for all \(p\).
\end{proposition}

\begin{proof}
  \(f_p\) is injective for all \(p\) if and only if \(\ker f_p = 0\) for all \(p\), if and only if \((\ker f)_p = 0\) for all \(p\), if and only if \(\ker f = 0\), since \(0 \to \ker f\) is an isomorphism on stalks, if and only if \(f\) is injective. Analogous for \(\im f\) by noting the inclusion \(\im f \to \sh G\).
\end{proof}

It is strongly recommended at this point to do all problems in II.1 of Hartshorne.

\begin{definition}
  Let \(f: X \to Y\) be a continuous map of topological spaces. Let \(\sh F\) be a sheaf on \(X\), \(\sh G\) a sheaf on \(Y\). We define \(f_* \sh F\) to be the sheaf with
  \[
    (f_* \sh F)(U) = \sh F (f^{-1}(U))
  \]
  and obvious restriction maps. We define \(f^{-1} \sh G\) to be the sheaf associated to the presheaf
  \[
    U \mapsto \varinjlim_{V \supseteq f(U)} \sh G(V) = \{(V, s): V \supseteq f(U) \text{ open}, s \in \sh G(V)\}/ \sim
  \]
  where \((V, s) \sim (V', s')\) if exists \(W \subseteq V \cap V'\) with \(f(U) \subseteq W\) and \(s|_W = s'|_W\).
\end{definition}

\begin{eg}
  If \(f: \{p\} \to X\) and \(\sh G\) is a sheaf on \(X\) then \(f^{-1} \sh G = \sh G_p\). More generally if \(i: Z \embed X\) and \(\sh F\) is a sheaf in \(X\) we write \(\sh F|_Z = i^{-1} \sh F\). In particular if \(Z\) is open then \(\sh F|_Z\) is easy to describe: \(\sh F|_Z(U) = \sh F(U)\).
\end{eg}

\begin{notation}
  If \(s \in \sh F(U)\), we say \(s\) is a \emph{section}\index{section} of \(\sh F\) over \(U\). We often write \(\Gamma(U, \sh F)\) for \(\sh F(U)\), thinking of \(\Gamma(U, \cdot)\) as a covariant functor \(\c{PreSh}_X \to \c{Ab}\).
\end{notation}

\section{Schemes}

The first goal is to for a ring \(A\) construct a sheaf \(\sh O = \mathcal O_{\Spec A}\) on \(\Spec A\), the sheaf of ``regular functions'' on \(\Spec A\).

We recall some facts about localisation. Let \(S \subseteq A\) be a multiplicatively closed subset, i.e.\ \(1 \in S\) and if \(s_1, s_2 \in S\) then \(s_1, s_2 \in S\). Define
\[
  S^{-1}A = \{(a, s): a \in A, s \in S\}/\sim
\]
where \((a, s) \sim (a', s')\) if exists \(s'' \in S\) such that \(s''(as' - a's) = 0\). We write \(\frac{a}{s}\) for the equivalence class of \((a, s)\). This is the \emph{localisation}\index{localisation} of \(A\) at \(S\).

\begin{eg}\leavevmode
  \begin{enumerate}
  \item Let \(S = \{1, f, f^2, \dots\}\) for some \(f \in A\). We write \(A_f = S^{-1}A\).
  \item Let \(\mathfrak p \subseteq A\) a prime ideal, \(S = A \setminus \mathfrak p\). We write \(A_{\mathfrak p} = S^{-1}A\), called \(A\) localised at \(\mathfrak p\). There is a canonical homomorphism
    \begin{align*}
      A &\to A_{\mathfrak p} \\
      a &\mapsto \frac{a}{1}
    \end{align*}
    and the image of \(\mathfrak p\) generates the unique maximal ideal of \(A_{\mathfrak p}\), which we write as \(\mathfrak p A_{\mathfrak p}\). A ring \(A\) is \emph{local} if it has a unqiue maximal ideal, so \(A_{\mathfrak p}\) is local.
  \end{enumerate}
\end{eg}

Now we construct \(\sh O = \mathcal O_{\Spec A}\). In particular we want \(\sh O_{\mathfrak p} = A_{\mathfrak p}\). Define
\[
  \sh O(U) =
  \left\{
    \begin{tabular}{c}
      \(s: U \to \coprod_{\mathfrak p \in U} A_{\mathfrak p}\): \(s(\mathfrak p) \in A_{\mathfrak p}\), \\
      for each \(\mathfrak p \in U\), exists \(\mathfrak p \in V \subseteq U\) and \(a, f \in A\) \\
      such that \(f \notin \mathfrak q, s(\mathfrak q) = \frac{a}{f} \in A_{\mathfrak q}\) for all \(\mathfrak q \in V\)
    \end{tabular}
  \right\}
\]
and the restriction maps are restrictions of functions. This is defined locally so \(\sh O\) is a sheaf (of rings).

\begin{proposition}
  For any \(\mathfrak p \in \Spec A\), \(\sh O_{\mathfrak p} = A_{\mathfrak p}\).
\end{proposition}

\begin{proof}
  We have a well-defined map
  \begin{align*}
    \phi: \sh O_{\mathfrak p} &\to A_{\mathfrak p} \\
    (U, s) &\mapsto s(\mathfrak p)
  \end{align*}
  Surjectivity: any element of \(A_{\mathfrak p}\) can be written as \(\frac{a}{f}\) for some \(a \in A, f \in A \setminus \mathfrak p\). Let
  \[
    D(f) = \Spec A \setminus V((f)) = \{\mathfrak q \in \Spec A: f \notin \mathfrak q\}
  \]
  which is an open neighbourhood of \(\mathfrak q\). Now \(\frac{a}{f}\) defines a section of \(\sh O\) over \(D(f)\) via
  \[
    s(\mathfrak q) = \frac{a}{f} \in A_{\mathfrak q}
  \]
  for all \(\mathfrak q \in D(f)\). In particular \(\phi\) is surjective.

  Injectivity: let \(\mathfrak p \in U \subseteq \Spec A\) and \(s \in \sh O(U)\) with \(s(\mathfrak p) = 0 \in A_{\mathfrak p}\) so \((U, s) \in \ker \phi\). By shrinking we can assume \(s(\mathfrak q) = \frac{a}{f}\) for some \(a \in A, f \notin \mathfrak q\) for all \(\mathfrak q \in U\). There exists \(f' \notin \mathfrak p\) such that \(f'a = 0\). Let \(V = D(f') \cap U\) which is an open neighbourhood of \(\mathfrak p\). Then \((V, s|_V) = 0\) since \(f'a = 0\) implies \(\frac{a}{f} = 0 \in A_{\mathfrak q}\) for all \(\mathfrak q \in V\). Thus \((U, s) = 0 \in \sh O_{\mathfrak p}\) so \(\phi\) is injective.
\end{proof}

\begin{proposition}
  For any \(f \in A\), \(\sh O(D(f)) \cong A_f\). In particular \(\sh O(\Spec A) = A\).
\end{proposition}

\begin{proof}
  Define
  \begin{align*}
    \psi: A_f &\to \sh O(D(f)) \\
    \frac{a}{f^n} &\mapsto (\mathfrak p \mapsto \frac{a}{f^n} \in A_{\mathfrak p})
  \end{align*}
  We first show \(\psi\) is injective: if \(\psi(\frac{a}{f^n}) = 0\) then \(\frac{a}{f^n} = 0 \in A_{\mathfrak p}\) for all \(\mathfrak p \in D(f)\). Thus for each \(\mathfrak p\), exists \(h \notin \mathfrak p\) such that \(ah = 0\) in \(A\). Let
  \[
    I = \{g \in A: g a = 0\}
  \]
  so \(h \in I, h \notin \mathfrak p\) so \(I \nsubseteq \mathfrak p\). This is true for all \(\mathfrak p \in D(f)\), so \(V(I) \cap D(f) = \emptyset\). Thus
  \[
    f \in \bigcap_{\mathfrak p \in V(I)} \mathfrak p = \sqrt I,
  \]
  the radical of \(I\). Thus \(f^n \in I\) for some \(I\). Thus \(f^n a = 0\) so \(\frac{a}{f} = 0 \in A_f\).

  To show surjectivity, let \(s \in \sh O(D(f))\). Cover \(D(f)\) with open sets \(V_i\) on which \(s\) is represented by \(\frac{a_i}{gi}\) where \(a_i \in A, g_i \notin \mathfrak q\) for all \(\mathfrak q \in V_i\). By example sheet 1 question 1, the basic open sets form a basis for the topology of \(\Spec A\), so we can asume \(V_i = D(h_i)\) for some \(h_i \in A\). Since \(D(h_i) \subseteq D(g_i)\) and
  \begin{align*}
    D(h_i) \subseteq D(g_i)
    &\iff V((h_i)) \supseteq V((g_i)) \\
    &\iff \sqrt{(h_i)} \subseteq \sqrt{(g_i)} \\
    &\iff h_i^n \in (g_i) \text{ for some } n
  \end{align*}
  so \(h_i^n = c_i g_i\) for some \(c_i \in A\). Since \(\frac{a_i}{g_i} = \frac{c_i a_i}{h_i^n}\), we can assume \(g_i = h_i^n\). But also \(D(h_i) = D(h_i^n)\), we can replace \(h_i\) by \(h_i^n\) and assume that \(D(f)\) is covered by sets \(D(h_i)\) on which \(s\) is represented by \(\frac{a_i}{h_i}\). In fact, we claim that \(D(f)\) can be covered by a finite number of the \(D(h_i)\):
  \begin{align*}
    D(f) \subseteq \bigcup D(h_i)
    &\iff V((f)) \supseteq \bigcap_{i \in I} V((h_i)) = V(\sum_{i \in I} (h_i)) \\
    &\iff f \in \sqrt{\sum_{i \in I} (h_i)} \\
    &\iff f^m \in \sum_{i \in I} (h_i)
  \end{align*}
  for some \(n\). This means that \(f^m = \sum b_i h_i\) where all but a finite number of \(b_i\)'s are zero. So we can just take these \(h_i\) with \(b_i \neq 0\) and then \(\{D(h_i)\}\) still cover \(D(f)\).

  Thus we can now assume we have a finite covering \(\{D(h_i)\}\) of \(D(f)\) with \(s\) represented by \(\frac{a_i}{h_i}\) on \(D(h_i)\). On \(D(h_i) \cap D(h_j) = D(h_i h_j)\), note \(\frac{a_i}{h_i}, \frac{a_j}{h_j}\) both represent \(s\) so
  \[
    \frac{a_i}{h_i} = \frac{a_j}{h_j} \in A_{h_ih_j}
  \]
  which follows from injectivity of \(\psi\) on the open set \(D(h_ih_j)\). Therefore there exists \(n\) such that
  \[
    (h_ih_j)^n (h_j a_i - h_i a_j) = 0.
  \]
  Choose \(n\) large enough to work for all \(i, j\). Rewrite the equation as \(h_j^{n + 1} (h_i^n a_j) - h_i^{n + 1} (h_j^n a_i) = 0\). Replace each \(h_i\) by \(h_i^{n + 1}\) and \(a_i\) by \(h_i^n a_i\), we can assume \(h_ja_i - h_ia_j = 0\) for all \(i, j\). We also have \(f^m = \sum b_ih_i\) as in the proof of the claim. Let \(a = \sum b_i a_i\). Then for any \(j\),
  \[
    h_j a = \sum_i h_jb_ia_i = \sum_i h_ib_ia_j = f^m a_j.
  \]
  Thus \(\frac{a}{f^n} = \frac{a_j}{h_j}\) on \(D(h_j) \cap D(f)\), i.e.\ in the ring \(A_{fh_j}\). Thus \(\frac{a}{f^n} \in A_f\) defines a section of \(\sh O(D(f))\) whose restriction to \(D(h_j) \cap D(f)\) agrees with \(s\) so \(\psi(\frac{a}{f^n}) = s\) and \(\psi\) is surjective.
\end{proof}

\begin{definition}[ringed space]\index{ringed space}
  A \emph{ringed space} is a pair \((X, \sh O_X)\) with \(X\) a topological space and \(\sh O_X\) a sheaf of rings on \(X\).

  A \emph{morphism between ringed spaces} \(f: (X, \sh O_X) \to (Y, \sh O_Y)\) is data
  \begin{enumerate}
  \item \(f: X \to Y\) continuous,
  \item \(f^\#: \sh O_Y \to f_* \sh O_X\) a morphism of sheaves of rings, i.e.\ for all \(U \subseteq X\), \(f_U^\#: \sh O_Y(U) \to \sh O_X(f^{-1}(U))\).
  \end{enumerate}
\end{definition}

\begin{eg}\leavevmode
  \begin{enumerate}
  \item Let \(X\) be a topological space and \(\sh O_X(U) = \{\varphi: U \to \R \text{ continuous}\}\). Note \(f: X \to Y\) induces \(f: (X, \sh O_X) \to (Y, \sh O_Y)\) by
    \[
      f_U^\#(\varphi) = \varphi \compose f: f^{-1}(U) \to \R.
    \]
    In other words, there is no additional information in the ringed space structure and all data is encoded in the topological spaces themselves.
  \item Let \(X\) be a variety and \(\sh O_X\) the sheaf of regular functions on \(X\). Given \(f: X \to Y\) a morphism of varieties, we again get \(f_U^\#\) which acts by pullback.
  \end{enumerate}
\end{eg}

Both examples have the feature that \(\sh O_{X, p}\) is a local ring with maximal ideal \(\{(U, f) \in \sh O_{X, p}: f(p) = 0\}\): if \(f(p) \neq 0\) then by shrinking \(U\) we can assume \(f\) is nowhere zero so \((U, f^{-1}) \in \sh O_{X, p}\). This inspires us to define

\begin{definition}[locally ringed space]\index{locally ringed space}
  A \emph{locally ringed space} \((X, \sh O_X)\) is a ringed space such that \(\sh O_{X, p}\) is a local ring for all \(p \in X\).

  A \emph{morphism between locally ringed spaces} \(f: (X, \sh O_X) \to (Y, \sh O_Y)\) is a morphism of ringed spaces such that \(f_p^\#: \sh O_{Y, f(p)} \to \sh O_{X, p}\) is a local homomorphism for all \(p \in X\).
\end{definition}
Here
\begin{align*}
  f_p^\#: \sh O_{Y, f(p)} &\to \sh O_{X, p} \\
  (U, s) &\mapsto (f^{-1}(U), f_U^\#(s))
\end{align*}
and a homomorphism \(\varphi: (A, \mathfrak m_A) \to (B, \mathfrak m_B)\) between local rings is \emph{local}\index{local homomorphism} if \(\varphi^{-1}(\mathfrak m_B) = \mathfrak m_A\). Note that we always have \(\varphi^{-1}(\mathfrak m_B) \subseteq \mathfrak m_A\).

The local homomorphism condition thus says that, for example in the two examples above, if a function vanishes at \(f(p)\) then its pullback vanishes at \(p\).

\begin{eg}
  \((\Spec A, \sh O_{\Spec A})\) is a locally ringed space.
\end{eg}

\begin{definition}[affine scheme]\index{affine scheme}
  The \emph{category of affine schemes} is the category whose objects are \((\Spec A, \sh O_{\Spec A})\) for all rings \(A\) and morphisms are morphisms as locally ringed spaces.
\end{definition}

\begin{theorem}
  The category of affine schemes is equivalent to \(\c{Ring}^{\mathrm{op}}\).
\end{theorem}

\begin{proof}
  Need to show
  \begin{enumerate}
  \item if \(\varphi: A \to B\) is a homomorphism then we get a morphism of locally ringed spaces \((f, f^\#): (\Spec B, \sh O_{\Spec B}) \to (\Spec A, \sh O_{\Spec A})\).
  \item any morphism \((f, f^\#): (\Spec B, \sh O_{\Spec B}) \to (\Spec A, \sh O_{\Spec A})\) is contructed as in 1 from some ring homomorphism \(\varphi: A \to B\).
  \end{enumerate}

  Let's do 1 first. Given \(\varphi: A \to B\), define
  \begin{align*}
    f: \Spec B &\to \Spec A \\
    \mathfrak p &\mapsto \varphi^{-1}(\mathfrak p)
  \end{align*}
  \(f\) is continuous as for \(I \subseteq A\),
  \begin{align*}
    f^{-1}(V(I))
    &= \{\mathfrak p \in \Spec B: \varphi^{-1}(\mathfrak p) \supseteq I\} \\
    &= \{\mathfrak p \in \Spec B: \mathfrak p \supseteq \varphi(I)\} \\
    &= V(\varphi(I))
  \end{align*}
  For \(\mathfrak p \in \Spec B\), we obtain
  \begin{align*}
    \varphi_{\mathfrak p}: A_{\varphi^{-1}({\mathfrak p})} &\to B_{\mathfrak p} \\
    \frac{a}{s} &\mapsto \frac{\varphi(a)}{\varphi(s)}
  \end{align*}
  which makes sense as if \(s \notin \varphi^{-1}(\mathfrak p)\) then \(\varphi(s) \notin \mathfrak p\). It is also well-defined. Note \(\varphi_{\mathfrak p}\) is a local homomorphism: indeed the maximal ideal of \(B_{\mathfrak p}\) is generated by the image of \(\mathfrak p\), which we often write as \(\mathfrak p B_{\mathfrak p}\) and similarly the maximal ideal of \(A_{\varphi^{-1}(\mathfrak p)}\) is \(\varphi^{-1}(\mathfrak p) A_{\varphi^{-1}(\mathfrak p)}\) and clearly \(\varphi_{\mathfrak p}^{-1} (\mathfrak p B_{\mathfrak p}) = \varphi^{-1}(\mathfrak p) A_{\varphi^{-1}(\mathfrak p)}\).

  Thus given \(V \subseteq \Spec A\), we get
  \begin{align*}
    f_V^\#: \sh O_{\Spec A} (V) &\to (f_* \sh O_{\Spec B})(V) = \sh O_{\Spec B}(f^{-1}(V)) \\
    (\mathfrak p \mapsto s(\mathfrak p)) &\mapsto (\mathfrak q \mapsto \varphi_{\mathfrak q} (s (f(\mathfrak q))))
  \end{align*}
  where \(\mathfrak p \in V, \mathfrak q \in f^{-1}(V)\). If locally \(s\) is represented on \(W\) by \(\frac{a}{f}\) then \(f_V^\#(s)\) is locally represented on \(f^{-1}(W)\) by \(\frac{\varphi(a)}{\varphi(f)}\). This defined \(f^\#: \sh O_{\Spec A} \to f_* \sh O_{\Spec B}\) and since \(f^\#\) induces \(\varphi_{\mathfrak q}\) on stalks, this defines a morphism of locally ringed spaces.

  Conversely, suppose given \((f, f^\#): (\Spec B, \sh O_{\Spec B}) \to (\Spec A, \sh O_{\Spec A})\), we get
  \[
    \varphi = f_{\Spec A}^\#: \Gamma(\Spec A, \sh O_{\Spec A}) = A \to \Gamma(\Spec B, \sh O_{\Spec B}) = B
  \]
  and we need to show \(\varphi\) gives rise to \((f, f^\#)\) obtained from the construction in the first part. We have a commutative diagram
  \[
    \begin{tikzcd}
      A \ar[r, "\varphi"] \ar[d] & B \ar[d] \\
      A_{f(\mathfrak p)} \ar[r, "f_{\mathfrak p}^\#"] & B_{\mathfrak p}
    \end{tikzcd}
  \]
  where \(\varphi\) is induced by the map on sections, the vertical maps are passing to stalks, which are easily seen to be localisations, and the bottom map is the induced map on stalks so is a local homomorphism. Since pullback of the maximal ideal in the localisation gives the prime ideal, we have \(\varphi^{-1}(\mathfrak p) = f(\mathfrak p)\). Note that this depends crucially on the fact that we have a local homomorphism. Thus we conclude that \(f\) is induced by \(\varphi\) and \(f_{\mathfrak p}^\# = \varphi_{\mathfrak p}\). Thus \(f^\#\) agrees with the map constructed from \(\varphi\) in the first part.
\end{proof}

Now we make a slight modification to the definition of affine scheme:
\begin{definition}[affine scheme]\index{affine scheme}
  An \emph{affine scheme} is a locally ringed space isomorphic in the category of locally ringed spaces to \((\Spec A, \sh O_{\Spec A})\) for some \(A\).
\end{definition}

\begin{definition}[scheme]\index{scheme}
  A \emph{scheme} is a locally ringed space \((X, \sh O_X)\) with an open cover \(\{(U_i, \sh O_X|_{U_i})\}\) with each \((U_i, \sh O_X|_{U_i})\) an affine scheme.

  A \emph{morphism of schemes} is a morphism as locally ringed spaces.
\end{definition}

\begin{eg}\leavevmode
  \begin{enumerate}
  \item Let \(k\) be a field. Then \(\Spec k\) consists of a singleton \(\{0\}\) and a sheaf over the point, which is just the field \(k\). We write \(\Spec k = (\{0\}, k)\).

    What does a morphism \(f: \Spec k \to X\) for \(X\) a scheme mean? First it picks a point \(f(0) = x \in X\). Second we get a local homomorphism \(f_x^\#: \sh O_{X, x} \to \sh O_{\Spec k, 0} = k\), meaning that \(\ker f_x^\# = (f_x^\#)^{-1}(0) = \mathfrak m_x \subseteq \sh O_{X, x}\), where \(\mathfrak m_x\) is the maximal ideal of \(\sh O_{X, x}\). In particular we get a factorisation
    \[
      \sh O_{X, x} \to \sh O_{X, x}/\mathfrak m_x \embed k
    \]
    We call \(k(x) = \sh O_{X, x}/\mathfrak m_x\) the \emph{residue field}\index{residue field} of \(x\) in \(X\).

    Conversely, if given an inclusion \(k(x) \embed k\), we get a morphism \(f: \Spec k \to X\) with \(f(0) = x\) and
    \begin{align*}
      f_U^\#: \sh O_X(U) &\to (f_* k)(U) \\
      s &\mapsto
          \begin{cases}
            (U, s \pmod{\mathfrak m_x}) & x \in U \\
            0 & x \notin U
          \end{cases}
    \end{align*}

    We can ask the opposite question: what does it mean to give a morphism \(f: X \to \Spec k\)? \(f\) is constant but we need \(f^\#: k \to f_* \sh O_X\), i.e.\ \(f^\#_{\Spec k}: k \to \sh O_X(X)\) so \(\Gamma(X, \sh O_X)\) has the structure of a \(k\)-algebra and via composition with restriction
    \[
      k \to \Gamma(X, \sh O_X) \to \Gamma(U, \sh O_X)
    \]
    so \(\sh O_X\) becomes a sheaf of \(k\)-algebras. We say \(X\) is a \emph{scheme over \(\Spec k\)}\index{scheme!over \(k\)}. A morphism of schemes over \(\Spec k\) is a commutative diagram
    \[
      \begin{tikzcd}[column sep=tiny]
        X \ar[rr, "f"] \ar[dr] & & Y \ar[dl] \\
        & \Spec k
      \end{tikzcd}
    \]
    i.e.\ \(f^\#: \sh O_Y \to f_* \sh O_X\) is a morphsim of sheaves of \(k\)-algebras. More generally we can replace \(\Spec k\) by any scheme \(Z\) and talk about schemes over \(Z\) and their morphisms.
  \item Affine variety: let \(k\) be a field and \(A = k[x_1, \dots, x_n]/I\) with \(I = \sqrt I\). In other words, \(A\) is a finitely generated \(k\)-algebra with no nilpotents. The homomorphism \(k \to A\) gives a map \(\Spec A \to \Spec k\). We say \(\Spec A\) is an \emph{affine variety over \(k\)}.

    If \(k'\) is a field extension of \(k\), a diagram
    \[
      \begin{tikzcd}[column sep=tiny]
        \Spec k' \ar[rr] \ar[dr] & & \Spec A \ar[dl] \\
        & \Spec k
      \end{tikzcd}
    \]
    is the same as giving a \(k\)-algebra homomorphism \(A \to k'\), i.e.\ this is the same thing as giving \((a_1, \dots, a_n) \in (k')^n\) with \(f(a_1, \dots, a_n) = 0\) for all \(f \in I\). With \(X = \Spec A\), we write \(X(k')\) for the set of all such diagrams.

    More generally, we usually fix a base scheme \(S\) and consider the category of schemes over \(S\). Given \(X \to S, T \to S\), we write \(X(T)\) to be the set of morphisms \(T \to X\), the set of \emph{\(T\)-valued points} of \(X\).
  \item An example of a scheme that is not a variety: \(D = \Spec k[t]/(t^2) = (\{(t)\}, k[t]/(t^2))\). \(t\) is a ``function'' on a single point which squares to \(0\). What information is contained in \(D\)? Let \(X\) be any scheme over \(\Spec k\) and consider a morphism \(f: D \to X\) over \(\Spec k\). This specifies a point \(x = f((t)) \in X\) and a local homomorphism of \(k\)-algebras
    \begin{align*}
      f_x^\#: \sh O_{X, x} &\to \sh O_{D, (t)} = k[t]/(t^2) \\
      \mathfrak m_x &\to (t) \\
      \mathfrak m_x^2 &\to 0
    \end{align*}
    so we obtain a map \(\mathfrak m_x/\mathfrak m_x^2 \to (t) \cong k\) where the isomorphism is as a \(k\)-vector space. We also have a corresponding \(k\)-algebra homomorphism
    \[
      \sh O_{X, x} \to k[t]/(t^2) \to k[t]/(t) \cong k
    \]
    with kernel \(\mathfrak m_x\). This gives an inclusion \(k(x) = \sh O_{X, x}/\mathfrak m_x \embed k\) of \(k\)-algebras, i.e.\ \(k(x) \cong k\). Note \(\mathfrak m_x/\mathfrak m_x^2\) is a \(\sh O_{X, x}/\mathfrak m_x\)-vector space and thus \(\mathfrak m_x/\mathfrak m_x^2 \to k \cong k(x)\) is a map of \(k\)-vector spaces, i.e.\ an element of \((\mathfrak m_x/\mathfrak m_x^2)^*\). This is the \emph{Zariski tangent space}\index{Zariski tangent space} to \(X\) at \(x\). Thus giving \(D \to X\) is the same as giving a point \(x \in X\) with \(k(x) = k\) plus a Zariski tangent vector at \(x\).
  \end{enumerate}
\end{eg}

\paragraph{glued scheme}

(special case of example sheet 1 Q14): given schemes \(X_1, X_2\) and \(U_1 \subseteq X_1, U_2 \subseteq X_2\) open subsets with induced scheme structure \((U_i, \sh O_{X_i}|_{U_i})\) and an isomorphism \(f: U_1 \to U_2\), we can then glue \(X_1, X_2\) along \(f\) to get a scheme \(X\) with open subsets \(X_1', X_2'\) with \(X_i' \cong X_i, X_1' \cap X_2' \cong U_i\).

\begin{eg}
  Define \(\A_k^n = \Spec k[x_1, \dots, x_n]\). In particular \(\A_k^1 = \Spec k[x]\). Glue
  \begin{align*}
    U_1 &= \A_k^1 \setminus \{0\} \subseteq \A_k^1 = X_1 \\
    U_2 &= \A_k^1 \setminus \{0\} \subseteq \A_k^1 = X_2
  \end{align*}
  where \(0\) denotes the maximal ideal at \(0\) via \(\id: U_1 \to U_2\), then we obtain the affine line with double origin. This is pathological in some sense as in the classical topology this is non-Hausdorff. Later we will be able to pin down precisely what the pathology is.

  Alternatively, glue \(U_1\) to \(U_2\) via \(x \mapsto x^{-1}\): since
  \[
    U_i = D(x) = \Spec k[x]_x = \Spec k[x, x^{-1}]
  \]
  we specify this map via the ring homomorphism \(k[x, x^{-1}] \to k[x, x^{-1}], x \mapsto x^{-1}\). This gives a glued scheme \(\P_k^1\), the \emph{projective line}.
\end{eg}

\subsection{Projective schemes}

The gluing contruction brings about a whole class of schemes that are not affine, called \emph{projective schemes}. They are geometric objects associated to graded rings.

Let \(S = \bigoplus_{d \geq 0} S_d\) be a graded ring, meaning that \(S_d \cdot S_e \subseteq S_{d + e}\). For example \(S = k[x_1, \dots, x_n] = \bigoplus_{d \geq 0} S_d\) where \(S_d\) is the space of homogeneous polynomials of degree \(d\). If \(f \in S_d\), we say \(f\) is \emph{homogeneous of degree \(d\)} and write \(\deg f = d\). Define \(S_+ = \bigoplus_{d > 0} S_d\), the \emph{irrelevant ideal}\index{irrelevant ideal}. An ideal \(I \subseteq S\) is \emph{homogeneous}\index{homogeneous ideal} if it is generated by homogeneous elements. Define
\[
  \Proj S = \{\mathfrak p \subseteq S \text{ homogeneous prime ideals not containing } S_+\}.
\]

\begin{eg}
  Suppose \(k\) is algebraically closed and define \(\P^1_k = \Proj k[x_0, x_1]\). The maximal ideals of \(k[x_0, x_1]\) are of the form \((x_0 - a_0, x_1 - a_1)\), which is homogeneous if and only if \(a_0 = a_1 = 0\). Hence no maximal ideal of \(k[x_0, x_1]\) lies in \(\Proj k[x_0, x_1]\). By results in commutative algebra, \(k[x_0, x_1]\) has dimension \(2\) and all other primes of \(k[x_0, x_1]\) are either \(0\) or principal. Consider \(\mathfrak p = (f)\) with \(f\) homogeneous. Since \(k = \overline k\), \(f\) can be factored into linear factors. So if \(\mathfrak p\) is prime, in fact \(\mathfrak p = (a_1 x_0 - a_0 x_1)\) for some \(a_0, a_1 \in k\) not both \(0\). Note that the generators of the ideal are written in this way to show that \((a_0, a_1)\) is only defined by up to scaling by an element of \(k^\times\), so these points are in one-to-one correspondence with points of \((k^2 \setminus \{0\})/k^*\).
\end{eg}

Back to the construction of projective schemes. We start to define a topology and a structure sheaf on \(\Proj S\). For \(I \subseteq S\) homogeneous, define
\[
  V(I) = \{\mathfrak p \subseteq \Proj S: \mathfrak p \supseteq I\}.
\]
Check these are the closed sets for a topology in \(\Proj S\).

Fix \(\mathfrak p \in \Proj S\). Let
\[
  T = \{f \in S \setminus \mathfrak p: f \text{ homogeneous}\} \subseteq S
\]
which is a multiplicatively closed set, and let \(S_{(\mathfrak p)} \subseteq T^{-1}S\) be the subring of elements of degree \(0\), where we define \(\deg \frac{a}{b} = \deg a - \deg b\). We require the numerator and the denominator to be the same degree so that it defines a well-defined function on \(\Proj S\). Similarly if \(f \in S\) is homogeneous  write \(S_{(f)} \subseteq S_f\) for the set of elements of degree \(0\) in \(S_f\).

We now define the structure sheaf \(\sh O_{\Proj S}\). For \(U \subseteq S\), define
\[
  \sh O_{\Proj S}(U) =
  \left\{
    \begin{tabular}{c}
      \(s: U \to \coprod_{\mathfrak p \in U} S_{(\mathfrak p)}\): \(s(\mathfrak p) \in S_{(\mathfrak p)}\), \\
      for each \(\mathfrak p \in U\), exists \(\mathfrak p \in V \subseteq U\) \\
      and \(a, f \in S\) homogeneous of the same degree \\
      such that \(f \notin \mathfrak q, s(\mathfrak q) = \frac{a}{f} \in S_{(\mathfrak q)}\) for all \(\mathfrak q \in V\)
    \end{tabular}
  \right\}
\]
This defines \(\sh O_{\Proj S}\) with \(\sh O_{\Proj S, \mathfrak q} = S_{(\mathfrak q)}\), making \((\Proj S, \sh O_{\Proj S})\) a locally ringed space.

\begin{proposition}
  For \(f \in S_+\) homogeneous, define
  \[
    D_+(f) = \{\mathfrak p \in \Proj S: f \notin \mathfrak p\},
  \]
  an open subset of \(\Proj S\). Then \(D_+(f)\)'s cover \(\Proj S\) and
  \[
    (D_+(f), \sh O_{\Proj S}|_{D_+(f)}) \cong \Spec S_{(f)}.
  \]
  In particular \((\Proj S, \sh O_{\Proj S})\) is a scheme.
\end{proposition}

\begin{proof}
  Example sheet 2.
\end{proof}

\begin{definition}
  If \(A\) is a ring we define \(\P_A^n = \Proj A[x_0, \dots, x_n]\) with \(\deg x_i = 1\) and \(\deg a = 0\) for all \(a \in A\).
\end{definition}

If \(A = k\) is an algebraically closed field then the points of \(\P_k^n\) corresponding to the largest ideals in \(\Proj S\) are in one-to-one correspondence with points in \((k^{n + 1} \setminus \{0\})/k^*\).

\begin{definition}[closed point]\index{closed point}
  A point \(x \in X\) a scheme is a \emph{closed point} if \(\{x\}\) is closed.
\end{definition}

In \(\Spec A\), the closed points are precisely the maximal ideals as for any \(\mathfrak p \in \Spec A\), \(\overline{\{\mathfrak p\}} = V(\mathfrak p)\). In this language, the set of closed points in \(\Proj S\) are in one-to-one correspondence with \((k^{n + 1}\setminus \{0\})/k^*\).

\begin{eg}[weighted projective space]\index{weighted projective space}
  Let \(S = k[x_0, \dots, x_n]\) but with \(\deg x_i = w_i\) for some positive integers \(w_0, \dots, w_n\). Then \(\Proj S\) is the \emph{weighted projective space} \(W\P^n(w_0, \dots, w_n)\).

  Consider \(W\P^2(1, 1, 2)\). Consider
  \[
    \Spec S_{(x_i)} = D_+(x_i) = \{\mathfrak p \in \Proj S: x_i \notin \mathfrak p\}.
  \]
  For \(S_{(x_2)}\), there are several ways to make the numerator having the same degree as \(x_2\) and
  \[
    S_{(x_2)} = k[\frac{x_0^2}{x_2}, \frac{x_0x_1}{x_2}, \frac{x_1^2}{x_2}] \cong \frac{k[U, V, W]}{(UW - V^2)}.
  \]
  Note \(\Spec \frac{k[U, V, W]}{(UW - V^2)}\) is the quadratic cone \(UW = V^2\) in \(\A_k^3\) which has a singular point.
\end{eg}

\begin{eg}
  Let \(M = \Z^n\) and \(M_\R = M \otimes_\Z \R = \R^n\). Let \(\Delta \subseteq M_\R\) be a compact convex lattice polytope, i.e.\ there exists a finite set \(V \subseteq M\) such that \(\Delta\) is the convex hull of \(V\) in \(M_\R\). Set
  \[
    C(\Delta) = \{(m, r): m \in r \Delta, r \in \R, r \geq 0\} \subseteq M_\R \oplus \R.
  \]
  This is a \emph{rational polyhedral convex cone}. Consider the monoid ring
  \[
    S = k[C(\Delta) \cap (M \oplus \Z)] = \bigoplus_{p \in C(\Delta) \cap (M \oplus \Z)} k \cdot z^p,
  \]
  with multiplication \(z^p \cdot z^{p'} = z^{p + p'}\). \(S\) is graded via \(\deg z^{(m, r)} = r\) and check that
  \[
    \deg z^{(m_1, r_1)} \cdot z^{(m_2, r_2)} = \deg z^{(m_1 + m_2, r_1 + r_2)} = r_1 + r_2.
  \]
  We define \(\P_\Delta = \Proj S\). This is a \emph{projective toric variety}.
\end{eg}

\begin{eg}\leavevmode
  \begin{enumerate}
  \item Take \(\Delta\) to be the convex hull of \(\{0, e_1, \dots, e_n\}\) where \(e_1, \dots, e_n\) is the standard basis for \(M\). Then there is an isomorphism of rings
    \begin{align*}
      k[x_0, \dots, x_n] &\to k[C(\Delta) \cap (M \oplus \Z)] \\
      x_i &\mapsto
            \begin{cases}
              z^{(0, 1)} & i = 0 \\
              z^{(e_i, 1)} & i \ne 0
            \end{cases}
    \end{align*}
    In other words \(C(\Delta) \cap (M \oplus \Z)\) is generated freely by \((0, 1), (e_1, 1), \dots, (e_n, 1)\). Thus \(\P_\Delta = \P^n\).
  \item Take \(\Delta\) to be the convex hull of \((0, 0), (0, 1), (1, 0), (1, 1)\). One can check that \(C(\Delta) \cap (M \oplus \Z)\) is generated as a monoid by \((0, 0, 1), (1, 0, 1), (1, 1, 1)\) and \((0, 1, 1)\) with only one relation
    \[
      (0, 0, 1) + (1, 1, 1) = (1, 0, 1) + (0, 1, 1)
    \]
    so
    \[
      S \cong \frac{k[U, V, W, Z]}{(UW - VZ)}
    \]
    so \(\Proj S\) is a quadratic surface.
  \end{enumerate}
\end{eg}

\subsection{Open and closed subschemes}

\begin{definition}[open subscheme]\index{open subscheme}
  An \emph{open subscheme} of a scheme \(X\) is \((U, \sh O_X|_U)\) for \(U \subseteq X\) an open subset.
\end{definition}
Check \(U\) can still be covered by affine schemes so is a scheme.

\begin{definition}[open immersion]\index{open immersion}
  An \emph{open immersion} \(f: X \to Y\) is a morphism which induces an isomorphism of \(X\) with an open subscheme of \(Y\).
\end{definition}
Note that this convention is different from that in differential geometry, where an immersion is a map inducing injective maps on tangent spaces and can itself be non-injective.

\begin{definition}[closed immersion]\index{closed immersion}
  A \emph{closed immersion} \(f: X \to Y\) is a morphism which is a homeomorphism of \(X\) onto a closed subset of \(Y\), and the induced morphism \(f^\#: \sh O_Y \to f_* \sh O_X\) is surjective.
\end{definition}

\begin{definition}[closed subscheme]\index{closed subscheme}
  A \emph{closed subscheme} of \(Y\) is an equivalence class of closed immersions where \(f: X \to Y, f': X' \to Y\) are equivalent if there exists an isomorphism \(i: X \to X'\) with \(f = f' \compose i\).
\end{definition}

\begin{eg}\leavevmode
  \begin{enumerate}
  \item Let \(Y = \Spec A\), \(I \subseteq A\) an ideal and \(X = \Spec A/I\). Then have the quotient map \(\varphi: A \to A/I\) inducing \(f: X \to Y\). This is a homeomorphism of \(X\) with \(V(I) \subseteq Y\). Also \(\sh O_Y \to f_* \sh O_X\) is surjective since it is surjective on stalks: \(\sh O_{Y, \mathfrak p} = A_{\mathfrak p}\) and
    \[
      (f_* \sh O_X)_{\mathfrak p} =
      \begin{cases}
        0 & \mathfrak p \notin V(I) \\
        (A/I)_{\mathfrak p} & \mathfrak p \in V(I)
      \end{cases}
    \]

    The point is that the space \(\Spec A/I\) contains less information than the scheme structure. For example consider \(\Spec \frac{k[x, y]}{(x^2, xy)}\). We have \(V(x^2, xy) = V(x)\) so the closed points can be identified with the \(y\)-axis. However, \(x\) is nilpotent in the quotient ring so the origin behaves differently from the origin in the affine line. The origin in this case is an example of an \emph{embedded point}\index{embedded point}.
  \item Non-example: consider the morphism \(\A_k^1 \to \A_k^2\) induced by
    \begin{align*}
      k[x, y] &\to k[t] \\
      x &\mapsto t^2 \\
      y &\mapsto t^3
    \end{align*}
    Then the map is not surjective so this is not an immersion, although the image \(V(y^2 - x^3)\) is closed in \(\A^2_k\) and the map is a homeomorphism onto its image.
  \end{enumerate}
\end{eg}

\subsection{Fibre products}

Let \(\c C\) be a category and consider a diagram in the category
\[
  \begin{tikzcd}
    & Y \ar[d, "g"] \\
    X \ar[r, "f"] & Z
  \end{tikzcd}
\]
Then the fibre product\index{fibre product}, if exists, is an object \(W\) equipped with morphisms \(p: W \to X, q: W \to Y\) with \(f \compose p = g \compose q\) such that for any object \(W'\) and morphisms \(\rho': W' \to X, q': W' \to X\) such that \(f \compose p' = g \compose q'\) then there exists a unique map \(h: W' \to W\) such that \(p' = p \compose h, q' = q \compose h\). In other words, the following diagram commutes:
\[
  \begin{tikzcd}
    W' \ar[drr, "q'", bend left] \ar[ddr, "p'", bend right] \ar[dr, "h", dotted] \\
    & W \ar[r, "q"] \ar[d, "p"] & Y \ar[d, "g"] \\
    & X \ar[r, "f"] & Z
  \end{tikzcd}
\]
If it exists then it is unique up to a unique isomorphism. If \(W\) exists we write it as \(X \times_Z Y\).

\begin{eg}
  Let \(\c C\) be \(\c{Set}\), the category of sets. Then
  \[
    X \times_Z Y = \{(x, y) \in X \times Y: f(x) = g(y)\}.
  \]
\end{eg}

Digression on Yoneda lemma and general approach to construct universal objects.

\begin{definition}
  Let \(\c C\) be a category. Write \(h_X\) for the contravariant functor \(h_X: \c C \to \c{Set}, Y \mapsto \Hom(Y, X)\) and
  \begin{align*}
    h_X(f: Y \to Z): \Hom(Z, X) &\to \Hom(Y, X) \\
    \varphi &\mapsto \varphi \compose f
  \end{align*}
\end{definition}

Recall that a \emph{natural transformation}\index{natural transformation} \(T: F \to G\) of (contravariant) functors \(F, G: \c C \to \c D\) is data \(T(X): F(X) \to G(X)\) for each object \(X\) in \(\c C\) and for each morphism \(f: X \to Y\) in \(\c C\) a commutative diagram
\[
  \begin{tikzcd}
    F(Y) \ar[r, "F(f)"] \ar[d, "T(Y)"] & F(X) \ar[d, "T(X)"] \\
    G(Y) \ar[r, "G(f)"] & G(X)
  \end{tikzcd}
\]

\begin{theorem}[Yoneda lemma]\index{Yoneda lemma}
  The set of natural transformations between \(h_X: \c C \to \c{Set}\) and (contravariant) \(G: \c C \to \c{Set}\) is \(G(X)\).
\end{theorem}

\begin{proof}[Sketch proof]
  Given \(\eta \in G(X)\), we define for each object \(Y\) a map
  \begin{align*}
    h_X(Y) &\to G(Y) \\
    f &\mapsto G(f)(\eta)
  \end{align*}
  Conversely given \(T: h_X \to G\), set \(\eta\) to be \(T(X)(\id_X)\).
\end{proof}

\begin{corollary}
  \(\operatorname{NatTrans}(h_X, h_Y) = h_Y(X) = \Hom(X, Y)\).
\end{corollary}

\begin{remark}
  When \(X\) is a scheme, we write \(X(T)\) for the set of \(T\)-valued points of \(X\), which is precisely \(h_X(T)\).
\end{remark}

\begin{definition}[representable functor]\index{representable functor}
  A contravariant functor \(F: \c C \to \c{Set}\) is \emph{representable} if \(F \cong h_X\) for some object \(X\) in \(\c C\).
\end{definition}

We can redefine fibre product as follow: the fibre product\index{fibre product} in a category is an object which represents the functor
\[
  T \mapsto \Hom(T, X) \times_{\Hom(T, Z)} \Hom(T, Y)
\]
(with \(X \xrightarrow{f} Z \xleftarrow{g} Y\) given).

The advantage of phrasing universal property in terms of representable functors is that it enables us to prove identities easily. For example, in \(\c{Set}\) we have
\[
  (A \times_B C) \times_C D \cong A \times_B D
\]
which is simply \(((a, c), d) \mapsto (a, d)\). Then we get this identity for all fibre products (if exist) for free: the two functors
\begin{align*}
  T &\mapsto (h_A(T) \times_{h_B(T)} h_C(T)) \times_{h_C(T)} h_D(T) \\
  T &\mapsto h_A(T) \times_{h_B(T)} h_D(T)
\end{align*}
are naturally isomorphic by the map on sets just written down, so by Yoneda they are represented by isomorphic objects.

\begin{theorem}
  Fibre products exist in the category of schemes.
\end{theorem}

\begin{proof}
  This is an prolonged construction and we proceed in several steps.

  Step 1: suppose \(X = \Spec A, Y = \Spec B, S = \Spec R\). Assume given \(A \xleftarrow{f} R \xrightarrow{g} B\) inducing \(X \to S \leftarrow Y\). Tensor product is pushout in the category of rings.
  \[
    \begin{tikzcd}
      C \\
      & A \otimes_R B \ar[ul, dotted] & B \ar[l] \ar[ull, bend right] \\
      & A \ar[u] \ar[uul, bend left] & R \ar[l, "f"'] \ar[u, "g"]
    \end{tikzcd}
  \]
  Thus \(\Spec A \otimes_R B = \Spec A \times_{\Spec R} \Spec B\) in the category of \emph{affine schemes}. In general, fibre products in a category are not the same as those in a subcategory, since we have different test objects. But if \(T\) is an arbitrary scheme, giving a map \(T \to \Spec A\) is the same as \(A \to \Gamma(T, \sh O_T)\) so we can replace \(\Spec C\) with an arbitrary scheme \(T\). Thus \(X \times_S Y = \Spec A \otimes_R B\).

  Step 2: We will construct the general fibre proudct via gluing schemes (example sheet 1 question 14). We will also want to glue morphisms: given an open cover \(\{U_i\}\) of a scheme \(X\) and morphisms \(f_i: U_i \to Y\) with \(f_i|_{U_i \cap U_j} = f_j|_{U_i \cap U_j}\) then exists a unique morphism \(f: X \to Y\) such that \(f|_{U_i} = f_i\). This is an exercise.

  Step 3: Given \(X, Y \to S\) such that \(X \times_S Y\) exists with projections \(p_1: X \times_S Y \to X, p_2: X \times_S Y \to Y\), suppose \(U \subseteq X\) is an open subscheme. Then \(p_1^{-1}(U) \subseteq X \times_S Y\) is \(U \times_S Y\): given maps \(f_1: T \to U, f_2: T \to Y\), by composition we get a map \(T \to X\) so by universal property of fibre product there is a map \(h: T \to \times_S Y\). As \(p_2 \compose h = i \compose f_1\), must have \(h\) factors through \(p_1^{-1}(U)\).
  \[
    \begin{tikzcd}
      T \ar[drrr, out=-5, "f_2"] \ar[drr, "h"', out=-15, in=150] \ar[dr, dotted] \ar[ddr, "f_1", bend right] \\
      & p_1^{-1}(U) \ar[r, hook] \ar[d] & X \times_S Y \ar[r, "p_2"] \ar[d, "p_1"] & Y \ar[d] \\
      & U \ar[r, "i", hook] & X \ar[r] & S
    \end{tikzcd}
  \]

  Step 4: Let \(\{X_i\}\) be an open cover of \(X\) and suppose \(X_i \times_S Y\) exists for each \(i\). Then claim \(X \times_S Y\) exists.
  \begin{proof}
    Let \(X_{ij} = X_i \cap X_j, U_{ij} = p_1^{-1}(X_{ij}) = X_i \times_S Y\). Then \(U_{ij} = X_{ij} \times_S Y\) by step 3 and hence by uniqueness of fibre product up to a unique isomorphism, we get an isomorphism \(\varphi_{ij}: U_{ij} \to U_{ji}\). As an exercise, check these isomorphism satisfy the hypotheses of example sheet 1 question 14. We can then glue the schemes \(X_i \times_S Y\) along the \(U_{ij}\)'s to get a scheme \(X \times_S Y\).

    Need to show this is the fibre product. Suppose given \(p_1': T \to X, p_2': T \to Y\). Set \(T_1 = (p_1')^{-1}(X_i)\) so get a map \(\theta_i: T_i \to X_i \times_S Y\) by universal property. We have an open immersion \(X_i \times_S Y \embed X \times_S Y\) so denote also by \(\theta_i\) the composition of \(\theta_i\) with the inclusion. On \(T_i \cap T_j\), \(\theta_i\) and \(\theta_j\) agree since they factor through \(X_{ij} \times_S Y \subseteq X_i \times_S Y\) and \(X_{ji} \times_S Y \subseteq X_j \times_S Y\) respectively. Thus using step 2, we can glue the \(\theta_i\)'s to get \(\theta: T \to X \times_S Y\).
  \end{proof}

  Step 5: Using step 4 we can construct \(X \times_S Y\) when \(S\) and \(Y\) are affine by taking \(\{X_i\}\) to be an affine cover. Similarly we obtain \(X \times_S Y\) for \(X, Y\) arbitrary by reversing the roles of \(X\) and \(Y\).

  Step 6: For \(X, Y, S\) arbitrary, let \(\{S_i\}\) be an affine cover of \(S\). Take \(X_i, Y_i\) to be the preimages of \(S_i\) in \(X, Y\). Then \(X_i \times_{S_i} Y_i\) exists by step 5 and \(X_i \times_{S_i} Y_i = X_i \times_S Y_i\) by the universal property. Glue as before.
\end{proof}

\paragraph{scheme-theoretic fibres of morphisms}

Give a set-theoretic map \(f: X \to Y\), one way to describe the fibre of \(y \in Y\) is to form the fibre product
\[
  \{y\} \times_Y X = \{(y, x): y = f(x)\} \cong f^{-1}(X).
\]
This is completely analogous for schemes. Given a morphism of schemes \(f: X \to Y\) and \(y \in Y\), we have \(k(y) = \sh O_{Y, y}/\mathfrak m_y\) and a morphism \(\Spec k(y) \to Y\) with image \(y\). We define
\[
  X_y = \Spec k(y) \times_Y X
\]
to be the \emph{scheme-theoretic fibre}\index{fibre} of \(f\) at \(y\).

\begin{eg}
  Let \(X = \Spec k[x], Y = \Spec k[t]\) and a morphism \(f: X \to Y\) induced by \(k[t] \to k[x], t \mapsto x^2\). Suppose for the moment \(k = \overline k\). Let \(y = (t - a)\) for some \(a \in K\). Then \(k(y) = k[t]/(t - a)\) so \(\Spec k(y) \to \Spec k[t]\) is induced by the quotient map \(k[t] \to \frac{k[t]}{(t - a)}\). Then
  \[
    X_y = \Spec \frac{k[t]}{(t - a)} \otimes_{k[t]} k[x] = \Spec \frac{k[x]}{(x^2 - a)}
  \]
  by noting that \((A/I) \otimes_A M = M/IM\). If \(a \neq 0\) and \(\ch k \neq 2\) then by Chinese remainder theorem
  \[
    \frac{k[x]}{(x^2 - a)} = \frac{k[x]}{(x - \sqrt a)} \times \frac{k[x]}{(x + \sqrt a)}
  \]
  so the fibre are just two points. If \(a = 0\) or \(\ch k = 2\) we get a ring with nilpotents \(\frac{k[x]}{((x + \sqrt a)^2)}\). In some ways this indicates ramification at \(0\), and this confirms our previous remark that the scheme captures more information than the underlying set.

    If we instead take \(y = (0) \in Y\), then \(k(y) = k[t]_{(0)}/\mathfrak m_{(0)} = k(t)\) so
    \[
      X_y = \Spec k(t) \otimes_{k[t]} k[x] = \Spec \frac{k(t)[x]}{(x^2 - t)} = \Spec k(\sqrt t).
    \]
\end{eg}

\begin{definition}[integral scheme]\index{scheme!integral}
  A scheme is \emph{integral} if for every open set \(U \subseteq X\), \(\sh O_X(U)\) is an integral domain.
\end{definition}

\begin{definition}[morphism (locally) of finite type]\index{morphism!locally of finite type}\index{morphism!of finite type}
  Let \(f: X \to Y\) be a morphism of schemes. Then \(f\) is \emph{locally of finite type} if there is a covering of \(Y\) by open affine subsets \(V_i = \Spec B_i\) such that for each \(i\), \(f^{-1}(V_i)\) can be covered by open affines \(U_{ij} = \Spec A_{ij}\) with each \(A_{ij}\) a finitely-generated \(B_i\)-algebra.

  We say \(f\) is \emph{of finite type} if the cover \(\{U_{ij}\}\) of \(f^{-1}(V_i)\) can always be taken to be finite.
\end{definition}

\begin{ex}
  Let \(U_i = \P^1_k\) for \(i \in \Z\) and identify \(0 \in U_i\) with \(\infty \in U_{i + 1}\). Let \(X = \coprod_{i \in \Z} U_i/\sim\). Show the morphism \(X \to \Spec k\) is locally of finite type but not of finite type.
\end{ex}

We can now redefine a variety to be
\begin{definition}[variety over \(k\)]\index{variety}
  Let \(k\) be a field. A \emph{variety over \(k\)} is a scheme \(X\) over \(\Spec k\) such that \(X\) is integral and \(X \to \Spec k\) is finite type.
\end{definition}

\begin{note}
  This still allows the affine line with double origin.
\end{note}

More exercises on properties of schemes and morphisms can be found on example sheet 2.

\paragraph{quick remarks on separated and proper morphisms}

The line with double origin is non-Hausdorff in the Euclidean topology, but as Zariski topology is so coarse, Hausdorffness does not suit the algebraic geometry world. Instead, we use the characterisation that \(X\) is Hausdorff if and only if \(\Delta_X \subseteq X \times X\) is closed.

\begin{definition}[separated morphism]\index{diagonal morphism}\index{morphism!separated}
  Let \(f: X \to Y\) be a morphism of schemes and \(\Delta: X \to X \times_Y X\) the \emph{diagonal morphism} induced by \(f: X \to Y\) and \(\id: X \to X\). We say \(f\) is \emph{separated} if \(\Delta\) is a closed immersion.
\end{definition}

\begin{ex}
  The affine line with two origins in not separated.
\end{ex}

\begin{proposition}[valuative criterion for separatedness]
  Let \(f: X \to Y\) be a morphism with \(X\) Noetherian. Then \(f\) is separated if and only if the following condition holds: for any field \(K\) and any valuation ring \(R \leq K\) (\(R\) is an integral domain with field of fractions \(K\) and for all \(x \in K^*\) either \(x \in R\) or \(x^{-1} \in R\)), let \(T = \Spec R, U = \Spec K\) and \(U \to T\) the morphism induced by \(R \embed K\). Given any commutative diagram
  \[
    \begin{tikzcd}
      U \ar[r] \ar[d] & X \ar[d, "f"] \\
      T \ar[r] \ar[ur, "h", dotted] & Y
    \end{tikzcd}
  \]
  there is at most one \(h\) making the diagram commute.
\end{proposition}

One may ask the dual question when such \(h\) exists.

\begin{definition}[proper morphism]\index{morphism!proper}
  A morphism \(f: X \to Y\) is \emph{proper} if it is separated, of finite type and universally closed, i.e.\ for all \(Y' \to Y\), the morphism \(X \times_Y Y' \to Y'\) is a closed map.
\end{definition}

\begin{proposition}[valuative criterion for properness]
   Let \(f: X \to Y\) be a morphism of finite type with \(X\) Noetherian. Then \(f\) is proper if and only if in the set up of the criterion for separatedness, there exists a unique morphism \(h\) making the diagram commute.
\end{proposition}

\begin{eg}
  If \(X\) is a projective variety over \(\Spec k\) (i.e.\ a closed subscheme of \(\P_k^n\)) then \(X \to \Spec k\) is proper.
\end{eg}

\section{Sheaves of \(\sh O_X\)-modules}

\begin{definition}[sheaf of modules]\index{sheaf of modules}
  Let \((X, \sh O_X)\) be a ringed space. A \emph{sheaf of \(\sh O_X\)-modules} is a sheaf \(\sh F\) of abelian groups such that \(\sh F(U)\) has the structure of \(\sh O_X(U)\)-module compatible with restriction, i.e.\ if \(V \subseteq U, s \in \sh O_X(U), m \in \sh F(U)\) then \((s \cdot m)|_V = s|_V \cdot m|_V\).

  A \emph{morphism of sheave of \(\sh O_X\)-modules} \(f: \sh F \to \sh G\) is a morphism of sheaves such that \(f_U: \sh F(U) \to \sh G(U)\) is an \(\sh O_X(U)\)-module homomorphism.
\end{definition}

Kernels, cokernels and images of such morphisms are sheaves of \(\sh O_X\)-modules.

We have
\[
  \Hom_{\sh O_X}(\sh F, \sh G) = \{f: \sh F \to \sh G: f \text{ morphism of }\sh O_X\text{-module}\}
\]
an \(\sh O_X(X)\)-module. We define the \emph{Hom sheaf}\index{Hom sheaf} to be
\[
  \mathit{Hom}_{\sh O_X}(\sh F, \sh G)(U) = \Hom_{\sh O_X|_U}(\sh F|_U, \sh G|_U),
\]
an \(\sh O_X(U)\)-module. Then \(Hom_{\sh O_X}(\sh F, \sh G)\) is a sheaf of \(\sh O_X\)-modules.

We define \(\sh F \otimes_{\sh O_X} \sh G\) to be the sheaf associated to the presheaf \(U \mapsto \sh F(U) \otimes_{\sh O_X(U)} \sh G(U)\).

Given \(f: X \to Y\) a morphism of ringed spaces, \(\sh F\) a sheaf of \(\sh O_X\)-module, \(\sh G\) a sheaf of \(\sh O_Y\)-modules, then
\begin{enumerate}
\item \(f_*\sh F\) is naturally a sheaf of \(\sh O_Y\)-modules as \(f_*\sh F\) is a sheaf of \(f_* \sh O_X\)-modules, and the morphism\(f^\#: \sh O_Y \to f_* \sh O_X\) gives \(f_* \sh O_X\) an \(\sh O_Y\)-algebra structure.
\item \(f^{-1} \sh G\) is an \(f^{-1} \sh O_Y\)-module, but not necessarily an \(\sh O_X\)-module. However by adjunction between \(f^{-1}\) and \(f^*\) on example sheet 1, \(f^\#: \sh O_Y \to f_* \sh O_X\) gives a map \(f^\#: f^{-1} \sh O_Y \to \sh O_X\). Then we define
  \[
    f^* \sh G = f^{-1} \sh G \otimes_{f^{-1} \sh O_Y} \sh O_X
  \]
  which is an \(\sh O_X\)-module.
\end{enumerate}

\begin{definition}[(locally) free sheaf, line bundle, invertible sheaf]\index{sheaf of modules!free}\index{sheaf of modules!locally free}\index{line bundle}\index{invertible sheaf}
  A sheaf of \(\sh O_X\) is \emph{free} if it is isomophic to \(\bigoplus_{i \in I} \sh O_X\) for some index set \(I\). If \(\# I = r < \infty\) we say the sheaf is \emph{free of rank \(r\)}.

  A sheaf \(\sh F\) is \emph{locally free of rank \(r\)} if exists \(\{U_i\}\) open cover of \(X\) with \(\sh F|_{U_i}\) free of rank \(r\) for all \(i\).

  Finally we say \(\sh F\) is a \emph{line bundle} or \emph{invertible sheaf} if it is locally free of rank \(1\).
\end{definition}

\begin{eg}
  Let \(X = \Spec A\) and \(M\) be an \(A\)-module. We obtain a sheaf \(\widetilde M\) as follow.
  \begin{align*}
    \widetilde M(U) =
    \left\{
    \begin{tabular}{c}
      \(s: U \to \coprod_{\mathfrak p \in U} M_{\mathfrak p}\): \(s(\mathfrak p) \in M_{\mathfrak p}\), \\
      for each \(\mathfrak p \in U\), exists \(\mathfrak p \in V \subseteq U\) and \(m \in M, a \in A\) \\
      such that \(a \notin \mathfrak q, s(\mathfrak q) = \frac{m}{a} \in M_{\mathfrak q}\) for all \(\mathfrak q \in V\)
    \end{tabular}
    \right\}
  \end{align*}
\end{eg}

\begin{proposition}\leavevmode
  \begin{enumerate}
  \item \((\widetilde M)_{\mathfrak p} = M_{\mathfrak p}\).
  \item \(\widetilde M(D(f)) = M_f\). In particular \(\Gamma(X, \widetilde M) = M\).
  \end{enumerate}
\end{proposition}

\begin{proof}
  Exercise.
\end{proof}

\begin{definition}[(quasi-)coherent sheaf]\index{sheaf of modules!coherent}\index{sheaf of modules!quasi-coherent}
  Let \(X\) be a scheme and \(\sh F\) a sheaf of \(\sh O_X\)-modules. We say \(\sh F\) is \emph{quasi-coherent} if exists a cover \(\{U_i = \Spec A_i\}\) of \(X\) and \(A_i\)-modules \(M_i\) such that \(F|_{U_i} = \widetilde M_i\).

  If further \(M_i\) is a finitely genertated \(A_i\)-module for each \(i\) we say \(\sh F\) is \emph{coherent}.
\end{definition}

\begin{remark}
  The category of quasi-coherent (coherent respectively) sheaves on \(X = \Spec A\) is equiavlent to the category of \(A\)-modules (finitely generated \(A\)-modules respectively). This is not obvious and the key point is to know that if \(\sh F\) is a quasi-coherent sheaf on \(\Spec A\) then \(\sh F = \widetilde{\Gamma(X, \sh F)}\).
\end{remark}

\begin{eg}\leavevmode
  \begin{enumerate}
  \item A locally free sheaf is quasi-coherent, and coherent if finite rank: if \(\sh F\) is locally free then there exists an open cover \(\{U_i\}\) such that \(\sh F|_{U_i} = \bigoplus_{i \in I} \sh O_{U_i}\). If \(U_i = \Spec A\) then \(\sh F|_{U_i} \cong \widetilde{\bigoplus_{i \in I} A}\).
  \item Kernels, cokernels and images of morphisms of quasi-coherent sheaves are quasi-coherent. It suffices to show \(M \mapsto \widetilde M\) is exact so, for example, \(\ker(\widetilde M \to \widetilde N) \cong \widetilde{\ker(M \to N)}\).

    If \(X\) is Noetherian then the same holds for coherent sheaves (as submodules of finitely generated modules over a Noetherian ring is finitely generated).
  \end{enumerate}
\end{eg}

\begin{eg}
  Note that if \(\sh L\) is a line bundle with a trivialising cover \(\{U_i\}\) then on \(U_i \cap U_j\) we have
  \[
    \begin{tikzcd}
      \sh O_{U_i}|_{U_i \cap U_j} \ar[r, "\cong"] & \sh L|_{U_i \cap U_j} & \sh O_{U_j}|_{U_i \cap U_j} \ar[l, "\cong"']
    \end{tikzcd}
  \]
  where the isomorphisms are given by trivialisations on \(U_i\) and \(U_j\) respectively. Thus for each \(i \neq j\), we get an automorphism \(\varphi_{ij}: \sh O_{U_i \cap U_j} \to \sh O_{U_i \cap U_j}\) of \(\sh O_{U_i \cap U_j}\)-modules. \(\varphi_{ij}\) must be given by \(\varphi_{ij}(s) = g_{ij} s\) for some \(g_{ij} \in \sh O_X^*(U_i \cap U_j)\) where
  \[
    \sh O_X^*(U) = \{f \in \sh O_X(U): f \text{ is invertible}\}.
  \]
  We call the \(g_{ij}\)'s \emph{transition functions}\index{transition functions}. Furthermore On \(U_i \cap U_j \cap U_k\), we have \(\varphi_{ik} = \varphi_{jk} \compose \varphi_{ij}\).

  Given \(f: X \to Y\) and \(\sh L\) a line bundle on \(Y\), we can explicitly describe \(f^* \sh L\) using transition functions. Let \(\{U_i\}\) be a trivialising cover for \(\sh L\) and let \(X_i = f^{-1}(U_i)\) and \(f_i: X_i \to U_i\) the restriction of \(f\). Then
  \[
    f_i^*(\sh L|_{U_i}) = f_i^*(\sh O_{U_i}) = f_i^{-1} \sh O_{U_i} \otimes_{f^{-1} \sh O_{U_i}} \sh O_{X_i} = \sh O_{X_i}
  \]

  so \(f^*(\sh L)|_{X_i} \cong \sh O_{X_i}\). Thus the pullback of a line bundle is a line bundle, and the transition functions are \(f^\#(g_{ij}) \in \sh O_X^*(X_i \cap X_j)\).

  More generally the pullback of a locally free sheaf is a locally free sheaf.
\end{eg}

\begin{eg}
  Let \(\sh L_1, \sh L_2\) be line bundles with a common trivialising cover \(\{U_i\}\) and let \(g_{ij}, h_{ij}\) be the transition functions for \(\sh L_1\) and \(\sh L_2\). Then
  \begin{enumerate}
  \item the transition functions for \(\sh L_1 \otimes_{\sh O_X} \sh L_2\) are \(g_{ij} \cdot h_{ij}\): if \(M_1, M_2\) are rank \(1\) free \(A\)-modules, \(\alpha: M_1\to M_1, m \mapsto gm, \beta: M_2 \to M_2, m \mapsto hm\) then \(\alpha \otimes \beta: M_1 \otimes M_2 \to M_1 \otimes M_2\) is given by
    \[
      m_1 \otimes m_2 \mapsto gm_1 \otimes hm_2 = (g\cdot h)(m_1 \otimes m_2).
    \]
  \item set \(\sh L_1^\vee = \sh L_1^{-1} = Hom_{\sh O_X}(\sh L_1, \sh O_X)\). Then the transition maps of \(\sh L_1^\vee\) are \(g_{ij}^{-1}\): if \(M\) is a rank \(1\) free \(A\)-module and \(\alpha: M \to M, m \mapsto gm\) then one might guess that \(M^\vee \to M^\vee\) is given by \(\varphi \mapsto g \varphi\). However, now we are going in the wrong way because of the dualising, so we invert \(g\).
  \end{enumerate}
\end{eg}

\begin{remark}
  As a result \(\sh L \otimes_{\sh O_X} \sh L^\vee \cong \sh O_X\) for any line bundle \(\sh L\).
\end{remark}

\begin{definition}[Picard group]\index{Picard group}
  Let \(X\) be a scheme. Denote by \(\Pic(X)\), the \emph{Picard group}, to be the set of isomorphism classes of line bundles on \(X\). This is a group with multiplication \((\sh L_1, \sh L_2) \mapsto \sh L_1 \otimes_{\sh O_X} \sh L_2\) and inverse \(\sh L \mapsto \sh L^\vee\).
\end{definition}

This is the most important invariant associated to a scheme.

\subsection{Morphisms into projective space}

Fix a base scheme \(\Spec k\) and \(\P_k^n = \Proj k[x_0, \dots, x_n]\). Let \(\c{Sch}/k\) be the category of schemes over \(k\). Let \(F: \c{Sch}/k \to \c{Set}\) be the functor
\begin{align*}
  \mathrm{Ob}(\c{Sch}/k) \ni T &\mapsto
                        \left\{
                        \begin{tabular}{c}
                          surjections \(\sh O_T^{\oplus(n + 1)} \surj \sh L\) \\
                          for \(\sh L\) a line bundle on \(T\)
                        \end{tabular}
  \right\}/\sim \\
  (f: T_1 \to T_2) &\mapsto (\sh O_{T_2}^{\oplus(n + 1)} \surj \sh L) \mapsto (f^* \sh O_{T_2}^{\oplus (n + 1)} = \sh O_{T_1}^{\oplus (n + 1)} \surj f^* \sh L)
\end{align*}
with an isomorphism being a commutative diagram
\[
  \begin{tikzcd}
    \sh O_T^{\oplus(n + 1)} \ar[r] \ar[dr] & \sh L_1 \ar[d, "\cong"] \\
    & \sh L_2
  \end{tikzcd}
\]
Surjectivity is by right exactness of tensor product.

\begin{theorem}
  The contravariant functor \(F\) is represented by \(\P_k^n\), i.e.\ \(F \cong h_{\P^n_k}\).
\end{theorem}

\begin{proof}
  If this holds there is a universal object on \(\P_k^n\), i.e.\ \(1_{\P_k^n} \in h_{\P_k^n}(\P_k^n)\) corresponds to some element in \(F(\P_k^n)\), i.e.\ a surjection \(\sh O_{\P^n}^{\oplus (n + 1)} \surj \sh L\). Further, following the proof of Yoneda, given \(T: h_{\P^n} \to F\) the natural transformation giving the equivalence and \(f: X \to \P^n\) in \(h_{\P_n}(X)\), we get a commutative diagram
  \[
    \begin{tikzcd}
      h_{\P^n}(\P^n) \ar[rrr, "T(\P^n)"] \ar[ddd, "h_{\P^n}(f)"] &&& F(\P^n) \ar[ddd, "F(f)"] \\
      & 1_{\P^n} \ar[r, mapsto] \ar[d, mapsto] & (\sh O_{\P^n}^{\oplus(n + 1)} \surj \sh L) \ar[d, mapsto] \\
      & f \ar[r, mapsto] & (\sh O_X^{\oplus(n + 1)} \surj f^* \sh L) \\
      h_\P^n(X) \ar[rrr, "T(X)"] &&& F(X)
    \end{tikzcd}
  \]
  so the element of \(F(X)\) corresponding to \(f \in h_{\P^n}(X)\) is just \(\sh O_X^{\oplus(n + 1)} \surj f^*\sh L\). Representability means that \(\P^n\) comes with a universal object \(\sh O_{\P^n}^{\oplus(n + 1)} \surj \sh L\), such that for any \(X\) and \(\sh O_X^{\oplus(n + 1)} \surj \sh L'\), there exists a unique morphism \(f: X \to \P^n\) such that
  \[
    (\sh O_X^{\oplus(n + 1)} \surj f^*\sh L) \cong (\sh O_X^{\oplus(n + 1)} \surj \sh L').
  \]

  We will write the universal object in \(\P^n\) as \(\sh O_{\P^n}^{\oplus(n + 1)} \surj \sh O_{\P^n}(1)\). \(\P^n\) has an open cover \(\{D_+(x_i): 0 \leq i \leq n\}\) and \(D_+(x_i) = \Spec S_{(x_i)}\) where \(S = k[x_0, \dots, x_n], S_{(x_i)} = k[\frac{x_0}{x_i}, \dots, \frac{\hat x_i}{x_i}, \dots, \frac{x_n}{x_i}]\). We take this to be the trivialising cover with transition functions
  \[
    g_{ij} = \frac{x_i}{x_j} \in \sh O_{\P^n}^*(D_+(x_i) \cap D_+(x_j)) = S_{(x_ix_j)}
  \]
  as \(D_+(x_i) \cap D_+(x_j) = D_+(x_ix_j)\). We will later see why we choose \(\frac{x_i}{x_j}\) and not \(\frac{x_j}{x_i}\). Have a sheaf morphism \(\sh O_{\P^n}^{\oplus(n + 1)} \to \sh O_{\P^n}(1)\) defined on \(D_+(x_i)\) by
  \begin{align*}
    \sh O_{D_+(x_i)}^{\oplus(n + 1)} &\to \sh O_{D_+(x_i)} \\
    e_k &\mapsto \frac{x_k}{x_i}
  \end{align*}
  where \(e_k\) is \(1\) on \(k\)th coordinate and \(0\) elsewhere. This is well-defined on overlaps:
  \begin{align*}
    - \cdot \frac{x_i}{x_j}: \sh O_{D_+(x_i)}|_{D_+(x_ix_j)} &\to \sh O_{D_+(x_j)}|_{D_+(x_ix_j)} \\
    \frac{x_k}{x_i} &\mapsto \frac{x_k}{x_j}
  \end{align*}
  Further this map is surjective on \(D_+(x_i)\) as \(e_i \mapsto \frac{x_i}{x_i} = 1\), so for any \(\varphi \in \sh O_{D_+(x_i)}(D_+(x_i))\), \(\varphi \cdot e_i \mapsto \varphi\). This implies surjectivity on stalks.

  Now suppose given \(T\) a scheme over \(k\) and \(\varphi: \sh O_T^{\oplus(n + 1)} \surj \sh L\), we want to construct a morphism \(f: T \to \P^n\) such that
  \[
    (f^*(\sh O_{\P^n}^{\oplus(n + 1)} \surj \sh O_{\P^n}(1))) \cong (\sh O_T^{\oplus(n + 1)} \surj \sh L)
  \]
  Let \(\varphi(e_i) = s_i \in \Gamma(T, \sh L)\) where \(e_i = (0, \dots, 1, \dots, 0) \in \Gamma(T, \sh O_T^{\oplus(n + 1)})\). Define
  \[
    Z_i = \{t \in T: (s_i)_t \in \mathfrak m_t \sh L_t\}
  \]
  which makes sense as \(\sh L_t\) is a \(\sh O_{T, t}\)-module. Claim that \(Z_i\) is a closed set: being closed can be checked on an open cover \(\{U_j\}\), i.e.\ by checking that \(U_j \cap Z_i\) is closed in \(U_j\) for all \(j\), so can take affine cover which also trivialises \(\sh L\). Consider open subset \(\Spec A\) and \(\sh L = \widetilde A = \sh O_{\Spec A}\) and \(s_i \in A\) induces \(\frac{s_i}{1} \in A_{\mathfrak p}\) for all \(\mathfrak p \in \Spec A\). thus \(\mathfrak p \in U_i\) if and only if \(\frac{s_i}{1} \in \mathfrak m_{\mathfrak p} A_{\mathfrak p}\), if and only if \(s_i \in A \cap \mathfrak m_{\mathfrak p} A_{\mathfrak p} = \mathfrak p\). Thus
  \[
    (\Spec A) \cap Z_i = V((s_i))
  \]
  is a closed subset. Note that \(\bigcap Z_i = \emptyset\) by surjectivity of \(\varphi\).

  Let \(U_i = T\setminus Z_i\) open. Then
  \begin{align*}
    \sh O_{U_i} &\to \sh L|_{U_i} \\
    1 &\mapsto s_i
  \end{align*}
  is an isomorphism because it is isomorphism on stalks and we denote its inverse by \(s \mapsto \frac{s}{s_i}\). Now define \(f_i: U_i \to D_+(x_i) = \Spec S_{(x_i)}\) by giving a \(k\)-algebra homomorphism
  \begin{align*}
    k[\frac{x_0}{x_i}, \dots, \frac{x_n}{x_i}] &\to \Gamma(U_i, \sh O_{U_i}) \\
    \frac{x_k}{x_i} &\mapsto \frac{s_k}{s_i}
  \end{align*}
  On \(U_i \cap U_j\), want to show \(f_i|_{U_i \cap U_j} = f_j|_{U_i \cap U_j}\):
  \begin{align*}
    (f_i)_{U_i \cap U_j}^\#: S_{(x_i x_j)} = \Gamma(D_+(x_i) \cap D_+(x_j), \sh O_{\P^n}) &\to \Gamma(U_i \cap U_j, \sh O_T) \\
    \frac{x_k}{x_i} &\mapsto \frac{s_k}{s_i} \\
    \frac{x_k}{x_j} = \frac{x_k}{x_i} \frac{x_i}{x_j} &\mapsto \frac{s_k}{s_i} \frac{s_i}{s_j} = \frac{s_k}{s_j}
  \end{align*}
  and
  \begin{align*}
    (f_j)_{U_i \cap U_j}^\#: S_{(x_i x_j)} &\to \Gamma(U_i \cap U_j, \sh O_T) \\
    \frac{x_k}{x_j} &\mapsto \frac{s_k}{s_j} \\
    \frac{x_k}{x_i} = \frac{x_k}{x_j} \frac{x_j}{x_i} &\mapsto \frac{s_k}{s_j} \frac{s_j}{s_i} = \frac{s_k}{s_i}
  \end{align*}
  so the ring maps agree and we may glue the \(f_i\)'s to get a morphism \(f: T \to \P^n\).

  The intuition is as follow: sections \(s_i\) of a line bundle are analogous to homogeneous coordinates \(x_i\) of projective space. In particular they are not functions although their quotients are. In other words, \(t \mapsto (s_0(t), \dots, s_n(t))\) is defined only up to scaling. What we're really doing is to define \(f: T \to \P^n, t \mapsto (s_0(t): \dots : s_n(t))\) piecewise on affine charts.

  Note that \(f^* \sh O_{\P^n}(1) \cong \sh L\) since \(f^\#(\frac{x_i}{x_j}) = \frac{s_i}{s_j}\) on \(U_i \cap U_j\), but the transition maps for \(\sh L\) on \(U_i \cap U_j\) are
  \begin{align*}
    \sh O_{U_i}|_{U_i \cap U_j} &\to \sh L|_{U_i \cap U_j} \to \sh O_{U_j}|_{U_i \cap U_j} \\
    1 &\mapsto s_i \mapsto \frac{s_i}{s_j}
  \end{align*}
  so they agree. Note that had we used transition functions \(\frac{x_j}{x_i}\), we would get a different line bundle (the tautological bundle \(\sh O_{\P^n}(-1)\)) whose pullback is not isomorphic to \(\sh L\).

  For uniqueness, suppose given \(\varphi: \sh O_T^{\oplus(n + 1)} \surj \sh L\) and a morphism \(g: T \to \P^n\) such that
  \[
    g^*(\sh O_{\P^n}^{\oplus(n + 1)} \surj \sh O_{\P^n}(1)) \cong \varphi.
  \]
  Let \(s_i = \varphi(e_i) \in \Gamma(T, \sh L)\) and \(x_i \in \Gamma(\P^n, \sh O_{\P^n}(1))\) the image of \(e_i \in \Gamma(\P_n, \sh O_{\P^n}^{\oplus(n + 1)})\). Then the given isomorphism gives \(s_i = g^*x_i\) (recall \(g^* \sh O_{\P^n}(1) = g^{-1} \sh O_{\P^n}(1) \otimes_{g^{-1} \sh O_{\P^n}} \sh O_T\) so \(g^*x_i\) equals to the image of \(x_i \otimes 1\) under sheafification). Now note that \(s_i\) vanishes at a point \(t \in T\), i.e.\ \(s_i \in \mathfrak m_t \sh L_t\), if and only if \(x_i\) vanishes at the point \(g(t)\). Thus if \(U_i = \{t \in T: s_i \notin \mathfrak m_t \sh L_t\}\) then necessarily \(g^{-1}(D_+(x_i)) = U_i\). It is thus enough to show \(f_i = g|_{U_i}\). But \(g^\#(\frac{x_j}{x_i}) = \frac{s_j}{s_i} \in \sh O_T(U_i)\) and \(f_i^\#(\frac{x_j}{x_i}) = \frac{s_j}{s_i}\) by definition.
\end{proof}

Let \(s_0, \dots, s_n \in \Gamma(X, \sh L)\) be images of \(e_i\) under \(\sh O_X^{\oplus(n + 1)}\). If this morphism is surjective (as in the case above), we say \(s_0, \dots, s_n\) \emph{generate \(\sh L\) globally}\index{globally generated}, and say \(\sh L\) is \emph{generated by global sections}. By the proposition we get a morphism \(X \to \P^n\), and understanding morphisms into projective space is important to understand varieties.

\subsection{Divisors and the Picard groups}

The aim of this section is to define two divisors
\begin{enumerate}
\item Weil divisors: codimension \(1\) subvariety.
\item Cartier divisor: a subvariety locally defined by a single equation.
\end{enumerate}

We begin by defining dimension and codimension.

\begin{definition}[dimension of a topological space]\index{dimension}
  The \emph{dimension} of a topological space \(X\) is the length \(d\) of the longest chain
  \[
    Z_0 \subsetneq Z_1 \subsetneq Z_1 \cdots \subsetneq Z_d \subseteq X
  \]
  of irreducible closed subsets of \(X\).
\end{definition}

\begin{definition}[Krull dimension]\index{Krull dimension}
  The \emph{Krull dimension} of a ring \(A\) is
  \[
    \dim A = \dim \Spec A
  \]
  which equals to the length \(d\) of the longest chain of prime ideals
  \[
    \mathfrak p_0 \subsetneq \mathfrak p_1 \subsetneq \cdots \subsetneq \mathfrak p_d
  \]
  of \(A\).
\end{definition}

\begin{definition}[codimension]\index{codimension}
  If \(Z \subseteq X\) is an irreducible closed subset then the \emph{codimension of \(Z\) in \(X\)}, \(\codim(Z, X)\), is the length \(d\) of the longest chain
  \[
    Z = Z_0 \subsetneq Z_1 \subsetneq \cdots \subsetneq Z_d \subseteq X
  \]
  of irreducible closed subsets.

  More generally, if \(Z \subseteq X\) is closed then
  \[
    \codim(Z, X) = \inf_{Z' \subseteq Z \text{ irreducible}} \codim(Z', X).
  \]
\end{definition}

\begin{definition}[height]\index{height}
  If \(\mathfrak p \in \Spec A\) we define the \emph{height} of \(\mathfrak p\) to be
  \[
    \operatorname{ht} \mathfrak p = \codim(V(\mathfrak p), \Spec A)
  \]
  which is the length \(d\) of the longest chain of primes
  \[
    \mathfrak p_0 \subsetneq \cdots \subsetneq \mathfrak p_d = \mathfrak p.
  \]
\end{definition}

\begin{remark}
  Codimension and dimension don't always behave as expected even for Noetherian affine schemes. But if \(B\) is a finitely generated \(k\)-algebra and integral domain, then for any \(\mathfrak p \in \Spec B\),
  \[
    \operatorname{ht} \mathfrak p + \dim B/\mathfrak p = \dim B
  \]
  or equivalently,
  \[
    \codim(V(\mathfrak p), \Spec B) + \dim V(\mathfrak p) = \dim \Spec B.
  \]
  Thus for a variety \(X\) (i.e.\ an integral scheme of finite type over \(k\)), if \(Z \subseteq X\) is an irreducible closed subset then
  \[
    \codim (Z, X) + \dim Z = \dim X.
  \]
  Moreover if \(\eta \in Z\) is the \emph{generic point}\index{generic point} of \(Z\), i.e.\ the unique \(\eta \in Z\) such that \(\overline{\{\eta\}} = Z\) (see example sheet 3) then \(\dim \sh O_{X, \eta} = \codim(Z, X)\).
\end{remark}

\begin{proposition}
  If \(X\) is a Noetherian topological space\index{Noetherian topological space} (i.e.\ satisfies the descending chain condition for closed subsets) then there exists a decomposition \(X = X_1 \cup \cdots \cup X_n\) into irreducible closed subsets. Moreover if \(X_i \nsubseteq X_j\) for \(i \neq j\) then the decomposition is unique up to reordering.
\end{proposition}

\begin{proof}
  Exercise.
\end{proof}

\begin{definition}[regular local ring]\index{regular local ring}
  A local ring \((A, \mathfrak m)\) is a \emph{regular local ring} if \(\dim_{A/\mathfrak m} \mathfrak m/\mathfrak m^2 = \dim A\).
\end{definition}

For dealing with divisors we assume \(X\) is a Noetherian integral scheme over \(\Spec k\) which is \emph{regular in codimension one}, i.e.\ for any \(x \in X\) with \(\dim \sh O_{X, x} = 1\), \(\sh O_{X, x}\) is a regular local ring.

\begin{remark}
  It is a standard commutative algebra fact (Atiyah, MacDonald chapter 9) that if \((A, \mathfrak m)\) is a regular Noetherian local ring which is a domain and \(\dim A = 1\) then \(A\) is a \emph{discrete valuation ring}\index{discrete valuation ring}, i.e.\ if \(K\) is the field of fractions of \(A\) then there exists a group homomorphism \(v: K^* \to \Z\) such that \(v(\mathfrak m^k \setminus \mathfrak m^{k + 1}) = k\). In particular
  \begin{align*}
    A &= \{x \in K^*: v(x) \geq 0\} \cup \{0\} \\
    \mathfrak m &= \{x \in K^*: v(x) \geq 1\} \cup \{0\}
  \end{align*}
\end{remark}

\begin{eg}\leavevmode
  \begin{enumerate}
  \item \(k[x]_{(x - a)}\) is a DVR with valuation
    \begin{align*}
      v: k(x)^* &\to \Z \\
      (x - a)^k \frac{f}{g} &\mapsto k
    \end{align*}
    if \(f, g \in k[x]\) and \((x - a) \ndivides f, g\).
  \item The number theoretic analogue is \(\Z_{(p)}\) with \(v: \Q^* \to \Z, p^k \frac{a}{b} \mapsto k\).
  \end{enumerate}
\end{eg}

We emphasise again the assumptions put on scheme \(X\).

\begin{definition}[prime divisor]\index{prime divisor}
  A \emph{prime divisor} of \(X\) is a closed subvariety, i.e.\ an integral closed subscheme of \(X\), of codimension \(1\).
\end{definition}

Let \(\Div X\) be the free abelian group generated by prime divisors on \(X\). An element of \(\Div X\) is call a \emph{divisor}\index{divisor}. Let \(K(X)\) be the function field of \(X\) (see example sheet 2). Note that \(K(X)\) is the field of fractions of \(A\) whenever \(\Spec A \subseteq X\) is an affine open subset. It is also \(\sh O_{X, \eta}\), the stalk at the generic point.

For \(Y\) a prime divisor, let \(\eta \in Y \subseteq X\) be its generic point. Then
\[
  \dim \sh O_{X, \eta} = \codim(Y, X) = 1.
\]
Thus \(\sh O_{X, \eta}\) is a DVR with valuation \(v_Y: K(X)^* \to \Z\) that measures the order of zero/pole of a function along \(Y\). In particular
\[
  \sh O_{X, \eta} = \{f \in K(X)^*: v_Y(f) \geq 0\} \cup \{0\}.
\]
Define the \emph{divisor of zeros and poles}\index{divisor of zeros and poles} of \(f \in K(X)^*\) to be
\[
  (f) = \sum_{Y \text{ prime divisor}} v_Y(f) \cdot Y.
\]
A priori \((f)\) may not be in \(\Div X\) as the sum might be infinite. But we have

\begin{lemma}
  With \(X\) satisfying the assumptions, if \(f \in K(X)^*\) then \(v_Y(f) = 0\) for all but a finite number of prime divisors.
\end{lemma}

\begin{proof}
  First pass to an open affine \(U = \Spec B \subseteq X\) with \(f = \frac{s}{a}\), \(s \in B, a \in B\setminus \{0\}\). By passing to \(D(a)\) we can assume \(f \in B\). Let \(Z = X \setminus U\). Then \(Z\) is a Noetherian topological space so \(Z\) has a finite decomposition into irreducible components. Thus \(Z\) contains a finite number of prime divisors, so we can replace \(X\) with \(\Spec B\) as any prime divisor \(Y\) intersecting \(U\) must have its generic point \(\eta_Y\) in \(U\), and \(U \cap Y\) is a prime divisor of \(U\).

  Now \(v_Y(f) \geq 0\) for \(Y \subseteq X\) since \(f \in B\) and \(v_Y(f) > 0\) if and only if \(Y \subseteq V((f))\). But \(V((f))\) is a proper closed subset of \(X\) and hence has a finite decomposition into irreducible components. Thus there are only finitely many prime divisors with \(v_Y(f) > 0\).
\end{proof}

Note \(K(X)^* \to \Div X, f \mapsto (f)\) is a group homomorphism as \(v_Y\) is.

\begin{definition}[linearly equivalent divisor, principal divisor]\index{divisor!linearly equivalent}\index{divisor!principal}
  Two divisors \(D, D' \in \Div X\) are \emph{linearly equivalent}\index{divisor!linearly equivalent} if exists \(f \in K(X)^*\) with \(D - D' = (f)\) and we write \(D \sim D'\).

  If \(D \sim 0\), i.e.\ \(D = (f)\) for some \(f\) we say \(D\) is a \emph{principal divisor}.
\end{definition}

\begin{definition}[class group]\index{class group}
  The \emph{class group} of \(X\), \(\Cl X\), is \(\Div X\) modulo the principal divisors.
\end{definition}

\begin{remark}
  If \(\Q \subseteq K\) is a finite field extension, let \(\sh O_K \subseteq K\) be the integral closure of \(\Z\) in \(K\), i.e.\ the ring of integers. Then from algebraic number theory we know \(\sh O_K\) is a Dedekind domain and hence \(\Spec \sh O_K\) satisfies our assumptions (except for being a \(k\)-scheme). Then \(\Cl \Spec \sh O_K = \Cl \sh O_K\) as defined in number theory.
\end{remark}

\begin{theorem}
  Let \(A\) be a Noetherian domain. Then \(A\) is a UFD if and only if \(X = \Spec A\) is normal, i.e.\ \(A\) is integrally closed in its field of fractions, and \(\Cl X = 0\).
\end{theorem}

\begin{proof}
  A UFD is integrally closed in its field of fractions. Also \(A\) is a UFD if and only if every height 1 prime is principal. Thus it is enough to show that if \(A\) is integrally closed, then \(\Cl X = 0\) if and only if every prime \(\mathfrak p \subseteq A\) of height \(1\) is principal.
  \begin{itemize}
  \item \(\impliedby\): given a prime divisor \(Y \subseteq X\), \(Y\) corresponds to a prime \(\mathfrak p\) with \(Y = V(\mathfrak p)\). If \(\mathfrak p\) is generated by \(f\) then \((f) = 1 \cdot Y\). Thus every prime divisor is principal so \(\Cl X = 0\).
  \item \(\implies\): suppose \(\Cl X = 0\), \(\mathfrak p \subseteq A\) a height \(1\) prime and \(Y = V(\mathfrak p)\) a prime divisor. Then \(Y\) is a principal divisor so exists \(f \in K(X)^*\) such that \((f) = 1 \cdot Y\). Since \(v_Y(f) = 1\), \(f\) generates \(\mathfrak p A_{\mathfrak p} = \mathfrak m_{\mathfrak p} \sh O_{X, \mathfrak p}\).

    For any other prime divisor \(Y' = V(\mathfrak q)\), \(v_{Y'}(f) = 0\) so \(f \in A_{\mathfrak q} = \sh O_{X, \mathfrak q}\) and moreover \(f\) is a unit in \(A_{\mathfrak q}\). Now apply the following proposition (Matsumura, Commutative Algebra, Thm 38, pg 124): if \(A\) is an integrally closed Noetherian domain then
    \[
      A = \bigcap_{\substack{\mathfrak p \in \Spec A \\ \operatorname{ht} \mathfrak p = 1}} A_{\mathfrak p} \subseteq A_{(0)}.
    \]
    Thus \(f \in A\) so \(f \in A \cap \mathfrak p A_{\mathfrak p} = \mathfrak p\). To show \(f\) generates \(\mathfrak p\), let \(g \in \mathfrak p\). Then \(v_Y(g) \geq 1\) since \(g \in \mathfrak p A_{\mathfrak p}\). Also \(v_{Y'}(g) \geq 0\) for all \(Y'\) so
    \[
      v_{Y'}(\frac{g}{f}) = v_{Y'}(g) - v_{Y'}(f) \geq 0
    \]
    Thus \(\frac{g}{f} \in A_{\mathfrak q}\) for all \(\mathfrak q\) of height 1, so \(\frac{g}{f} \in A\) by Matsumura. Then \(g = \frac{g}{f} \cdot f \in (f)\). Thus \(\mathfrak p = (f)\).
  \end{itemize}
\end{proof}

\begin{proposition}
  Suppose \(X\) satisfies the assumptions. Let \(Z \subseteq X\) be a proper closed subset and \(U = X \setminus Z\). Then
  \begin{enumerate}
  \item there exists a surjective homomorphism
    \begin{align*}
      \Cl X &\to \Cl U \\
      \sum n_i Y_i &\mapsto \sum n_i (Y_i \cap U)
    \end{align*}
    with \(Y_i \cap U = \emptyset\) interpreted as \(0\).
  \item If \(\codim(Z, X) \geq 2\) then the homomorphism is an isomorphism.
  \item If \(Z\) is irreducible of codimension \(1\) then there is an exact sequence
    \[
      \begin{tikzcd}
        \Z \ar[r] & \Cl X \ar[r] & \Cl U \ar[r] & 0
      \end{tikzcd}
    \]
    where the first map is \(\Z \to \Cl X, 1 \mapsto [Z]\).
  \end{enumerate}
\end{proposition}

\begin{proof}\leavevmode
  \begin{enumerate}
  \item If \(Y\) is a prime divisor of \(X\) then \(Y \cap U\) is a prime divisor of \(V\) (provided it is not empty). If \(f \in K(X)^* = K(U)^*\) then the image of \((f)\) under the map is \((f)_U\) since \(v_Y(f) = v_{Y \cap U}(f)\). The map is surjective as any prime divisor \(Y\) of \(U\) satisfies \(Y = \overline Y \cap U\) with \(\overline Y\) a prime divisor on \(X\).
  \item \(\Div X = \Div U\).
  \item \(\ker (\Cl X \to \Cl U)\) consists of divisors contained only in \(Z\). As \(Z\) is irreducible, there is precisely one such prime divisor.
  \end{enumerate}
\end{proof}

\begin{proposition}
  \(\Cl \P_k^n \cong \Z\) and is generated by the divisor class of \(H = V((x_i))\).
\end{proposition}

\begin{proof}
  Note \(\P^n_k \setminus H = D_+(x_i) \cong \A^n_k\). But \(\Cl \A_k^n = 0\) since \(k[y_1, \dots, y_n]\) is a UFD. Thus we have a surjection \(\Z \to \Cl \P_k^n, 1 \mapsto [H]\). A rational function on \(\P^n_k\) is a fraction \(\frac{f}{g}\) with \(f, g \in k[x_0, \dots, x_n]\) homogeneous of the same degree. Thus if \(d \cdot H \sim 0\) then there is a rational function \(\varphi\) with \((\varphi) = d \cdot H\), which is impossible unless \(d = 0\).
\end{proof}

\subsection{Cartier divisor}

\begin{definition}[sheaf of rational functions]\index{sheaf of rational functions}
  Let \(X\) be a scheme. We define the \emph{sheaf of rational functions on \(X\)}, \(\sh K_X\), to be the sheaf associated to the presheaf \(U \mapsto S(U)^{-1} \Gamma(U, \sh O_X)\) where \(S(U) \subseteq \Gamma(U, \sh O_X)\) is the set of elements whose stalks in \(\sh O_{X, x}\) are non-zero divisors for each \(x \in U\).
\end{definition}

\begin{remark}
  If \(X\) is integral then this is the constant sheaf \(U \mapsto K(X)\).
\end{remark}

Let \(\sh K_X^* \subseteq \sh K_X\) be the subsheaf of invertible elements. Then we have an inclusion \(\sh O_X^* \embed \sh K_X^*\) (since it is an inclusion at the presheaf level).

\begin{definition}[Cartier divisor]\index{Cartier divisor}\index{Cartier divisor!principal}\index{Cartier divisor!linearly equivalent}
  A \emph{Cartier divisor} on a scheme \(X\) is a global section of \(\sh K_X^*/\sh O_X^*\).

  A Cartier divisor is \emph{principal} if it is the image of the homomorphism \(\Gamma(X, \sh K_X^*) \to \Gamma(X, \sh K_X^*/\sh O_X^*)\).

  Two divisors are \emph{linearly equivalent} if their difference is principal.

  We write \(\CaCl(X)\) to be the group of Cartier divisors modulo principal divisors.
\end{definition}

\begin{remark}
  We have a short exact sequence
  \[
    \begin{tikzcd}
      0 \ar[r] & \sh O_X^* \ar[r] & \sh K_X^* \ar[r] & \sh K_X^*/\sh O_X^* \ar[r] & 0
    \end{tikzcd}
  \]
  so the divisor group measures the failure of the global section functor to be exact.
\end{remark}

Note that locally, however, the last map in the short exact sequence is surjective on sections so a Cartier divisor can always be represented by \(\{(U_i, f_i)\}_{i \in I}\) where \(\{U_i\}_{i \in I}\) is an open cover of \(X\), \(f_i \in \Gamma(U_i, \sh K_X^*)\) and on \(U_i \cap U_j\), \(\frac{f_i}{f_j}|_{U_i \cap U_j} \in \sh O_X^*(U_i \cap U_j)\).

\paragraph{Relationship to Weil divisors}

We assume \(X\) satisfies the assumptions. Then there exists a homomorphism \(\Gamma(X, \sh K_X^*/\sh O_X^*) \to \Div X\) descending to a homomorphism \(\CaCl(X) \to \Cl X\): given a Cartier divisor \(\{(U_i, f_i)\}\) and \(Y\) a prime divisor on \(X\), choose \(i\) so that \(U_i \cap Y \neq \emptyset\), so \(U_i \cap Y\) can be thought of a prime divisor on \(U_i\). Let \(n_Y = v_{U_i \cap Y}(f_i)\). Note this is independent of choice of \(i\): if \(U_j \cap Y \neq \emptyset\) then on \(U_i \cap U_j\), \(f_j = f_i \cdot f\) with \(f \in \sh O_X^*(U_i \cap U_j)\) and then
\[
  v_Y(f_j) = v_Y(f_i \cdot f) = v_Y(f_i) + v_Y(f) = v_Y(f_i).
\]
Then set \(D = \sum n_Y \cdot Y\) (to check this is a finite sum, use quasi-compactness of \(X\) to assume \(\{U_i\}\) is a finite cover).

Note that a principal divisor can be represented by \(\{(X, f)\}\) with \(f \in \Gamma(X, \sh K_X^*) = K(X)^*\), which is mapped to \((f) \in \Div X\). Thus the map descends to a map \(\CaCl X \to \Cl X\).

\begin{proposition}
  If \(X\) satisfies the assumptions and all local rings of \(X\) are UFDs (i.e.\ \(X\) is locally factorial) then the map \(\Gamma(X, \sh K_X^*/\sh O_X^*) \to \Div X\) is an isomorphism.
\end{proposition}

\begin{remark}
  If \(X\) is non-singular, i.e.\ all \(\sh O_{X, x}\) are regular then \(\sh O_{X, x}\) is a UFD. This is a theorem of Serre.

  As a counterexample, \(\Spec k[x, y, z, w]/(xy - zw)\) is not locally factorial, essentially because it is singular at \((x, y, z, w)\).
\end{remark}

\begin{proof}
  Need to construct the inverse map. Let \(D\) be a Weil divisor on \(X\). Let \(x \in X\). Then \(D\) induces a Weil divisor \(D_x\) on \(\Spec \sh O_{X, x}\): indeed we have a natural morphism \(\Spec \sh O_{X, x} \to X\) induced by localisation of any affine neighbourhood of \(x\) and can take inverse image of prime divisors under this map. Since \(\sh O_{X, x}\) is a UFD, \(\Cl \Spec \sh O_{X, x} = 0\) and hence exists \(f_x \in K(X)^*\) such that \((f_x) = D_x\). Now consider \((f_x)\) on \(X\). This may differ from \(D\) on prime divisors not containing \(x\). Nevertheless there exists an open neighbourhood \(U\) of \(x\) on which \((f_x) = D|_{U_x}\). We do this for all \(x\) and then represent \(D\) as the Cartier divisor \(\{(U_x, f_x)\}_{x \in X}\). On \(U_x \cap U_y\), \((f_x)\) and \((f_y)\) agree as both agree with \(D|_{U_i \cap U_j}\). So \(\frac{f_x}{f_y}\) is invertible in \(\sh O_{X, \mathfrak p}\) for all \(\mathfrak p \in U_x \cap U_y\) with \(\dim \sh O_{X, \mathfrak p} = 1\). If we cover \(U_x \cap U_y\) by open affines \(\Spec A\), this says \(\frac{f_x}{f_y} \in A_{\mathfrak p}\) for all \(\mathfrak p \in \Spec A\) of height \(1\). But since \(A_{\mathfrak q}\) is a UFD, hence integrally closed for all \(\mathfrak q \in \Spec A\), \(A\) is integrally closed and by Matsumura \(\frac{f_x}{f_y} \in A\). Thus \(\frac{f_x}{f_y} \in \Gamma(U_i \cap U_j, \sh O_X)\) and same for \(\frac{f_y}{f_x}\). Thus \(\frac{f_x}{f_y} \in \Gamma(U_i \cap U_j, \sh O_X^*)\).
\end{proof}

\paragraph{Correspondence between Cartier divisors and line bundles}

\begin{definition}
  Let \(D\) be a Cartier divisor on \(X\) represented by \(\{(U_i, f_i)\}\). Define \(\sh O_X(D)\) to be the subsheaf of \(\sh O_X\)-modules of \(\sh K_X\) generated by \(f_i^{-1}\) on \(U_i\).
\end{definition}

Note that as \(\frac{f_i}{f_j} \in \Gamma(U_i \cap U_j, \sh O_X^*)\), \(f_i^{-1}\) and \(f_j^{-1}\) generate the same \(\sh O_X\)-module over \(U_i \cap U_j\). Also note that \(\sh O_X(D)\) is a locally free sheaf of rank \(1\). For those interested in number theory, this defines a fractional ideal for a Dedekind domain.

\begin{remark}
  The local trivialising map is
  \begin{align*}
    \sh O_X|_{U_i} &\to \sh O_X(D)|_{U_i} \\
    s &\mapsto s \cdot f_i^{-1}
  \end{align*}
  so the transition map on \(U_i \cap U_j\) is given by \(\frac{f_j}{f_i} \in \sh O_X^*(U_i \cap U_j)\). Consequently \(\sh O_X(D_1) \otimes \sh O_X(D_2)^\vee \cong \sh O_X(D_1 - D_2)\), so we have a group homomorphism \(\Gamma(X, \sh K_X^*/\sh O_X^*) \to \Pic X\).
\end{remark}

\begin{lemma}
  \(D_1 \sim D_2\) if and only if \(\sh O_X(D_1) \cong \sh O_X(D_2)\).
\end{lemma}

\begin{proof}
  Suffices to show \(D\) is principal if and only if \(\sh O_X(D) = \sh O_X\). If \(D\) is principal then \(D\) is represented by \(\{(X, f)\}\) for some \(f \in \Gamma(X, \sh K_X^*)\). Thus
  \begin{align*}
    \sh O_X(D) = \sh O_X \cdot f^{-1} &\to \sh O_X \\
    s &\mapsto sf
  \end{align*}
  is an isomorphism. Conversely if \(\sh O_X(D) \cong \sh O_X\), \(1 \in \Gamma(X, \sh O_X)\) be identified with some \(f \in \Gamma(X, \sh O_X(D)) \subseteq \Gamma(X, \sh K_X)\). Thus \(\{(X, f^{-1})\}\) represents the Cartier divisor \(D = \{(U_i, g_i)\}\) since on \(U_i\), \(f^{-1}\) and \(g_i\) differ by a factor in \(\Gamma(U_i, \sh O_X^*)\), as both \(f^{-1}|_{U_i}\) and \(g_i\) generate \(\sh O_X(D)|_{U_i}\). Thus \(D\) is principal.
\end{proof}

\begin{corollary}
  There is an injective homomorphism
  \begin{align*}
    \CaCl X &\to \Pic X \\
    [D] &\mapsto [\sh O_X(D)]
  \end{align*}
\end{corollary}

\begin{proposition}
  If \(X\) is integral then the map is an isomorphism.
\end{proposition}

\begin{proof}
  Omitted. The idea is to show that if \(X\) is integral then every line bundle on \(X\) is isomorphic to a subsheaf of \(\sh K_X\).
\end{proof}

\begin{eg}
  \(\P_k^n\) satisfies all hypotheses necessary to obtain
  \[
    \Cl \P^n \cong \CaCl \P^n \cong \Pic \P^n.
  \]
  We have calculated \(\Cl \P^n = \Z[H]\) for any hyperplane \(H\). We will later see that the image of \([H]\) in \(\Pic \P^n\) is \(\sh O_{\P^n}(1)\). We will call the image of \(d [H]\) \(\sh O_{\P^n}(d)\). Since this is is a homomorphism, we have
  \[
    \sh O_{\P^n}(d) =
    \begin{cases}
      \sh O_{\P^n}(1)^{\otimes d} & d > 0 \\
      \sh O_{\P^n}(-d)^\vee & d < 0
    \end{cases}
  \]
\end{eg}

\paragraph{Effective divisors}

\begin{definition}[effective divisor]\index{effective divisor}
  Assume \(X\) is integral (and for Weil divisor satisfying the assumptions). A Weil divisor \(\sum a_i Y_i\) is \emph{effective} if \(a_i \geq 0\) for all \(i\).

  A Cartier divisor is \emph{effective} if it is represented by \(\{(U_i, f_i)\}\) with \(f_i \in \Gamma(U_i, \sh O_X)\) for all \(i\).
\end{definition}

If \(s \in \Gamma(X, \sh L)\) for \(\sh L\) a line bundle, \(\{U_i\}\) a trivialising cover with \(\varphi_i: \sh L|_{U_i} \to \sh O_{U_i}\) then we get a Cartier divisor \((s)_0 = \{(U_i, \varphi_i(s|_{U_i}))\}\) provided \(s \neq 0\) as \(X\) integral implies that \(s \in K(X)^* = \Gamma(X, \sh K_X^*)\). This is an effective Cartier divisor: \(\varphi_i(s|_{U_i}) \in \Gamma(U_i, \sh O_X)\) and on \(U_i \cap U_j\), \(\frac{\varphi_i(s|_{U_i})}{\varphi_j(s|_{U_j})}\) is the transition function for \(\sh L\), which lies in \(\Gamma(U_i \cap U_j, \sh O_X^*)\). This is called the \emph{divisor of zeros of \(s\)}\index{divisor of zeros}.

\begin{theorem}
  Let \(X \subseteq \P^n_k\) be a closed subscheme and \(\sh F\) a coherent sheaf of \(\sh O_X\)-modules. Then \(\Gamma(X, \sh F)\) is a finite dimensional \(k\)-vector space.
\end{theorem}

\begin{proof}
  Hartshorne II, Thm 5.19. The magic word here is \emph{properness}.
\end{proof}

\begin{theorem}
  Let \(X \subseteq \P^n_k\) be an integral closed subscheme (i.e.\ a projective variety). Then \(\Gamma(X, \sh O_X) = k\) if \(k = \overline k\).
\end{theorem}

\begin{proof}
  Hartshorne I, 3.4.
\end{proof}

\begin{theorem}
  Let \(X\) be an integral closed subscheme of \(\P^n_k\) where \(k = \overline k\). Let \(D_0\) be a Cartier divisor on \(X\) and \(\sh L = \sh O_X(D_0)\). Then
  \begin{enumerate}
  \item for every \(s \in \Gamma(X, \sh L), s \neq 0\), \((s)_0\) is an effective Cartier divisor linearly equivalent to \(D_0\).
  \item every effective divisor linearly equivalent to \(D_0\) is of the form \((s)_0\) for some \(s \in \Gamma(X, \sh L)\).
  \item two sections \(s, s' \in \Gamma(X, \sh L)\) give the same divisor if and only if there exists \(\lambda \in k^*\) with \(s = \lambda s'\).
  \end{enumerate}
\end{theorem}

This says that we have a natural isomorphism
\[
  \P(\Gamma(X, \sh L)) = (\Gamma(X, \sh L) \setminus \{0\})/k^* \cong |D_0|.
\]
where \(|D_0| = \{D' \text{ Cartier effective}: D' \sim D_0\}\) is a \emph{complete linear system}\index{complete linear system}.

\begin{proof}\leavevmode
  \begin{enumerate}
  \item We have seen \((s)_0\) is effective so left to show it is linearly equivalent to \(D_0\). \(\sh O_X(D_0) \subseteq \sh K_X\) so \(s \in \Gamma(X, \sh L)\) corresponds to some \(f \in \Gamma(X, \sh K_X) = K(X)\). If \(D_0\) is represented by \(\{(U_i, f_i)\}\) then \(\sh O_X(D_0)\) is locally generated by \(f_i^{-1}\), giving trivialisations
    \begin{align*}
      \varphi_i: \sh O_X(D_0)|_{U_i} &\to \sh O_{U_i} \\
      t &\mapsto t \cdot f_i
    \end{align*}
    so \(f \mapsto f \cdot f_i\) and \((s)_0\) is represented by \(\{(U_i, f \cdot f_i)\}\). Thus \((s)_0 = D_0 + (f)\).
  \item If \(D\) is effective and \(D = D_0 + (f)\) then write \(D = \{(U_i, f_i \cdot f)\}\) with \(f_i \cdot f \in \Gamma(U_i, \sh O_X)\). Then \(\varphi_i^{-1}(f_i \cdot f)\) is a section of \(\sh O_X(D_0)|_{U_i}\) and is equal to \(f\). Thus \(f\) determines a global section \(s\) of \(\sh O_X(D_0)\) with \((s)_0 = D\).
  \item If \((s)_0 = (s')_0\) then \((s)_0 = D_0 + (f), (s')_0 = D_0 + (f')\) and \((\frac{f}{f'}) = 0\) so \(\frac{f}{f'} \in \Gamma(X, \sh O_X^*) = k^*\) by the assumption that \(X\) is projective and \(k = \overline k\).
  \end{enumerate}
\end{proof}

\begin{eg}
  Let \(X = \P^n\) and \(s \in \Gamma(\P^n, \sh O_{\P^n}(1))\). Recall that the transition maps from \(U_i = D_+(x_i)\) to \(U_j = D_+(x_j)\) is \(\frac{x_i}{x_j}\). Then one section of \(\sh O_{\P^n}(1)\) is given by \(\frac{x_0}{x_i}\) on \(U_i\). The divisor of zeros is \((s)_0 = \{(U_i, \frac{x_0}{x_i})\}\), and \(H_0 = V(x_0)\) is a prime Weil divisor. It's not hard to see that \(\Gamma(X, \sh O_{\P^n}(1)) = S_1\), the space of linear homogeneous polynomials.
\end{eg}

We can refine the correspondence between divisor and line bundle if we expand our vocabulary.

\begin{definition}[support of an effective divisor]\index{support}
  If \(D = \{(U_i, f_i)\}\) is an effective Cartier divisor then define its \emph{support} to be
  \[
    \Supp D = \bigcup_i \{x \in U_i: f_i \in \mathfrak m_x \subseteq \sh O_{X, x}\}.
  \]
\end{definition}
Then for a Weil divisor,
\[
  \Supp \sum a_iY_i = \bigcup_{a_i \neq 0} Y_i.
\]

\begin{definition}[linear system, basepoint-free]\index{linear system}\index{basepoint-free}
  A linear subspace \(\mathfrak D \leq |D|\) is called a \emph{linear system}. We say \(\mathfrak D\) is \emph{basepoint-free} if for all \(x \in X\), exists \(D' \in \mathfrak D\) such that \(x \notin \Supp D'\).
\end{definition}

We can summarise the result as follow. Assume \(X\) is a projective variety over an algebraically closed field \(k\).

\begin{table}[h]
  \centering
  \begin{tabular}{p{0.5\textwidth}|p{0.5\textwidth}}
    line bundle & Cartier divisor \\ \hline
    line bundle \(\sh L\) on \(X\) & \(D \in \CaCl X\) with \(\sh L \cong \sh O_X(D)\) \\ \hline
    section \(s \in \Gamma(X, \sh L)\) & effective Cartier divisor \((s)_0\) linearly equivalent to \(D\) \\ \hline
    \(\P(\Gamma(X, \sh L)) = (\Gamma(X, \sh L) \setminus \{0\})/k^*\) & complete linear system \(|D|\) \\ \hline
    \(s_0, \dots, s_n \in \Gamma(X, \sh L)\) inducing a morphism \(\sh O_X^{\oplus (n + 1)} \to \sh L\) & linear system \(\mathfrak D\) spanned by \(s_0, \dots, s_n\) \\ \hline
    \(\sh L\) globally generated\index{globally generated} by sections \(s_0, \dots, s_n\), i.e.\ \(\sh O_X^{\oplus(n + 1)} \surj \sh L\), inducing a morphism \(X \to \P^n\) & basepoint-free \(\mathfrak D\) inducing a morphism \(\varphi: X \to \P^n\) after choosing a basis \(s_0, \dots, s_n\) of the corresponding vector space. Pullbacks of hyperplanes in \(\P^n\) give all elements of \(\mathfrak D\) \\ \hline
    if sections of \(\sh L\) define a closed immersion \(X \to \P^n\), say \(\sh L\) \emph{very ample}\index{very ample} & if \(|D|\) induces a closed immersion \(X \to \P^n\), say \(|D|\) is \emph{very ample} \\ \hline
    if \(\sh L^{\otimes m}\) is very ample for some \(m > 0\), say \(\sh L\) \emph{ample}\index{ample} & if \(mD\) is very ample for some \(m > 0\), say \(|D|\) is \emph{ample}
  \end{tabular}
  \caption{Dictionary between line bundle and Cartier divisor}
\end{table}

\begin{remark}
  There exists a (subtle) criterion for ampleness on example sheet 3. There also exists a numerical criterion for ampleness (degrees of pullbacks to curves on varieties). It is important to control how many sections a line bundle has.
\end{remark}

\section{Cohomology of sheaves}

If
\[
  \begin{tikzcd}
    0 \ar[r] & \sh F' \ar[r] & \sh F \ar[r] & \sh F'' \ar[r] & 0
  \end{tikzcd}
\]
is a short exact sequence of sheaves of abelian groups, then
\[
  \begin{tikzcd}
    0 \ar[r] & \Gamma(X, \sh F') \ar[r] & \Gamma(X, \sh F) \ar[r] & \Gamma(X, \sh F'')
  \end{tikzcd}
\]
is exact, but in general the last map is not surjective. Can we extend this to a long exact sequence? There is a very general solution to this type of question: \emph{derived functors}\index{derived functor}. In this case they are the right derived functor of \(\Gamma(X, \cdot)\), written as \(H^i(X, \cdot)\), the \(i\)th \emph{cohomology} functor.

We first give a list of properties of \(H^i(X, \cdot)\) and then give a sketch of its construction. \(H^i(X, \cdot): \c{Sh}_X \to \c{Ab}\) is a covariant functor with the following properties:
\begin{enumerate}
\item If \(\begin{tikzcd}
    0 \ar[r] & \sh F' \ar[r] & \sh F \ar[r] & \sh F'' \ar[r] & 0
  \end{tikzcd}
  \) is a short exact sequence then there are homomorphisms \(\delta: H^i(X, \sh F'') \to H^{i + 1}(X, \sh F')\) giving rise to a long exact sequence
  \[
    \begin{tikzcd}
      & & 0 \ar[dll, out=0, in=180, overlay] \\
      H^0(X, \sh F') \ar[r] & H^0(X, \sh F) \ar[r] & H^0(X, \sh F'') \ar[dll, "\delta"', out=0, in=180, overlay] \\
      H^1(X, \sh F') \ar[r] & H^1(X, \sh F) \ar[r] & H^1(X, \sh F'') \ar[dll, "\delta"', out=0, in=180, overlay] \\
      H^2(X, \sh F') \ar[r] & \cdots
    \end{tikzcd}
  \]
\item Given a commutative diagrams of short exact sequences
  \[
    \begin{tikzcd}
      0 \ar[r] & \sh F' \ar[r] \ar[d] & \sh F \ar[r] \ar[d] & \sh F'' \ar[r] \ar[d] & 0 \\
      0 \ar[r] & \sh G' \ar[r] & \sh G \ar[r] & \sh G'' \ar[r] & 0
    \end{tikzcd}
  \]
  we get commutative squares
  \[
    \begin{tikzcd}
      H^i(X, \sh F'') \ar[r, "\delta"] \ar[d] & H^{i + 1}(X, \sh F') \ar[d] \\
      H^i(X, \sh G'') \ar[r, "\delta"] & H^{i + 1}(X, \sh G')
    \end{tikzcd}
  \]
\item Whenever \(\sh F\) is \emph{flasque}\index{flasque} or \emph{flabby}\index{flabby}, i.e.\ all restriction maps are surjective, \(H^i(X, \sh F) = 0\) for \(i > 0\).
\item \(H^0(X, \sh F) = \Gamma(X, \sh F)\).
\end{enumerate}

The construction of sheaf cohomology is similar to other derived functors in homological algebra. Recall that an abelian group \(I\) is \emph{injective}\index{injective module} if given any diagram where the row is exact
\[
  \begin{tikzcd}
    & I \\
    0 \ar[r] & A \ar[r, "i"] \ar[u, "f"] & B \ar[ul, dotted, "g"']
  \end{tikzcd}
\]
exists \(g: B \to I\) making the diagram commute. Examples include \(\Q\), and more generally any divisible group \(G\), i.e.\ if \(g \in G, n \in \Z, n > 0\) then exists \(g' \in G\) such that \(ng' = g\).

It is a fact that every abelian group \(A\) has an inclusion \(
\begin{tikzcd}
  0 \ar[r] & A \ar[r] & I
\end{tikzcd}
\) for some \(I\) injective. This gives an \emph{injective resolution}\index{injective resolution} of \(A\) which is a sequence
\[
  \begin{tikzcd}
    0 \ar[r] & A \ar[r, "\epsilon"] & I^0 \ar[r] & I^1 \ar[r] & I^2 \ar[r] & \cdots
  \end{tikzcd}
\]
where \(I^n\) is injective and the sequence is exact at \(I^n\) for all \(n\).

We use this to get injective resolutions of sheaves. If \(\sh F\) is a sheaf of abelian groups on \(X\), then for all \(x \in X\) we get an inclusion \(
\begin{tikzcd}
  0 \ar[r] & \sh F_x \ar[r] & I_x
\end{tikzcd}
\) where \(I_x\) is injecitve. Let \(I_x\) also denote the corresponding sheaf on \(\{x\}\) and let \(i_x: \{x\} \embed X\) be the inclusion. Define
\[
  \sh I = \prod_{x \in X} (i_x)_* I_x,
\]
we then get an inclusion \(
\begin{tikzcd}
  0 \ar[r] & \sh F \ar[r] & \sh I
\end{tikzcd}
\) and one can show \(\sh I\) is injective in the category of sheaves of abelian groups. This shows that the category of sheaves of abelian groups \emph{has enough injectives}.

We then obtain an injective resolution of \(\sh F\)
\[
  \begin{tikzcd}
    0 \ar[r] & \sh F \ar[r] & \sh I^0 \ar[r, "d^0"] & \sh I^1 \ar[r, "d^1"] & \sh I^2 \ar[r, "d^2"] & \cdots
  \end{tikzcd}
\]
and define
\[
  H^i(X, \sh F) = \frac{\ker d^i: \Gamma(X, \sh I^i) \to \Gamma(X, \sh I^{i + 1})}{\im d^{i - 1}: \Gamma(X, \sh I^{i - 1}) \to \Gamma(X, \sh I^i)}.
\]
It does satisfy properties of a cohomology functor and the properties listed above.

\subsection{Čech cohomology}
\index{Cech cohomology@Čech cohomology}

Let \(X\) be a topological space, \(\sh F\) a sheaf of abelian groups on \(X\). Let \(\mathcal U = \{U_i\}\) be an open cover and choose a well-ordering on \(I\). Write \(U_{i_0 \cdots i_p} = U_{i_0} \cap \cdots \cap U_{i_p}\). Set
\[
  \check C^p(\mathcal U, \sh F) = \prod_{i_0 < \cdots < i_p} \sh F(U_{i_0 \cdots i_p}).
\]
Write \(\alpha \in \check C^p(\mathcal U, \sh F)\) as \(\alpha = (\alpha_{i_0 \cdots i_p})_{i_0 < \cdots < i_p}\), then we define the coboundary map
\begin{align*}
  d: \check C^p(\mathcal U, \sh F) &\to \check C^{p + 1}(\mathcal U, \sh F) \\
  d((\alpha_{i_0 \cdots i_p})_{i_0 < \cdots < i_p})_{j_0 < \cdots < j_{p + 1}} &= \sum_{k = 0}^{p + 1} (-1)^k \alpha_{j_0 \cdots \hat j_k \cdots j_{p + 1}}|_{U_{j_0 \cdots j_{p + 1}}}
\end{align*}

\begin{ex}
  \(d^2 = 0\).
\end{ex}
We then define
\[
  \check H^p(\mathcal U, \sh F) = H^p(\check C^\bullet(\mathcal U, \sh F)) = \frac{\ker d: \check C^p \to \check C^{p + 1}}{\im d: \check C^{p - 1} \to \check C^p}
\]

\begin{eg}\leavevmode
  \begin{enumerate}
  \item Let \(X = S^1\), \(\sh F\) the constant sheaf \(\Z\), i.e.\ \(\sh F(U) = \{f: U \to \Z \text{ continuous}\}\). Take an open cover \(\{U_0 = X - \{1\}, U_1 = X - \{0\}\}\) of \(S^1\). Then
    \begin{align*}
      \check C^0(\mathcal U, \sh F) &= \sh F(U_0) \times \sh F(U_1) = \Z \times \Z \\
      \check C^1(\mathcal U, \sh F) &= \sh F(U_0 \cap U_1) = \Z \times \Z
    \end{align*}
    and the coboundary map is
    \begin{align*}
      d: \Z \times \Z &\to \Z \times \Z \\
      (a, b) &\mapsto (b - a, b - a)
    \end{align*}
    so
    \begin{align*}
      \ker d &= \check H^0(\mathcal U, \sh F) = \Z(1, 1) \cong \Z \\
      \coker d &= \check H^1(\mathcal U, \sh F) = \Z^2/\Z(1, 1) \cong \Z
    \end{align*}
    and of course the higher cohomology groups vanish. It is not a coincidence that this gives the same result as the ``ordinary cohomologies'' for topological spaces, as long as the cover satisfies certain properties.
  \item \(\sh F = \sh O_{\P^1}(-2) = (\sh O_{\P^1}(-1) \otimes \sh O_{\P^1}(-1))^\vee\). Recall \(\sh O_{\P^1}(1)\) has transition map from \(U_0 = D_+(x_0)\) to \(U_1 = D_+(x_1)\) given by \(\frac{x_0}{x_1}\). Thus \(\sh O_{\P^1}(-2)\) has transition map \(\frac{x_1^2}{x_0^2}\). Let \(\mathcal U = \{U_0, U_1\}\). Then
    \begin{align*}
      \check C^0(\mathcal U, \sh F) &= \Gamma(U_0, \sh F) \times \Gamma(U_1, \sh F) \\
                                               &= k[\frac{x_1}{x_0}] \times k[\frac{x_0}{x_1}] \quad \text{using trivialisations on \(U_0\) and \(U_1\)} \\
      \check C^1(\mathcal U, \sh F) &= \sh F(U_0 \cap U_1) = k[\frac{x_0}{x_1}]_{\frac{x_0}{x_1}} \quad \text{using trivialisation on \(U_1\)}
    \end{align*}
    Then
    \[
      d(f, g) = g - \frac{x_1^2}{x_0^2} \cdot f
    \]
    where the contribution from \(g\) is just inclusion, and the contribution from \(f\) must be multiplied by the transition function. \(\ker d = 0\) as no cancellation is possible. \(\coker d\) is one dimensional, spanned by  \(\frac{x_1}{x_0}\). Thus
    \[
      \check H^0(\mathcal U, \sh F) = 0, \check H^1(\mathcal U, \sh F) = k.
    \]

    Similarly for \(d > 0\), \(\check H^1(\P^1, \sh O_{\P^1}(-d))\) is generated by \(\frac{x_1}{x_0}, \dots, \frac{x_1^{d - 1}}{x_0^{d - 1}}\).
  \end{enumerate}
\end{eg}

To remove the dependence on the cover, we need to take the direct limit of Čech cohomologies with respect to refinement of open cover. However this calculation soon becomes intractable. Fortunately we have

\begin{theorem}
  Let \(X\) be a Noetherian scheme with an open affine cover \(\sh U = \{U_i\}_{i \in I}\) such that \(U_{i_0 \cdots i_p}\) are affine for \(i_0 < \cdots < i_p\). Then \(\check H^p(\mathcal U, \sh F) = H^p(X, \sh F)\) for \(\sh F\) a quasi-coherent sheaf.
\end{theorem}

\begin{proof}
  Omitted.
\end{proof}

Here open affine subsets are analogous to contractible open subsets of a manifold.

\begin{remark}
  If \(X \to S\) is a separated morphism with \(S\) affine then any affine open cover of \(X\) satisfies the hypothesis.
\end{remark}

\begin{theorem}[Grothendieck]
  Let \(X\) be a Noetherian topological space of dimension \(n\), \(\sh F\) a sheaf of abelian groups on \(X\). Then \(H^i(X, \sh F) = 0\) for all \(i > n\).
\end{theorem}

\begin{proof}
  Hartshorne III Thm 2.7.
\end{proof}

\paragraph{Calculation of cohomology of projective space}

Fix \(X = \P_k^r\) where \(r > 0\). We would like to calculate the cohomology of \(\sh O_X(m) = \sh O_{\P^r}(m) = \sh O_X(mH)\) for \(m \in \Z\).

\begin{definition}[perfect pairing]\index{perfect pairing}
  A \emph{perfect pairing} is a bilinear map \(\langle \cdot, \cdot \rangle: V \times W \to k\) of vector spaces such that the induce map \(V \to W^*, v \mapsto \langle v, \cdot \rangle\) is an isomorphism.
\end{definition}

\begin{theorem}
  Let \(S = k[x_0, \dots, x_r]\). Then
  \begin{enumerate}
  \item there exists an isomorphism of graded \(S\)-modules
    \[
      S \cong \bigoplus_{m \in \Z} H^0(X, \sh O_X(m)).
    \]
  \item \(H^i(X, \sh O_X(m)) = 0\) for \(0 < i < r\).
  \item \(H^r(X, \sh O_X(-r - 1)) \cong k\).
  \item there is a perfect pairing
    \[
      H^0(X, \sh O_X(m)) \times H^r(X, \sh O_X(-m - r - 1)) \to H^r(X, \sh O_X(-r - 1)) \cong k.
    \]
  \end{enumerate}
\end{theorem}

\begin{proof}
  Use Čech cohomology with standard covering \(\mathcal U = \{U_i = D_+(x_i): 0 \leq i \leq r\}\). We will calculate all cohomologies at once by calculating cohomologies of \(\sh F = \bigoplus_{m \in \Z} \sh O_X(m)\), as Čech cohomology respects direct sums.

  Recall the transition maps for \(\sh O_X(m)\) from \(U_i\) to \(U_j\) are \(\frac{x_i^m}{x_j^m}\). For \(I \subseteq \{0, \dots, r\}\), \(U_I = \bigcap_{i \in I} U_i = D_+(\prod_{i \in I}x_i)\). The crucial trick is to identify \(\Gamma(U_I, \sh O_X(m))\) with the vector space with basis of Laurent polynomials
  \[
    \{x_0^{a_0} \cdots x_r^{a_r}: a_i \in \Z, \sum a_i = m_i, a_i \geq 0 \text{ unless } i \in I\}.
  \]
  If \(M\) is such a monomial then it induces a section of \(\sh O_X(m)\) on \(U_I\) using the transition coming from \(U_i\) by \(\frac{M}{x_i^m}\). If we instead use the trivialisation on \(U_j\), we note
  \[
    \frac{M}{x_i^m} \cdot \frac{x_i^m}{x_j^m} = \frac{M}{x_j^m}.
  \]
  Thus \(\Gamma(U_I, \sh F)\) can be identified with \(S_{\prod_{i \in I}x_i}\) and restriction maps \(\Gamma(U_I, \sh F) \to \Gamma(U_{I'}, \sh F)\) for \(I \subseteq I'\) are the natural inclusions \(S_{\prod_{i \in I} x_i} \subseteq S_{\prod_{i \in I'} x_i}\) with all these rings subrings of \(S_{x_0 \cdots x_r}\). The Čech complex is thus
  \[
    \begin{tikzcd}
      \displaystyle \prod_{0 \leq i_0 \leq r} S_{x_{i_0}} \ar[r, "d^0"] & \displaystyle \prod_{0 \leq i_0 < i_1 \leq r} S_{x_{i_0} x_{i_1}} \ar[r, "d^1"] & \cdots \ar[r, "d^{r - 1}"] & S_{x_0 \cdots x_r}
    \end{tikzcd}
  \]
  Note \(H^0(X, \sh F) = \ker d^0\) and
  \[
    d^0((M_i)_{0 \leq i \leq r}) = (M_j - M_i)_{0 \leq i < j \leq r}.
  \]
  Thus \(M_i = M_j\) for all \(i, j\) if and only if \((M_i) \in \ker d^0\). Thus
  \[
    \ker d^0 = \bigcap_{i = 0}^r S_{x_i} \subseteq S_{x_0 \cdots x_r}.
  \]
  Any homogeneous element of \(S_{x_0 \cdots x_r}\) can be written uniquely as \(x_0^{i_0} \cdots x_r^{i_r} f(x_0, \dots, x_r)\) with \(f \in S\) homogeneous and not divisible by any \(x_i\) with \(i_0, \dots, i_r \in \Z\). This lives in \(S_{x_i}\) if and only if \(i_j \geq 0\) for \(j \neq i\). Thus \(x_0^{i_0} \cdots x_r^{i_r} f \in \bigcap S_{x_i}\) if and only if \(i_j \geq 0\) for all \(j\). Thus \(\bigcap S_{x_i} = S\), so \(H^0(X, \sh F) = S\). As this is an isomorphism of graded modules,
  \[
    H^0(X, \sh O_X(m)) = S_m = \text{homogeneous elments of \(S\) of degree \(m\)}.
  \]

  Next consider
  \begin{align*}
    d^{r - 1}: \prod_k S_{x_0 \cdots \hat x_k \cdots x_r} &\to S_{x_0 \cdots x_r} \\
    (M_k) &\mapsto \sum (-1)^k M_k
  \end{align*}
  Note \(S_{x_0 \cdots x_r}\) is a \(k\)-vector space with basis consisting of all Laurent monomials \(x_0^{i_0} \cdots x_r^{i_r}, i_0, \dots, i_r \in \Z\), while \(S_{x_0 \cdots \hat x_k \cdots x_r}\) has a basis of monomials \(x_0^{i_0} \cdots x_r^{i_r}\) with \(i_k \geq 0\). Thus \(\im d^{r - 1}\) has a basis consisting of monomials \(x_0^{i_0} \cdots x_r^{i_r}\) with at least one \(i_j \geq 0\). So \(\coker d_{r - 1}\) has a basis \(\{x_0^{i_0} \cdots x_r^{i_r}: i_j < 0\}\). In degree \(-r - 1\), the only basis vector is \((x_0 \cdots x_r)^{-1}\). Thus
  \[
    H^r(X, \sh O_X(-r - 1)) \cong k.
  \]

  For perfect pairing, note that \(H^0(X, \sh O_X(m)) = 0\) for \(m < 0\) since \(S_m = 0\). Also \(H^r(X, \sh O_X(-m - r - 1)) = 0\) for \(m < 0\). Thus the pairing is trivial if \(m < 0\). If \(m \geq 0\), we have a basis for \(H^0(X, \sh O_X(m))\) given by
  \[
    \{x_0^{i_0} \cdots x_r^{i_r}: \sum i_j = m, i_j \geq 0\}
  \]
  and the pairing is given on the level of basis vectors by
  \[
    \underbrace{(x_0^{i_0} \cdots x_r^{i_r})}_{\substack{\sum i_k = m \\ i_k \geq 0}} \cdot
    \underbrace{(x_0^{j_0} \cdots x_r^{j_r})}_{\substack{\sum j_k = -m - r - 1 \\ j_k < 0}}
    = x_0^{i_0 + j_0} \cdots x_r^{i_r + j_r}
  \]
  where RHS should be interpreted as \(0\) if any \(i_k + j_k \geq 0\). As a sanity check, it has degree \(m - m -r - 1 = -r - 1\). Note that \(x_0^{-i_0 - 1} \cdots x_r^{-i_r - 1}\) is the dual basis vector to \(x_0^{i_0} \cdots x_r^{i_r}\). Hence the pairing is perfect.

  It remains to show \(H^i(X, \sh O_X(m)) = 0\) for \(0 < i < r\). Induction on \(r\). The base case \(r = 1\) is vacuously true. Assume true for \(r - 1\). If we localise \(\check C^\bullet(\mathcal U, \sh F)\) at \(x_r\) as a graded \(S\)-module, the Čech complex now calculates the cohomology of \(\sh F|_{U_r}\) using the open covering \(\{U_i \cap U_r: 0 \leq i \leq r\}\). But \(U_r \cong \A^n_k\) and any quasi-coherent sheaf \(\sh F\) on an affine scheme \(Y\) has \(H^i(Y, \sh F) = 0\) for all \(i > 0\), so \(H^i(U_r, \sh F|_{U_r}) = 0\) for all \(i > 0\) and thus \(\check C^\bullet(\mathcal U, \sh F)_{x_r}\) has cohomology vanishing in degree \(> 0\). Since localisation is exact, we see \(H^i(X, \sh F)_{x_r} = 0\) for all \(i > 0\). Thus for \(i > 0\) every element of \(H^i(X, \sh F)\) is annihilated by some power of \(x_r\). Let \(H = V((x_r)) \subseteq \P^r\). Note that we can view \(H\) as the closed subscheme \(\Proj S/(x_r) = \Proj k[x_0, \dots, x_{r - 1}]\) so \(H \cong \P^{r - 1}\). In particular we have a surjective map \(\sh O_{\P^r} \to i_* \sh O_H\) where \(i: H \to \P^r\) is the inclusion. The kernel is the \emph{ideal sheaf}\index{ideal sheaf} \(\sh I\) of \(H\) in \(\P^r\), and as \(H\) is defined by a single equation, \(\sh I\) is a line bundle. On \(U_i = \Spec S_{(x_i)}\), \(\sh I\) is generated by \(\frac{x_r}{x_i}\), i.e.\ \(H \cap U_i = \Spec \frac{S_{x_i}}{(x_r/x_i)}\). Thus \(\sh I\) is a line bundle with transition maps
  \begin{align*}
    \sh O_{U_i}|_{U_i \cap U_j} &\to \sh I|_{U_i \cap U_j} \to \sh O_{U_j}|_{U_i \cap U_j} \\
    1 &\mapsto \frac{x_r}{x_i} \mapsto \frac{x_r}{x_i} \cdot \frac{x_j}{x_r}
  \end{align*}
  so \(\sh I \cong \sh O_X(-1)\). We now have an exact sequence
  \[
    \begin{tikzcd}
      0 \ar[r] & \sh O_X(-1) \ar[r, "- \cdot x_r"] & \sh O_X \ar[r] & i_* \sh O_H \ar[r] & 0
    \end{tikzcd}
  \]
  where \(- \cdot x_r\) means multiplication by \(\frac{x_r}{x_i}\) on \(U_i\) under standard trivialisation. Tensoring with \(\sh O_X(m)\) we get an exact sequence
  \[
    \begin{tikzcd}
      0 \ar[r] & \sh O_X(m - 1) \ar[r, "- \cdot x_r"] & \sh O_X(m) \ar[r] & (i_* \sh O_H) \otimes \sh O_X(m) \ar[r] & 0
    \end{tikzcd}
  \]
  since \(\sh O_X(m)\) is locally free. On the other hand \((i_* \sh O_H) \otimes \sh O_X(m) = i_* \sh O_H(m)\) since transition maps for \(\sh O_X(m)\) restrict to transition maps for \(\sh O_H(m)\). Direct sum over all \(m\),
  \[
    \begin{tikzcd}
      0 \ar[r] & \sh F(-1) \ar[r, "-\cdot x_r"] & \sh F \ar[r] & i_* \sh F_H \ar[r] & 0
    \end{tikzcd}
  \]
  where \(\sh F(-1) = \sh F \otimes \sh O_X(-1)\) is the same module as \(\sh F\) with grading shifted by \(1\). We get a long exact sequence
  \[
    \begin{tikzcd}
      \cdots \ar[r] & H^j(X, \sh F(-1)) \ar[r, "- \cdot x_r"] & H^j(X, \sh F) \ar[r] & H^j(X, i_* \sh F_H) \ar[r] & \cdots
    \end{tikzcd}
  \]
  The induction hypothesis says \(H^j(X, \sh F_H) = H^j(H, \sh F_H) = 0\) as the Cech complexes are the same using covers \(\{U_i\}\) and \(\{U_i \cap H\}\). Write \(H^j(X, \sh F_H)\) for \(H^j(X, i_* \sh F_H)\). If \(1 < j < r - 1\) we get a short exact sequence
  \[
    \begin{tikzcd}
      0 \ar[r] & H^j(X, \sh F(-1)) \ar[r, "- \cdot x_r"] & H^j(X, \sh F) \ar[r] & 0
    \end{tikzcd}
  \]
  so multiplication by \(x_r\) is an isomorphism. But we know every element of \(H^j(X, \sh F)\) is annihilated by a power of \(x_r\), so \(H^j(X, \sh F) = 0\).

  Now we are left with two boundary cases. If \(j = 1\) we get
  \[
    \begin{tikzcd}[row sep=scriptsize]
      & S(-1) \ar[d, equal] & S \ar[d, equal] & S/(x_r) \ar[d, equal] \\
      0 \ar[r] & H^0(X, \sh F(-1)) \ar[r, "- \cdot x_r"] & H^0(X, \sh F) \ar[r] & H^0(H, \sh F_H) \ar[dll, overlay, in=180, out=0] \\
      & H^1(X, \sh F(-1)) \ar[r, "- \cdot x_r"] & H^1(X, \sh F)
    \end{tikzcd}
  \]
  where \(S(-1)\) is the graded \(S\)-module with \(S(-1)_d = S_{d - 1}\). The map \(H^0(X, \sh F) \to H^0(X, \sh F_H)\) is surjective so \(H^0(X, \sh F_H) \to H^1(X, \sh F(-1))\) is \(0\). Thus \(- \cdot x_r: H^1(X, \sh F(-1)) \to H^1(X, \sh F)\) is surjective and hence \(H^1(X, \sh F) = 0\).

  For \(j = r - 1\), we have
  \[
    \begin{tikzcd}[row sep=scriptsize, column sep=small]
      H^{r - 1}(H, \sh F_H) \ar[r] & H^r(X, \sh F(-1)) \ar[r, "- \cdot x_r"] & H^r(X, \sh F) \ar[r] & H^r(H, \sh F_H) \ar[d, equal] \ar[r] & 0 \\
      & & & 0
    \end{tikzcd}
  \]
  By our calculations of \(H^r\), the kernel of \(- \cdot x_r\) is generated by \(\{x_0^{a_0} \cdots x_r^{a_r}: a_i \leq -1 \text{ for all } i < r, a_r = 1\}\). But this is precisely \(H^{r - 1}(H, \sh F_H)\). So \(- \cdot x_r: H^{r - 1}(X, \sh F(-1)) \to H^{r - 1}(X, \sh F)\) is surjective and \(H^{r - 1}(X, \sh F) = 0\).
\end{proof}

\begin{remark}\leavevmode
  \begin{enumerate}
  \item In general, given an effective Cartier divisor \(D = \{(U_i, f_i)\}\) where \(f_i \in \sh O_X(U_i)\), we can view \(D\) as a closed subscheme defined by \(f_i\) on \(U_i\). Then \(\sh I_{D/X} \cong \sh O_X(-D)\).
  \item Given a sheaf \(\sh F\) on \(X\) and a divisor \(D\), we usually write \(\sh F(D) = \sh F \otimes_{\sh O_X} \sh O_X(D)\). For example if \(X = \P^r, D = nH\) then \(\sh F(n) = \sh F \otimes_{\sh O_X} \sh O_X(n)\), the \emph{Serre twisting sheaf}\index{Serre twisting sheaf}.
  \item It is a general fact that if \(i: X \to Y\) is a closed immersion then \(H^j(X, \sh F) = H^j(Y, i_* \sh F)\) for all \(j\), and frequently write \(H^j(Y, \sh F)\) instead of \(H^j(Y, i_* \sh F)\).
  \end{enumerate}
\end{remark}

\paragraph{Normal and conormal bundles}

Recall from example sheet 3 if \(i: Z \embed X\) is a closed subscheme then \(\sh I_{Z/X} = \ker(i^\#: \sh O_X \to i_* \sh O_Z)\) is a quasi-coherent sheaf of ideals (coherent if \(X\) is Noetherian). Define
\[
  N_{Z/X}^\vee = \sh I_{Z/X}/\sh I_{Z/X}^2
\]
which is quasi-coherent (coherent respectively). Note this is also an \(\sh O_X/\sh I_{Z/X} \cong \sh O_Z\)-module. This is the \emph{conormal sheaf}\index{conormal sheaf} of \(Z\) in \(X\) which can be viewed as a sheaf on \(Z\) (analogue: \(I \subseteq A\) an ideal then \(I/I^2\) is an \(A/I\)-module).

Fact: if \(X\) and \(Z\) are nonsingular varieties (i.e.\ all local rings are regular) then \(N_{Z/X}^\vee\) is locally free of rank \(\codim(Z, X)\).

In this case we define the \emph{normal bundle}\index{normal bundle}
\[
  N_{Z/X} = Hom_{\sh O_Z}(N_{Z/X}^\vee, \sh O_Z).
\]

\begin{definition}[differential]\index{differential}
  Suppose \(f: X \to Y\) is a separated morphism, i.e.\ \(\Delta: X \to X \times_Y X\) is a closed immersion then we define
  \[
    \Omega_{X/Y} = \Delta^* N_{\Delta(X)/X \times_Y X}^\vee
  \]
\end{definition}

Quick recap of algebra: let \(B\) an \(A\)-algebra and \(M\) a \(B\)-module. An \emph{\(A\)-derivation}\index{derivation} \(d: B \to M\) is a map such that
\begin{enumerate}
\item \(d(a) = 0\) for \(a \in A\),
\item \(d(b + b') = d(b) + d(b')\),
\item \(d(bb') = b d(b') + d(b) b'\).
\end{enumerate}
The module of relative differential \(\Omega_{B/A}\) is a \(B\)-module satisfying the following universal property: there exists a unique \(A\)-derivation \(d: B \to \Omega_{B/A}\) such that for any \(A\)-derivation \(d': B \to M\), exists a \(B\)-module homomorphism \(f: \Omega_{B/A} \to M\) such that \(d' = f \compose d\).
\[
  \begin{tikzcd}
    B \ar[r, "d'"] \ar[d, "d"] & M \\
    \Omega_{B/A} \ar[ur, dotted, "f"']
  \end{tikzcd}
\]
\(\Omega_{B/A}\) is constructed as follow: consider \(\varphi: B \otimes_A B \to B, b \otimes b' \mapsto b \cdot b'\). Let \(I = \ker \varphi\). Then \(I/I^2\) is a \(B\)-module and we can define
\begin{align*}
  d: B &\to I/I^2 \\
  b &\mapsto 1 \otimes b - b \otimes 1
\end{align*}
which makes \((I/I^2, d) = (\Omega_{B/A}, d)\).

\begin{eg}
  Suppose \(Y = \Spec k\), \(X\) a non-singular variety of dimension \(n\) over \(k\), then \(\Omega_{X/Y}\) is a locally free sheaf of rank \(n\) on \(X\).
\end{eg}

Just as in differential geometry where we define bundle of differential forms once we have the cotangent bundle, we define the \emph{canonical bundle}\index{canonical bundle} of \(X\) to be \(\omega_X = \Lambda^{\dim X} \Omega_{X/Y}\). Hence if \(\Omega_{X/Y}\) has a trivialisation on an open cover \(\{U_i\}\) with transition maps \(g_{ij} \in \GL_n(\sh O_X(U_i \cap U_j))\), then \(\omega_X\) is the line bundle with transition maps \(\det g_{ij} \in \sh O_X^*(U_i \cap U_j)\). It is also called the \emph{determinant line bundle}\index{determinant line bundle} of \(\Omega_{X/Y}\). We usually write the divisor class of \(\omega_X\) as \(K_X\), called the \emph{canonical class}\index{canonical class}.

\begin{theorem}[Serre duality]\index{Serre duality}
  Let \(X\) be a non-singular projective variety over \(\Spec k\) of dimension \(n\). Then for any locally free sheaf \(\sh F\) on \(X\), there is a natural isomorphism
  \[
    H^i(X, \sh F^\vee \otimes \omega_X) \to H^{n - i}(X, \sh F)^\vee
  \]
  where \(\sh F^\vee = Hom_{\sh O_X}(\sh F, \sh O_X)\).
\end{theorem}

This is analogous to Poincaré duality for manifolds\footnote{To account for the mysterious tensor product we need the full version of twisted Poincaré duality which uses local orientations and does not require orientability.}.

\begin{eg}
  For \(\P^r = X, \omega_X = \sh O_X(-r - 1)\) so we can recover the perfect pairing by setting \(\sh F = \sh O_X(m)\):
  \[
    H^i(X, \sh O_X(-r - 1 - m)) \to H^{r - i}(X, \sh O_X(m))^\vee.
  \]
\end{eg}

In general if \(X\) is a projective variety over \(k\) and \(\sh F\) ia coherent sheaf on \(X\) then \(H^i(X, \sh F)\) are finite dimensional \(k\)-vector space. We then define the \emph{Euler characteristic}\index{Euler characteristic} of \(\sh F\) as
\[
  \chi(\sh F) = \sum_i (-1)^i \dim_k H^i(X, \sh F).
\]
Note that if \(
\begin{tikzcd}
  0 \ar[r] & \sh F' \ar[r] & \sh F \ar[r] & \sh F'' \ar[r] & 0
\end{tikzcd}
\) is exact then
\[
  \chi(\sh F) = \chi(\sh F') + \chi(\sh F'')
\]
which follows from if \(
\begin{tikzcd}
  0 \ar[r] & V_0 \ar[r] & \cdots \ar[r] & V_n \ar[r] & 0
\end{tikzcd}
\) is a long exact sequence of vector spaces then \(\sum (-1)^i \dim V_i = 0\). From this we can derive the classical Riemann-Roch for curves.

Let \(X\) be a non-singular projective curve over a field \(k\), i.e.\ \(X \subseteq \P^n_k\) is a closed integral scheme of dimension \(1\) with all local rings regular.

\begin{definition}[genus]\index{genus}
  The \emph{genus} of \(X\) is \(g = \dim H^1(X, \sh O_X)\).
\end{definition}

\begin{definition}[degree]
  If \(D\) is a divisor on \(X\), \(D = \sum n_iP_i\) then the \emph{degree} of \(D\) is \(\deg D = \sum n_i\).
\end{definition}

\begin{theorem}[Riemann-Roch for curves]\index{Riemann-Roch theorem for curves}
  For \(D \in \Div X\),
  \[
    \dim H^0(X, \sh O_X(D)) - \dim H^0(X, \sh O_X(K_X - D)) = \deg D + 1 - g.
  \]
\end{theorem}

\begin{proof}
  We prove the theorem under the hypothesis \(k = \overline k\). By Serre duality
  \begin{align*}
    \chi(\sh O_X(D))
    &= \dim H^0(X, \sh O_X(D)) - \dim H^1(X, \sh O_X(D)) \\
    &= \dim H^0(X, \sh O_X(D)) - \dim H^0(X, \omega_X \otimes \sh O_X(-D)) \\
    &= \mathrm{LHS}
  \end{align*}
  Now let \(P \in X\) a closed point. Have an exact sequence
  \[
    \begin{tikzcd}
      0 \ar[r] & \sh I_{P/X} \ar[r] & \sh O_X \ar[r] & \sh O_P \ar[r] & 0
    \end{tikzcd}
  \]
  (recall the convention that \(\sh O_P\) denotes pushforward). Note \(\sh I_{P/X} = \sh O_X(-P)\). Now tensor with a line bundle \(\sh L\),
  \[
    \begin{tikzcd}[row sep=scriptsize]
      0 \ar[r] & \sh L \otimes \sh O_X(-P) \ar[r] \ar[d, equal] & \sh L \ar[r] & \sh O_P \otimes \sh L \ar[r] \ar[d, equal] & 0 \\
      & \sh L(-P) & & \sh O_P
    \end{tikzcd}
  \]
  Thus
  \[
    \chi(\sh L) = \chi(\sh L(-P)) + \chi(\sh O_P) = \chi(\sh L(-P)) + 1
  \]
  so \(\chi(\sh O_X(D)) = \chi(\sh O_X) + \deg D\) by repeated use of the above equation. Also
  \[
    \chi(\sh O_X) = \dim H^0(X, \sh O_X) - \dim H^1(X, \sh O_X) = 1 - g
  \]
  so the result follows.
\end{proof}

\begin{remark}\leavevmode
  \begin{enumerate}
  \item By Serre duality, \(H^1(X, \sh O_X) \cong H^0(X, \omega_X)^\vee\) so \(g = \dim H^0(X, \omega_X)\), the definition of genus from IID Algebraic Geometry using differentials.
  \item If \(k = \C\) we can endow \(X\) with the Euclidean topology, making it a \(2\)-dimensional manifold, written \(X^{\mathrm{an}}\). Then \(g\) is the genus of \(X^{\mathrm{an}}\) and
    \[
      H^1_{\mathrm{sing}}(X^{\mathrm{an}}, \C) \cong H^0(X, \omega_X) \oplus H^1(X, \sh O_X).
    \]
    This is related to \emph{Hodge decomposition}\index{Hodge decomposition} and will be covered in detail in III Complex Manifolds.
  \end{enumerate}
\end{remark}

\begin{remark}\leavevmode
  \begin{enumerate}
  \item Have
    \begin{align*}
      \chi(\omega_X)
      &= \dim H^0(X, \omega_X) - \dim H^1(X, \omega_X) \\
      &= \dim H^0(X, \omega_X) - \dim H^0(X, \sh O_X) \\
      &= g - 1
    \end{align*}
    so \(g - 1 = \deg K_X + 1 - g\) so \(\deg K_X = 2g - 2\).
  \item If \(\deg D < 0\) then \(H^0(X, \sh O_X(D)) = 0\). Indeed if \(D \sim D'\) then \(\deg D = \deg D'\) (as \(\chi(\sh O_X(D)) = \chi(\sh O_X(D'))\), this follow from Riemann-Roch). If \(s \in \Gamma(X, \sh O_X(D)), s \ne 0\) then \((s)_0 \sim D\) and \((s)_0\) is effective, contradicting \(\deg (s)_0 < 0\). Thus if \(\deg D > 2g - 2\) then
    \[
      \deg (K_X - D) = 2g - 2 - \deg D < 0,
    \]
    so \(\dim H^0(X, \sh O_X(K_X - D)) = 0\). Thus by Riemann-Roch \(\dim H^0(\sh O_X(D)) = \deg D + 1 - g\).
  \item A linear system\index{linear system} on a curve on a curve is basepoint-free\index{basepoint-free} if
    \[
      \dim H^0(X, \sh O_X(D)) = \dim H^0(X, \sh O_X(D - P)) + 1
    \]
    for all \(P \in X\), as follows from the exact sequence
    \[
      \begin{tikzcd}[column sep=scriptsize]
        0 \ar[r] & \sh O_X(D - P) \ar[r] & \sh O_X(D) \ar[r] & \sh O_P \ar[r] \ar[d, equal] & 0 \\
        & & & \sh O_X(D)/\mathfrak m_P \sh O_X(D)
      \end{tikzcd}
    \]
    and \(\Gamma(X, \sh O_X(D)) \to \Gamma(X, \sh O_P)\) is surjective if and only if \(\sh L\) is generated by global sections at \(P\). In particular if \(\deg D > 2g - 1\) then \(|D|\) is basepoint-free or equivalently, \(\sh O_X(D)\) is generated by global sections.
  \item The very ampleness\index{very ample} criterion on example sheet 3 takes the following form for curves: \(D\) is very ample if
    \[
      \dim H^0(X, \sh O_X(D - P - Q)) = \dim H^0(X, \sh O_X(D)) - 2
    \]
    for all \(P, Q \in X\) not necessarily distinct. Thus if \(\deg D > 2g\) then \(|D|\) is very ample.
  \item As such, the most interesting behaviour happens when \(0 \leq \deg D \leq 2g - 2\).
  \end{enumerate}
\end{remark}

\begin{eg}\leavevmode
  \begin{enumerate}
  \item \(g = 0\). Then if \(P \in X\) then \(|P|\) is very ample and \(\dim H^0(X, \sh O_X(P)) = 2\) so we get a closed embedding \(f: X \embed \P^1\), necessarily an isomorphism.
  \item \(g = 1\). Fix \(P_0 \in X\). \(|3P_0|\) is very ample and we get an embedding \(f: X \embed \P^2\). The image is a plane cubic, given by a single equation \(h = 0\) (as height \(1\) prime ideals are principal) where \(h\) is a homogeneous polynomial of degree \(3\). To see it has degree \(3\), suppose \(H = (s)_0\) for \(s \in \Gamma(\P^2, \sh O_{\P^2}(1))\) is a hyperplane. Then \(3P_0 \sim (f^* s)_0\).

    What are divisors of degree \(0\) on \(X\)? Claim that if \(D \in \Div X\) with \(\deg D = 0\) then \(D \sim P - P_0\) for some unique \(P \in X\).

    \begin{proof}
      Consider \(D + P_0\). We have \(\dim H^0(X, \sh O_X(D + P_0)) = 1\) so exists an effective divisor \(P \sim D + P_0\), say \(P = (s)_0\) for \(s \in H^0(X, \sh O_X(D + P_0)) \setminus \{0\}\). Note \(P\) has degree \(1\) so must be a point. This point is uniquely determined as
      \[
        |P| = \P(H^0(X, \sh O_X(D + P))) = \{\mathrm{pt}\}.
      \]
      Then \(D \sim P - P_0\).
    \end{proof}
  \end{enumerate}
\end{eg}

For any curve we have an exact sequence
\[
  \begin{tikzcd}
    0 \ar[r] & \Cl^0 X \ar[r] & \Cl X \ar[r, "\deg"] & \Z \ar[r] & 0
  \end{tikzcd}
\]
where \(\Cl^0 X\) is the equivalence class of degree \(0\) divisors. Thus if \(g = 1\) have a bijection \(\{\text{closed points of } X\} \leftrightarrow \Cl^0 X\), so we can transport the group structure on \(\Cl^0 X\) to the set of closed points. See for example III Elliptic Curves.

More generally if \(X\) is of genus \(g\), \(\Cl^0 X\) is in bijection with the closed points of a projective variety \(A\) of dimension \(g\). We can also specify morphisms \(m: A \times A \to A, i: A \to A\) that satisfy group laws.

\paragraph{Surfaces*}

Fix \(X\) a projective non-singular surface. Then divisors on \(X\) are linear combinations of curves. If two curves \(C, D\) intersect transversally we can count the number of intersections.

\begin{theorem}
  There exists a unique pairing
  \begin{align*}
    \Div X \times \Div X &\to \Z \\
    (C, D) &\mapsto C \cdot D
  \end{align*}
  satisfying the following properties:
  \begin{enumerate}
  \item if \(C, D\) are non-singular curves meeting transversally (i.e.\ \(C\) and \(D\) not tangent at any point of \(C \cap D)\) then \(C \cdot D = \#(C \cap D)\).
  \item \(C \cdot D = D \cdot C\).
  \item \((C_1 + C_2) \cdot D = C_1 \cdot D + C_2 \cdot D\).
  \item if \(C_1 \sim C_2\) then \(C_1 \cdot D = C_2 \cdot D\).
  \end{enumerate}
  We thus get a pairing \(\Cl X \times \Cl X \to \Z\).
\end{theorem}

Analogy with algebraic topology: a two dimensional projective surface over \(\C\) can be thought of as a \(4\)-dimensional (compact orientable) manifold. Then the pairing corresponds to cup product \(H^2(X; \Z) \times H^2(X; \Z) \to H^4(X; \Z) \cong \Z\).

\begin{theorem}[Riemann-Roch for surfaces]\index{Riemann-Roch theorem for curves}
  For \(X\) a non-singular surface,
  \begin{align*}
    \dim H^0(X, \sh O_X(D)) - \dim H^1(X, \sh O_X(D)) + \dim H^0(X, \sh O_X(K_X - D)) \\
    = \frac{1}{2} D \cdot (D - K_X) + 1 + P_a(X)
  \end{align*}
  where \(P_a(X) = \chi(\sh O_X) - 1\) is the \emph{arithmetic genus}\index{arithmetic genus} of \(X\).
\end{theorem}

\begin{eg}
  Let \(X = \P^2\) so \(\Cl \P^2 = \Z\). Then
  \begin{align*}
    \Cl X \times \Cl X &\to \Z \\
    aH \cdot bH &\mapsto ab
  \end{align*}
\end{eg}

Consider \(X \subseteq \A^n \times \P^{n - 1}\) and \(\mathrm{pr}_1: \A^n \times \P^{n - 1} \to \A^n\). Give \(\A^n\) coordinates \(x_1, \dots, x_n\) and \(\A^n \times \P^{n - 1}\) coordinates \(x_1, \dots, x_n, y_1, \dots, y_n\). Can think of \(\A^n \times \P^{n - 1} = \Proj k[x_1, \dots, x_n, y_1, \dots, y_n], \deg x_i = 0, \deg y_i = 1\).

\(X\) is defined by the ideal generated by \(\{x_iy_j - x_j y_i = 0, 1 \leq i < j \leq n\}\).

\[
  \begin{tikzcd}
    X \ar[r, "\subseteq"] \ar[dr, "\varphi"'] & \A^n \times \P^{n - 1} \ar[d, "pr_1"] \\
    & \A^n
  \end{tikzcd}
\]

Some facts:
\begin{enumerate}
\item \(X\) is a closed subvariety (in particular irreducible) of \(\A^n \times \P^{n - 1}\).
\item \(\varphi: \varphi^{-1}(\A^n \setminus \{1\}) \to \A^n \setminus \{0\}\) is an isomorphism.
\item \(\varphi^{-1}(0) = \{0\} \times \P^{n - 1}\).
\end{enumerate}
\(\varphi\) is called the \emph{blow-up}\index{blow-up} of \(\A^2\) at the origin.

If \(Z \subseteq \A^n\) is any closed subvariety and \(0 \in Z\) then the blow-up of \(\Z\) at \(0\) is \(\overline{\varphi^{-1}(Z \setminus \{0\})} \subseteq X\). This is the also called the \emph{strict transformation}\index{strict transformation} of \(Z\).

This allows blowing up affine variety the points and then not too hard to define the blow-up of a projective variety at a point.

\begin{eg}
  Let \(X\) be the blow-up of \(\P^2\) at \(6\) general points \(P_1, \dots, P_6 \in \P^2\) (here it means no \(3\) lie on a line and not all \(6\) lie on a conic). Let \(\varphi: X \to \P^2\) be the blow-up. Let \(E_i = \varphi^{-1}(P_i)\), \(E_i \cong \P^1\). Have \(\Cl X = \Cl \P^2 \oplus \bigoplus_{i = 1}^6 \Z E_i\). Here we use the convention that \(\Cl \P^2\) is identified as a subgroup of \(\Cl X\) via the pullback map \(\varphi^*: \Pic \P^2 \to \Pic X\), and for \(H \in \Cl \P^2\) the generator, write \(\varphi^*H\) for the corresponding divisor in \(\Cl X\). One can check that
  \[
    (\varphi^* D) \cdot (\varphi^* D') = D \cdot D',
    (\varphi^* D) \cdot E_i = 0,
    E_i \cdot E_j =
    \begin{cases}
      0 & i \ne j \\
      -1 & i = j
    \end{cases}
  \]
  \(|3 \varphi^* H - E_1 - \dots - E_6|\) is very ample and embeds \(X\) as a cubic surface in \(\P^6\).
\end{eg}

\printindex
\end{document}