I'm really confused on this exercise. People have suggested hints and I've seen online solutions involving modules and tensor products, but I don't see how any of it is related to the problem. Let $\phi: A \rightarrow B$ be a homomorphism of rings, and let $f: Y \rightarrow X$ be the induced continuous map on the spectra, where $X = Spec(A), Y = Spec(B)$, and $f(\mathfrak q) = \phi^{-1}\mathfrak q$. If $\mathfrak q \in Y$, there is a natural local homomorphism of local rings $\phi_{\mathfrak q}: A_{\phi^{-1}\mathfrak q} \rightarrow B_{\mathfrak q}$. We have a usual morphisms of sheaves $f^{\#}: \mathcal O_X \rightarrow f_{\ast} \mathcal O_Y$. I'm trying to prove that if $\phi$ is injective, then so is $f^{\#}$. I've been trying to prove this by showing that the induced homomorphism on the stalks $f_{\mathfrak p}^{\#}$ is injective for all $\mathfrak p \in X$.
We can identify $A_{\mathfrak p}$ with $\mathcal O_{X,\mathfrak p}$ by sending any $\frac{a}{s} \in A_{\mathfrak p}$ to the equivalence class $(t, D(s))$, where $t \in \mathcal O_X (D(s))$ is the function $t(\mathfrak p')= \frac{a}{s} \in A_{\mathfrak p'}$ for all $\mathfrak p' \in D(s)$. Now $$(f_{\ast}\mathcal O_Y)_{\mathfrak p} = \varinjlim\limits_{U \ni \mathfrak p} \mathcal O_Y(f^{-1}U)$$ and the map on the stalks $f^{\#}_{\mathfrak p}$ sends $(t,D(s))$ to the equivalence class $(t', f^{-1}D(s)) \in (f_{\ast}\mathcal O_Y)_{\mathfrak p}$, where $t' \in \mathcal O_Y(f^{-1}D(s))$ is the function given by $$t'(\mathfrak q) = \phi_{\mathfrak q}(t(\phi^{-1}\mathfrak q)) = \phi_{\mathfrak q}(\frac{a}{s}) := \frac{\phi(a)}{\phi(s)} \in B_{\mathfrak q}$$ for all $\mathfrak q \in f^{-1}D(s) = \{\mathfrak q \in \textrm{Spec } B : s \not\in \phi^{-1} \mathfrak q\}$. If $(t', f^{-1}D(s))$ is the zero element, we need to argue that $\frac{a}{s} = 0$. I have gotten nowhere with this. Also, what if $f^{-1}D(s)$ is empty? Wouldn't that mean that $(f_{\ast} \mathcal O_Y)_{\mathfrak p}$ is the zero ring?
I think you are trying to be too explicit and getting lost in the notation and technical details. Let me try to explain what is going on here.
$(f_* \mathcal{O}_Y)_p$ by definition is the directed limit of $\mathcal{O}_Y (f^{-1} (U))$ where $U$ ranges over all open subsets containing $p$. Since it is a directed limit, we can just restrict our attention to the $U$'s that are distinguished opens, i.e. $D(f)$ that contain $p$. Now, $\mathcal{O}_Y (f^{-1} (D(f))) = \mathcal{O}_Y ( D(\varphi (f)))$ so this tells us that the stalk is actually just $B_p$ where $B$ has the structure of an $A$-module via $\varphi$.