[proofplan]
The implication $(1) \implies (2)$ uses the isomorphism $M_\mathfrak{p} \cong R_\mathfrak{p} \otimes_R M$ and the fact that the base-change of a flat module is flat. The implication $(2) \implies (3)$ is immediate since maximal ideals are prime. The substantial direction $(3) \implies (1)$ takes an injective $R$-linear map $f: A \to B$ and must show $f \otimes \operatorname{id}_M: A \otimes_R M \to B \otimes_R M$ is injective. Using the canonical isomorphism between localizing a tensor product and tensoring the localizations, the local flatness hypothesis converts the problem into checking injectivity at every maximal ideal, which then follows from [Injectivity and Surjectivity Are Local Properties](/theorems/2853).
[/proofplan]
[step:Prove $(1) \implies (2)$: base change preserves flatness]
Assume $M$ is a flat $R$-module. For a prime $\mathfrak{p} \in \operatorname{Spec}(R)$, the localization $M_\mathfrak{p}$ is canonically isomorphic to $R_\mathfrak{p} \otimes_R M$ as an $R_\mathfrak{p}$-module. We must show $M_\mathfrak{p}$ is flat over $R_\mathfrak{p}$, i.e., for every injective $R_\mathfrak{p}$-linear map $g: L_1 \to L_2$, the map $g \otimes_{R_\mathfrak{p}} \operatorname{id}_{M_\mathfrak{p}}: L_1 \otimes_{R_\mathfrak{p}} M_\mathfrak{p} \to L_2 \otimes_{R_\mathfrak{p}} M_\mathfrak{p}$ is injective.
Using the canonical isomorphism $L_i \otimes_{R_\mathfrak{p}} M_\mathfrak{p} \cong L_i \otimes_{R_\mathfrak{p}} (R_\mathfrak{p} \otimes_R M) \cong L_i \otimes_R M$ (the last isomorphism being the associativity of tensor products: for any $R_\mathfrak{p}$-module $L$ and $R$-module $M$, one has $L \otimes_{R_\mathfrak{p}} (R_\mathfrak{p} \otimes_R M) \cong L \otimes_R M$ via $\ell \otimes (r \otimes m) \mapsto \ell r \otimes m$), the map $g \otimes_{R_\mathfrak{p}} \operatorname{id}_{M_\mathfrak{p}}$ identifies with $g \otimes_R \operatorname{id}_M: L_1 \otimes_R M \to L_2 \otimes_R M$.
Since $g$ is an injective $R_\mathfrak{p}$-linear map, it is in particular an injective $R$-linear map (via the $R$-module structure on $R_\mathfrak{p}$-modules given by restriction of scalars along $R \to R_\mathfrak{p}$). Since $M$ is flat over $R$, the map $g \otimes_R \operatorname{id}_M$ is injective. Therefore $g \otimes_{R_\mathfrak{p}} \operatorname{id}_{M_\mathfrak{p}}$ is injective, confirming $M_\mathfrak{p}$ is flat over $R_\mathfrak{p}$.
[guided]
We need to show that if $M$ is flat over $R$, then $M_\mathfrak{p} = R_\mathfrak{p} \otimes_R M$ is flat over $R_\mathfrak{p}$.
Take an injective $R_\mathfrak{p}$-linear map $g: L_1 \to L_2$. We must show $g \otimes_{R_\mathfrak{p}} \operatorname{id}_{M_\mathfrak{p}}$ is injective. The key algebraic identity is the tensor product associativity: for an $R_\mathfrak{p}$-module $L$,
\begin{align*}
L \otimes_{R_\mathfrak{p}} M_\mathfrak{p} = L \otimes_{R_\mathfrak{p}} (R_\mathfrak{p} \otimes_R M) \cong L \otimes_R M.
\end{align*}
This isomorphism sends $\ell \otimes_{R_\mathfrak{p}} (\frac{r}{s} \otimes_R m)$ to $\frac{r}{s} \ell \otimes_R m$. Under this identification, $g \otimes_{R_\mathfrak{p}} \operatorname{id}_{M_\mathfrak{p}}$ corresponds to $g \otimes_R \operatorname{id}_M$.
Now $g: L_1 \to L_2$ is injective as an $R_\mathfrak{p}$-linear map, and we can view it as an $R$-linear map by restriction of scalars. It remains injective as an $R$-linear map (the underlying set map is unchanged). Since $M$ is flat over $R$, the functor $- \otimes_R M$ preserves injectivity, so $g \otimes_R \operatorname{id}_M$ is injective. Hence $g \otimes_{R_\mathfrak{p}} \operatorname{id}_{M_\mathfrak{p}}$ is injective, and $M_\mathfrak{p}$ is flat over $R_\mathfrak{p}$.
This argument shows that flatness is preserved by base change along any ring homomorphism $R \to S$ (here $S = R_\mathfrak{p}$), which is a general fact: if $M$ is flat over $R$, then $S \otimes_R M$ is flat over $S$.
[/guided]
[/step]
[step:Verify $(2) \implies (3)$: maximal ideals are prime]
Every maximal ideal of $R$ is prime, so $\operatorname{mSpec}(R) \subseteq \operatorname{Spec}(R)$. If $M_\mathfrak{p}$ is flat over $R_\mathfrak{p}$ for every prime $\mathfrak{p}$, then in particular $M_\mathfrak{m}$ is flat over $R_\mathfrak{m}$ for every maximal ideal $\mathfrak{m}$.
[/step]
[step:Prove $(3) \implies (1)$: use local flatness to check injectivity of tensored maps globally]
We must show $M$ is flat over $R$: for every injective $R$-linear map $f: A \to B$, the map $f \otimes_R \operatorname{id}_M: A \otimes_R M \to B \otimes_R M$ is injective.
By [Injectivity and Surjectivity Are Local Properties](/theorems/2853), the map $f \otimes_R \operatorname{id}_M$ is injective if and only if its localization $(f \otimes_R \operatorname{id}_M)_\mathfrak{m}$ is injective for every maximal ideal $\mathfrak{m}$. We identify this localization using the canonical isomorphism: for any $R$-modules $P$ and $Q$ and any multiplicative subset $S$,
\begin{align*}
S^{-1}(P \otimes_R Q) \cong S^{-1}P \otimes_{S^{-1}R} S^{-1}Q.
\end{align*}
Applying this with $S = R \setminus \mathfrak{m}$, $P = A$ (or $B$), and $Q = M$:
\begin{align*}
(A \otimes_R M)_\mathfrak{m} &\cong A_\mathfrak{m} \otimes_{R_\mathfrak{m}} M_\mathfrak{m}, \\
(B \otimes_R M)_\mathfrak{m} &\cong B_\mathfrak{m} \otimes_{R_\mathfrak{m}} M_\mathfrak{m}.
\end{align*}
Under these isomorphisms, the localized map $(f \otimes_R \operatorname{id}_M)_\mathfrak{m}$ corresponds to $f_\mathfrak{m} \otimes_{R_\mathfrak{m}} \operatorname{id}_{M_\mathfrak{m}}$.
Since $f: A \to B$ is injective and localization is exact, $f_\mathfrak{m}: A_\mathfrak{m} \to B_\mathfrak{m}$ is injective. By hypothesis, $M_\mathfrak{m}$ is flat over $R_\mathfrak{m}$, so the functor $- \otimes_{R_\mathfrak{m}} M_\mathfrak{m}$ preserves injectivity. Therefore $f_\mathfrak{m} \otimes_{R_\mathfrak{m}} \operatorname{id}_{M_\mathfrak{m}}$ is injective.
Since $(f \otimes_R \operatorname{id}_M)_\mathfrak{m}$ is injective for every maximal ideal $\mathfrak{m}$, by [Injectivity and Surjectivity Are Local Properties](/theorems/2853), the map $f \otimes_R \operatorname{id}_M$ is injective. This holds for every injective $R$-linear map $f$, so $M$ is flat.
[guided]
This is the heart of the proof. We need to show that if $M_\mathfrak{m}$ is flat over $R_\mathfrak{m}$ for every maximal $\mathfrak{m}$, then $M$ is flat over $R$.
Let $f: A \to B$ be an injective $R$-linear map. We must show $f \otimes_R \operatorname{id}_M: A \otimes_R M \to B \otimes_R M$ is injective.
The strategy: instead of proving injectivity directly, we check it locally at every maximal ideal and then invoke localness of injectivity. By [Injectivity and Surjectivity Are Local Properties](/theorems/2853), $f \otimes_R \operatorname{id}_M$ is injective iff $(f \otimes_R \operatorname{id}_M)_\mathfrak{m}$ is injective for every maximal $\mathfrak{m}$.
The key algebraic input is the canonical isomorphism
\begin{align*}
S^{-1}(P \otimes_R Q) \cong S^{-1}P \otimes_{S^{-1}R} S^{-1}Q,
\end{align*}
which holds for any $R$-modules $P$, $Q$ and any multiplicative subset $S \subseteq R$. (The isomorphism sends $\frac{p \otimes q}{s}$ to $\frac{p}{s} \otimes \frac{q}{1}$; it is well-defined and bijective by the universal property of localization and the universal property of tensor products.)
With $S = R \setminus \mathfrak{m}$, this gives
\begin{align*}
(A \otimes_R M)_\mathfrak{m} \cong A_\mathfrak{m} \otimes_{R_\mathfrak{m}} M_\mathfrak{m}, \qquad (B \otimes_R M)_\mathfrak{m} \cong B_\mathfrak{m} \otimes_{R_\mathfrak{m}} M_\mathfrak{m}.
\end{align*}
Under these identifications, $(f \otimes_R \operatorname{id}_M)_\mathfrak{m}$ becomes $f_\mathfrak{m} \otimes_{R_\mathfrak{m}} \operatorname{id}_{M_\mathfrak{m}}$. (One verifies this by tracing through: $(f \otimes \operatorname{id}_M)_\mathfrak{m}$ sends $\frac{a \otimes m}{s}$ to $\frac{f(a) \otimes m}{s}$, and $f_\mathfrak{m} \otimes \operatorname{id}_{M_\mathfrak{m}}$ sends $\frac{a}{s} \otimes \frac{m}{1}$ to $\frac{f(a)}{s} \otimes \frac{m}{1}$, which match under the isomorphism.)
Now we have two inputs:
- Since $f$ is injective and localization is exact, $f_\mathfrak{m}: A_\mathfrak{m} \to B_\mathfrak{m}$ is injective.
- Since $M_\mathfrak{m}$ is flat over $R_\mathfrak{m}$ by hypothesis, $- \otimes_{R_\mathfrak{m}} M_\mathfrak{m}$ preserves injectivity.
Combining: $f_\mathfrak{m} \otimes_{R_\mathfrak{m}} \operatorname{id}_{M_\mathfrak{m}}$ is injective. Hence $(f \otimes_R \operatorname{id}_M)_\mathfrak{m}$ is injective for every maximal $\mathfrak{m}$.
By [Injectivity and Surjectivity Are Local Properties](/theorems/2853), $f \otimes_R \operatorname{id}_M$ is injective. Since $f$ was an arbitrary injective $R$-linear map, $M$ is flat over $R$.
Notice the logical structure: the proof of $(3) \implies (1)$ for flatness bootstraps on the localness of injectivity (which was proved in the previous theorem), combined with the algebraic fact that localization commutes with tensor products. This is a recurring pattern in commutative algebra: properties defined by exactness conditions can be checked locally because both the exactness itself and the relevant algebraic constructions behave well under localization.
[/guided]
[/step]