Problem 3.24, Commutative Algebra Atiyah & Macdonald I'm getting stuck in understanding the solution of the following exercise in Commutative Algebra text by Atiyah & Macdonald:
Let $(U_i)_{i \in I}$ be a covering of $X = Spec(A)$ by basic open sets. For each $i \in I$ let $s_i \in A(U_i)$ be such that, for each pair of indices $i$,$j$, the images of $s_i$ and $s_j$ in $A(U_i \cap U_j)$ are equal. Then there exists a unique $s \in A$ ($= A(X)$) whose image in $A(U_i)$ is $s_i$, for all $i \in I$. (An open basis set $U$ has the form $X_f$ for some $f \in A$ and $A(U) = A_f$ denotes the localization $S^{-1}A$, where $S = \{f^n\}_{n \geq 0}$ for $f \in A$)
There are several solutions I read, but they all start with the following observation. Write $s_i = x_i/f_i^{m_i}$. For two open set $U_i = X_{f_i}$ and $U_j=X_{f_j}$, since the image of $s_i, s_j$ are the same in $A(U_i \cap U_j)$, one has for some integer $k$
$$ (f_if_j)^k(x_if_j^{m_j} - x_jf_i^{m_i}) = 0 \tag{1} $$
I don't think this is true. Because by the previous exercise (exercise 3.23), if we have $U_g=X_g$  be an open basis in $X$, and $U_g \subset U_f=X_f$ for some $f,g \in A$, then we have $g^n=uf$ for some $n$ and $u \in A$. The map $A(U_f) \to A(U_g)$ should send $a/f^m \to au^m/g^{mn}$. So, comeback to the observation, since $U_i \cap U_j = X_{f_if_j} \subset U_i = X_{f_i}$, if we take $n=1$ and $g=f_if_j$ and $u=f_j$, the image of $s_i$ in $A(U_i \cap U_j)$ should be $x_if_j^{m_i}/(f_if_j)^{m_i}$ and similarly the image of $s_j$ should be $x_jf_i^{m_j}/(f_if_j)^{m_j}$. Since there two images are the same, equation $(1)$ should be written as
$$ (f_if_j)^k(x_if_j^{m_i}(f_if_j)^{m_j} - x_jf_i^{m_j}(f_if_j)^{m_i}) = 0 $$
More generally, given a ring $A$ and a multiplicative subset $S$, assume that there are $a,b \in A$ and $s\in S$ such that $bs \in S$ but $b \notin S$. We can say that $as/bs \in S^{-1}A$, but we cannot say that $s$ will be canceled out and $a/b \in S^{-1}A$ since $b \notin S$ and the expression $a/b$ makes no sense when we're taking about $S^{-1}A$. Am I right in this case?
Thanks a lot!
 A: I think is useful to write correctly our discussion in comments. Let me consider a slightly more general statement, which might be useful.

Let $X=\operatorname{Spec}(A)$, and $U_1=X_{f_1}$, $U_2=X_{f_2}$, $V=X_g$, such that $V \subseteq U_1 \cap U_2$. If $s_i=x_i/f_i^{m_i} \in A(U_i)=A_{f_i}$ agree on $V$, then
$$ g^k(x_1f_2^{m_2}-x_2f_1^{m_1})=0 $$
for some $k >0$.

The intuition here is that this is the condition for the statement $x_1/f_1^{m_1}=x_2/f_2^{m_2}$ in $A_g$. But it is not obvious how to interpret "$1/f_1$ in $A_g$". One needs to use the following remark.

If $X_g \subseteq X_f$, then $g^s=uf$ for some $s>0$ and some $u \in A$.

This way, we can write $g^{d_1}=u_1f_1$, $g^{d_2}=u_2f_2$. Therefore, the map $A_{f_1}=A(U_1) \to A(V)=A_g$ maps $x_1/f_1^{m_1}$ to $x_1u_1^{m_1}/g^{d_1m_1}$, and similarly with $x_2/f_2^{m_2}$.
Now, by assumption we have that the images of $s_1$ and $s_2$ agree on $A_g$. This is, we have
$$ \frac{x_1u_1^{m_1}}{g^{d_1m_1}} = \frac{x_2u_2^{m_2}}{g^{d_2m_2}} $$
in $A_g$. This is equivalent to
$$ 0=g^r(x_1u_1^{m_1}g^{d_2m_2} - x_2 u_2^{m_2}g^{d_1m_1}) $$
in $A$, for some $r>0$. Now, using that $g^{d_1}=u_1f_1$ and $g^{d_2}=u_2f_2$, we can rewrite
\begin{align*}
0 =& g^r(x_1u_1^{m_1}g^{d_2m_2} - x_2 u_2^{m_2}g^{d_1m_1}) \\
=& g^r(x_1u_1^{m_1}u_2^{m_2}f_2^{m_2} - x_2 u_2^{m_2}u_1^{m_1}f_1^{m_1}) \\
=& g^r u_1^{m_1}u_2^{m_2}(x_1f_2^{m_2}-x_2f_1^{m_1}).
\end{align*}
Multiply everything by $f_1^{m_1}f_2^{m_2}$ to get
$$ 0 = g^{r+d_1m_1+d_2m_2}(x_1f_2^{m_2}-x_2f_1^{m_1}). $$
This is exactly the original condition, taking $k=r+d_1m_1+d_2m_2$.
(As a remark, your original question is this one with $g=f_1f_2$, $d_1=d_2=1$, $u_1=f_2$, $u_2=f_1$. This is what I sketched in the comments.)
