TITLE: Characterization of short exact sequences
QUESTION [5 upvotes]: The following is the first part of Proposition 2.9 in "Introduction to Commutative Algebra" by Atiyah & Macdonald.

Let $A$ be a commutative ring with $1$. Let $$M'
\overset{u}{\longrightarrow}M\overset{v}{\longrightarrow}M''\longrightarrow
 0\tag{1} $$ be sequence of $A$-modules and homomorphisms. Then the sequence (1) is exact if and only if for all $A$-modules $N$, the
  sequence  $$0\longrightarrow \operatorname{Hom}(M'', N)
 \overset{\overline{v}}{\longrightarrow}\operatorname{Hom}(M,
 N)\overset{\overline{u}}{\longrightarrow}\operatorname{Hom}(M', N)
 \tag{2} $$ is exact.

Here, $\overline{v}$ is the map defined by $\overline{v}(f)=f\circ v$ for every $f\in\operatorname{Hom}(M'', N)$ and $\overline{u}$ is defined likewise. 
The proof one of direction, namely $(2)\Rightarrow (1)$ is given in the book, which I am having some trouble understanding. So assuming (2) is exact sequence, the authors remark that "since $\overline{v}$ is injective for all $N$, it follows that $v$ is surjective". Could someone explain why this follows?
Given that $\overline{v}$ is injective, we know that whenever $f(v(x))=g(v(x))$ for all $x\in M$, we have $f=g$. I am not sure how we conclude from this surjectivity of $v$.
Thanks!

REPLY [6 votes]: I think I have found the solution using Zach L's hint. 
Let $N=\operatorname{coker}(v)=M''/\operatorname{Im}(v)$, and let $p\in\operatorname{Hom}(M'', N)$ be the canonical map $p: M''\to M''/\operatorname{Im(v)}=N$. We observe for every $x\in M$, we have
$$p(v(x))=v(x)+\operatorname{Im}(v)=0+\operatorname{Im}(v)=0_{M''/\operatorname{Im(v)}}$$
So $p\circ v=0$. But we know that $\overline{v}$ is injective, that is, $\ker{\overline{v}}=\{0\}$. So $\overline{v}(p)=p\circ v=0$ implies $p=0$ (that is, the identically zero map), from which we get $M''/\operatorname{Im}(v)=0$, that is, $\operatorname{Im}(v)=M''$, proving that $v$ is surjective.