I am doing exercise 3.23 in Atiyah Macdonald and in the first part of the problem they ask to show that the ring $A_f = S^{-1}A$ where $S = \{1,f,f^2 \ldots \}$ depends only on the choice of the basic open set $X_f$ and not on $f$. For reference,
$X_f \stackrel{\text{def}}{\equiv} \{P \in \operatorname{Spec}(A) : f \notin P\}.$
I interpret this as saying that if there is another $g \in A$ such that $X_g = X_f$, then $A_f \cong A_g$. Since $X_f = X_g$ we deduce that $\operatorname{rad}\Big((f)\Big) = \operatorname{rad}\Big((g) \Big).$ From these equalities of radicals, this means that there are equations
\begin{eqnarray*} f^n &=& ag \hspace{5mm} \\ g^m &=& bf \end{eqnarray*}
for some $n,m \in \Bbb{N}$ such that $n,m >0$ and $a,b \in A$. Now we may suppose that $f$ and $g$ are not nilpotent for then $A_f \cong A_g \cong 0$. To show that $A_f \cong A_g$ I am trying to use Corollary 3.3 of Atiyah - Macdonald:
${\color{blue}{\text{Corollary 3.3: If $\tilde{g}: A \rightarrow B$ is a ring homomorphism such that}}}$
${\color{blue}{\text{(i) $s \in S \implies \tilde{g}(s)$ is a unit }}}$
${\color{blue}{\text{(ii) $\tilde{g}(a) = 0\implies as = 0$ for some $s \in S$}}}$
${\color{blue}{\text{(iii) Every element in $B$ is of the form $\tilde{g}(a)\tilde{g}(s)^{-1}$ for some $a\in A$ and $s \in S$ }}}$
${\color{blue}{\text{then there is a unique isomorphism $h:S^{-1}A \rightarrow B$ such that $\tilde{g}$ factorises }}}$ ${\color{blue}{\text{through the localisation $S^{-1}A$.}}}$
In our case we can set $B = P^{-1}A$ where $P = \{1,g,g^2, \ldots\}$.
$\textbf{Difficulty:}$ I have been spending some time now trying to define such a map $\tilde{g} : A \longrightarrow P^{-1}A$. Now it seems to me from those two equations above that there are only choices (up-to multiplication by some constant) orf such a map $\tilde{g}$. The problem is every time I define my $\tilde{g}$, property ${\color{blue}{(iii)}}$ is not satisfied. For example, I have tried to define for $x \in A$
$ \tilde{g}(x) = \frac{bx}{a} \hspace{4mm} \text{or} \hspace{4mm} \tilde{g}(x) = \frac{x^n}{ab} \hspace{4mm} \text{or} \hspace{4mm} \tilde{g}(x) = \frac{bx}{ag^{m-1}}.$
Suppose I try to write some $x/g^k$ in $P^{-1}A$ as $g(x')g(s)^{-1}$ for some $a' \in A$ and $s \in S$. Then one candidate we have is $x' =x$ and $s = f$. But then we only get
$g(x)g(f)^{-1} = \frac{bx}{g^m}.$
If I try say $g(xf)g(f)^{-1}$ to remove the $g^m$ in the denominator the problem is that I just end up with $x$. The problems are similar for the second and third $\tilde{g}$ I defined above. How can I get around this? Please do not give it all away as I would like to enjoy some of the fun!
Thanks.