# Prop. 2.3 Hartshorne: $\varphi:A\to B$ induces a morphism $\operatorname{Spec}(B)\to\operatorname{Spec}(A)$

I don't fully understand a step in the proof of the above-mentioned Proposition; more precisely, in part (b):

If $\varphi:A\to B$ is a homomorphism of rings, $X=\operatorname{Spec}(A)$, $Y=\operatorname{Spec}(B)$, then $\varphi$ induces a natural morphism of locally ringed spaces $$(f,f^*):(Y,\mathcal{O}_Y)\to(X,\mathcal{O}_X).$$

As for the proof: I understand how $f$ is constructed and why it is continuous. It's the $f^*$ part I don't quite get yet. If we localize $\varphi$ at a point $\mathfrak{p}\in Y=\operatorname{Spec}(B)$, we get a local homomorphism $\varphi_{\mathfrak{p}}:A_{\varphi^{-1}(\mathfrak{p})}\to B_{\mathfrak{p}}$. Now for an open set $U\subseteq X$ we should obtain a ring homomorphism $f^*:\mathcal{O}_X(U)\to\mathcal{O}_Y(f^{-1}(U))$.

I tried to figure out how that works: the elements of $\mathcal{O}_X(U)$ are functions $U\to\coprod_{\mathfrak{q}\in U}A_{\mathfrak{q}}$, while those of $\mathcal{O}_Y(f^{-1}(U))$ are of the form $f^{-1}(U)\to\coprod_{\mathfrak{p}\in f^{-1}(U)}B_\mathfrak{p}$. If we compose an $s\in\mathcal{O}_X(U)$ with $f$ from the left, half of what we need is there. I want to use the local homomorphisms $\varphi_\mathfrak{p}$ on the codomain of $s$, but my mind begins twisting when I try to think about the indexing set there. I'm pretty sure it's an easy 'problem'. Does maybe the first equality in $$\coprod_{\mathfrak{q}\in U}A_\mathfrak{q}=\coprod_{\mathfrak{p}\in f^{-1}(U)}A_{\varphi^{-1}(\mathfrak{p})}=\coprod_{\varphi^{-1}(\mathfrak{p})\in U}A_{\varphi^{-1}(\mathfrak{p})}$$ already hold (so I could use the $\varphi_\mathfrak{p}$)?

Is every point in $U$ already of the form $\varphi^{-1}(\mathfrak{p})$, and is this one-to-one? I guess my thoughts here go in the wrong direction, and maybe someone is able to understand my little crisis and help me out. This construction still confuses me, in particular the switching of directions all the time.

Thank you very much in advance!

-
No, not every prime ideal in $A$ is the preimage of a prime ideal in $B$, take $\phi$ to be the inclusion of the integers into the rational numbers. Maybe a more abstract viewpoint helps to get the morphism: For open subsets of the form $D(g)$ (sometimes written $X_g$), where $g \in A$, you can write them down directly: We have $f^{-1}(D(g)) = D(\phi(g))$, and the map $\mathcal{O}_Y(D(g)) = A_g \rightarrow B_{\phi(g)} = f_*\mathcal{O}_X(D(g))$ is induced by $\phi$ using the universal property of localization. For arbitrary open $V \subset Y$ use the direct limit construction to get the map. –  Lennart Mar 6 '12 at 11:57
Hello @Lennart, I'm still struggling with these abstract arguments, since I want to know how the mappings really look, and I tend to 'lose' them in the process of using universal properties. But thanks for the viewpoint, I'll try to understand it :) –  Rand al'Thor Mar 6 '12 at 12:36
In order to define $f^*:\mathcal{O}_X(U)\to\mathcal{O}_Y(f^{-1}(U))$ we are given a map $s: U\to\coprod_{\mathfrak{q}\in U}A_{\mathfrak{q}}$ with $s(\mathfrak q) \in A_\mathfrak{q}$ for all $\mathfrak q \in U$ and we want to find a map $f^*(s): f^{-1}(U) \to \coprod_{\mathfrak p \in f^{-1}(U)} B_\mathfrak p$ which takes $\mathfrak p \in f^{-1}(U)$ to some element in $B_\mathfrak p$. Well, for $\mathfrak p \in f^{-1}(U)$ we have $f(\mathfrak p) \in U$, so we can apply our $s$ to $f(\mathfrak p)$ and get $(s \circ f)(\mathfrak p) \in A_{f(\mathfrak p)}$. As you said, the ring homomorphism $\varphi: A \to B$ induces a homomorphism $\varphi_{\mathfrak p}: A_{f(\mathfrak p)} \to B_\mathfrak p$ of local rings. We can apply this to $(s \circ f)(\mathfrak p)$ and we get $(\varphi_\mathfrak p \circ s \circ f)(\mathfrak p) \in B_\mathfrak p$. Altogether, our map $f^*$ looks like this: $$f^*: \mathcal{O}_X(U)\to\mathcal{O}_Y(f^{-1}(U))\\ (s(\mathfrak q))_{\mathfrak q \in U} \in \prod_{\mathfrak q \in U} A_\mathfrak q \mapsto ((\varphi_\mathfrak p \circ s \circ f)(\mathfrak p))_{\mathfrak p \in f^{-1}(U)} \in \prod_{\mathfrak p \in f^{-1}(U)} B_\mathfrak p$$
Hi @marlu, that was very insightful, thank you! I did not use the property that $s(\mathfrak{q})\in A_\mathfrak{q}$ (and analogously for $f^*(\mathfrak{p})$. Trying to see 'how does an element get mapped from $f^{-1}(U)$ to $U$ and further on' helps a lot! –  Rand al'Thor Mar 6 '12 at 12:44