[proofplan]
We must show $\operatorname{im}(f) = \ker(g)$. For the inclusion $\operatorname{im}(f) \subseteq \ker(g)$, we specialise the hypothesis to $P = C$ and use the identity map $\operatorname{id}_C$ to deduce $g \circ f = 0$. For the reverse inclusion $\ker(g) \subseteq \operatorname{im}(f)$, we specialise to $P = B / \operatorname{im}(f)$ and use the canonical projection $\pi: B \to B / \operatorname{im}(f)$ together with the assumed exactness of the Hom sequence to show that $\pi$ vanishes on $\ker(g)$, forcing $\ker(g) \subseteq \ker(\pi) = \operatorname{im}(f)$.
[/proofplan]
[step:Show $\operatorname{im}(f) \subseteq \ker(g)$ by testing with $P = C$ and $\operatorname{id}_C$]
Set $P = C$ in the hypothesis. By assumption the sequence
\begin{align*}
\operatorname{Hom}_R(C, C) \xrightarrow{g^*} \operatorname{Hom}_R(B, C) \xrightarrow{f^*} \operatorname{Hom}_R(A, C)
\end{align*}
is exact. In particular $f^* \circ g^* = 0$ (this is the inclusion $\operatorname{im}(g^*) \subseteq \ker(f^*)$, which is part of exactness at $\operatorname{Hom}_R(B, C)$).
Apply this to $\operatorname{id}_C \in \operatorname{Hom}_R(C, C)$:
\begin{align*}
0 = f^*(g^*(\operatorname{id}_C)) = f^*(\operatorname{id}_C \circ g) = f^*(g) = g \circ f.
\end{align*}
Since $g \circ f = 0$ as a map $A \to C$, for every $a \in A$ we have $g(f(a)) = 0$, i.e., $f(a) \in \ker(g)$. Hence $\operatorname{im}(f) \subseteq \ker(g)$.
[guided]
The inclusion $\operatorname{im}(g^*) \subseteq \ker(f^*)$ is weaker than full exactness — it only says $f^* \circ g^* = 0$, which does not require the exactness hypothesis in its full strength. But this weak consequence is enough to yield $g \circ f = 0$.
The trick of plugging in $\operatorname{id}_C$ is a Yoneda-style argument: the identity map is the "universal test element" in $\operatorname{Hom}_R(C, C)$. The equation $f^*(g^*(\operatorname{id}_C)) = g \circ f$ holds because $g^*$ is pre-composition by $g$ and $f^*$ is pre-composition by $f$, so their composition evaluates on $\operatorname{id}_C$ as $\operatorname{id}_C \circ g \circ f = g \circ f$.
[/guided]
[/step]
[step:Show $\ker(g) \subseteq \operatorname{im}(f)$ by testing with $P = B / \operatorname{im}(f)$ and the projection $\pi$]
Define $P := B / \operatorname{im}(f)$ and let $\pi: B \to B / \operatorname{im}(f)$ denote the canonical projection. This is a well-defined quotient because $\operatorname{im}(f)$ is a submodule of $B$ (as $f$ is an $R$-module homomorphism).
Consider $\pi \in \operatorname{Hom}_R(B, P)$. We compute $f^*(\pi)$: for any $a \in A$,
\begin{align*}
f^*(\pi)(a) = (\pi \circ f)(a) = \pi(f(a)) = 0 + \operatorname{im}(f) = 0 \in B / \operatorname{im}(f),
\end{align*}
since $f(a) \in \operatorname{im}(f)$ by definition. Hence $f^*(\pi) = 0$, i.e., $\pi \in \ker(f^*)$.
By the exactness hypothesis at $\operatorname{Hom}_R(B, P)$, $\ker(f^*) = \operatorname{im}(g^*)$. Hence there exists $\gamma \in \operatorname{Hom}_R(C, P)$ with $g^*(\gamma) = \pi$, i.e., $\gamma \circ g = \pi$.
Now let $b \in \ker(g)$. Then
\begin{align*}
\pi(b) = (\gamma \circ g)(b) = \gamma(g(b)) = \gamma(0) = 0.
\end{align*}
So $b \in \ker(\pi) = \operatorname{im}(f)$. Since $b \in \ker(g)$ was arbitrary, $\ker(g) \subseteq \operatorname{im}(f)$.
[guided]
The choice $P = B / \operatorname{im}(f)$ is motivated by the desire to detect whether $\ker(g)$ is contained in $\operatorname{im}(f)$. The projection $\pi: B \to B / \operatorname{im}(f)$ acts as a "membership test": $\pi(b) = 0$ if and only if $b \in \operatorname{im}(f)$. So showing $\pi(b) = 0$ for all $b \in \ker(g)$ is equivalent to showing $\ker(g) \subseteq \operatorname{im}(f)$.
The computation $f^*(\pi) = \pi \circ f = 0$ is immediate: composing $\pi$ with $f$ sends every $a \in A$ to $\pi(f(a)) = 0$ since $f(a) \in \operatorname{im}(f) = \ker(\pi)$. So $\pi \in \ker(f^*)$.
The exactness hypothesis $\ker(f^*) = \operatorname{im}(g^*)$ then provides $\gamma \in \operatorname{Hom}_R(C, P)$ with $\gamma \circ g = \pi$. For any $b \in \ker(g)$, we evaluate: $\pi(b) = \gamma(g(b)) = \gamma(0) = 0$. Hence $b \in \ker(\pi) = \operatorname{im}(f)$.
Why is this argument a "converse" to left exactness? The [Left Exactness of Hom Functors](/theorems/2836) says: exact sequences of modules produce exact Hom sequences. Here we run the logic backwards: if the Hom sequence is exact for every test module $P$, we can extract exactness of the original sequence by choosing $P$ cleverly. The two clever choices ($P = C$ with $\operatorname{id}_C$, and $P = B / \operatorname{im}(f)$ with $\pi$) are both instances of the Yoneda principle — probing a functor by its universal elements.
[/guided]
[/step]
[step:Combine the two inclusions to conclude]
From the first step, $\operatorname{im}(f) \subseteq \ker(g)$. From the second step, $\ker(g) \subseteq \operatorname{im}(f)$. Together, $\operatorname{im}(f) = \ker(g)$, which is the definition of exactness of $A \xrightarrow{f} B \xrightarrow{g} C$ at $B$.
[/step]