on the adjointness of the global section functor and the Spec functor
In fact, it is an exercise on Hartshorne, Ex 2.4 to the second chapter of it (P79): let $A$ be a ring and $(X,\mathcal{O}_X)$ be a scheme. Given a morphism $f:X\longrightarrow \operatorname{Spec} A$,we have an associated map on sheaves $f^\sharp :\mathcal{O}_{\operatorname{Spec} A}\longrightarrow f_*\mathcal{O}_X$.Taking global sections we obtain a homomorphism $A\longrightarrow \Gamma (X,\mathcal{O}_X)$.Thus there is a natural map $\alpha:\operatorname{Hom}_{\mathcal{Sch}}(X,\operatorname{Spec} A)\longrightarrow \operatorname{Hom}_{\mathcal{Rings}}(A,\Gamma (X,\mathcal{O}_X))$.How to show that $\alpha$ is bijective?My approach is to construct an inverse for $\alpha$.Starting from a ring hom $\phi :A\longrightarrow \Gamma (X,\mathcal{O}_X)$,and an affine covering $X=\bigcup_i \operatorname{Spec} B_i$,restricting $\Gamma (X,\mathcal{O}_X)$ to $\mathcal{O}_X (\operatorname{Spec}B_i)$,we get maps $\phi_i:A\longrightarrow B_i$,thus inducing $(f_i,f_{i}^{\sharp}):\operatorname{Spec}B_i\longrightarrow \operatorname{Spec} A$.Then I want to glue these $\operatorname{Spec}B_i$ together to get a morphism $(f,f^\sharp):(X,\mathcal{O}_X)\longrightarrow (\operatorname{Spec}A,\mathcal{O}_{\operatorname{Spec}A})$.I get stuck here:I don't know how to glue them together and verify that $(f,f^\sharp)$ is independent of the covering $\{ \operatorname{Spec}B_i\}_i$.Is my idea right? Will someone be kind enough to give me some hints on this problem?Thank you very much!
Solution 1:
If you want to prove the statement in question using a gluing argument, then you need to prove the result in the special case that $X=\mathrm{Spec}(B)$ is also affine. This will allow you to conclude that your maps on intersections of affine opens agree on overlaps (because $\mathrm{Hom}(\mathrm{Spec}(B),\mathrm{Spec}(A))\rightarrow\mathrm{Hom}(A,B)$ is a bijection).
The result for $X=\mathrm{Spec}(B)$ is proved in Hartshorne if I remember correctly. In any case, the idea is that a ring map $\varphi:A\rightarrow B$ induces a continuous map $\alpha:\mathrm{Spec}(B)\rightarrow\mathrm{Spec}(A)$ under which the inverse image of a standard open $D(f)\subseteq\mathrm{Spec}(A)$ is $D(\varphi(f))$ ($f\in A$). The homomorphism $\varphi$ naturally induces, for each $f\in A$, a ring map $A_f\rightarrow B_{\varphi(f)}$, i.e., a map $\mathcal{O}_{\mathrm{Spec}(A)}(D(f))\rightarrow\mathcal{O}_{\mathrm{Spec}(B)}(D(\varphi(f))$, compatible with restriction, and since the sets $D(f)$ give a base for the topology of $\mathrm{Spec}(A)$, this is extends uniquely to a sheaf map $\mathcal{O}_{\mathrm{Spec}(A)}\rightarrow\alpha_*\mathcal{O}_{\mathrm{Spec}(B)}$. For $\mathfrak{q}\in\mathrm{Spec}(B)$, $\mathfrak{p}=\alpha(\mathfrak{q})=\varphi^{-1}(\mathfrak{q})$, the stalk map $A_\mathfrak{p}\rightarrow B_\mathfrak{q}$ is also induced (via the universal property of localization) by $\varphi$, and is easily seen to be local (by construction). This morphism $\alpha$ also recovers $\varphi$ on global sections.
Uniqueness follows ultimately because of the requirement that the stalk maps of a morphism of locally ringed spaces are local and because morphisms of sheaves are determined by the morphisms on stalks. The requirement that the stalk maps be local forces $\alpha(\mathfrak{q})=\varphi^{-1}(\mathfrak{q})$, and then, again using the universal property of localization, there is a unique map of stalks $A_{\varphi^{-1}(\mathfrak{q})}\rightarrow B_\mathfrak{q}$ compatible with $\varphi$. In summary, if you want to recover $\varphi$ on global sections and you want your stalk maps to be local, you only have one choice (everything is induced by the universal property of localization).
I want to point out that this argument actually extends to prove the result you're after with $X$ replaced not just by an arbitrary scheme, but by an arbitrary locally ringed space. This means the result actually has nothing to do with gluing (since an arbitrary locally ringed space needn't be built from affine schemes). The crucial thing is (as mentioned above) that for a morphism $\alpha:X\rightarrow\mathrm{Spec}(A)$ the stalk map $\alpha_x^\sharp:A_{f(x)}\rightarrow\mathcal{O}_{X,x}$ is local for any $x\in X$. Note that here $f(x)$ is a prime ideal of $A$ and $A_{f(x)}$ is the localization at that prime (the stalk of the structure sheaf of $\mathrm{Spec}(A)$ at $f(x)$). If $\alpha^\sharp:A\rightarrow\mathcal{O}_X(X)$ is the map on global sections of the morphism $\alpha$, then its compatibility with the stalk map $\alpha_x^\sharp$ and the fact that $\alpha_x^\sharp$ is local actually implies that $f(x)$ is the inverse image of the maximal ideal $\mathfrak{m}_x\subseteq\mathcal{O}_{X,x}$ under the ring map $A\rightarrow\mathcal{O}_X\rightarrow\mathcal{O}_{X,x}$ (the first arrow is $\alpha^\sharp$ and the second is taking the stalk at $x$). So the map on global sections determines the morphism $\alpha$ on the underlying topological spaces. Once you know this, it also follows that the stalk maps are uniquely determined.
The point of all this is that the map you want to prove is a bijection is injective. To prove that it is surjective, you basically run the above argument backwards. Given a ring map $\varphi:A\rightarrow\mathcal{O}_X(X)$, you can define $\alpha:X\rightarrow\mathrm{Spec}(A)$ on topological spaces by taking $f(x)$ to the prime ideal that is the inverse image of $\mathfrak{m}_x\subseteq\mathcal{O}_{X,x}$ under the map mentioned in the previous paragraph. You can prove then that for any $f\in A$, $\alpha^{-1}(D(f))$ is $X_{\varphi(f)}$, defined as the set of all $x\in X$ such that $\varphi(f)_x$ is not in the maximal ideal $\mathfrak{m}_x$ of $\mathcal{O}_{X,x}$. This is an open set of $X$ (the analogue of a standard open in an affine scheme), so $\alpha$ is continuous. The universal property of localization together with the fact that $\varphi(f)\vert_{X_{\varphi(f)}}\in\mathcal{O}_X(X_{\varphi(f)})$ is a unit (this follows from the definition of $X_{\varphi(f)}$) shows that the ring map $A\rightarrow\mathcal{O}_X(X)\rightarrow\mathcal{O}_X(X_{\varphi(f)})$ ($\varphi$ followed by restriction from $X$ to $X_{\varphi(f)})$ induces a unique map $A_f\rightarrow\mathcal{O}_X(X_f)$ compatible with restriction. This data is what you need for a map of sheaves $\mathcal{O}_{\mathrm{Spec}(A)}\rightarrow\alpha_*\mathcal{O}_X$. This $\alpha$ recovers $\varphi$ on global sections and proves surjectivity.
Just to explain, the reason I went through all this was to illustrate that the adjunction between the global sections functor and $\mathrm{Spec}$ actually works on the entire category of locally ringed spaces (not just the full subcategory of schemes) and so really has nothing to do with gluing maps on affine patches. I personally (when learning algebraic geometry) found this fact really helped me and shaped the way I think of affine schemes among locally ringed spaces (or just schemes). For example, any locally ringed space $X$ admits a unique morphism to $\mathrm{Spec}(\mathbb{Z})$, and the method of proof I've described shows that it sends a point $x\in X$ to the prime ideal generated by the characteristic of the residue field $ \kappa(x)$.
Solution 2:
I think it's unfortunate that Hartshorne doesn't say, "you can glue morphisms". Here's a general lemma that might help:
Let $(X, \mathscr{O}_X)$ and $(Y, \mathscr{O}_Y)$ be ringed spaces. Suppose I have an open cover $\{U_i\}$ of $X$ and morphisms $f_i\colon (U_i, \mathscr{O}_X|_{U_i}) \to Y$ such that for each $i, j$ we have $f_i|_{U_i \cap U_j} = f_j|_{U_i \cap U_j}$. Then there is a unique morphism $f\colon X \to Y$ such that each $f|_{U_i} = f_i$.
It seems to me that one way to avoid worrying about canonicity is to take the family of all affine open sets in $X$ as your cover. There are some remaining technical points in order to even apply the lemma; hopefully I can comment on those later.