localized module tensor with localized ring Let  $f: S^{-1} M \to S^{-1}A \otimes_A M$ defined by
        $$m/s \to  1/s \otimes m$$
$g: S^{-1}A \otimes_A M \to S^{-1} M$ defined by 
         $$a/s \otimes m \to  am/s $$ 
Prove that $f$ and $g$ are well defined ?
How can we prove $f$ is an $S^{-1}A$ module homomorphism?
Here $A$ is commutative ring with identity and $M$ is module and $S$ multiplicative subset of $A$.
 A: Hint: To get the map $S^{-1}A \otimes_A M \rightarrow M$, define a suitable bilinear map $S^{-1}A \times M \rightarrow S^{-1}M$ and then use the universal property of the tensor product.
To show that the map $S^{-1}M \rightarrow S^{-1}A\otimes_A M$ is well defined, note that $m/s = n/t \Rightarrow \exists s' \in S| s'(tm - sn) = 0 \Rightarrow (1/s'st) \otimes (s'(tm - sn)) = 0 \Rightarrow (1/st) \otimes (tm - sn) = 0 \Rightarrow (1/s) \otimes m - (1/t) \otimes n = 0$
A: 
Prove that $f$ is well defined

means the following: 

An element of $S^{-1}M$ is an equivalence class of "fractions" $m/s$. Prove that $f(m/s)$ remains the same no matter what representative for the equivalence class of $m/s$ you choose.

(This is more or less always what it means when an exercise tells you to prove that a function is well-defined.) So, two fractions $m/s$ and $n/t$ represent the same equivalence class if there is an $u\in S$ such that $u(tm - sn) = 0$. So, let's see what happens to the two fractions if we use $f$ on them:
$$
f(m/s) = 1/s \otimes m \\ f(n/t) = 1/t\otimes n
$$
Now, the question is, do they represent the same element in $S^{-1}A \otimes_A M$? The usual way to test this is to take the difference between the two results and verify that it equals $0$. But as they stand it's not easy to calculate the difference, since the two tensor products have no terms in common. We need to fix that.
In $S^{-1}A$, we have that $1/s = ut/ust$, and likewise, $1/t = us/ust$, so we get (by bilinearity of tensor product):
$$
 1/s \otimes m =  ut/ust \otimes m = 1/ust\otimes utm \\
1/t \otimes n =  us/ust \otimes n = 1/ust\otimes usn
$$
Now we can calculate the difference between these two as 
$$
1/ust\otimes utm - 1/ust\otimes usn = 1/ust\otimes (utm - usn) = 1/ust\otimes 0 = 0
$$
and thus the value of $f$ at $m/s$ in independent of the choice of representative, and $f$ is therefore well defined. Can you make a similar reasoning for $g$? Can you prove that $f\circ g$ and $g\circ f$ are the identity functions on their respective $A$-modules? What does this tell us about the relationship between $S^{-1}A \otimes_A M$ and $S^{-1}M$?
A: To prove that the maps are well-defined, you must show that if $m/s=m^\prime/s^\prime$, then $f(m/s)=f(m^\prime/s^\prime)$. For $f$, this means that you must show that $1/s^\prime \otimes m^\prime = 1/s \otimes m$. This follows from the following fact: $(ms^\prime-m^\prime)r=0$ for some $r \in A$. Now, multiply both sides of $1/s^\prime \otimes m^\prime = 1/s \otimes m$ with $ss^\prime$, and use that (since we tensor over $A$), you can move elements from $A$ on the other side of $\otimes$). Multiply on both sides by $r$. The result follows.
To prove that $g\circ f$ is the identity, just plug in and see what happens. A general element in $S^{-1}M$ is written as $m/s$. Now: $g(f(m/s))=g(1/s \otimes m)=m/s$, so $g \circ f$ is the identity. The composition $f \circ g$ is similar.
