Suppose $R$ is a commutative ring and $S$ is a multiplicatively closed subset. A finite group $G$ acts on $R$ satisfying $g(S)\subseteq S$ for all $g\in G$, then the action can be extended to $S^{-1}R$. Prove that $(S^{-1}R)^G=(S^{-1})^GR^G$, where $-^G$ means all the elements in the set stable under the action.
This is the second part of exercise 12, chapter 5 of Commutative Algebra [Atiyah-McDonald].
It is easy to see the inclusion $(S^{-1})^GR^G\subseteq(S^{-1}R)^G$, and for the second inclusion I think $\forall\frac{a}{s}\in S^{-1}R$ we need to find an element $\frac{b}{t}=\frac{a}{s}$ s.t. $b,t$ are invariant under the action. But I really have no idea about it.
For any $x\in S^{-1}R$, we have $x=\dfrac{a}{s}=\dfrac{\prod_{g\neq 1}(g\cdot s)a}{\prod_g(g\cdot s)}$.
The denominator is $G$-invariant since $R$ is commutative.
So $x=\dfrac{a}{s}=\dfrac{b}{t}$, where $t$ is $G$-invariant.
Now if $x$ is $G$-invariant, it means $\dfrac{b}{t}=\dfrac{g\cdot b}{t}$ for all $g$, so there exists $u_g\in S$ such that $u_g(g\cdot b-b)=0$.
Since $G$ is finite , taking $u=\prod_g u_g$, we have $u(g\cdot b-b)=0$ for all $g$. Setting now $v=\prod_g g\cdot u$, we have $v(g\cdot b-b)=0$ for all $g$, where $v\in S$ is $G$-invariant. But $vb=v(g\cdot b)=(g\cdot v)(g\cdot b)=g\cdot vb$ for all $g$, meaning that $vb$ in $G$-invariant. Now $x=\dfrac{b}{t}=\dfrac{vb}{vt}$. Since $t$ and $v$ are $G$-invariant, the same holds for $vt$. Since $vb$ is $G$-invariant, we are done.