Extension of R-linear derivation to localization Let $R$ be a commutative ring. Given a commutative $R$-algebra $A$, a multiplicative subset $S \subset A$, and a $R$-linear derivation $D: A \rightarrow M$, where $M$ is an $S^{-1}A$-module, $D$ can be uniquely extended to a $R$-linear derivation $S^{-1}A \rightarrow M$ by defining $D(s^{-1}a):= s^{-2}(sD(a) - aD(s))$. How could one go about proving that this map is well defined and unique?
 A: The following is a way to solve the problem which employs the universal property of localization. In case noone else does I will add explicit calculations later.
If $M$ is a module over the $R$-algebra $A$, you can form the square-zero extension $M\rtimes A$, which is another $R$-algebra defined as follows: As an abelian group, $M\rtimes A = M\oplus A$, and the multiplication is given by $(m+a)\cdot (m^{\prime}+a^{\prime}) := a^{\prime} m + a m^{\prime} + aa^{\prime}$. In this $R$-algebra, $M$ is an ideal which squares to zero, and the quotient of $M\rtimes A$ by $M$ is the  projection $M\rtimes A\to A$ - therefore the name. Now you can check that the $R$-derivations $D: A\to M$ of $A$ in $M$ bijectively correspond to $R$-algebra homomorphisms $\varphi: A\to M\rtimes A$ of $A$ such that $A\to M\rtimes A\to A$ is the identity: given $D$, put $\varphi(a) = a + D(a)$, and given $\varphi$, put $D := A\xrightarrow{\varphi} M\rtimes A\to M$. 
Now suppose $M$ is an $S^{-1}A$-module so that $M\rtimes S^{-1}A$ is defined and we have a canonical $R$-algebra homomorphism $M\rtimes A\to M\rtimes S^{-1}A$. Then, if $\varphi: A\to M\rtimes A$ corresponds to an $R$-derivation of $A$ in $M$, the composition $A\to M\rtimes A\to M\rtimes S^{-1}A$ sends the elements of $S$ to elements of the form $\text{unit} + \text{nilpotent}$, hence to units, and therefore extends uniquely to an $R$-algebra homomorphism $S^{-1} A\to M\rtimes S^{-1}A$, giving rise to an $R$-derivation of $S^{-1}A$ in $M$.
Explicitly, this gives your formula: If $D: A\to M$ is the given $R$-derivation, then $\varphi: A\to M\rtimes A$ is $a\mapsto a + D(a)$. If $s\in S$, then the inverse of $\varphi(s) = s + D(s) = s (1 + s^{-1} D(s))$ in $M\rtimes S^{-1}A$ is $s^{-1} (1 - s^{-1} D(s)) = s^{-1} - s^{-2} D(s)=s^{-2}(s - D(s))$, so the extension $\tilde{\varphi}: S^{-1} A\to M\rtimes S^{-1}A$ maps $s^{-1}a$ to $s^{-2}(s - D(s))(a + D(a)) = s^{-2}(s D(a) - a D(s)) + s^{-1} a$. The $M$-part $s^{-2}(s D(a) - a D(s))$ of this expression is then the value of $s^{-1}a$ under the extended derivation $\tilde{D}: S^{-1}A\to M$ corresponding to $\tilde{\varphi}$.
Of course, you can also directly use your formula and check that it is well-defined and a derivation, but this requires some computation and is not very enlightening. Let's check that $D(s^{-1} a) = s^{-2}(sD(a) - a D(s))$ is well-defined on $S^{-1}A$, so if $s^{-1}a=t^{-1} b$ in $S^{-1}A$, we want to show $$(\dagger)\qquad s^{-2}(sD(a)-aD(s)) = t^{-2}(tD(b)-bD(t))\\ \Leftrightarrow t^2 s D(a) - t^2 a D(s) = s^2 t D(b) - s^2 b D(t)\\ \Leftrightarrow ts (t D(a) - s D(b)) = t^2 a D(s) - s^2 b D(t)$$ By the explicit construction of $S^{-1}A$, there exists some $u\in S$ such that $u(ta)=u(sb)$. Applying $D$ gives $u D(ta) + ta D(u) = u D(sb) + sb D(u)$. Now, since $M$ is a $S^{-1}A$ module and $ta=sb$ in $S^{-1}A$, we have $ta D(u) = sb D(u)$, so these two summands cancel on both sides, leaving us with $u D(ta) = u D(sb)$, hence $D(ta) = D(sb)$ using the invertibility of $u$ on $M$ again. Unfolding this gives
$$(\ast)\qquad t D(a) + a D(t) = s D(b) + b D(s)\Leftrightarrow t D(a) - s D(b) = b D(s) - a D(t).$$ Inserting $(\ast)$ into $(\dagger)$ leaves us with proving
$$stb D(s) - staD(t) = t^2 a D(s) - s^2 b D(t)$$
which holds since, again, the actions of $ta$ and $sb$ coincide on $M$.
