Problem: Let $R$ be a commutative ring, $S\subset R$ multiplicative and $M,N$ $R$-modules. Show that $$S^{-1}M \otimes_R N=S^{-1}M\otimes_{S^{-1}R} S^{-1}N=S^{-1}M\otimes_R S^{-1}N,$$ where $S^{-1}(\cdot)$ is the localization.
My attempt: Using the cancellation law, and the fact that the functors $S^{-1}(\cdot)$ and $S^{-1}R\otimes_R\cdot$ are isomorphic, I get \begin{align*} S^{-1}M \otimes_R N &= S^{-1}M\otimes_{S^{-1}R}(S^{-1}R\otimes_R N)\\ &= S^{-1}M\otimes_{S^{-1}R}S^{-1}N \end{align*}
Now, how would I go around to prove the second isomorphism? Many thanks in advance!
More generally, if $R \to T$ is an epimorphism in the category of commutative rings (for example, every localization $R \to S^{-1} R$) and $M,N$ are two $T$-modules, then the canonical map of $R$-modules $$M \otimes_R N \to M \otimes_T N$$ is an isomorphism. Since both sides are cocontinuous functors in $M$ and $N$, and $M,N$ are colimits of copies of $T$, it suffices to prove that the canonical map $$T \otimes_R T \to T$$ is an isomorphism. But this is one of the characterizations of an epimorphism $f : X \to Y$ in a category, namely that the codiagonal $Y \sqcup_X Y \to Y$ is an isomorphism.
Of course, you can also fiddle around with elements to prove the result for localizations. You only need to argue that a $R$-bilinear map $\beta$ between $S^{-1} R$-modules is also $S^{-1} R$-bilinear (and conversely, but the converse is trivial). But $\beta(s^{-1} x,y) = s^{-1} \beta(x,y)$ is equivalent to $s \beta(s^{-1} x,y) = \beta(x,y)$, and the left side is, in fact, equal to $\beta(s s^{-1} x,y)=\beta(x,y)$.