I'm doing this exercise (exercise 18, p. 46) in "Introduction to Commutative Algebra" of Atiyah and get confused by the hint in this book. Here is the exercise:
Let $f: A \rightarrow B$ be a flat homomorphism of rings, let $q$ be a prime ideal of $B$ and let $p = q^{c}$. Then $f^*: \operatorname{Spec}(B_q) \rightarrow \operatorname{Spec}(A_p)$ is surjective [Hint: For $B_p$ is flat over $A_p$ by (3.10), and $B_q$ is a local ring of $B_p$, hence is flat over $B_p$...]
The highlighted part is the one I want to ask. Elements of the module $B_q$ have form $b/s$, here $s \in B$ but $s \notin q$. In the other hand, elements of the module $B_p$ have form $b/s$, here $s \in A$ but $s \notin p$. So why $B_q$ is local ring of $B_p$. And one more thing, why is local ring flat? Please help me clarify this. I really appreciate. Thanks.
Well, here there is a little abuse of notation in the definition of $B_p$, because an element in $B_p$ has the form $b/s$, where $s \notin f(A \setminus p)$. As a warning, $f(A \setminus p)$ is different from $B \setminus q$: take for example the inclusion $k \rightarrow k[T]$, $q = (T)$ and $p = q \cap k = 0$.
Now this is clarified, we see that $B_q$ is a localization of $B \otimes_A A_p \cong B_p$. Indeed, taking $T = B \setminus q \:$ and $S = f(A \setminus p)$, we have that $$ B_q = T^{-1} B \cong (S^{-1} T)^{-1} (S^{-1} B) = (S^{-1}T)^{-1} B_p, $$ where the isomorphism should be clear from the fact that $S \subset T$.
For the second question, the canonical homomorphism $A \rightarrow S^{-1}A$ is flat, because if $N \subset M$ is an $A$-submodule, clearly $S^{-1}N \subset S^{-1}M$ and therefore $N \otimes_A S^{-1}A \rightarrow M \otimes_A S^{-1}A$ is injective. (via the isomorphism of $S^{-1}A$-modules $N \otimes_A S^{-1}A \cong S^{-1}N$, and similarly for $M$)