Atiyah Macdonald Chapter 3 Problem 23 Part ii) I am really confused about Atiyah Macdonald chapter 3 problem 23 part ii)
The set up: Let $A$ be a ring and $X=\text{Spec}(A)$ be the set of prime ideals of $A$ with the Zariski topology.  Let $U$ be a basic open set, meaning $U=X_f$ for some $f\in A$ where $X_f$ is the set of prime ideals of $A$ that do not contain $f$.  By part i) of the problem the ring $A(U)$ defined by $A(U) = A_f = S^{-1}A$ where $S = \{f^n : n \geq 0 \}$ depends only on $U$ up to the isomorphism $A_f\to A_g$ given by $\frac{a}{f^m}\mapsto\frac{a}{g^m}$ (EDIT: as pointed out below this is not the correct isomorphism, see Ben's answer).
Let $U'$ be another basic open set $U'=X_g$ such that $U' \subset U$.  There is an equation of the form $g^n=uf$ where $u\in A$ and $n>0$ since $U'\subset U$ implies $g$ is in the radical of $f$.  Define a ring homomorphism $\rho : A(U)\to A(U')$ given by $\frac{a}{f^m}\mapsto \frac{au^m}{g^{mn}}$.  I am supposed to show that $\rho$ depends only on $U$ and $U'$.  
First of all, the equation defining $\rho$ is not well defined, so I assume we should choose $n$ to be minimum, although it doesn't say that in the problem.  Second, it is straightforward to check that $\rho$ is a ring homomorphism if it is well defined but I don't see why it is well defined on equivalence classes.  Can this be done using the universal property of $A(U)$?  Lastly, I don't see why $\rho$ depends only on $U$ and $U'$.  I wrote down the obvious commutative diagram and element wise I am not seeing it.  Is there something conceptual here that I am missing?  Any help is appreciated.  
 A: (a) I really like your question because it's so totally engaged with the text!
(b) I think you're wrong that the isomorphism in part (i) is supposed to be $a/f^m \mapsto a/g^m$. For example, if $g=f^2$, then $X_f=X_g$, but the isomorphism is actually $a/f^m \mapsto f^ma/g^m$. I think it would be a clarifying exercise for you to work out what the isomorphism actually has to be. (Relatedly to what Alex Youcis said in a comment, the key to finding it is that $X_f=X_g$ implies that $f$ and $g$ are contained in all the same prime ideals and thus have the same radical; thus each is in the other's radical.)
(c) Regarding the well-definedness of $\rho$ in part (ii), it's conceptually not unlike the isomorphism in part (i). I think once you answer part (i) satisfyingly, (ii) will be a lot clearer. I don't have much to add to Alex Youcis' hint except that I think you should return to part (i) first.
(d) The conceptual big picture here: what the question is getting at makes much more sense from the point of view of algebraic geometry than it does if you're studying commutative algebra outside of this context. I am about to run down some of the fundamental ideas of algebraic geometry. This may be helpful or overwhelming, I'm not sure which, but I'll offer it in the spirit that it makes the whole picture make a lot more sense to me anyway.
The idea is that the elements of $A$ are being regarded as "functions" on the topological space $X=\operatorname{Spec}A$. To make this concrete, suppose that $A$ is the ring $\mathbb{C}[x]$. (I picked this ring to make the geometric picture match as closely as possible with what Atiyah-MacDonald are doing.) $A$ is a p.i.d. so its nonzero prime ideals are generated by irreducible polynomials, which are all degree $1$ since $\mathbb{C}$ is algebraically closed. Thus the nonzero prime ideals look like $(x-\alpha)$ for $\alpha\in\mathbb{C}$. So they are in one-to-one correspondence with the points of $\mathbb{C}$. We think of $\operatorname{Spec}A$ as being the points of $\mathbb{C}$, plus a "generic point" corresponding with the zero ideal. Elements of $A$, being polynomials, are thus literally functions on $\operatorname{Spec}A$ with values in $\mathbb{C}$. Notice that for a polynomial $f\in A$, $f\in(x-\alpha)$ if and only if $f$ is zero at $\alpha$. Thus a function vanishing at a point translates to being contained in the corresponding prime ideal. We think of the set $X_f$ of prime ideals not containing $f$ as the "set of points where $f$ doesn't vanish."
The next step is that Zariski-open subsets of $\mathbb{C}$ each determine a bigger ring of functions. In algebraic geometry, the idea of a function being "sufficiently well-behaved" is called regular. (This is analogous with the role of continuous functions in topology, smooth functions in differential geometry, and holomorphic functions in complex analysis.) Regular means it's a rational function without poles. If we ask for a rational function without poles on all of $\mathbb{C}$, then its denominator has to be constant because every nonconstant polynomial has a zero so if it's in the denominator it would cause a pole. But if we are just interested in a subset of $\mathbb{C}$, regular functions on it can have nonconstant denominators. For example, $1/x$ is regular on $\mathbb{C}\setminus\{0\}$. We could ask, "what is the ring of regular functions on $\mathbb{C}\setminus\{0\}$?" It's exactly $A_x=\mathbb{C}[x]_x$, because the denominator has to not have any zeros away from the origin, so the denominator can't have any factors like $x-\alpha$ other than $x$. Note that it's a bigger ring than just $A$ (functions regular everywhere) because they just have to be regular on a smaller set.
More generally, the idea is that $A_f$ is the ring of functions that are regular away from the zero set of $f$. (In my example in the last paragraph, $f=x$ is zero only at the origin so $A_x$ is functions regular away from the origin.) We would like to know that if $f$ and $g$ have the same "zero set", then $A_f$ and $A_g$ are actually the same ring. That's the point of part (i). The point of part (ii) is that if $g$'s zero set includes $f$'s, then functions regular away from $g$'s zero set are automatically regular away from $f$'s so you should be able to map the ring {functions regular away from f's zero set} to the ring {functions regular away from g's zero set} just by restricting a function from $f$'s nonzero set to $g$'s. Again, it shouldn't matter what $f$ and $g$ are, only what their zero sets are.
All of this will probably seem fuzzy because for a general ring $A$, the elements are not literally functions. But the theory that this problem was born from was developed to carry this analogy as far as possible. The problem is designed to show that it can be carried pretty far. The goal of the problem is to show that although $f,g$ are not functions, so $X_f$ is not literally "the set of points where $f$ doesn't vanish", nonetheless if we treat $A_f$ as "the ring of functions that are regular on $X_f$", then it only depends on the set $X_f$ and not on the 'function' $f$. Likewise, if $X_g\subset X_f$, then "the ring of functions regular on $X_f$" has a natural "restriction map" to "the ring of functions regular on $X_g$" that doesn't depend on the choices of $f,g$ that define the sets $X_f,X_g$.
A: Just another perspective on this map. Recall that the open subset $X_f \subset \operatorname{Spec} A$ naturally corresponds to $\operatorname{Spec} A_f$. If $\mathfrak{p} \in X_f$ then an element $a \in A$ vanishes at (i.e., is contained in) $\mathfrak{p}$ if and only if its image in $A_f$ vanishes at $\mathfrak{p}A_f$.
When you write $X_g \subset X_f$ you're saying that $f$ doesn't vanish at any of the points of $X_g$, so the image of $f$ in $A_g$ isn't contained in any of the prime ideals of that ring and is hence a unit. The universal property of localization then gives a canonical $A$-algebra homomorphism $A_f \to A_g$. This is precisely the map that Atiyah-MacDonald make explicit, so you don't really need to check well-definedness again.
