Localizing a ring of invariants 
Let $A$ be a domain and $G$ a finite group of automorphisms of $A$. I define $$A^G=\{a\in A\mid\sigma(a)=a ,\forall\sigma\in G\}.$$ Furthermore let $S\subset A$ be multiplicatively closed such that $\sigma(S)\subset S$ for all $\sigma\in G$ and we write $S^G=S\cap A^G$. I want to show that $$(S^G)^{-1}A^G\cong(S^{-1}A)^G.$$ (Atiyah and Macdonald, Introduction to Commutative Algebra, Exercise 12, Chapter 5.)

First off, I'm not really sure what is meant by $(S^{-1}A)^G$ here, so it would be nice if somebody could try to guess what would be the most natural interpretation of this.
Regarding the general procedure: I only know that $A$ is integral over $A^G$, which would give me $(S^G)^{-1}A$ being integral over $(S^G)^{-1}A^G$, though I'm not sure if this would be helpful even if I knew what $(S^{-1}A)^G$ was. So depending on this, maybe a little hint would also be nice.
Thanks in advance.

There is a natural injection $(S^G)^{-1} A^G \hookrightarrow (S^{-1}A)^G$. To show that this is an isomorphism, you must show that every invariant fraction is a fraction of invariants.
Here are some hints.
So assume $\sigma \cdot \frac{a}{s}= \frac{a}{s}$. This is equivalent to $s \sigma (a) = a \sigma (s)$.
Since $G$ is a finite group, there is some $n$ such that $\sigma^n=id$. Then note that
$$
\frac{a}{s} = \frac{\sigma^{n-1}(s) \sigma^{n-2}(s)\ldots \sigma(s)a }{\sigma^{n-1}(s) \sigma^{n-2}(s)\ldots \sigma(s)s} = \frac{\sigma^{n-1}(s) \sigma^{n-2}(s)\ldots \sigma(a)s }{\sigma^{n-1}(s) \sigma^{n-2}(s)\ldots \sigma(s)s}
$$
By induction one can show that the numerator is $\sigma^{n-1}(a)\sigma^{n-2}(s) \ldots \sigma(s) s$.
Now its not difficult to see that both the numerator and denominator are invariant.
