\input{preamble} % OK, start here. % \begin{document} \title{Schemes} \maketitle \phantomsection \label{section-phantom} \tableofcontents \section{Introduction} \label{section-introduction} \noindent In this document we define schemes. A basic reference is \cite{EGA}. \section{Locally ringed spaces} \label{section-locally-ringed-spaces} \noindent Recall that we defined ringed spaces in Sheaves, Section \ref{sheaves-section-ringed-spaces}. Briefly, a ringed space is a pair $(X, \mathcal{O}_X)$ consisting of a topological space $X$ and a sheaf of rings $\mathcal{O}_X$. A morphism of ringed spaces $f : (X, \mathcal{O}_X) \to (Y, \mathcal{O}_Y)$ is given by a continuous map $f : X \to Y$ and an $f$-map of sheaves of rings $f^\sharp : \mathcal{O}_Y \to \mathcal{O}_X$. You can think of $f^\sharp$ as a map $\mathcal{O}_Y \to f_*\mathcal{O}_X$, see Sheaves, Definition \ref{sheaves-definition-f-map} and Lemma \ref{sheaves-lemma-f-map}. \medskip\noindent A good geometric example of this to keep in mind is $\mathcal{C}^\infty$-manifolds and morphisms of $\mathcal{C}^\infty$-manifolds. Namely, if $M$ is a $\mathcal{C}^\infty$-manifold, then the sheaf $\mathcal{C}^\infty_M$ of smooth functions is a sheaf of rings on $M$. And any map $f : M \to N$ of manifolds is smooth if and only if for every local section $h$ of $\mathcal{C}^\infty_N$ the composition $h \circ f$ is a local section of $\mathcal{C}^\infty_M$. Thus a smooth map $f$ gives rise in a natural way to a morphism of ringed spaces $$f : (M , \mathcal{C}^\infty_M) \longrightarrow (N, \mathcal{C}^\infty_N)$$ see Sheaves, Example \ref{sheaves-example-continuous-map-ringed}. It is instructive to consider what happens to stalks. Namely, let $m \in M$ with image $f(m) = n \in N$. Recall that the stalk $\mathcal{C}^\infty_{M, m}$ is the ring of germs of smooth functions at $m$, see Sheaves, Example \ref{sheaves-example-germs-functions}. The algebra of germs of functions on $(M, m)$ is a local ring with maximal ideal the functions which vanish at $m$. Similarly for $\mathcal{C}^\infty_{N, n}$. The map on stalks $f^\sharp : \mathcal{C}^\infty_{N, n} \to \mathcal{C}^\infty_{M, m}$ maps the maximal ideal into the maximal ideal, simply because $f(m) = n$. \medskip\noindent In algebraic geometry we study schemes. On a scheme the sheaf of rings is not determined by an intrinsic property of the space. The spectrum of a ring $R$ (see Algebra, Section \ref{algebra-section-spectrum-ring}) endowed with a sheaf of rings constructed out of $R$ (see below), will be our basic building block. It will turn out that the stalks of $\mathcal{O}$ on $\Spec(R)$ are the local rings of $R$ at its primes. There are two reasons to introduce locally ringed spaces in this setting: (1) There is in general no mechanism that assigns to a continuous map of spectra a map of the corresponding rings. This is why we add as an extra datum the map $f^\sharp$. (2) If we consider morphisms of these spectra in the category of ringed spaces, then the maps on stalks may not be local homomorphisms. Since our geometric intuition says it should we introduce locally ringed spaces as follows. \begin{definition} \label{definition-locally-ringed-space} Locally ringed spaces. \begin{enumerate} \item A {\it locally ringed space $(X, \mathcal{O}_X)$} is a pair consisting of a topological space $X$ and a sheaf of rings $\mathcal{O}_X$ all of whose stalks are local rings. \item Given a locally ringed space $(X, \mathcal{O}_X)$ we say that $\mathcal{O}_{X, x}$ is the {\it local ring of $X$ at $x$}. We denote $\mathfrak{m}_{X, x}$ or simply $\mathfrak{m}_x$ the maximal ideal of $\mathcal{O}_{X, x}$. Moreover, the {\it residue field of $X$ at $x$} is the residue field $\kappa(x) = \mathcal{O}_{X, x}/\mathfrak{m}_x$. \item A {\it morphism of locally ringed spaces} $(f, f^\sharp) : (X, \mathcal{O}_X) \to (Y, \mathcal{O}_Y)$ is a morphism of ringed spaces such that for all $x \in X$ the induced ring map $\mathcal{O}_{Y, f(x)} \to \mathcal{O}_{X, x}$ is a local ring map. \end{enumerate} \end{definition} \noindent We will usually suppress the sheaf of rings $\mathcal{O}_X$ in the notation when discussing locally ringed spaces. We will simply refer to the locally ringed space $X$''. We will by abuse of notation think of $X$ also as the underlying topological space. Finally we will denote the corresponding sheaf of rings $\mathcal{O}_X$ as the {\it structure sheaf of $X$}. In addition, it is customary to denote the maximal ideal of the local ring $\mathcal{O}_{X, x}$ by $\mathfrak{m}_{X, x}$ or simply $\mathfrak{m}_x$. We will say let $f : X \to Y$ be a morphism of locally ringed spaces'' thereby suppressing the structure sheaves even further. In this case, we will by abuse of notation think of $f : X\to Y$ also as the underlying continuous map of topological spaces. The $f$-map corresponding to $f$ will customarily be denoted $f^\sharp$. The condition that $f$ is a morphism of locally ringed spaces can then be expressed by saying that for every $x\in X$ the map on stalks $$f^\sharp_x : \mathcal{O}_{Y, f(x)} \longrightarrow \mathcal{O}_{X, x}$$ maps the maximal ideal $\mathfrak m_{Y, f(x)}$ into $\mathfrak m_{X, x}$. \medskip\noindent Let us use these notational conventions to show that the collection of locally ringed spaces and morphisms of locally ringed spaces forms a category. In order to see this we have to show that the composition of morphisms of locally ringed spaces is a morphism of locally ringed spaces. OK, so let $f : X \to Y$ and $g : Y \to Z$ be morphism of locally ringed spaces. The composition of $f$ and $g$ is defined in Sheaves, Definition \ref{sheaves-definition-composition-maps-ringed-spaces}. Let $x \in X$. By Sheaves, Lemma \ref{sheaves-lemma-compose-f-maps-stalks} the composition $$\mathcal{O}_{Z, g(f(x))} \xrightarrow{g^\sharp} \mathcal{O}_{Y, f(x)} \xrightarrow{f^\sharp} \mathcal{O}_{X, x}$$ is the associated map on stalks for the morphism $g \circ f$. The result follows since a composition of local ring homomorphisms is a local ring homomorphism. \medskip\noindent A pleasing feature of the definition is the fact that the functor $$\textit{Locally ringed spaces} \longrightarrow \textit{Ringed spaces}$$ reflects isomorphisms (plus more). Here is a less abstract statement. \begin{lemma} \label{lemma-isomorphism-locally-ringed} \begin{slogan} An isomorphism of ringed spaces between locally ringed spaces is an isomorphism of locally ringed spaces. \end{slogan} Let $X$, $Y$ be locally ringed spaces. If $f : X \to Y$ is an isomorphism of ringed spaces, then $f$ is an isomorphism of locally ringed spaces. \end{lemma} \begin{proof} This follows trivially from the corresponding fact in algebra: Suppose $A$, $B$ are local rings. Any isomorphism of rings $A \to B$ is a local ring homomorphism. \end{proof} \section{Open immersions of locally ringed spaces} \label{section-open-immersion} \begin{definition} \label{definition-immersion-locally-ringed-spaces} Let $f : X \to Y$ be a morphism of locally ringed spaces. We say that $f$ is an {\it open immersion} if $f$ is a homeomorphism of $X$ onto an open subset of $Y$, and the map $f^{-1}\mathcal{O}_Y \to \mathcal{O}_X$ is an isomorphism. \end{definition} \noindent The following construction is parallel to Sheaves, Definition \ref{sheaves-definition-restriction} (3). \begin{example} \label{example-open-subspace} Let $X$ be a locally ringed space. Let $U \subset X$ be an open subset. Let $\mathcal{O}_U = \mathcal{O}_X|_U$ be the restriction of $\mathcal{O}_X$ to $U$. For $u \in U$ the stalk $\mathcal{O}_{U, u}$ is equal to the stalk $\mathcal{O}_{X, u}$, and hence is a local ring. Thus $(U, \mathcal{O}_U)$ is a locally ringed space and the morphism $j : (U, \mathcal{O}_U) \to (X, \mathcal{O}_X)$ is an open immersion. \end{example} \begin{definition} \label{definition-open-subspace} Let $X$ be a locally ringed space. Let $U \subset X$ be an open subset. The locally ringed space $(U, \mathcal{O}_U)$ of Example \ref{example-open-subspace} above is the {\it open subspace of $X$ associated to $U$}. \end{definition} \begin{lemma} \label{lemma-open-immersion} Let $f : X \to Y$ be an open immersion of locally ringed spaces. Let $j : V = f(X) \to Y$ be the open subspace of $Y$ associated to the image of $f$. There is a unique isomorphism $f' : X \cong V$ of locally ringed spaces such that $f = j \circ f'$. \end{lemma} \begin{proof} Let $f'$ be the homeomorphism between $X$ and $V$ induced by $f$. Then $f = j \circ f'$ as maps of topological spaces. Since there is an isomorphism of sheaves $f^\sharp : f^{-1}(\mathcal{O}_Y) \to \mathcal{O}_X$, there is an isomorphism of rings $f^\sharp : \Gamma(U, f^{-1}(\mathcal{O}_Y)) \to \Gamma(U, \mathcal{O}_X)$ for each open subset $U \subset X$. Since $\mathcal{O}_V = j^{-1}\mathcal{O}_Y$ and $f^{-1} = f'^{-1} j^{-1}$ (Sheaves, Lemma \ref{sheaves-lemma-pullback-composition}) we see that $f^{-1}\mathcal{O}_Y = f'^{-1}\mathcal{O}_V$, hence $\Gamma(U, f'^{-1}(\mathcal{O}_V)) \to \Gamma(U, f^{-1}(\mathcal{O}_Y))$ is an isomorphism for every $U \subset X$ open. By composing these we get an isomorphism of rings $$\Gamma(U, f'^{-1}(\mathcal{O}_V)) \to \Gamma(U, \mathcal{O}_X)$$ for each open subset $U \subset X$, and therefore an isomorphism of sheaves $f^{-1}(\mathcal{O}_V) \to \mathcal{O}_X$. In other words, we have an isomorphism $f'^{\sharp} : f'^{-1}(\mathcal{O}_V) \to \mathcal{O}_X$ and therefore an isomorphism of locally ringed spaces $(f', f'^{\sharp}) : (X, \mathcal{O}_X) \to (V, \mathcal{O}_V)$ (use Lemma \ref{lemma-isomorphism-locally-ringed}). Note that $f = j \circ f'$ as morphisms of locally ringed spaces by construction. \medskip\noindent Suppose we have another morphism $f'' : (X, \mathcal{O}_X) \to (V, \mathcal{O}_V)$ such that $f = j \circ f''$. At any point $x \in X$, we have $j(f'(x)) = j(f''(x))$ from which it follows that $f'(x) = f''(x)$ since $j$ is the inclusion map; therefore $f'$ and $f''$ are the same as morphisms of topological spaces. On structure sheaves, for each open subset $U \subset X$ we have a commutative diagram $$\xymatrix @R=5em{ \Gamma(U, f^{-1}(\mathcal{O}_Y)) \ar[d]_\cong\ar[r]^\cong & \Gamma(U, \mathcal{O}_X) \\ \Gamma(U, f'^{-1}(\mathcal{O}_V)) \ar@/^/[ru]^{f'^\sharp} \ar@/_/[ru]_{f''^\sharp} & }$$ from which we see that $f'^\sharp$ and $f''^\sharp$ define the same morphism of sheaves. \end{proof} \noindent From now on we do not distinguish between open subsets and their associated subspaces. \begin{lemma} \label{lemma-restrict-map-to-opens} Let $f : X \to Y$ be a morphism of locally ringed spaces. Let $U \subset X$, and $V \subset Y$ be open subsets. Suppose that $f(U) \subset V$. There exists a unique morphism of locally ringed spaces $f|_U : U \to V$ such that the following diagram is a commutative square of locally ringed spaces $$\xymatrix{ U \ar[d]_{f|_U} \ar[r] & X \ar[d]^f \\ V \ar[r] & Y }$$ \end{lemma} \begin{proof} Omitted. \end{proof} \noindent In the following we will use without further mention the following fact which follows from the lemma above. Given any morphism $f : Y \to X$ of locally ringed spaces, and any open subset $U \subset X$ such that $f(Y) \subset U$, then there exists a unique morphism of locally ringed spaces $Y \to U$ such that the composition $Y \to U \to X$ is equal to $f$. In fact, we will even by abuse of notation write $f : Y \to U$ since this rarely gives rise to confusion. \section{Closed immersions of locally ringed spaces} \label{section-closed-immersion} \noindent We follow our conventions introduced in Modules, Definition \ref{modules-definition-closed-immersion}. \begin{definition} \label{definition-closed-immersion-locally-ringed-spaces} Let $i : Z \to X$ be a morphism of locally ringed spaces. We say that $i$ is a {\it closed immersion} if: \begin{enumerate} \item The map $i$ is a homeomorphism of $Z$ onto a closed subset of $X$. \item The map $\mathcal{O}_X \to i_*\mathcal{O}_Z$ is surjective; let $\mathcal{I}$ denote the kernel. \item The $\mathcal{O}_X$-module $\mathcal{I}$ is locally generated by sections. \end{enumerate} \end{definition} \begin{lemma} \label{lemma-closed-local-target} Let $f : Z \to X$ be a morphism of locally ringed spaces. In order for $f$ to be a closed immersion it suffices that there exists an open covering $X = \bigcup U_i$ such that each $f : f^{-1}U_i \to U_i$ is a closed immersion. \end{lemma} \begin{proof} Omitted. \end{proof} \begin{example} \label{example-closed-subspace} Let $X$ be a locally ringed space. Let $\mathcal{I} \subset \mathcal{O}_X$ be a sheaf of ideals which is locally generated by sections as a sheaf of $\mathcal{O}_X$-modules. Let $Z$ be the support of the sheaf of rings $\mathcal{O}_X/\mathcal{I}$. This is a closed subset of $X$, by Modules, Lemma \ref{modules-lemma-support-sheaf-rings-closed}. Denote $i : Z \to X$ the inclusion map. By Modules, Lemma \ref{modules-lemma-i-star-exact} there is a unique sheaf of rings $\mathcal{O}_Z$ on $Z$ with $i_*\mathcal{O}_Z = \mathcal{O}_X/\mathcal{I}$. For any $z \in Z$ the stalk $\mathcal{O}_{Z, z}$ is equal to a quotient $\mathcal{O}_{X, i(z)}/\mathcal{I}_{i(z)}$ of a local ring and nonzero, hence a local ring. Thus $i : (Z, \mathcal{O}_Z) \to (X, \mathcal{O}_X)$ is a closed immersion of locally ringed spaces. \end{example} \begin{definition} \label{definition-closed-subspace} Let $X$ be a locally ringed space. Let $\mathcal{I}$ be a sheaf of ideals on $X$ which is locally generated by sections. The locally ringed space $(Z, \mathcal{O}_Z)$ of Example \ref{example-closed-subspace} above is the {\it closed subspace of $X$ associated to the sheaf of ideals $\mathcal{I}$}. \end{definition} \begin{lemma} \label{lemma-closed-immersion} Let $f : X \to Y$ be a closed immersion of locally ringed spaces. Let $\mathcal{I}$ be the kernel of the map $\mathcal{O}_Y \to f_*\mathcal{O}_X$. Let $i : Z \to Y$ be the closed subspace of $Y$ associated to $\mathcal{I}$. There is a unique isomorphism $f' : X \cong Z$ of locally ringed spaces such that $f = i \circ f'$. \end{lemma} \begin{proof} Omitted. \end{proof} \begin{lemma} \label{lemma-characterize-closed-subspace} Let $X$, $Y$ be locally ringed spaces. Let $\mathcal{I} \subset \mathcal{O}_X$ be a sheaf of ideals locally generated by sections. Let $i : Z \to X$ be the associated closed subspace. A morphism $f : Y \to X$ factors through $Z$ if and only if the map $f^*\mathcal{I} \to f^*\mathcal{O}_X = \mathcal{O}_Y$ is zero. If this is the case the morphism $g : Y \to Z$ such that $f = i \circ g$ is unique. \end{lemma} \begin{proof} Clearly if $f$ factors as $Y \to Z \to X$ then the map $f^*\mathcal{I} \to \mathcal{O}_Y$ is zero. Conversely suppose that $f^*\mathcal{I} \to \mathcal{O}_Y$ is zero. Pick any $y \in Y$, and consider the ring map $f^\sharp_y : \mathcal{O}_{X, f(y)} \to \mathcal{O}_{Y, y}$. Since the composition $\mathcal{I}_{f(y)} \to \mathcal{O}_{X, f(y)} \to \mathcal{O}_{Y, y}$ is zero by assumption and since $f^\sharp_y(1) = 1$ we see that $1 \not \in \mathcal{I}_{f(y)}$, i.e., $\mathcal{I}_{f(y)} \not = \mathcal{O}_{X, f(y)}$. We conclude that $f(Y) \subset Z = \text{Supp}(\mathcal{O}_X/\mathcal{I})$. Hence $f = i \circ g$ where $g : Y \to Z$ is continuous. Consider the map $f^\sharp : \mathcal{O}_X \to f_*\mathcal{O}_Y$. The assumption $f^*\mathcal{I} \to \mathcal{O}_Y$ is zero implies that the composition $\mathcal{I} \to \mathcal{O}_X \to f_*\mathcal{O}_Y$ is zero by adjointness of $f_*$ and $f^*$. In other words, we obtain a morphism of sheaves of rings $\overline{f^\sharp} : \mathcal{O}_X/\mathcal{I} \to f_*\mathcal{O}_Y$. Note that $f_*\mathcal{O}_Y = i_*g_*\mathcal{O}_Y$ and that $\mathcal{O}_X/\mathcal{I} = i_*\mathcal{O}_Z$. By Sheaves, Lemma \ref{sheaves-lemma-equivalence-categories-closed-structures} we obtain a unique morphism of sheaves of rings $g^\sharp : \mathcal{O}_Z \to g_*\mathcal{O}_Y$ whose pushforward under $i$ is $\overline{f^\sharp}$. We omit the verification that $(g, g^\sharp)$ defines a morphism of locally ringed spaces and that $f = i \circ g$ as a morphism of locally ringed spaces. The uniqueness of $(g, g^\sharp)$ was pointed out above. \end{proof} \begin{lemma} \label{lemma-restrict-map-to-closed} Let $f : X \to Y$ be a morphism of locally ringed spaces. Let $\mathcal{I} \subset \mathcal{O}_Y$ be a sheaf of ideals which is locally generated by sections. Let $i : Z \to Y$ be the closed subspace associated to the sheaf of ideals $\mathcal{I}$. Let $\mathcal{J}$ be the image of the map $f^*\mathcal{I} \to f^*\mathcal{O}_Y = \mathcal{O}_X$. Then this ideal is locally generated by sections. Moreover, let $i' : Z' \to X$ be the associated closed subspace of $X$. There exists a unique morphism of locally ringed spaces $f' : Z' \to Z$ such that the following diagram is a commutative square of locally ringed spaces $$\xymatrix{ Z' \ar[d]_{f'} \ar[r]_{i'} & X \ar[d]^f \\ Z \ar[r]^{i} & Y }$$ Moreover, this diagram is a fibre square in the category of locally ringed spaces. \end{lemma} \begin{proof} The ideal $\mathcal{J}$ is locally generated by sections by Modules, Lemma \ref{modules-lemma-pullback-locally-generated}. The rest of the lemma follows from the characterization, in Lemma \ref{lemma-characterize-closed-subspace} above, of what it means for a morphism to factor through a closed subspace. \end{proof} \section{Affine schemes} \label{section-affine-schemes} \noindent Let $R$ be a ring. Consider the topological space $\Spec(R)$ associated to $R$, see Algebra, Section \ref{algebra-section-spectrum-ring}. We will endow this space with a sheaf of rings $\mathcal{O}_{\Spec(R)}$ and the resulting pair $(\Spec(R), \mathcal{O}_{\Spec(R)})$ will be an affine scheme. \medskip\noindent Recall that $\Spec(R)$ has a basis of open sets $D(f)$, $f \in R$ which we call standard opens, see Algebra, Definition \ref{algebra-definition-Zariski-topology}. In addition, the intersection of two standard opens is another: $D(f) \cap D(g) = D(fg)$, $f, g\in R$. \begin{lemma} \label{lemma-standard-open} Let $R$ be a ring. Let $f \in R$. \begin{enumerate} \item If $g\in R$ and $D(g) \subset D(f)$, then \begin{enumerate} \item $f$ is invertible in $R_g$, \item $g^e = af$ for some $e \geq 1$ and $a \in R$, \item there is a canonical ring map $R_f \to R_g$, and \item there is a canonical $R_f$-module map $M_f \to M_g$ for any $R$-module $M$. \end{enumerate} \item Any open covering of $D(f)$ can be refined to a finite open covering of the form $D(f) = \bigcup_{i = 1}^n D(g_i)$. \item If $g_1, \ldots, g_n \in R$, then $D(f) \subset \bigcup D(g_i)$ if and only if $g_1, \ldots, g_n$ generate the unit ideal in $R_f$. \end{enumerate} \end{lemma} \begin{proof} Recall that $D(g) = \Spec(R_g)$ (see Algebra, Lemma \ref{algebra-lemma-standard-open}). Thus (a) holds because $f$ maps to an element of $R_g$ which is not contained in any prime ideal, and hence invertible, see Algebra, Lemma \ref{algebra-lemma-Zariski-topology}. Write the inverse of $f$ in $R_g$ as $a/g^d$. This means $g^d - af$ is annihilated by a power of $g$, whence (b). For (c), the map $R_f \to R_g$ exists by (a) from the universal property of localization, or we can define it by mapping $b/f^n$ to $a^nb/g^{ne}$. The equality $M_f = M \otimes_R R_f$ can be used to obtain the map on modules, or we can define $M_f \to M_g$ by mapping $x/f^n$ to $a^nx/g^{ne}$. \medskip\noindent Recall that $D(f)$ is quasi-compact, see Algebra, Lemma \ref{algebra-lemma-qc-open}. Hence the second statement follows directly from the fact that the standard opens form a basis for the topology. \medskip\noindent The third statement follows directly from Algebra, Lemma \ref{algebra-lemma-Zariski-topology}. \end{proof} \noindent In Sheaves, Section \ref{sheaves-section-bases} we defined the notion of a sheaf on a basis, and we showed that it is essentially equivalent to the notion of a sheaf on the space, see Sheaves, Lemmas \ref{sheaves-lemma-extend-off-basis} and \ref{sheaves-lemma-extend-off-basis-structures}. Moreover, we showed in Sheaves, Lemma \ref{sheaves-lemma-cofinal-systems-coverings-standard-case} that it is sufficient to check the sheaf condition on a cofinal system of open coverings for each standard open. By the lemma above it suffices to check on the finite coverings by standard opens. \begin{definition} \label{definition-standard-covering} Let $R$ be a ring. \begin{enumerate} \item A {\it standard open covering} of $\Spec(R)$ is a covering $\Spec(R) = \bigcup_{i = 1}^n D(f_i)$, where $f_1, \ldots, f_n \in R$. \item Suppose that $D(f) \subset \Spec(R)$ is a standard open. A {\it standard open covering} of $D(f)$ is a covering $D(f) = \bigcup_{i = 1}^n D(g_i)$, where $g_1, \ldots, g_n \in R$. \end{enumerate} \end{definition} \noindent Let $R$ be a ring. Let $M$ be an $R$-module. We will define a presheaf $\widetilde M$ on the basis of standard opens. Suppose that $U \subset \Spec(R)$ is a standard open. If $f, g \in R$ are such that $D(f) = D(g)$, then by Lemma \ref{lemma-standard-open} above there are canonical maps $M_f \to M_g$ and $M_g \to M_f$ which are mutually inverse. Hence we may choose any $f$ such that $U = D(f)$ and define $$\widetilde M(U) = M_f.$$ Note that if $D(g) \subset D(f)$, then by Lemma \ref{lemma-standard-open} above we have a canonical map $$\widetilde M(D(f)) = M_f \longrightarrow M_g = \widetilde M(D(g)).$$ Clearly, this defines a presheaf of abelian groups on the basis of standard opens. If $M = R$, then $\widetilde R$ is a presheaf of rings on the basis of standard opens. \medskip\noindent Let us compute the stalk of $\widetilde M$ at a point $x \in \Spec(R)$. Suppose that $x$ corresponds to the prime $\mathfrak p \subset R$. By definition of the stalk we see that $$\widetilde M_x = \colim_{f\in R, f\not\in \mathfrak p} M_f$$ Here the set $\{f \in R, f \not \in \mathfrak p\}$ is preordered by the rule $f \geq f' \Leftrightarrow D(f) \subset D(f')$. If $f_1, f_2 \in R \setminus \mathfrak p$, then we have $f_1f_2 \geq f_1$ in this ordering. Hence by Algebra, Lemma \ref{algebra-lemma-localization-colimit} we conclude that $$\widetilde M_x = M_{\mathfrak p}.$$ \medskip\noindent Next, we check the sheaf condition for the standard open coverings. If $D(f) = \bigcup_{i = 1}^n D(g_i)$, then the sheaf condition for this covering is equivalent with the exactness of the sequence $$0 \to M_f \to \bigoplus M_{g_i} \to \bigoplus M_{g_ig_j}.$$ Note that $D(g_i) = D(fg_i)$, and hence we can rewrite this sequence as the sequence $$0 \to M_f \to \bigoplus M_{fg_i} \to \bigoplus M_{fg_ig_j}.$$ In addition, by Lemma \ref{lemma-standard-open} above we see that $g_1, \ldots, g_n$ generate the unit ideal in $R_f$. Thus we may apply Algebra, Lemma \ref{algebra-lemma-cover-module} to the module $M_f$ over $R_f$ and the elements $g_1, \ldots, g_n$. We conclude that the sequence is exact. By the remarks made above, we see that $\widetilde M$ is a sheaf on the basis of standard opens. \medskip\noindent Thus we conclude from the material in Sheaves, Section \ref{sheaves-section-bases} that there exists a unique sheaf of rings $\mathcal{O}_{\Spec(R)}$ which agrees with $\widetilde R$ on the standard opens. Note that by our computation of stalks above, the stalks of this sheaf of rings are all local rings. \medskip\noindent Similarly, for any $R$-module $M$ there exists a unique sheaf of $\mathcal{O}_{\Spec(R)}$-modules $\mathcal{F}$ which agrees with $\widetilde M$ on the standard opens, see Sheaves, Lemma \ref{sheaves-lemma-extend-off-basis-module}. \begin{definition} \label{definition-structure-sheaf} Let $R$ be a ring. \begin{enumerate} \item The {\it structure sheaf $\mathcal{O}_{\Spec(R)}$ of the spectrum of $R$} is the unique sheaf of rings $\mathcal{O}_{\Spec(R)}$ which agrees with $\widetilde R$ on the basis of standard opens. \item The locally ringed space $(\Spec(R), \mathcal{O}_{\Spec(R)})$ is called the {\it spectrum} of $R$ and denoted $\Spec(R)$. \item The sheaf of $\mathcal{O}_{\Spec(R)}$-modules extending $\widetilde M$ to all opens of $\Spec(R)$ is called the sheaf of $\mathcal{O}_{\Spec(R)}$-modules associated to $M$. This sheaf is denoted $\widetilde M$ as well. \end{enumerate} \end{definition} \noindent We summarize the results obtained so far. \begin{lemma} \label{lemma-spec-sheaves} Let $R$ be a ring. Let $M$ be an $R$-module. Let $\widetilde M$ be the sheaf of $\mathcal{O}_{\Spec(R)}$-modules associated to $M$. \begin{enumerate} \item We have $\Gamma(\Spec(R), \mathcal{O}_{\Spec(R)}) = R$. \item We have $\Gamma(\Spec(R), \widetilde M) = M$ as an $R$-module. \item For every $f \in R$ we have $\Gamma(D(f), \mathcal{O}_{\Spec(R)}) = R_f$. \item For every $f\in R$ we have $\Gamma(D(f), \widetilde M) = M_f$ as an $R_f$-module. \item Whenever $D(g) \subset D(f)$ the restriction mappings on $\mathcal{O}_{\Spec(R)}$ and $\widetilde M$ are the maps $R_f \to R_g$ and $M_f \to M_g$ from Lemma \ref{lemma-standard-open}. \item Let $\mathfrak p$ be a prime of $R$, and let $x \in \Spec(R)$ be the corresponding point. We have $\mathcal{O}_{\Spec(R), x} = R_{\mathfrak p}$. \item Let $\mathfrak p$ be a prime of $R$, and let $x \in \Spec(R)$ be the corresponding point. We have $\widetilde M_x = M_{\mathfrak p}$ as an $R_{\mathfrak p}$-module. \end{enumerate} Moreover, all these identifications are functorial in the $R$ module $M$. In particular, the functor $M \mapsto \widetilde M$ is an exact functor from the category of $R$-modules to the category of $\mathcal{O}_{\Spec(R)}$-modules. \end{lemma} \begin{proof} Assertions (1) - (7) are clear from the discussion above. The exactness of the functor $M \mapsto \widetilde M$ follows from the fact that the functor $M \mapsto M_{\mathfrak p}$ is exact and the fact that exactness of short exact sequences may be checked on stalks, see Modules, Lemma \ref{modules-lemma-abelian}. \end{proof} \begin{definition} \label{definition-affine-scheme} An {\it affine scheme} is a locally ringed space isomorphic as a locally ringed space to $\Spec(R)$ for some ring $R$. A {\it morphism of affine schemes} is a morphism in the category of locally ringed spaces. \end{definition} \noindent It turns out that affine schemes play a special role among all locally ringed spaces, which is what the next section is about. \section{The category of affine schemes} \label{section-category-affine-schemes} \noindent Note that if $Y$ is an affine scheme, then its points are in canonical $1-1$ bijection with prime ideals in $\Gamma(Y, \mathcal{O}_Y)$. \begin{lemma} \label{lemma-morphism-into-affine-where-point-goes} Let $X$ be a locally ringed space. Let $Y$ be an affine scheme. Let $f \in \Mor(X, Y)$ be a morphism of locally ringed spaces. Given a point $x \in X$ consider the ring maps $$\Gamma(Y, \mathcal{O}_Y) \xrightarrow{f^\sharp} \Gamma(X, \mathcal{O}_X) \to \mathcal{O}_{X, x}$$ Let $\mathfrak p \subset \Gamma(Y, \mathcal{O}_Y)$ denote the inverse image of $\mathfrak m_x$. Let $y \in Y$ be the corresponding point. Then $f(x) = y$. \end{lemma} \begin{proof} Consider the commutative diagram $$\xymatrix{ \Gamma(X, \mathcal{O}_X) \ar[r] & \mathcal{O}_{X, x} \\ \Gamma(Y, \mathcal{O}_Y) \ar[r] \ar[u] & \mathcal{O}_{Y, f(x)} \ar[u] }$$ (see the discussion of $f$-maps below Sheaves, Definition \ref{sheaves-definition-f-map}). Since the right vertical arrow is local we see that $\mathfrak m_{f(x)}$ is the inverse image of $\mathfrak m_x$. The result follows. \end{proof} \begin{lemma} \label{lemma-f-open} Let $X$ be a locally ringed space. Let $f \in \Gamma(X, \mathcal{O}_X)$. The set $$D(f) = \{x \in X \mid \text{image }f \not\in \mathfrak m_x\}$$ is open. Moreover $f|_{D(f)}$ has an inverse. \end{lemma} \begin{proof} This is a special case of Modules, Lemma \ref{modules-lemma-s-open}, but we also give a direct proof. Suppose that $U \subset X$ and $V \subset X$ are two open subsets such that $f|_U$ has an inverse $g$ and $f|_V$ has an inverse $h$. Then clearly $g|_{U\cap V} = h|_{U\cap V}$. Thus it suffices to show that $f$ is invertible in an open neighbourhood of any $x \in D(f)$. This is clear because $f \not \in \mathfrak m_x$ implies that $f \in \mathcal{O}_{X, x}$ has an inverse $g \in \mathcal{O}_{X, x}$ which means there is some open neighbourhood $x \in U \subset X$ so that $g \in \mathcal{O}_X(U)$ and $g\cdot f|_U = 1$. \end{proof} \begin{lemma} \label{lemma-f-open-affine} In Lemma \ref{lemma-f-open} above, if $X$ is an affine scheme, then the open $D(f)$ agrees with the standard open $D(f)$ defined previously (in Algebra, Definition \ref{algebra-definition-spectrum-ring}). \end{lemma} \begin{proof} Omitted. \end{proof} \begin{lemma} \label{lemma-morphism-into-affine} \begin{reference} A reference for this fact is \cite[II, Err 1, Prop. 1.8.1]{EGA} where it is attributed to J. Tate. \end{reference} Let $X$ be a locally ringed space. Let $Y$ be an affine scheme. The map $$\Mor(X, Y) \longrightarrow \Hom(\Gamma(Y, \mathcal{O}_Y), \Gamma(X, \mathcal{O}_X))$$ which maps $f$ to $f^\sharp$ (on global sections) is bijective. \end{lemma} \begin{proof} Since $Y$ is affine we have $(Y, \mathcal{O}_Y) \cong (\Spec(R), \mathcal{O}_{\Spec(R)})$ for some ring $R$. During the proof we will use facts about $Y$ and its structure sheaf which are direct consequences of things we know about the spectrum of a ring, see e.g.\ Lemma \ref{lemma-spec-sheaves}. \medskip\noindent Motivated by the lemmas above we construct the inverse map. Let $\psi_Y : \Gamma(Y, \mathcal{O}_Y) \to \Gamma(X, \mathcal{O}_X)$ be a ring map. First, we define the corresponding map of spaces $$\Psi : X \longrightarrow Y$$ by the rule of Lemma \ref{lemma-morphism-into-affine-where-point-goes}. In other words, given $x \in X$ we define $\Psi(x)$ to be the point of $Y$ corresponding to the prime in $\Gamma(Y, \mathcal{O}_Y)$ which is the inverse image of $\mathfrak m_x$ under the composition $\Gamma(Y, \mathcal{O}_Y) \xrightarrow{\psi_Y} \Gamma(X, \mathcal{O}_X) \to \mathcal{O}_{X, x}$. \medskip\noindent We claim that the map $\Psi : X \to Y$ is continuous. The standard opens $D(g)$, for $g \in \Gamma(Y, \mathcal{O}_Y)$ are a basis for the topology of $Y$. Thus it suffices to prove that $\Psi^{-1}(D(g))$ is open. By construction of $\Psi$ the inverse image $\Psi^{-1}(D(g))$ is exactly the set $D(\psi_Y(g)) \subset X$ which is open by Lemma \ref{lemma-f-open}. Hence $\Psi$ is continuous. \medskip\noindent Next we construct a $\Psi$-map of sheaves from $\mathcal{O}_Y$ to $\mathcal{O}_X$. By Sheaves, Lemma \ref{sheaves-lemma-f-map-basis-below-structures} it suffices to define ring maps $\psi_{D(g)} : \Gamma(D(g), \mathcal{O}_Y) \to \Gamma(\Psi^{-1}(D(g)), \mathcal{O}_X)$ compatible with restriction maps. We have a canonical isomorphism $\Gamma(D(g), \mathcal{O}_Y) = \Gamma(Y, \mathcal{O}_Y)_g$, because $Y$ is an affine scheme. Because $\psi_Y(g)$ is invertible on $D(\psi_Y(g))$ we see that there is a canonical map $$\Gamma(Y, \mathcal{O}_Y)_g \longrightarrow \Gamma(\Psi^{-1}(D(g)), \mathcal{O}_X) = \Gamma(D(\psi_Y(g)), \mathcal{O}_X)$$ extending the map $\psi_Y$ by the universal property of localization. Note that there is no choice but to take the canonical map here! And we take this, combined with the canonical identification $\Gamma(D(g), \mathcal{O}_Y) = \Gamma(Y, \mathcal{O}_Y)_g$, to be $\psi_{D(g)}$. This is compatible with localization since the restriction mapping on the affine schemes are defined in terms of the universal properties of localization also, see Lemmas \ref{lemma-spec-sheaves} and \ref{lemma-standard-open}. \medskip\noindent Thus we have defined a morphism of ringed spaces $(\Psi, \psi) : (X, \mathcal{O}_X) \to (Y, \mathcal{O}_Y)$ recovering $\psi_Y$ on global sections. To see that it is a morphism of locally ringed spaces we have to show that the induced maps on local rings $$\psi_x : \mathcal{O}_{Y, \Psi(x)} \longrightarrow \mathcal{O}_{X, x}$$ are local. This follows immediately from the commutative diagram of the proof of Lemma \ref{lemma-morphism-into-affine-where-point-goes} and the definition of $\Psi$. \medskip\noindent Finally, we have to show that the constructions $(\Psi, \psi) \mapsto \psi_Y$ and the construction $\psi_Y \mapsto (\Psi, \psi)$ are inverse to each other. Clearly, $\psi_Y \mapsto (\Psi, \psi) \mapsto \psi_Y$. Hence the only thing to prove is that given $\psi_Y$ there is at most one pair $(\Psi, \psi)$ giving rise to it. The uniqueness of $\Psi$ was shown in Lemma \ref{lemma-morphism-into-affine-where-point-goes} and given the uniqueness of $\Psi$ the uniqueness of the map $\psi$ was pointed out during the course of the proof above. \end{proof} \begin{lemma} \label{lemma-category-affine-schemes} The category of affine schemes is equivalent to the opposite of the category of rings. The equivalence is given by the functor that associates to an affine scheme the global sections of its structure sheaf. \end{lemma} \begin{proof} This is now clear from Definition \ref{definition-affine-scheme} and Lemma \ref{lemma-morphism-into-affine}. \end{proof} \begin{lemma} \label{lemma-standard-open-affine} Let $Y$ be an affine scheme. Let $f \in \Gamma(Y, \mathcal{O}_Y)$. The open subspace $D(f)$ is an affine scheme. \end{lemma} \begin{proof} We may assume that $Y = \Spec(R)$ and $f \in R$. Consider the morphism of affine schemes $\phi : U = \Spec(R_f) \to \Spec(R) = Y$ induced by the ring map $R \to R_f$. By Algebra, Lemma \ref{algebra-lemma-standard-open} we know that it is a homeomorphism onto $D(f)$. On the other hand, the map $\phi^{-1}\mathcal{O}_Y \to \mathcal{O}_U$ is an isomorphism on stalks, hence an isomorphism. Thus we see that $\phi$ is an open immersion. We conclude that $D(f)$ is isomorphic to $U$ by Lemma \ref{lemma-open-immersion}. \end{proof} \begin{lemma} \label{lemma-fibre-product-affine-schemes} The category of affine schemes has finite products, and fibre products. In other words, it has finite limits. Moreover, the products and fibre products in the category of affine schemes are the same as in the category of locally ringed spaces. In a formula, we have (in the category of locally ringed spaces) $$\Spec(R) \times \Spec(S) = \Spec(R \otimes_{\mathbf{Z}} S)$$ and given ring maps $R \to A$, $R \to B$ we have $$\Spec(A) \times_{\Spec(R)} \Spec(B) = \Spec(A \otimes_R B).$$ \end{lemma} \begin{proof} This is just an application of Lemma \ref{lemma-morphism-into-affine}. First of all, by that lemma, the affine scheme $\Spec(\mathbf{Z})$ is the final object in the category of locally ringed spaces. Thus the first displayed formula follows from the second. To prove the second note that for any locally ringed space $X$ we have \begin{eqnarray*} \Mor(X, \Spec(A \otimes_R B)) & = & \Hom(A \otimes_R B, \mathcal{O}_X(X)) \\ & = & \Hom(A, \mathcal{O}_X(X)) \times_{\Hom(R, \mathcal{O}_X(X))} \Hom(B, \mathcal{O}_X(X)) \\ & = & \Mor(X, \Spec(A)) \times_{\Mor(X, \Spec(R))} \Mor(X, \Spec(B)) \end{eqnarray*} which proves the formula. See Categories, Section \ref{categories-section-fibre-products} for the relevant definitions. \end{proof} \begin{lemma} \label{lemma-disjoint-union-affines} Let $X$ be a locally ringed space. Assume $X = U \amalg V$ with $U$ and $V$ open and such that $U$, $V$ are affine schemes. Then $X$ is an affine scheme. \end{lemma} \begin{proof} Set $R = \Gamma(X, \mathcal{O}_X)$. Note that $R = \mathcal{O}_X(U) \times \mathcal{O}_X(V)$ by the sheaf property. By Lemma \ref{lemma-morphism-into-affine} there is a canonical morphism of locally ringed spaces $X \to \Spec(R)$. By Algebra, Lemma \ref{algebra-lemma-spec-product} we see that as a topological space $\Spec(\mathcal{O}_X(U)) \amalg \Spec(\mathcal{O}_X(V)) = \Spec(R)$ with the maps coming from the ring homomorphisms $R \to \mathcal{O}_X(U)$ and $R \to \mathcal{O}_X(V)$. This of course means that $\Spec(R)$ is the coproduct in the category of locally ringed spaces as well. By assumption the morphism $X \to \Spec(R)$ induces an isomorphism of $\Spec(\mathcal{O}_X(U))$ with $U$ and similarly for $V$. Hence $X \to \Spec(R)$ is an isomorphism. \end{proof} \section{Quasi-coherent sheaves on affines} \label{section-quasi-coherent-affine} \noindent Recall that we have defined the abstract notion of a quasi-coherent sheaf in Modules, Definition \ref{modules-definition-quasi-coherent}. In this section we show that any quasi-coherent sheaf on an affine scheme $\Spec(R)$ corresponds to the sheaf $\widetilde M$ associated to an $R$-module $M$. \begin{lemma} \label{lemma-compare-constructions} Let $(X, \mathcal{O}_X) = (\Spec(R), \mathcal{O}_{\Spec(R)})$ be an affine scheme. Let $M$ be an $R$-module. There exists a canonical isomorphism between the sheaf $\widetilde M$ associated to the $R$-module $M$ (Definition \ref{definition-structure-sheaf}) and the sheaf $\mathcal{F}_M$ associated to the $R$-module $M$ (Modules, Definition \ref{modules-definition-sheaf-associated}). This isomorphism is functorial in $M$. In particular, the sheaves $\widetilde M$ are quasi-coherent. Moreover, they are characterized by the following mapping property $$\Hom_{\mathcal{O}_X}(\widetilde M, \mathcal{F}) = \Hom_R(M, \Gamma(X, \mathcal{F}))$$ for any sheaf of $\mathcal{O}_X$-modules $\mathcal{F}$. Here a map $\alpha : \widetilde M \to \mathcal{F}$ corresponds to its effect on global sections. \end{lemma} \begin{proof} By Modules, Lemma \ref{modules-lemma-construct-quasi-coherent-sheaves} we have a morphism $\mathcal{F}_M \to \widetilde M$ corresponding to the map $M \to \Gamma(X, \widetilde M) = M$. Let $x \in X$ correspond to the prime $\mathfrak p \subset R$. The induced map on stalks are the maps $\mathcal{O}_{X, x} \otimes_R M \to M_{\mathfrak p}$ which are isomorphisms because $R_{\mathfrak p} \otimes_R M = M_{\mathfrak p}$. Hence the map $\mathcal{F}_M \to \widetilde M$ is an isomorphism. The mapping property follows from the mapping property of the sheaves $\mathcal{F}_M$. \end{proof} \begin{lemma} \label{lemma-widetilde-constructions} Let $(X, \mathcal{O}_X) = (\Spec(R), \mathcal{O}_{\Spec(R)})$ be an affine scheme. There are canonical isomorphisms \begin{enumerate} \item $\widetilde{M \otimes_R N} \cong \widetilde M \otimes_{\mathcal{O}_X} \widetilde N$, see Modules, Section \ref{modules-section-tensor-product}. \item $\widetilde{\text{T}^n(M)} \cong \text{T}^n(\widetilde M)$, $\widetilde{\text{Sym}^n(M)} \cong \text{Sym}^n(\widetilde M)$, and $\widetilde{\wedge^n(M)} \cong \wedge^n(\widetilde M)$, see Modules, Section \ref{modules-section-symmetric-exterior}. \item if $M$ is a finitely presented $R$-module, then $\SheafHom_{\mathcal{O}_X}(\widetilde M, \widetilde N) \cong \widetilde{\Hom_R(M, N)}$, see Modules, Section \ref{modules-section-internal-hom}. \end{enumerate} \end{lemma} \begin{proof}[First proof] Using Lemma \ref{lemma-compare-constructions} and Modules, Lemma \ref{modules-lemma-construct-quasi-coherent-sheaves} we see that the functor $M \mapsto \widetilde M$ can be viewed as $\pi^*$ for a morphism $\pi$ of ringed spaces. And pulling back modules commutes with tensor constructions by Modules, Lemmas \ref{modules-lemma-tensor-product-pullback} and \ref{modules-lemma-pullback-tensor-algebra}. The morphism $\pi : (X, \mathcal{O}_X) \to (\{*\}, R)$ is flat for example because the stalks of $\mathcal{O}_X$ are localizations of $R$ (Lemma \ref{lemma-spec-sheaves}) and hence flat over $R$. Thus pullback by $\pi$ commutes with internal hom if the first module is finitely presented by Modules, Lemma \ref{modules-lemma-pullback-internal-hom}. \end{proof} \begin{proof}[Second proof] Proof of (1). By Lemma \ref{lemma-compare-constructions} to give a map $\widetilde{M \otimes_R N}$ into $\widetilde M \otimes_{\mathcal{O}_X} \widetilde N$ we have to give a map on global sections $M \otimes_R N \to \Gamma(X, \widetilde M \otimes_{\mathcal{O}_X} \widetilde N)$ which exists by definition of the tensor product of sheaves of modules. To see that this map is an isomorphism it suffices to check that it is an isomorphism on stalks. And this follows from the description of the stalks of $\widetilde{M}$ (either in Lemma \ref{lemma-spec-sheaves} or in Modules, Lemma \ref{modules-lemma-construct-quasi-coherent-sheaves}), the fact that tensor product commutes with localization (Algebra, Lemma \ref{algebra-lemma-tensor-product-localization}) and Modules, Lemma \ref{modules-lemma-stalk-tensor-product}. \medskip\noindent Proof of (2). This is similar to the proof of (1), using Algebra, Lemma \ref{algebra-lemma-tensor-algebra-localization} and Modules, Lemma \ref{modules-lemma-stalk-tensor-algebra}. \medskip\noindent Proof of (3). Since the construction $M \mapsto \widetilde{M}$ is functorial there is an $R$-linear map $\Hom_R(M, N) \to \Hom_{\mathcal{O}_X}(\widetilde{M}, \widetilde{N})$. The target of this map is the global sections of $\SheafHom_{\mathcal{O}_X}(\widetilde M, \widetilde N)$. Hence by Lemma \ref{lemma-compare-constructions} we obtain a map of $\mathcal{O}_X$-modules $\widetilde{\Hom_R(M, N)} \to \SheafHom_{\mathcal{O}_X}(\widetilde M, \widetilde N)$. We check that this is an isomorphism by comparing stalks. If $M$ is finitely presented as an $R$-module then $\widetilde M$ has a global finite presentation as an $\mathcal{O}_X$-module. Hence we conclude using Algebra, Lemma \ref{algebra-lemma-hom-from-finitely-presented} and Modules, Lemma \ref{modules-lemma-stalk-internal-hom}. \end{proof} \begin{proof}[Third proof of part (1)] For any $\mathcal{O}_X$-module $\mathcal{F}$ we have the following isomorphisms functorial in $M$, $N$, and $\mathcal{F}$ \begin{align*} \Hom_{\mathcal{O}_X}(\widetilde{M} \otimes _{\mathcal{O} _X} \widetilde{N}, \mathcal{F}) & = \Hom_{\mathcal{O}_X}(\widetilde{M}, \SheafHom_{\mathcal{O} _X} (\widetilde{N}, \mathcal{F})) \\ & = \Hom_R(M, \Gamma(X, \SheafHom_{\mathcal{O}_X}(\widetilde{N}, \mathcal{F})) \\ & = \Hom_R(M, \Hom_{\mathcal{O}_X}(\widetilde{N}, \mathcal{F})) \\ & = \Hom_R(M, \Hom_R(N, \Gamma(X,\mathcal{F}))) \\ & = \Hom_R(M \otimes_R N, \Gamma(X, \mathcal{F})) \\ & = \Hom_{\mathcal{O}_X}(\widetilde{M \otimes_R N}, \mathcal{F}) \end{align*} The first equality is Modules, Lemma \ref{modules-lemma-internal-hom}. The second equality is the universal property of $\widetilde{M}$, see Lemma \ref{lemma-compare-constructions}. The third equality holds by definition of $\SheafHom$. The fourth equality is the universal property of $\widetilde{N}$. Then fifth equality is Algebra, Lemma \ref{algebra-lemma-hom-from-tensor-product}. The final equality is the universal property of $\widetilde{M \otimes_R N}$. By the Yoneda lemma (Categories, Lemma \ref{categories-lemma-yoneda}) we obtain (1). \end{proof} \begin{lemma} \label{lemma-widetilde-pullback} Let $(X, \mathcal{O}_X) = (\Spec(S), \mathcal{O}_{\Spec(S)})$, $(Y, \mathcal{O}_Y) = (\Spec(R), \mathcal{O}_{\Spec(R)})$ be affine schemes. Let $\psi : (X, \mathcal{O}_X) \to (Y, \mathcal{O}_Y)$ be a morphism of affine schemes, corresponding to the ring map $\psi^\sharp : R \to S$ (see Lemma \ref{lemma-category-affine-schemes}). \begin{enumerate} \item We have $\psi^* \widetilde M = \widetilde{S \otimes_R M}$ functorially in the $R$-module $M$. \item We have $\psi_* \widetilde N = \widetilde{N_R}$ functorially in the $S$-module $N$. \end{enumerate} \end{lemma} \begin{proof} The first assertion follows from the identification in Lemma \ref{lemma-compare-constructions} and the result of Modules, Lemma \ref{modules-lemma-restrict-quasi-coherent}. The second assertion follows from the fact that $\psi^{-1}(D(f)) = D(\psi^\sharp(f))$ and hence $$\psi_* \widetilde N(D(f)) = \widetilde N(D(\psi^\sharp(f))) = N_{\psi^\sharp(f)} = (N_R)_f = \widetilde{N_R}(D(f))$$ as desired. \end{proof} \noindent Lemma \ref{lemma-widetilde-pullback} above says in particular that if you restrict the sheaf $\widetilde M$ to a standard affine open subspace $D(f)$, then you get $\widetilde{M_f}$. We will use this from now on without further mention. \begin{lemma} \label{lemma-quasi-coherent-affine} Let $(X, \mathcal{O}_X) = (\Spec(R), \mathcal{O}_{\Spec(R)})$ be an affine scheme. Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module. Then $\mathcal{F}$ is isomorphic to the sheaf associated to the $R$-module $\Gamma(X, \mathcal{F})$. \end{lemma} \begin{proof} Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module. Since every standard open $D(f)$ is quasi-compact we see that $X$ is a locally quasi-compact, i.e., every point has a fundamental system of quasi-compact neighbourhoods, see Topology, Definition \ref{topology-definition-locally-quasi-compact}. Hence by Modules, Lemma \ref{modules-lemma-quasi-coherent-module} for every prime $\mathfrak p \subset R$ corresponding to $x \in X$ there exists an open neighbourhood $x \in U \subset X$ such that $\mathcal{F}|_U$ is isomorphic to the quasi-coherent sheaf associated to some $\mathcal{O}_X(U)$-module $M$. In other words, we get an open covering by $U$'s with this property. By Lemma \ref{lemma-standard-open} for example we can refine this covering to a standard open covering. Thus we get a covering $\Spec(R) = \bigcup D(f_i)$ and $R_{f_i}$-modules $M_i$ and isomorphisms $\varphi_i : \mathcal{F}|_{D(f_i)} \to \mathcal{F}_{M_i}$ for some $R_{f_i}$-module $M_i$. On the overlaps we get isomorphisms $$\xymatrix{ \mathcal{F}_{M_i}|_{D(f_if_j)} \ar[rr]^{\varphi_i^{-1}|_{D(f_if_j)}} & & \mathcal{F}|_{D(f_if_j)} \ar[rr]^{\varphi_j|_{D(f_if_j)}} & & \mathcal{F}_{M_j}|_{D(f_if_j)}. }$$ Let us denote these $\psi_{ij}$. It is clear that we have the cocycle condition $$\psi_{jk}|_{D(f_if_jf_k)} \circ \psi_{ij}|_{D(f_if_jf_k)} = \psi_{ik}|_{D(f_if_jf_k)}$$ on triple overlaps. \medskip\noindent Recall that each of the open subspaces $D(f_i)$, $D(f_if_j)$, $D(f_if_jf_k)$ is an affine scheme. Hence the sheaves $\mathcal{F}_{M_i}$ are isomorphic to the sheaves $\widetilde M_i$ by Lemma \ref{lemma-compare-constructions} above. In particular we see that $\mathcal{F}_{M_i}(D(f_if_j)) = (M_i)_{f_j}$, etc. Also by Lemma \ref{lemma-compare-constructions} above we see that $\psi_{ij}$ corresponds to a unique $R_{f_if_j}$-module isomorphism $$\psi_{ij} : (M_i)_{f_j} \longrightarrow (M_j)_{f_i}$$ namely, the effect of $\psi_{ij}$ on sections over $D(f_if_j)$. Moreover these then satisfy the cocycle condition that $$\xymatrix{ (M_i)_{f_jf_k} \ar[rd]_{\psi_{ij}} \ar[rr]^{\psi_{ik}} & & (M_k)_{f_if_j} \\ & (M_j)_{f_if_k} \ar[ru]_{\psi_{jk}} }$$ commutes (for any triple $i, j, k$). \medskip\noindent Now Algebra, Lemma \ref{algebra-lemma-glue-modules} shows that there exist an $R$-module $M$ such that $M_i = M_{f_i}$ compatible with the morphisms $\psi_{ij}$. Consider $\mathcal{F}_M = \widetilde M$. At this point it is a formality to show that $\widetilde M$ is isomorphic to the quasi-coherent sheaf $\mathcal{F}$ we started out with. Namely, the sheaves $\mathcal{F}$ and $\widetilde M$ give rise to isomorphic sets of glueing data of sheaves of $\mathcal{O}_X$-modules with respect to the covering $X = \bigcup D(f_i)$, see Sheaves, Section \ref{sheaves-section-glueing-sheaves} and in particular Lemma \ref{sheaves-lemma-mapping-property-glue}. Explicitly, in the current situation, this boils down to the following argument: Let us construct an $R$-module map $$M \longrightarrow \Gamma(X, \mathcal{F}).$$ Namely, given $m \in M$ we get $m_i = m/1 \in M_{f_i} = M_i$ by construction of $M$. By construction of $M_i$ this corresponds to a section $s_i \in \mathcal{F}(U_i)$. (Namely, $\varphi^{-1}_i(m_i)$.) We claim that $s_i|_{D(f_if_j)} = s_j|_{D(f_if_j)}$. This is true because, by construction of $M$, we have $\psi_{ij}(m_i) = m_j$, and by the construction of the $\psi_{ij}$. By the sheaf condition of $\mathcal{F}$ this collection of sections gives rise to a unique section $s$ of $\mathcal{F}$ over $X$. We leave it to the reader to show that $m \mapsto s$ is a $R$-module map. By Lemma \ref{lemma-compare-constructions} we obtain an associated $\mathcal{O}_X$-module map $$\widetilde M \longrightarrow \mathcal{F}.$$ By construction this map reduces to the isomorphisms $\varphi_i^{-1}$ on each $D(f_i)$ and hence is an isomorphism. \end{proof} \begin{lemma} \label{lemma-equivalence-quasi-coherent} Let $(X, \mathcal{O}_X) = (\Spec(R), \mathcal{O}_{\Spec(R)})$ be an affine scheme. The functors $M \mapsto \widetilde M$ and $\mathcal{F} \mapsto \Gamma(X, \mathcal{F})$ define quasi-inverse equivalences of categories $$\xymatrix{ \QCoh(\mathcal{O}_X) \ar@<1ex>[r] & \text{Mod}_R \ar@<1ex>[l] }$$ between the category of quasi-coherent $\mathcal{O}_X$-modules and the category of $R$-modules. \end{lemma} \begin{proof} See Lemmas \ref{lemma-compare-constructions} and \ref{lemma-quasi-coherent-affine} above. \end{proof} \noindent From now on we will not distinguish between quasi-coherent sheaves on affine schemes and sheaves of the form $\widetilde M$. \begin{lemma} \label{lemma-kernel-cokernel-quasi-coherent} Let $X = \Spec(R)$ be an affine scheme. Kernels and cokernels of maps of quasi-coherent $\mathcal{O}_X$-modules are quasi-coherent. \end{lemma} \begin{proof} This follows from the exactness of the functor $\widetilde{\ }$ since by Lemma \ref{lemma-compare-constructions} we know that any map $\psi : \widetilde{M} \to \widetilde{N}$ comes from an $R$-module map $\varphi : M \to N$. (So we have $\Ker(\psi) = \widetilde{\Ker(\varphi)}$ and $\Coker(\psi) = \widetilde{\Coker(\varphi)}$.) \end{proof} \begin{lemma} \label{lemma-colimit-quasi-coherent} Let $X = \Spec(R)$ be an affine scheme. The direct sum of an arbitrary collection of quasi-coherent sheaves on $X$ is quasi-coherent. The same holds for colimits. \end{lemma} \begin{proof} Suppose $\mathcal{F}_i$, $i \in I$ is a collection of quasi-coherent sheaves on $X$. By Lemma \ref{lemma-equivalence-quasi-coherent} above we can write $\mathcal{F}_i = \widetilde{M_i}$ for some $R$-module $M_i$. Set $M = \bigoplus M_i$. Consider the sheaf $\widetilde{M}$. For each standard open $D(f)$ we have $$\widetilde{M}(D(f)) = M_f = \left(\bigoplus M_i\right)_f = \bigoplus M_{i, f}.$$ Hence we see that the quasi-coherent $\mathcal{O}_X$-module $\widetilde{M}$ is the direct sum of the sheaves $\mathcal{F}_i$. A similar argument works for general colimits. \end{proof} \begin{lemma} \label{lemma-extension-quasi-coherent} Let $(X, \mathcal{O}_X) = (\Spec(R), \mathcal{O}_{\Spec(R)})$ be an affine scheme. Suppose that $$0 \to \mathcal{F}_1 \to \mathcal{F}_2 \to \mathcal{F}_3 \to 0$$ is a short exact sequence of sheaves of $\mathcal{O}_X$-modules. If two out of three are quasi-coherent then so is the third. \end{lemma} \begin{proof} This is clear in case both $\mathcal{F}_1$ and $\mathcal{F}_2$ are quasi-coherent because the functor $M \mapsto \widetilde M$ is exact, see Lemma \ref{lemma-spec-sheaves}. Similarly in case both $\mathcal{F}_2$ and $\mathcal{F}_3$ are quasi-coherent. Now, suppose that $\mathcal{F}_1 = \widetilde M_1$ and $\mathcal{F}_3 = \widetilde M_3$ are quasi-coherent. Set $M_2 = \Gamma(X, \mathcal{F}_2)$. We claim it suffices to show that the sequence $$0 \to M_1 \to M_2 \to M_3 \to 0$$ is exact. Namely, if this is the case, then (by using the mapping property of Lemma \ref{lemma-compare-constructions}) we get a commutative diagram $$\xymatrix{ 0 \ar[r] & \widetilde M_1 \ar[r] \ar[d] & \widetilde M_2 \ar[r] \ar[d] & \widetilde M_3 \ar[r] \ar[d] & 0 \\ 0 \ar[r] & \mathcal{F}_1 \ar[r] & \mathcal{F}_2 \ar[r] & \mathcal{F}_3 \ar[r] & 0 }$$ and we win by the snake lemma. \medskip\noindent The correct'' argument here would be to show first that $H^1(X, \mathcal{F}) = 0$ for any quasi-coherent sheaf $\mathcal{F}$. This is actually not all that hard, but it is perhaps better to postpone this till later. Instead we use a small trick. \medskip\noindent Pick $m \in M_3 = \Gamma(X, \mathcal{F}_3)$. Consider the following set $$I = \{ f \in R \mid \text{the element }fm\text{ comes from }M_2\}.$$ Clearly this is an ideal. It suffices to show $1 \in I$. Hence it suffices to show that for any prime $\mathfrak p$ there exists an $f \in I$, $f \not\in \mathfrak p$. Let $x \in X$ be the point corresponding to $\mathfrak p$. Because surjectivity can be checked on stalks there exists an open neighbourhood $U$ of $x$ such that $m|_U$ comes from a local section $s \in \mathcal{F}_2(U)$. In fact we may assume that $U = D(f)$ is a standard open, i.e., $f \in R$, $f \not \in \mathfrak p$. We will show that for some $N \gg 0$ we have $f^N \in I$, which will finish the proof. \medskip\noindent Take any point $z \in V(f)$, say corresponding to the prime $\mathfrak q \subset R$. We can also find a $g \in R$, $g \not \in \mathfrak q$ such that $m|_{D(g)}$ lifts to some $s' \in \mathcal{F}_2(D(g))$. Consider the difference $s|_{D(fg)} - s'|_{D(fg)}$. This is an element $m'$ of $\mathcal{F}_1(D(fg)) = (M_1)_{fg}$. For some integer $n = n(z)$ the element $f^n m'$ comes from some $m'_1 \in (M_1)_g$. We see that $f^n s$ extends to a section $\sigma$ of $\mathcal{F}_2$ on $D(f) \cup D(g)$ because it agrees with the restriction of $f^n s' + m'_1$ on $D(f) \cap D(g) = D(fg)$. Moreover, $\sigma$ maps to the restriction of $f^n m$ to $D(f) \cup D(g)$. \medskip\noindent Since $V(f)$ is quasi-compact, there exists a finite list of elements $g_1, \ldots, g_m \in R$ such that $V(f) \subset \bigcup D(g_j)$, an integer $n > 0$ and sections $\sigma_j \in \mathcal{F}_2(D(f) \cup D(g_j))$ such that $\sigma_j|_{D(f)} = f^n s$ and $\sigma_j$ maps to the section $f^nm|_{D(f) \cup D(g_j)}$ of $\mathcal{F}_3$. Consider the differences $$\sigma_j|_{D(f) \cup D(g_jg_k)} - \sigma_k|_{D(f) \cup D(g_jg_k)}.$$ These correspond to sections of $\mathcal{F}_1$ over $D(f) \cup D(g_jg_k)$ which are zero on $D(f)$. In particular their images in $\mathcal{F}_1(D(g_jg_k)) = (M_1)_{g_jg_k}$ are zero in $(M_1)_{g_jg_kf}$. Thus some high power of $f$ kills each and every one of these. In other words, the elements $f^N \sigma_j$, for some $N \gg 0$ satisfy the glueing condition of the sheaf property and give rise to a section $\sigma$ of $\mathcal{F}_2$ over $\bigcup (D(f) \cup D(g_j)) = X$ as desired. \end{proof} \section{Closed subspaces of affine schemes} \label{section-closed-in-affine} \begin{example} \label{example-closed-immersion-affines} Let $R$ be a ring. Let $I \subset R$ be an ideal. Consider the morphism of affine schemes $i : Z = \Spec(R/I) \to \Spec(R) = X$. By Algebra, Lemma \ref{algebra-lemma-spec-closed} this is a homeomorphism of $Z$ onto a closed subset of $X$. Moreover, if $I \subset \mathfrak p \subset R$ is a prime corresponding to a point $x = i(z)$, $x \in X$, $z \in Z$, then on stalks we get the map $$\mathcal{O}_{X, x} = R_{\mathfrak p} \longrightarrow R_{\mathfrak p}/IR_{\mathfrak p} = \mathcal{O}_{Z, z}$$ Thus we see that $i$ is a closed immersion of locally ringed spaces, see Definition \ref{definition-closed-immersion-locally-ringed-spaces}. Clearly, this is (isomorphic) to the closed subspace associated to the quasi-coherent sheaf of ideals $\widetilde I$, as in Example \ref{example-closed-subspace}. \end{example} \begin{lemma} \label{lemma-closed-immersion-affine-case} \begin{slogan} For affine schemes, closed immersions correspond to ideals. \end{slogan} Let $(X, \mathcal{O}_X) = (\Spec(R), \mathcal{O}_{\Spec(R)})$ be an affine scheme. Let $i : Z \to X$ be any closed immersion of locally ringed spaces. Then there exists a unique ideal $I \subset R$ such that the morphism $i : Z \to X$ can be identified with the closed immersion $\Spec(R/I) \to \Spec(R)$ constructed in Example \ref{example-closed-immersion-affines} above. \end{lemma} \begin{proof} This is kind of silly! Namely, by Lemma \ref{lemma-closed-immersion} we can identify $Z \to X$ with the closed subspace associated to a sheaf of ideals $\mathcal{I} \subset \mathcal{O}_X$ as in Definition \ref{definition-closed-subspace} and Example \ref{example-closed-subspace}. By our conventions this sheaf of ideals is locally generated by sections as a sheaf of $\mathcal{O}_X$-modules. Hence the quotient sheaf $\mathcal{O}_X / \mathcal{I}$ is locally on $X$ the cokernel of a map $\bigoplus_{j \in J} \mathcal{O}_U \to \mathcal{O}_U$. Thus by definition, $\mathcal{O}_X / \mathcal{I}$ is quasi-coherent. By our results in Section \ref{section-quasi-coherent-affine} it is of the form $\widetilde S$ for some $R$-module $S$. Moreover, since $\mathcal{O}_X = \widetilde R \to \widetilde S$ is surjective we see by Lemma \ref{lemma-extension-quasi-coherent} that also $\mathcal{I}$ is quasi-coherent, say $\mathcal{I} = \widetilde I$. Of course $I \subset R$ and $S = R/I$ and everything is clear. \end{proof} \section{Schemes} \label{section-schemes} \begin{definition} \label{definition-scheme} \begin{history} In \cite{EGA1} what we call a scheme was called a pre-sch\'ema'' and the name sch\'ema'' was reserved for what is a separated scheme in the Stacks project. In the second edition \cite{EGA1-second} the terminology was changed to the terminology that is now standard. However, one may occasionally encounter the terminology prescheme'', for example in \cite{Murre-lectures}. \end{history} A {\it scheme} is a locally ringed space with the property that every point has an open neighbourhood which is an affine scheme. A {\it morphism of schemes} is a morphism of locally ringed spaces. The category of schemes will be denoted $\Sch$. \end{definition} \noindent Let $X$ be a scheme. We will use the following (very slight) abuse of language. We will say $U \subset X$ is an {\it affine open}, or an {\it open affine} if the open subspace $U$ is an affine scheme. We will often write $U = \Spec(R)$ to indicate that $U$ is isomorphic to $\Spec(R)$ and moreover that we will identify (temporarily) $U$ and $\Spec(R)$. \begin{lemma} \label{lemma-open-subspace-scheme} Let $X$ be a scheme. Let $j : U \to X$ be an open immersion of locally ringed spaces. Then $U$ is a scheme. In particular, any open subspace of $X$ is a scheme. \end{lemma} \begin{proof} Let $U \subset X$. Let $u \in U$. Pick an affine open neighbourhood $u \in V \subset X$. Because standard opens of $V$ form a basis of the topology on $V$ we see that there exists a $f\in \mathcal{O}_V(V)$ such that $u \in D(f) \subset U$. And $D(f)$ is an affine scheme by Lemma \ref{lemma-standard-open-affine}. This proves that every point of $U$ has an open neighbourhood which is affine. \end{proof} \noindent Clearly the lemma (or its proof) shows that any scheme $X$ has a basis (see Topology, Section \ref{topology-section-bases}) for the topology consisting of affine opens. \begin{example} \label{example-not-affine} Let $k$ be a field. An example of a scheme which is not affine is given by the open subspace $U = \Spec(k[x, y]) \setminus \{ (x, y)\}$ of the affine scheme $X =\Spec(k[x, y])$. It is covered by two affines, namely $D(x) = \Spec(k[x, y, 1/x])$ and $D(y) = \Spec(k[x, y, 1/y])$ whose intersection is $D(xy) = \Spec(k[x, y, 1/xy])$. By the sheaf property for $\mathcal{O}_U$ there is an exact sequence $$0 \to \Gamma(U, \mathcal{O}_U) \to k[x, y, 1/x] \times k[x, y, 1/y] \to k[x, y, 1/xy]$$ We conclude that the map $k[x, y] \to \Gamma(U, \mathcal{O}_U)$ (coming from the morphism $U \to X$) is an isomorphism. Therefore $U$ cannot be affine since if it was then by Lemma \ref{lemma-category-affine-schemes} we would have $U \cong X$. \end{example} \section{Immersions of schemes} \label{section-immersions} \noindent In Lemma \ref{lemma-open-subspace-scheme} we saw that any open subspace of a scheme is a scheme. Below we will prove that the same holds for a closed subspace of a scheme. \medskip\noindent Note that the notion of a quasi-coherent sheaf of $\mathcal{O}_X$-modules is defined for any ringed space $X$ in particular when $X$ is a scheme. By our efforts in Section \ref{section-quasi-coherent-affine} we know that such a sheaf is on any affine open $U \subset X$ of the form $\widetilde M$ for some $\mathcal{O}_X(U)$-module $M$. \begin{lemma} \label{lemma-closed-subspace-scheme} Let $X$ be a scheme. Let $i : Z \to X$ be a closed immersion of locally ringed spaces. \begin{enumerate} \item The locally ringed space $Z$ is a scheme, \item the kernel $\mathcal{I}$ of the map $\mathcal{O}_X \to i_*\mathcal{O}_Z$ is a quasi-coherent sheaf of ideals, \item for any affine open $U = \Spec(R)$ of $X$ the morphism $i^{-1}(U) \to U$ can be identified with $\Spec(R/I) \to \Spec(R)$ for some ideal $I \subset R$, and \item we have $\mathcal{I}|_U = \widetilde I$. \end{enumerate} In particular, any sheaf of ideals locally generated by sections is a quasi-coherent sheaf of ideals (and vice versa), and any closed subspace of $X$ is a scheme. \end{lemma} \begin{proof} Let $i : Z \to X$ be a closed immersion. Let $z \in Z$ be a point. Choose any affine open neighbourhood $i(z) \in U \subset X$. Say $U = \Spec(R)$. By Lemma \ref{lemma-closed-immersion-affine-case} we know that $i^{-1}(U) \to U$ can be identified with the morphism of affine schemes $\Spec(R/I) \to \Spec(R)$. First of all this implies that $z \in i^{-1}(U) \subset Z$ is an affine neighbourhood of $z$. Thus $Z$ is a scheme. Second this implies that $\mathcal{I}|_U$ is $\widetilde I$. In other words for every point $x \in i(Z)$ there exists an open neighbourhood such that $\mathcal{I}$ is quasi-coherent in that neighbourhood. Note that $\mathcal{I}|_{X \setminus i(Z)} \cong \mathcal{O}_{X \setminus i(Z)}$. Thus the restriction of the sheaf of ideals is quasi-coherent on $X \setminus i(Z)$ also. We conclude that $\mathcal{I}$ is quasi-coherent. \end{proof} \begin{definition} \label{definition-immersion} Let $X$ be a scheme. \begin{enumerate} \item A morphism of schemes is called an {\it open immersion} if it is an open immersion of locally ringed spaces (see Definition \ref{definition-immersion-locally-ringed-spaces}). \item An {\it open subscheme} of $X$ is an open subspace of $X$ in the sense of Definition \ref{definition-open-subspace}; an open subscheme of $X$ is a scheme by Lemma \ref{lemma-open-subspace-scheme}. \item A morphism of schemes is called a {\it closed immersion} if it is a closed immersion of locally ringed spaces (see Definition \ref{definition-closed-immersion-locally-ringed-spaces}). \item A {\it closed subscheme} of $X$ is a closed subspace of $X$ in the sense of Definition \ref{definition-closed-subspace}; a closed subscheme is a scheme by Lemma \ref{lemma-closed-subspace-scheme}. \item A morphism of schemes $f : X \to Y$ is called an {\it immersion}, or a {\it locally closed immersion} if it can be factored as $j \circ i$ where $i$ is a closed immersion and $j$ is an open immersion. \end{enumerate} \end{definition} \noindent It follows from the lemmas in Sections \ref{section-open-immersion} and \ref{section-closed-immersion} that any open (resp.\ closed) immersion of schemes is isomorphic to the inclusion of an open (resp.\ closed) subscheme of the target. \medskip\noindent Our definition of a closed immersion is halfway between Hartshorne and EGA. Hartshorne defines a closed immersion as a morphism $f : X \to Y$ of schemes which induces a homeomorphism of $X$ onto a closed subset of $Y$ such that $f^\# : \mathcal{O}_Y \to f_*\mathcal{O}_X$ is surjective, see \cite[Page 85]{H}. We will show this is equivalent to our notion in Lemma \ref{lemma-characterize-closed-immersions}. In \cite{EGA}, Grothendieck and Dieudonn\'e first define closed subschemes via the construction of Example \ref{example-closed-subspace} using quasi-coherent sheaves of ideals and then define a closed immersion as a morphism $f : X \to Y$ which induces an isomorphism with a closed subscheme. It follows from Lemma \ref{lemma-closed-subspace-scheme} that this agrees with our notion. \medskip\noindent Pedagogically speaking the definition above is a disaster/nightmare. In teaching this material to students, we have found it often convenient to define a closed immersion as an affine morphism $f : X \to Y$ of schemes such that $f^\# : \mathcal{O}_Y \to f_*\mathcal{O}_X$ is surjective. Namely, it turns out that the notion of an affine morphism (Morphisms, Section \ref{morphisms-section-affine}) is quite natural and easy to understand. \medskip\noindent For more information on closed immersions we suggest the reader visit Morphisms, Sections \ref{morphisms-section-closed-immersions} and \ref{morphisms-section-closed-immersions-quasi-coherent}. \medskip\noindent We will discuss locally closed subschemes and immersions at the end of this section. \begin{remark} \label{remark-not-reverse-open-closed} If $f : X \to Y$ is an immersion of schemes, then it is in general not possible to factor $f$ as an open immersion followed by a closed immersion. See Morphisms, Example \ref{morphisms-example-thibaut}. \end{remark} \begin{lemma} \label{lemma-immersion-when-closed} Let $f : Y \to X$ be an immersion of schemes. Then $f$ is a closed immersion if and only if $f(Y) \subset X$ is a closed subset. \end{lemma} \begin{proof} If $f$ is a closed immersion then $f(Y)$ is closed by definition. Conversely, suppose that $f(Y)$ is closed. By definition there exists an open subscheme $U \subset X$ such that $f$ is the composition of a closed immersion $i : Y \to U$ and the open immersion $j : U \to X$. Let $\mathcal{I} \subset \mathcal{O}_U$ be the quasi-coherent sheaf of ideals associated to the closed immersion $i$. Note that $\mathcal{I}|_{U \setminus i(Y)} = \mathcal{O}_{U \setminus i(Y)} = \mathcal{O}_{X \setminus i(Y)}|_{U \setminus i(Y)}$. Thus we may glue (see Sheaves, Section \ref{sheaves-section-glueing-sheaves}) $\mathcal{I}$ and $\mathcal{O}_{X \setminus i(Y)}$ to a sheaf of ideals $\mathcal{J} \subset \mathcal{O}_X$. Since every point of $X$ has a neighbourhood where $\mathcal{J}$ is quasi-coherent, we see that $\mathcal{J}$ is quasi-coherent (in particular locally generated by sections). By construction $\mathcal{O}_X/\mathcal{J}$ is supported on $U$ and equal to $\mathcal{O}_U/\mathcal{I}$. Thus we see that the closed subspaces associated to $\mathcal{I}$ and $\mathcal{J}$ are canonically isomorphic, see Example \ref{example-closed-subspace}. In particular the closed subspace of $U$ associated to $\mathcal{I}$ is isomorphic to a closed subspace of $X$. Since $Y \to U$ is identified with the closed subspace associated to $\mathcal{I}$, see Lemma \ref{lemma-closed-immersion}, we conclude that $Y \to U \to X$ is a closed immersion. \end{proof} \noindent Let $f : Y \to X$ be an immersion. Let $Z = \overline{f(Y)} \setminus f(Y)$ which is a closed subset of $X$. Let $U = X \setminus Z$. The lemma implies that $U$ is the biggest open subspace of $X$ such that $f : Y \to X$ factors through a closed immersion into $U$. We define a {\it locally closed subscheme of $X$} as a pair $(Z, U)$ consisting of a closed subscheme $Z$ of an open subscheme $U$ of $X$ such that in addition $\overline{Z} \cup U = X$. We usually just say let $Z$ be a locally closed subscheme of $X$'' since we may recover $U$ from the morphism $Z \to X$. The above then shows that any immersion $f : Y \to X$ factors uniquely as $Y \to Z \to X$ where $Z$ is a locally closed subspace of $X$ and $Y \to Z$ is an isomorphism. \medskip\noindent The interest of this is that the collection of locally closed subschemes of $X$ forms a set. We may define a partial ordering on this set, which we call inclusion for obvious reasons. To be explicit, if $Z \to X$ and $Z' \to X$ are two locally closed subschemes of $X$, then we say that {\it $Z$ is contained in $Z'$} simply if the morphism $Z \to X$ factors through $Z'$. If it does, then of course $Z$ is identified with a unique locally closed subscheme of $Z'$, and so on. \medskip\noindent For more information on immersions, we refer the reader to Morphisms, Section \ref{morphisms-section-immersions}. \section{Zariski topology of schemes} \label{section-topology} \noindent See Topology, Section \ref{topology-section-introduction} for some basic material in topology adapted to the Zariski topology of schemes. \begin{lemma} \label{lemma-scheme-sober} Let $X$ be a scheme. Any irreducible closed subset of $X$ has a unique generic point. In other words, $X$ is a sober topological space, see Topology, Definition \ref{topology-definition-generic-point}. \end{lemma} \begin{proof} Let $Z \subset X$ be an irreducible closed subset. For every affine open $U \subset X$, $U = \Spec(R)$ we know that $Z \cap U = V(I)$ for a unique radical ideal $I \subset R$. Note that $Z \cap U$ is either empty or irreducible. In the second case (which occurs for at least one $U$) we see that $I = \mathfrak p$ is a prime ideal, which is a generic point $\xi$ of $Z \cap U$. It follows that $Z = \overline{\{\xi\}}$, in other words $\xi$ is a generic point of $Z$. If $\xi'$ was a second generic point, then $\xi' \in Z \cap U$ and it follows immediately that $\xi' = \xi$. \end{proof} \begin{lemma} \label{lemma-basis-affine-opens} Let $X$ be a scheme. The collection of affine opens of $X$ forms a basis for the topology on $X$. \end{lemma} \begin{proof} This follows from the discussion on open subschemes in Section \ref{section-schemes}. \end{proof} \begin{remark} \label{remark-intersection-affine-opens} In general the intersection of two affine opens in $X$ is not affine open. See Example \ref{example-affine-space-zero-doubled}. \end{remark} \begin{lemma} \label{lemma-locally-quasi-compact} The underlying topological space of any scheme is locally quasi-compact, see Topology, Definition \ref{topology-definition-locally-quasi-compact}. \end{lemma} \begin{proof} This follows from Lemma \ref{lemma-basis-affine-opens} above and the fact that the spectrum of ring is quasi-compact, see Algebra, Lemma \ref{algebra-lemma-quasi-compact}. \end{proof} \begin{lemma} \label{lemma-standard-open-two-affines} Let $X$ be a scheme. Let $U, V$ be affine opens of $X$, and let $x \in U \cap V$. There exists an affine open neighbourhood $W$ of $x$ such that $W$ is a standard open of both $U$ and $V$. \end{lemma} \begin{proof} Write $U = \Spec(A)$ and $V = \Spec(B)$. Say $x$ corresponds to the prime $\mathfrak p \subset A$ and the prime $\mathfrak q \subset B$. We may choose an $f \in A$, $f \not \in \mathfrak p$ such that $D(f) \subset U \cap V$. Note that any standard open of $D(f)$ is a standard open of $\Spec(A) = U$. Hence we may assume that $U \subset V$. In other words, now we may think of $U$ as an affine open of $V$. Next we choose a $g \in B$, $g \not \in \mathfrak q$ such that $D(g) \subset U$. In this case we see that $D(g) = D(g_A)$ where $g_A \in A$ denotes the image of $g$ by the map $B \to A$. Thus the lemma is proved. \end{proof} \begin{lemma} \label{lemma-good-subcover} Let $X$ be a scheme. Let $X = \bigcup_i U_i$ be an affine open covering. Let $V \subset X$ be an affine open. There exists a standard open covering $V = \bigcup_{j = 1, \ldots, m} V_j$ (see Definition \ref{definition-standard-covering}) such that each $V_j$ is a standard open in one of the $U_i$. \end{lemma} \begin{proof} Pick $v \in V$. Then $v \in U_i$ for some $i$. By Lemma \ref{lemma-standard-open-two-affines} above there exists an open $v \in W_v \subset V \cap U_i$ such that $W_v$ is a standard open in both $V$ and $U_i$. Since $V$ is quasi-compact the lemma follows. \end{proof} \begin{lemma} \label{lemma-sheaf-on-affines} Let $X$ be a scheme. Let $\mathcal{B}$ be the set of affine opens of $X$. Let $\mathcal{F}$ be a presheaf of sets on $\mathcal{B}$, see Sheaves, Definition \ref{sheaves-definition-presheaf-basis}. The following are equivalent \begin{enumerate} \item $\mathcal{F}$ is the restriction of a sheaf on $X$ to $\mathcal{B}$, \item $\mathcal{F}$ is a sheaf on $\mathcal{B}$, and \item $\mathcal{F}(\emptyset)$ is a singleton and whenever $U = V \cup W$ with $U, V, W \in \mathcal{B}$ and $V, W \subset U$ standard open (Algebra, Definition \ref{algebra-definition-Zariski-topology}) the map $$\mathcal{F}(U) \longrightarrow \mathcal{F}(V) \times \mathcal{F}(W)$$ is injective with image the set of pairs $(s, t)$ such that $s|_{V \cap W} = t|_{V \cap W}$. \end{enumerate} \end{lemma} \begin{proof} The equivalence of (1) and (2) is Sheaves, Lemma \ref{sheaves-lemma-restrict-basis-equivalence}. It is clear that (2) implies (3). Hence it suffices to prove that (3) implies (2). By Sheaves, Lemma \ref{sheaves-lemma-cofinal-systems-coverings-standard-case} and Lemma \ref{lemma-standard-open} it suffices to prove the sheaf condition holds for standard open coverings (Definition \ref{definition-standard-covering}) of elements of $\mathcal{B}$. Let $U = U_1 \cup \ldots \cup U_n$ be a standard open covering with $U \subset X$ affine open. We will prove the sheaf condition for this covering by induction on $n$. If $n = 0$, then $U$ is empty and we get the sheaf condition by assumption. If $n = 1$, then there is nothing to prove. If $n = 2$, then this is assumption (3). If $n > 2$, then we write $U_i = D(f_i)$ for $f_i \in A = \mathcal{O}_X(U)$. Suppose that $s_i \in \mathcal{F}(U_i)$ are sections such that $s_i|_{U_i \cap U_j} = s_j|_{U_i \cap U_j}$ for all $1 \leq i < j \leq n$. Since $U = U_1 \cup \ldots \cup U_n$ we have $1 = \sum_{i = 1, \ldots, n} a_i f_i$ in $A$ for some $a_i \in A$, see Algebra, Lemma \ref{algebra-lemma-Zariski-topology}. Set $g = \sum_{i = 1, \ldots, n - 1} a_if_i$. Then $U = D(g) \cup D(f_n)$. Observe that $D(g) = D(gf_1) \cup \ldots \cup D(gf_{n - 1})$ is a standard open covering. By induction there is a unique section $s' \in \mathcal{F}(D(g))$ which agrees with $s_i|_{D(gfi)}$ for $i = 1, \ldots, n - 1$. We claim that $s'$ and $s_n$ have the same restriction to $D(gf_n)$. This is true by induction and the covering $D(gf_n) = D(gf_nf_1) \cup \ldots \cup D(gf_nf_{n - 1})$. Thus there is a unique section $s \in \mathcal{F}(U)$ whose restriction to $D(g)$ is $s'$ and whose restriction to $D(f_n)$ is $s_n$. We omit the verification that $s$ restricts to $s_i$ on $D(f_i)$ for $i = 1, \ldots, n - 1$ and we omit the verification that $s$ is unique. \end{proof} \begin{lemma} \label{lemma-scheme-finite-discrete-affine} Let $X$ be a scheme whose underlying topological space is a finite discrete set. Then $X$ is affine. \end{lemma} \begin{proof} Say $X = \{x_1, \ldots, x_n\}$. Then $U_i = \{x_i\}$ is an open neighbourhood of $x_i$. By Lemma \ref{lemma-basis-affine-opens} it is affine. Hence $X$ is a finite disjoint union of affine schemes, and hence is affine by Lemma \ref{lemma-disjoint-union-affines}. \end{proof} \begin{example} \label{example-scheme-without-closed-points} There exists a scheme without closed points. Namely, let $R$ be a local domain whose spectrum looks like $(0) = \mathfrak p_0 \subset \mathfrak p_1 \subset \mathfrak p_2 \subset \ldots \subset \mathfrak m$. Then the open subscheme $\Spec(R) \setminus \{\mathfrak m\}$ does not have a closed point. To see that such a ring $R$ exists, we use that given any totally ordered group $(\Gamma, \geq)$ there exists a valuation ring $A$ with valuation group $(\Gamma, \geq)$, see \cite{Krull}. See Algebra, Section \ref{algebra-section-valuation-rings} for notation. We take $\Gamma = \mathbf{Z}x_1 \oplus \mathbf{Z}x_2 \oplus \mathbf{Z}x_3 \oplus \ldots$ and we define $\sum_i a_i x_i \geq 0$ if and only if the first nonzero $a_i$ is $> 0$, or all $a_i = 0$. So $x_1 \geq x_2 \geq x_3 \geq \ldots \geq 0$. The subsets $x_i + \Gamma_{\geq 0}$ are prime ideals of $(\Gamma, \geq)$, see Algebra, notation above Lemma \ref{algebra-lemma-ideals-valuation-ring}. These together with $\emptyset$ and $\Gamma_{\geq 0}$ are the only prime ideals. Hence $A$ is an example of a ring with the given structure of its spectrum, by Algebra, Lemma \ref{algebra-lemma-ideals-valuation-ring}. \end{example} \section{Reduced schemes} \label{section-reduced} \begin{definition} \label{definition-reduced} Let $X$ be a scheme. We say $X$ is {\it reduced} if every local ring $\mathcal{O}_{X, x}$ is reduced. \end{definition} \begin{lemma} \label{lemma-reduced} A scheme $X$ is reduced if and only if $\mathcal{O}_X(U)$ is a reduced ring for all $U \subset X$ open. \end{lemma} \begin{proof} Assume that $X$ is reduced. Let $f \in \mathcal{O}_X(U)$ be a section such that $f^n = 0$. Then the image of $f$ in $\mathcal{O}_{U, u}$ is zero for all $u \in U$. Hence $f$ is zero, see Sheaves, Lemma \ref{sheaves-lemma-sheaf-subset-stalks}. Conversely, assume that $\mathcal{O}_X(U)$ is reduced for all opens $U$. Pick any nonzero element $f \in \mathcal{O}_{X, x}$. Any representative $(U, f \in \mathcal{O}(U))$ of $f$ is nonzero and hence not nilpotent. Hence $f$ is not nilpotent in $\mathcal{O}_{X, x}$. \end{proof} \begin{lemma} \label{lemma-affine-reduced} An affine scheme $\Spec(R)$ is reduced if and only if $R$ is reduced. \end{lemma} \begin{proof} The direct implication follows immediately from Lemma \ref{lemma-reduced} above. In the other direction it follows since any localization of a reduced ring is reduced, and in particular the local rings of a reduced ring are reduced. \end{proof} \begin{lemma} \label{lemma-reduced-closed-subscheme} Let $X$ be a scheme. Let $T \subset X$ be a closed subset. There exists a unique closed subscheme $Z \subset X$ with the following properties: (a) the underlying topological space of $Z$ is equal to $T$, and (b) $Z$ is reduced. \end{lemma} \begin{proof} Let $\mathcal{I} \subset \mathcal{O}_X$ be the sub presheaf defined by the rule $$\mathcal{I}(U) = \{f \in \mathcal{O}_X(U) \mid f(t) = 0\text{ for all }t \in T\cap U\}$$ Here we use $f(t)$ to indicate the image of $f$ in the residue field $\kappa(t)$ of $X$ at $t$. Because of the local nature of the condition it is clear that $\mathcal{I}$ is a sheaf of ideals. Moreover, let $U = \Spec(R)$ be an affine open. We may write $T \cap U = V(I)$ for a unique radical ideal $I \subset R$. Given a prime $\mathfrak p \in V(I)$ corresponding to $t \in T \cap U$ and an element $f \in R$ we have $f(t) = 0 \Leftrightarrow f \in \mathfrak p$. Hence $\mathcal{I}(U) = \bigcap_{\mathfrak p \in V(I)} \mathfrak p = I$ by Algebra, Lemma \ref{algebra-lemma-Zariski-topology}. Moreover, for any standard open $D(g) \subset \Spec(R) = U$ we have $\mathcal{I}(D(g)) = I_g$ by the same reasoning. Thus $\widetilde I$ and $\mathcal{I}|_U$ agree (as ideals) on a basis of opens and hence are equal. Therefore $\mathcal{I}$ is a quasi-coherent sheaf of ideals. \medskip\noindent At this point we may define $Z$ as the closed subspace associated to the sheaf of ideals $\mathcal{I}$. For every affine open $U = \Spec(R)$ of $X$ we see that $Z \cap U = \Spec(R/I)$ where $I$ is a radical ideal and hence $Z$ is reduced (by Lemma \ref{lemma-affine-reduced} above). By construction the underlying closed subset of $Z$ is $T$. Hence we have found a closed subscheme with properties (a) and (b). \medskip\noindent Let $Z' \subset X$ be a second closed subscheme with properties (a) and (b). For every affine open $U = \Spec(R)$ of $X$ we see that $Z' \cap U = \Spec(R/I')$ for some ideal $I' \subset R$. By Lemma \ref{lemma-affine-reduced} the ring $R/I'$ is reduced and hence $I'$ is radical. Since $V(I') = T \cap U = V(I)$ we deduced that $I = I'$ by Algebra, Lemma \ref{algebra-lemma-Zariski-topology}. Hence $Z'$ and $Z$ are defined by the same sheaf of ideals and hence are equal. \end{proof} \begin{definition} \label{definition-reduced-induced-scheme} Let $X$ be a scheme. Let $Z \subset X$ be a closed subset. A {\it scheme structure on $Z$} is given by a closed subscheme $Z'$ of $X$ whose underlying set is equal to $Z$. We often say let $(Z, \mathcal{O}_Z)$ be a scheme structure on $Z$'' to indicate this. The {\it reduced induced scheme structure} on $Z$ is the one constructed in Lemma \ref{lemma-reduced-closed-subscheme}. The {\it reduction $X_{red}$ of $X$} is the reduced induced scheme structure on $X$ itself. \end{definition} \noindent Often when we say let $Z \subset X$ be an irreducible component of $X$'' we think of $Z$ as a reduced closed subscheme of $X$ using the reduced induced scheme structure. \begin{remark} \label{remark-reduced-induced-locally-closed} Let $X$ be a scheme. Let $T \subset X$ be a locally closed subset. In this situation we sometimes also use the phrase reduced induced scheme structure on $T$''. It refers to the reduced induced scheme structure from Definition \ref{definition-reduced-induced-scheme} when we view $T$ as a closed subset of the open subscheme $X \setminus \partial T$ of $X$. Here $\partial T = \overline{T} \setminus T$ is the boundary'' of $T$ in the topological space of $X$. \end{remark} \begin{lemma} \label{lemma-map-into-reduction} Let $X$ be a scheme. Let $Z \subset X$ be a closed subscheme. Let $Y$ be a reduced scheme. A morphism $f : Y \to X$ factors through $Z$ if and only if $f(Y) \subset Z$ (set theoretically). In particular, any morphism $Y \to X$ factors as $Y \to X_{red} \to X$. \end{lemma} \begin{proof} Assume $f(Y) \subset Z$ (set theoretically). Let $\mathcal{I} \subset \mathcal{O}_X$ be the ideal sheaf of $Z$. For any affine opens $U \subset X$, $\Spec(B) = V \subset Y$ with $f(V) \subset U$ and any $g \in \mathcal{I}(U)$ the pullback $b = f^\sharp(g) \in \Gamma(V, \mathcal{O}_Y) = B$ maps to zero in the residue field of any $y \in V$. In other words $b \in \bigcap_{\mathfrak p \subset B} \mathfrak p$. This implies $b = 0$ as $B$ is reduced (Lemma \ref{lemma-reduced}, and Algebra, Lemma \ref{algebra-lemma-Zariski-topology}). Hence $f$ factors through $Z$ by Lemma \ref{lemma-characterize-closed-subspace}. \end{proof} \section{Points of schemes} \label{section-points} \noindent Given a scheme $X$ we can define a functor $$h_X : \Sch^{opp} \longrightarrow \textit{Sets}, \quad T \longmapsto \Mor(T, X).$$ See Categories, Example \ref{categories-example-hom-functor}. This is called the {\it functor of points of $X$}. A fun part of scheme theory is to find descriptions of the internal geometry of $X$ in terms of this functor $h_X$. In this section we find a simple way to describe points of $X$. \medskip\noindent Let $X$ be a scheme. Let $R$ be a local ring with maximal ideal $\mathfrak m \subset R$. Suppose that $f : \Spec(R) \to X$ is a morphism of schemes. Let $x \in X$ be the image of the closed point $\mathfrak m \in \Spec(R)$. Then we obtain a local homomorphism of local rings $$f^\sharp : \mathcal{O}_{X, x} \longrightarrow \mathcal{O}_{\Spec(R), \mathfrak m} = R.$$ \begin{lemma} \label{lemma-morphism-from-spec-local-ring} Let $X$ be a scheme. Let $R$ be a local ring. The construction above gives a bijective correspondence between morphisms $\Spec(R) \to X$ and pairs $(x, \varphi)$ consisting of a point $x \in X$ and a local homomorphism of local rings $\varphi : \mathcal{O}_{X, x} \to R$. \end{lemma} \begin{proof} Let $A$ be a ring. For any ring homomorphism $\psi : A \to R$ there exists a unique prime ideal $\mathfrak p \subset A$ and a factorization $A \to A_{\mathfrak p} \to R$ where the last map is a local homomorphism of local rings. Namely, $\mathfrak p = \psi^{-1}(\mathfrak m)$. Via Lemma \ref{lemma-morphism-into-affine} this proves that the lemma holds if $X$ is an affine scheme. \medskip\noindent Let $X$ be a general scheme. Any $x \in X$ is contained in an open affine $U \subset X$. By the affine case we conclude that every pair $(x, \varphi)$ occurs as the end product of the construction above the lemma. \medskip\noindent To finish the proof it suffices to show that any morphism $f : \Spec(R) \to X$ has image contained in any affine open containing the image $x$ of the closed point of $\Spec(R)$. In fact, let $x \in V \subset X$ be any open neighbourhood containing $x$. Then $f^{-1}(V) \subset \Spec(R)$ is an open containing the unique closed point and hence equal to $\Spec(R)$. \end{proof} \noindent As a special case of the lemma above we obtain for every point $x$ of a scheme $X$ a canonical morphism \begin{equation} \label{equation-canonical-morphism} \Spec(\mathcal{O}_{X, x}) \longrightarrow X \end{equation} corresponding to the identity map on the local ring of $X$ at $x$. We may reformulate the lemma above as saying that for any morphism $f : \Spec(R) \to X$ there exists a unique point $x \in X$ such that $f$ factors as $\Spec(R) \to \Spec(\mathcal{O}_{X, x}) \to X$ where the first map comes from a local homomorphism $\mathcal{O}_{X, x} \to R$. \medskip\noindent In case we have a morphism of schemes $f : X \to S$, and a point $x$ mapping to a point $s \in S$ we obtain a commutative diagram $$\xymatrix{ \Spec(\mathcal{O}_{X, x}) \ar[r] \ar[d] & X \ar[d] \\ \Spec(\mathcal{O}_{S, s}) \ar[r] & S }$$ where the left vertical map corresponds to the local ring map $f^\sharp_x : \mathcal{O}_{S, s} \to \mathcal{O}_{X, x}$. \begin{lemma} \label{lemma-specialize-points} Let $X$ be a scheme. Let $x, x' \in X$ be points of $X$. Then $x' \in X$ is a generalization of $x$ if and only if $x'$ is in the image of the canonical morphism $\Spec(\mathcal{O}_{X, x}) \to X$. \end{lemma} \begin{proof} A continuous map preserves the relation of specialization/generalization. Since every point of $\Spec(\mathcal{O}_{X, x})$ is a generalization of the closed point we see every point in the image of $\Spec(\mathcal{O}_{X, x}) \to X$ is a generalization of $x$. Conversely, suppose that $x'$ is a generalization of $x$. Choose an affine open neighbourhood $U = \Spec(R)$ of $x$. Then $x' \in U$. Say $\mathfrak p \subset R$ and $\mathfrak p' \subset R$ are the primes corresponding to $x$ and $x'$. Since $x'$ is a generalization of $x$ we see that $\mathfrak p' \subset \mathfrak p$. This means that $\mathfrak p'$ is in the image of the morphism $\Spec(\mathcal{O}_{X, x}) = \Spec(R_{\mathfrak p}) \to \Spec(R) = U \subset X$ as desired. \end{proof} \noindent Now, let us discuss morphisms from spectra of fields. Let $(R, \mathfrak m, \kappa)$ be a local ring with maximal ideal $\mathfrak m$ and residue field $\kappa$. Let $K$ be a field. A local homomorphism $R \to K$ by definition factors as $R \to \kappa \to K$, i.e., is the same thing as a morphism $\kappa \to K$. Thus we see that morphisms $$\Spec(K) \longrightarrow X$$ correspond to pairs $(x, \kappa(x) \to K)$. We may define a preorder on morphisms of spectra of fields to $X$ by saying that $\Spec(K) \to X$ dominates $\Spec(L) \to X$ if $\Spec(K) \to X$ factors through $\Spec(L) \to X$. This suggests the following notion: Let us temporarily say that two morphisms $p : \Spec(K) \to X$ and $q : \Spec(L) \to X$ are {\it equivalent} if there exists a third field $\Omega$ and a commutative diagram $$\xymatrix{ \Spec(\Omega) \ar[r] \ar[d] & \Spec(L) \ar[d]^q \\ \Spec(K) \ar[r]^p & X }$$ Of course this immediately implies that the unique points of all three of the schemes $\Spec(K)$, $\Spec(L)$, and $\Spec(\Omega)$ map to the same $x \in X$. Thus a diagram (by the remarks above) corresponds to a point $x \in X$ and a commutative diagram $$\xymatrix{ \Omega & L \ar[l] \\ K \ar[u] & \kappa(x) \ar[l] \ar[u] }$$ of fields. This defines an equivalence relation, because given any set of field extensions $K_i/\kappa$ there exists some field extension $\Omega/\kappa$ such that all the field extensions $K_i$ are contained in the extension $\Omega$. \begin{lemma} \label{lemma-characterize-points} Let $X$ be a scheme. Points of $X$ correspond bijectively to equivalence classes of morphisms from spectra of fields into $X$. Moreover, each equivalence class contains a (unique up to unique isomorphism) smallest element $\Spec(\kappa(x)) \to X$. \end{lemma} \begin{proof} Follows from the discussion above. \end{proof} \noindent Of course the morphisms $\Spec(\kappa(x)) \to X$ factor through the canonical morphisms $\Spec(\mathcal{O}_{X, x}) \to X$. And the content of Lemma \ref{lemma-specialize-points} is in this setting that the morphism $\Spec(\kappa(x')) \to X$ factors as $\Spec(\kappa(x')) \to \Spec(\mathcal{O}_{X, x}) \to X$ whenever $x'$ is a generalization of $x$. In case we have a morphism of schemes $f : X \to S$, and a point $x$ mapping to a point $s \in S$ we obtain a commutative diagram $$\xymatrix{ \Spec(\kappa(x)) \ar[r] \ar[d] & \Spec(\mathcal{O}_{X, x}) \ar[r] \ar[d] & X \ar[d] \\ \Spec(\kappa(s)) \ar[r] & \Spec(\mathcal{O}_{S, s}) \ar[r] & S. }$$ \section{Glueing schemes} \label{section-glueing-schemes} \noindent Let $I$ be a set. For each $i \in I$ let $(X_i, \mathcal{O}_i)$ be a locally ringed space. (Actually the construction that follows works equally well for ringed spaces.) For each pair $i, j \in I$ let $U_{ij} \subset X_i$ be an open subspace. For each pair $i, j \in I$, let $$\varphi_{ij} : U_{ij} \to U_{ji}$$ be an isomorphism of locally ringed spaces. For convenience we assume that $U_{ii} = X_i$ and $\varphi_{ii} = \text{id}_{X_i}$. For each triple $i, j, k \in I$ assume that \begin{enumerate} \item we have $\varphi_{ij}^{-1}(U_{ji} \cap U_{jk}) = U_{ij} \cap U_{ik}$, and \item the diagram $$\xymatrix{ U_{ij} \cap U_{ik} \ar[rr]_{\varphi_{ik}} \ar[rd]_{\varphi_{ij}} & & U_{ki} \cap U_{kj} \\ & U_{ji} \cap U_{jk} \ar[ru]_{\varphi_{jk}} }$$ is commutative. \end{enumerate} Let us call a collection $(I, (X_i)_{i\in I}, (U_{ij})_{i, j\in I}, (\varphi_{ij})_{i, j\in I})$ satisfying the conditions above a glueing data. \begin{lemma} \label{lemma-glue} \begin{slogan} If you have two locally ringed spaces, and a subspace of the first one is isomorphic to a subspace of the other, then you can glue them together into one big locally ringed space. \end{slogan} Given any glueing data of locally ringed spaces there exists a locally ringed space $X$ and open subspaces $U_i \subset X$ together with isomorphisms $\varphi_i : X_i \to U_i$ of locally ringed spaces such that \begin{enumerate} \item $X=\bigcup_{i\in I} U_i$, \item $\varphi_i(U_{ij}) = U_i \cap U_j$, and \item $\varphi_{ij} = \varphi_j^{-1}|_{U_i \cap U_j} \circ \varphi_i|_{U_{ij}}$. \end{enumerate} The locally ringed space $X$ is characterized by the following mapping properties: Given a locally ringed space $Y$ we have \begin{eqnarray*} \Mor(X, Y) & = & \{ (f_i)_{i\in I} \mid f_i : X_i \to Y, \ f_j \circ \varphi_{ij} = f_i|_{U_{ij}}\} \\ f & \mapsto & (f|_{U_i} \circ \varphi_i)_{i \in I} \\ \Mor(Y, X) & = & \left\{ \begin{matrix} \text{open covering }Y = \bigcup\nolimits_{i \in I} V_i\text{ and } (g_i : V_i \to X_i)_{i \in I} \text{ such that}\\ g_i^{-1}(U_{ij}) = V_i \cap V_j \text{ and } g_j|_{V_i \cap V_j} = \varphi_{ij} \circ g_i|_{V_i \cap V_j} \end{matrix} \right\} \\ g & \mapsto & V_i = g^{-1}(U_i), \ g_i = \varphi_i^{-1} \circ g|_{V_i} \end{eqnarray*} \end{lemma} \begin{proof} We construct $X$ in stages. As a set we take $$X = (\coprod X_i) / \sim.$$ Here given $x \in X_i$ and $x' \in X_j$ we say $x \sim x'$ if and only if $x \in U_{ij}$, $x' \in U_{ji}$ and $\varphi_{ij}(x) = x'$. This is an equivalence relation since if $x \in X_i$, $x' \in X_j$, $x'' \in X_k$, and $x \sim x'$ and $x' \sim x''$, then $x' \in U_{ji} \cap U_{jk}$, hence by condition (1) of a glueing data also $x \in U_{ij} \cap U_{ik}$ and $x'' \in U_{ki} \cap U_{kj}$ and by condition (2) we see that $\varphi_{ik}(x) = x''$. (Reflexivity and symmetry follows from our assumptions that $U_{ii} = X_i$ and $\varphi_{ii} = \text{id}_{X_i}$.) Denote $\varphi_i : X_i \to X$ the natural maps. Denote $U_i = \varphi_i(X_i) \subset X$. Note that $\varphi_i : X_i \to U_i$ is a bijection. \medskip\noindent The topology on $X$ is defined by the rule that $U \subset X$ is open if and only if $\varphi_i^{-1}(U)$ is open for all $i$. We leave it to the reader to verify that this does indeed define a topology. Note that in particular $U_i$ is open since $\varphi_j^{-1}(U_i) = U_{ji}$ which is open in $X_j$ for all $j$. Moreover, for any open set $W \subset X_i$ the image $\varphi_i(W) \subset U_i$ is open because $\varphi_j^{-1}(\varphi_i(W)) = \varphi_{ji}^{-1}(W \cap U_{ij})$. Therefore $\varphi_i : X_i \to U_i$ is a homeomorphism. \medskip\noindent To obtain a locally ringed space we have to construct the sheaf of rings $\mathcal{O}_X$. We do this by glueing the sheaves of rings $\mathcal{O}_{U_i} := \varphi_{i, *} \mathcal{O}_i$. Namely, in the commutative diagram $$\xymatrix{ U_{ij} \ar[rr]_{\varphi_{ij}} \ar[rd]_{\varphi_i|_{U_{ij}}} & & U_{ji} \ar[ld]^{\varphi_j|_{U_{ji}}} \\ & U_i \cap U_j & }$$ the arrow on top is an isomorphism of ringed spaces, and hence we get unique isomorphisms of sheaves of rings $$\mathcal{O}_{U_i}|_{U_i \cap U_j} \longrightarrow \mathcal{O}_{U_j}|_{U_i \cap U_j}.$$ These satisfy a cocycle condition as in Sheaves, Section \ref{sheaves-section-glueing-sheaves}. By the results of that section we obtain a sheaf of rings $\mathcal{O}_X$ on $X$ such that $\mathcal{O}_X|_{U_i}$ is isomorphic to $\mathcal{O}_{U_i}$ compatibly with the glueing maps displayed above. In particular $(X, \mathcal{O}_X)$ is a locally ringed space since the stalks of $\mathcal{O}_X$ are equal to the stalks of $\mathcal{O}_i$ at corresponding points. \medskip\noindent The proof of the mapping properties is omitted. \end{proof} \begin{lemma} \label{lemma-glue-schemes} \begin{slogan} Schemes can be glued to give new schemes. \end{slogan} In Lemma \ref{lemma-glue} above, assume that all $X_i$ are schemes. Then the resulting locally ringed space $X$ is a scheme. \end{lemma} \begin{proof} This is clear since each of the $U_i$ is a scheme and hence every $x \in X$ has an affine neighbourhood. \end{proof} \noindent It is customary to think of $X_i$ as an open subspace of $X$ via the isomorphisms $\varphi_i$. We will do this in the next two examples. \begin{example}[Affine space with zero doubled] \label{example-affine-space-zero-doubled} Let $k$ be a field. Let $n \geq 1$. Let $X_1 = \Spec(k[x_1, \ldots, x_n])$, let $X_2 = \Spec(k[y_1, \ldots, y_n])$. Let \$0_1 \in X_