Reading through a proof that a scheme is locally Noetherian if and only if every open, affine subscheme is induced by a Noetherian ring I came across the following which did not seem as obvious to me as it did to the person writing the proof.
Suppose $X=\mathrm{Spec} \ A$ is an affine scheme, and $U=\mathrm{Spec} \ B$ is an open, affine subscheme. Furthermore, if for some $f\in A$, $X_{f}\subset U$, letting $g$ be the image of $f$ in $B$ (via the restriction map), is it the case that $X_{f}=U_{g}$?
The restriction of $X$ to $U$ is isomorphic to $(\mathrm{Spec} \ B, \mathcal{O}_{\mathrm{Spec} \ B})$, but the associated homeomorphism could be quite complicated, so although $X_{f}$ will be mapped to an open set, I'm not sure why it would necessarily be $U_{g}$. Any help would be much appreciated.
Yes, this is true. Note that $X_f$ is just the set of points $p\in X$ such that the image of $f$ in the stalk $\mathcal{O}_{X,p}$ is not in the maximal ideal. On the other hand, $U_g$ is the set of points $p\in U$ such that the image of $g$ in the stalk $\mathcal{O}_{U,p}$ is not in the maximal ideal. But these two conditions are identical: the stalks $\mathcal{O}_{X,p}$ and $\mathcal{O}_{U,p}$ are the same, and the image of $f$ in $\mathcal{O}_{X,p}$ is the same as the image of $g$ in $\mathcal{O}_{U,p}$ since $g$ is the restriction of $f$.
(Note that none of this has anything to do with affine schemes in particular. The same argument would apply if $(X,\mathcal{O}_X)$ was any locally ringed space, with $f\in \mathcal{O}_X(X)$ some global section and $g$ the restriction of $f$ to $\mathcal{O}_X(U)$.)