I am working on the following exercise (Exercise 6.3.C. on Ravi Vakil's online notes), which has two parts:
Given a morphism of schemes $\pi: X \rightarrow Y$, show that if Spec $A$ is an affine open subset of $X$ and Spec $B$, an affine open subset of Y, such that $\pi($ Spec $A) \subseteq $ Spec $B$, then the induced morphism on the ringed space is a morphism of affine schemes.
Show that it suffices to check on a set (Spec $A_i$, Spec $B_i$) where the Spec $A_i$ form an open cover of $X$.
I would appreciate any help with the first part. I am also having trouble understanding exactly what it is being asked for the second part. Thank you for your time.
The first part of the question seems straightforward. If $\pi : X \to Y$ is a morphism of schemes, then by definition it is a morphism of the underlying locally ringed spaces. If $\text{Spec }A \subset X$ and $\text{Spec B} \subset Y$ are affine opens with $\pi(\text{Spec }A) \subset \text{Spec }B$, then the restriction of $\pi$ to $\text{Spec }A$ gives a map of locally ringed spaces, and hence a map of schemes, to $\text{Spec }B$. To see why this is the case, note that restriction of $\pi$ is necessarily a map of ringed spaces, and the condition that a map induce morphisms of local rings on stalks is a "local" condition. Finally, to check that the resulting map of schemes $\text{Spec }A \to \text{Spec }B$ is a map of affine schemes, one needs to show that it is induced from a ring map $B \to A$. But this is precisely what the "Key Proposition" on the previous page says!
The second part of the question is somewhat unclear, but I believe Vakil is trying to say the following. Suppose one has a morphism $\pi : X \to Y$ of ringed spaces such that there exists a cover of $X$ by affine open subschemes $\text{Spec } A_i$ and a cover of $Y$ by affine open subschemes $\text{Spec } B_i$ with the property that $\pi(\text{Spec } A_i) \subset \text{Spec } B_i$ for each $i$. Then $\pi$ is a map of schemes if and only if the restriction of $\pi$ to each $\text{Spec }A_i$ gives a morphism of affine schemes from $\text{Spec }A_i$ to $\text{Spec } B_i$.