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.
 A: 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.
A: You want to prove $f(M)=N$. Consider the quotient module $\frac{N}{f(M)}$. 
There is a result which says that, an $R$-module $M$ is zero module if $M_{\mathfrak{m}}=0$ for every maximal ideal $\mathfrak{m}$ of $R$. 
Look at the quotient $\left(\frac{N}{f(M)}\right)_{\mathfrak{m}}$. An element in $\left(\frac{N}{f(M)}\right)_{\mathfrak{m}}$ will be of the for $\frac{[n]}{a}$ where $a\in R\setminus \mathfrak{m}$. 
As $\frac{n}{a}\in N_{\mathfrak{m}}$ there exists $b(\mathfrak{m})\in M_{\mathfrak{m}}$ such that $f_{\mathfrak{m}}(b(\mathfrak{m}))=\frac{n}{a}$. Show that this means $\frac{[n]}{a}=0$. 
Thus, $\left(\frac{N}{f(M)}\right)_{\mathfrak{m}}=0 $ for every maximal ideal $\mathfrak{m}$. Thus, $\frac{N}{f(M)}=0$ i.e., $f(M)=N$.

Hint for the following result 

$M_{\mathfrak{m}}=0$ for all maximal ideals $\mathfrak{m}$ of $R$ implies $M=0$.

Let $a\in M$ is such that $a\neq 0$.
Consider the annihilator ideal $\text{Ann}(a)$ of $a$. This will be in some maximal ideal $\mathfrak{m}$.  
Localize $M$ at this $\mathfrak{m}$ and use that $M_{\mathfrak{m}}=0$. You will end up with $a=0$. Thus, $M=0$
