Preimage of distinguished open sets If we have a morphism between two affine Schemes $f: X \rightarrow Y$ with $X = $ Spec $A$, and $Y = $ Spec $B$, is it true that $f^{-1}(D(g)) = D(f'(g))$? (where $f'$ is the associated map on the structure sheaves) If so, is there a simple proof? Otherwise, is there any other way to characterize the preimages of distinguished open sets?
 A: Yes. You may want to look at Hartshorne's 'Algebraic Geometry' section II.2. For example Proposition II.2.3 discusses this matter.
A: This can be also be done using abstract nonsense.
Regard $\operatorname{Spec}$ as a functor $\mathbf{CRing}^{\operatorname{op}}\to\mathbf{Sch}$.
As a left adjoint, $\operatorname{Spec}$ converts pushouts in $\mathbf{CRing}$ to pullbacks.
The pushout of $A\leftarrow B\rightarrow B_g$ is $A\otimes_B B_g\simeq A_{\overline{g}}$ where $\overline{g}$ the image of $g$ in $A$.
The pullback of $\operatorname{Spec}A\rightarrow \operatorname{Spec}B \leftarrow \operatorname{Spec}B_g$ is $f^{-1}\operatorname{Spec}B_g$.
Therefore, $\operatorname{Spec}{A_\overline{g}}$ is isomorphic to $f^{-1}\operatorname{Spec}B_g$.
To show that the underlying sets are the same, the following will suffice :

*

*The maps $\operatorname{Spec}{A_\overline{g}}\to\operatorname{Spec}A$, $f^{-1}\operatorname{Spec}B_g\to\operatorname{Spec}A$, are inclusions.

*$\operatorname{Spec}A_{\overline{g}}$ is contained in $f^{-1}\operatorname{Spec}B_g$.

