Show that if $$ 0 \rightarrow M_1 \xrightarrow{f} M_2 \xrightarrow{g} M_3 $$ is an exact sequence of $R$-modules, then for all $R$-module $M$, $$ 0 \rightarrow \operatorname{Hom}_R(M,M_1) \xrightarrow{f_*} \operatorname{Hom}_R(M,M_2) \xrightarrow{g_*} \operatorname{Hom}_R(M,M_3) $$ is an exact sequence of $\mathbb{Z}$-modules (where $f_*(h)=f \circ h$).
In order to show this is an exact sequence, I have to prove $\mathrm{Im}(f_*) = \mathrm{Ker}(g_*)$.
I could show the inclusion $\mathrm{Im}(f_*) \subset \mathrm{Ker}(g_*)$: Let $\psi \in \mathrm{Im}(f_*)$, then there is $h \in \mathrm{Hom}_R(M, M_1)$ with $f \circ h = \psi$. It is clear that $\psi \in \mathrm{Hom}_R(M, M_2)$. Let’s evaluate in $g_*$: $$ g_*(\psi) = g \circ \psi = g \circ f \circ h \,. $$ We want to show $\psi \in \mathrm{Ker}(g_*)$, i.e., $g \circ \psi \equiv 0$. Let $x \in M$, then $$ g \circ \psi(x) = g \circ f \circ h(x) = g(f(h(x))) \,. $$ But $\mathrm{Im}(f) = \mathrm{Ker}(g)$, so $g(f(h(x))))=0$. From here one can conclude $\psi \in \mathrm{Ker}(g_*)$.
I couldn’t show the other inclusion, any help would be appreciated.
We can argue as follows. Pick an $h \in \ker g_* \subseteq \mathrm{Hom}_R(M, M_2)$. Then we have $g \circ h = 0.$ This means $\newcommand{\im}{\operatorname{im}} \im h \subseteq \ker g = \im f$. Since $f$ is injective, we have the $R$-homomorphism $(f|_{\im f})^{-1} \colon \im f \rightarrow M_1$. So we can define $j := (f|_{\im f})^{-1} \circ h \colon M \rightarrow M_1$. This is an $R$-homomorphism since it’s a composition of $R$-homomorphisms. By construction, we have $f \circ j = h$, or, in other words $h = f_*(j)$. Since $h$ was chosen arbitrarily, we have shown $\ker g_* \subseteq \im f_*,$ as desired.