Local criteria of flat modules

Let $A$, $B$ be rings and $M$ be a $B$-module. Let $f:A \to B$ be a ring morphism. For a prime ideal $p \subset B$ let $q=f^{-1}(p)$, and the corresponding local morphism $A_q \to B_p$ makes $M_p$ an $A_q$-module.

I want to show: If for any prime ideal $p \subset B$, $M_p$ is a flat $A_q$-module, then $M$ is a flat $A$-module.

I want to use the fact "$M$ is flat over $A$ $\iff$ $M_q$ is flat over $A_q$ for all the primes $q \subset A$".

But I have difficulties in two places:

(1) In the above problem, I have $M_p$ rather than $M_q$, and it seems that they may not equal to each other.

(2) $q$ may not be chosen for all the primes in $A$.

Fix a prime ideal $q$ of $A$. Denote by $S=f(A\setminus q)$. Then $B_q=S^{-1}B$, $M_q:=S^{-1}M$.

For all prime ideals $p'$ of $B$ such that $p'\cap S=\emptyset$, we have $M_{p'}=M_q\otimes_{B_q} {B_{p'}}$ and it is flat over $A_{q'}$ where $q'=f^{-1}(p')\subseteq q$. As $A_q\to A_{q'}$ is flat (it is a localization map), $M_{p'}$ is flat over $A_{q}$.

As the prime ideals of $B_q$ correspond canonically to the $p$' as above, we check easily that the localization of $M_q$ at all prime ideals of $B_q$ are flat over $A_q$. So $M_q$ is flat over $A_q$.

Edit Replacing $A\to B$ with $A_q\to B_q$, we are in the next situation:

Lemma Let $A\to B$ be a ring homomorphism and let $M$ be a $B$ module such that for all prime ideals $p$ of $B$, $M_p$ is flat over $A$. Then $M$ is flat over $A$.

Proof: Let $M_1\to M_2$ be an injective $A$-linear map and let $K$ be the kernel of $M_1\otimes_A M\to M_2\otimes_A M$. Then $K$ is also a $B$-module. As $B\to B_p$ is flat, $K\otimes_B B_p$ is the kernel of $M_1\otimes_A M_p\to M_2\otimes_{A} M_p$, hence equals to $0$. So $K=0$ and $M$ is flat over $A$.

• (1) It may not always exists $p'$, such that $p' \cap S =\emptyset$. In order to have such $p'$, one need to require $q \subset ker(f)$ (2)How do you know "$M_q$ is flat over $A_q$" from "the localization of $M_q$ at all prime ideals of $B_q$ are flat over $A_q$"? I try to prove it by proving following result: Let $T$ be a local ring,$R$ be a ring, and $N$ a $R$-module, and one have ring map $T \to R$. Let $p \subset R$ and $q \subset T$ are corresponding ideals, if $N_p$ is a flat $T$-module, then $N_q$ is a flat $T_q$-module. (3) the tensor for $M_{p'}$ in your second line seems not valid. – Li Zhan Mar 1 '12 at 22:29
• @LiZhan: (1) This is not a problem. If there is no such $p'$, then $B_q$ has no prime ideals, so $B_q=0$, hence $M_q=0$ and it is flat over $A_q$. (2) See the lemma above. (3) You are right it is $M_q\otimes B_{p'}$ and not $M_q\otimes A_{q'}$. I corrected. – user18119 Mar 4 '12 at 21:41
• :Thank you very very much for your detailed explanation!! This problem seems much harder than what I initially thought, and without your help, I can hardlly know how to do it. – Li Zhan Mar 5 '12 at 0:40