Homomorphisms and exact sequences

Suppose $M' \rightarrow M \rightarrow M'' \rightarrow 0$ is exact. Since $v$ is surjective, $Hom(M'', N) \rightarrow Hom(M, N)$ is injective. Let $p\colon M \rightarrow N$ be a homomorphism such that $pu = 0$. Let $y \in M''$. There exists $x \in M$ such that $y = v(x)$. Since $Im(u) = Ker(v) \subset Ker(p)$, $p(x)$ is independent of a choice of $x$. Hence we get a map $q\colon M'' \rightarrow N$ such that $q(y) = p(x)$. It is easy to see that $q$ is a homomorphism. Since $qv = p$, $Ker(Hom(M, N) \rightarrow Hom(M', N)) \subset Im(Hom(M'', N) \rightarrow Hom(M, N))$. The other inclusion is clear.

Conversely suppose $0 \rightarrow Hom(M'', N) \rightarrow Hom(M, N) \rightarrow Hom(M', N)$ is exact. I will prove that $M' \rightarrow M \rightarrow M'' \rightarrow 0$ is exact. Since $Hom(M'', N) \rightarrow Hom(M, N)$ is injective, $v$ is surjective. So it suffices to prove that $Im(u) = Ker(v)$. Since $0 \rightarrow Hom(M'', M'') \rightarrow Hom(M, M'') \rightarrow Hom(M', M'')$ is exact. $vu = 0$. Hence $Im(u) \subset Ker(v)$. Let $N = M/Im(u)$. Let $p\colon M \rightarrow N$ be the canonical homomorphism. Since $pu = 0$, there exists $q\colon M'' \rightarrow N$ such that $qv = p$. Let $x \in Ker(v)$. Since $0 = qv(x) = p(x), x \in Im(u)$. Hence $Ker(v) \subset Im(u)$.