TITLE: Is $(R_S)_{\mathfrak{p}R_S}$ isomorphic to $R_{\mathfrak{p}}$?
QUESTION [7 upvotes]: Let $R$ be an integral domain, let $S$ be a multiplicative subset of $R$, not intersecting $\mathfrak{p}$, where $\mathfrak{p}$ is a prime ideal of $R$. Hence $\mathfrak{p}R_S$ (the ideal generated by $\mathfrak{p}$ in $R_S$) is a prime ideal of $R_S$, and we can take localization $(R_S)_{\mathfrak{p}R_S}$. I'm asking if these two rings: $(R_S)_{\mathfrak{p}R_S}$ and $R_{\mathfrak{p}}$ are isomorphic or not.
I think there is something canonical here, hence i tried to show the existence of an iso only doing general considerations, not dealing with elements and their (possibly complicated) expressions. I used universal property of localization, in this sense: since $S\subseteq R - \mathfrak{p}$, then $R_S$ is contained in $R_{\mathfrak{p}}$ (both subrings of field of fractions of $R$), and let $i$ be the natural inclusion of $R_S$ in $R_{\mathfrak{p}}$. Clearly, $i$ sends elements of $S$ in invertible elements of $R_{\mathfrak{p}}$. Now, let $\phi$ be the canonical morphism from $R_S$ to its localization $(R_S)_{\mathfrak{p}R_S}$. By universal property, there is exactly one morphism of rings , say $h$, from $(R_S)_{\mathfrak{p}R_S}$ to $R_{\mathfrak{p}}$ such that $h\circ\phi=i$, which is obviously injective.
Now, is $h$ also surjective?

REPLY [4 votes]: If $T$ is a commutative ring, then
$$\begin{array}{ccl} \hom((R_S)_{\mathfrak{p} R_S},T) & \cong & \{f \in \hom(R_S,T) : f(R_S \setminus \mathfrak{p} R_S) \subseteq T^*\} \\ & \cong & \{f \in \hom(R,T) : f(S) \subseteq T^*, f(R \setminus \mathfrak{p}) \subseteq T^*\} \\ & = & \{f \in \hom(R,T) : f(R \setminus \mathfrak{p}) \subseteq T^*\} \\ & \cong & \hom(R_{\mathfrak{p}},T)\end{array}$$
The Yoneda Lemma implies $(R_S)_{\mathfrak{p} R_S} \cong R_{\mathfrak{p}}$.
Some more details: The first and last isomorphisms come from the universal property of localizations. The equality comes from the assumption $S \subseteq R \setminus \mathfrak{p}$ (and basically this is already the whole idea behind the proof). The second isomorphism comes from the universal property of the localization $R_S$, as well as the observation $R_S \setminus \mathfrak{p} R_S$ differs only by units from the image of $R \setminus \mathfrak{p}$ in $R_S$.
Bonus exercise: Try to find the proof of the Yoneda Lemma in Keenan's answer. 
Alternative proof using schemes: Using directed colimits, we may assume that $S=\{1,f,f^2,\dotsc\}$ for some $f \in R$. Open immersions are isomorphisms on stalks. Applying this to $D(f) \hookrightarrow \mathrm{Spec}(R)$, we get $(R_f)_{\mathfrak{p} R_f} = R_\mathfrak{p}$.