Surjectivity is a local property I am trying to show surjectivity is a local property, that is, for a ring $R$ and $R$-modules $M$ and $N$, 
$f: M \to N$ is surjective if and only if $f_{\mathscr{M}}:M_{\mathscr{M}} \to N_{\mathscr{M}}$ is surjective for all maximal ideals $\mathscr{M}$ of $R$, where $M_{\mathscr{M}}$ is the localization at $\mathscr{M}$.
One of the directions is easy but I am having trouble seeing how to prove that $f_{\mathscr{M}}:M_{\mathscr{M}} \to N_{\mathscr{M}}$ is surjective for all maximal ideals implies that $f: M \to N$ is surjective.
Atiyah Macdonald says to reverse the arrows in the injectivity proof (that uses exact sequences) but I am not sure how to go about it. Any help is much appreciated.

Exactness is a local property. So looking at the exactness of $M \to N \to 0$ gives that surjectivity is a local property, just as looking at the exactness of $0 \to M \to N$ gives that injectivity is a local property.
Doing as Atiyah and Macdonald say, reversing the arrows in their injectivity proof, works with some care.
Claim: $f\colon M \to N$ is surjective if and only if $f_m \colon M_m \to N_m$ is surjective for every maximal ideal $m$ of $R$.
Proof: (References are to Atiyah Macdonald and this proof is an adaptation of their proof of Proposition 3.9)
$(\to)$ Suppose that $f$ is surjective. Then $M \to N \to 0$ is an exact sequence. Because localization preserves exactness (Proposition 3.3), $M_m \to N_m \to 0$ is exact for all maximal ideals $m$ of $R$ and therefore each $f_m \colon M_m \to N_m$ is surjective.
($\leftarrow$) Suppose that $f_m \colon M_m \to N_m$ is surjective for every maximal ideal $m$ of $R$. Let $N' = N/\text{Im}(f)$ be the cokernel of $f$. Then the sequence $M \to N \to N' \to 0$ is exact and, again because localization preserves exactness, $M_m \to N_m \to N'_m \to 0$ is exact. Because localization commutes with quotients (Corollary 3.4), $N'_m$ is isomorphic to the cokernel of $f_m$. Because $f_m$ is surjective, this cokernel is $0$, so $N'_m = 0$ for every maximal ideal $m$ of $R$. Therefore, because being the $0$-module is a local property (Proposition 3.8), $N' = 0$. So the first three terms of the exact sequence $M \to N \to N' \to 0$ are really $M \to N \to 0$, which means that $f$ is surjective. $\square$
The point is to not only just reverse the arrows in the injectivity proof, but also to look at the cokernel of $f$ instead of at the kernel.
