[proofplan]
We prove both parts by direct verification of exactness at each term. For part (1), the covariant functor $\operatorname{Hom}_R(Q, -)$ acts by post-composition: $f_*(\alpha) = f \circ \alpha$. Injectivity of $f_*$ follows from injectivity of $f$, and the exactness $\operatorname{im}(f_*) = \ker(g_*)$ follows from the exactness $\operatorname{im}(f) = \ker(g)$ in the original sequence. For part (2), the contravariant functor $\operatorname{Hom}_R(-, P)$ acts by pre-composition: $g^*(\beta) = \beta \circ g$. Injectivity of $g^*$ follows from surjectivity of $g$, and the exactness $\operatorname{im}(g^*) = \ker(f^*)$ uses both the surjectivity of $g$ and the exactness at $B$.
[/proofplan]
[step:Part (1) — Verify injectivity of $f_*$]
Let $\alpha \in \operatorname{Hom}_R(Q, A)$ and suppose $f_*(\alpha) = 0$, i.e., $f \circ \alpha = 0$ as a map $Q \to B$. For any $q \in Q$, this gives $f(\alpha(q)) = 0$. Since the original sequence is exact at $A$, the map $f: A \to B$ is injective ($\ker f = 0$). Hence $\alpha(q) = 0$ for every $q \in Q$, so $\alpha = 0$. This shows $\ker(f_*) = 0$, i.e., $f_*$ is injective.
[/step]
[step:Part (1) — Verify exactness at $\operatorname{Hom}_R(Q, B)$: show $\operatorname{im}(f_*) \subseteq \ker(g_*)$]
Let $\alpha \in \operatorname{Hom}_R(Q, A)$. We must show $g_*(f_*(\alpha)) = 0$, i.e., $g \circ f \circ \alpha = 0$. The original sequence is exact at $B$, meaning $\operatorname{im}(f) = \ker(g)$. In particular $\operatorname{im}(f) \subseteq \ker(g)$, so $g \circ f = 0$ as a map $A \to C$. Hence $g \circ f \circ \alpha = 0$ for any $\alpha: Q \to A$.
[/step]
[step:Part (1) — Verify exactness at $\operatorname{Hom}_R(Q, B)$: show $\ker(g_*) \subseteq \operatorname{im}(f_*)$]
Let $\beta \in \operatorname{Hom}_R(Q, B)$ with $g_*(\beta) = 0$, i.e., $g \circ \beta = 0$. For any $q \in Q$, $g(\beta(q)) = 0$, so $\beta(q) \in \ker(g) = \operatorname{im}(f)$. Since $f$ is injective, for each $q \in Q$ there exists a unique $a_q \in A$ with $f(a_q) = \beta(q)$.
Define the map $\alpha: Q \to A$ by $\alpha(q) := a_q$. We verify $\alpha$ is an $R$-module homomorphism. For $q_1, q_2 \in Q$ and $r \in R$:
\begin{align*}
f(\alpha(q_1 + q_2)) &= \beta(q_1 + q_2) = \beta(q_1) + \beta(q_2) = f(\alpha(q_1)) + f(\alpha(q_2)) = f(\alpha(q_1) + \alpha(q_2)),
\end{align*}
and since $f$ is injective, $\alpha(q_1 + q_2) = \alpha(q_1) + \alpha(q_2)$. Similarly, $f(\alpha(rq)) = \beta(rq) = r\beta(q) = rf(\alpha(q)) = f(r\alpha(q))$, and injectivity of $f$ gives $\alpha(rq) = r\alpha(q)$.
Thus $\alpha \in \operatorname{Hom}_R(Q, A)$ and $f_*(\alpha) = f \circ \alpha = \beta$, so $\beta \in \operatorname{im}(f_*)$.
[guided]
The key step is constructing $\alpha$. Since $\beta(q) \in \ker(g) = \operatorname{im}(f)$ for each $q$, and $f$ is injective, the preimage $f^{-1}(\beta(q))$ is a single element of $A$. This defines a set-theoretic map $\alpha: Q \to A$. The verification that $\alpha$ is $R$-linear uses injectivity of $f$ as a "cancellation" tool: to show $\alpha(q_1 + q_2) = \alpha(q_1) + \alpha(q_2)$, we apply $f$ to both sides, use $R$-linearity of $f$ and $\beta$, and then cancel $f$ by injectivity.
Why do we need $f$ to be injective, not just the exactness $\operatorname{im}(f) = \ker(g)$? Because without injectivity, the preimage $f^{-1}(\beta(q))$ could have multiple elements, and there would be no canonical way to choose $\alpha(q)$.
[/guided]
[/step]
[step:Part (2) — Verify injectivity of $g^*$]
Let $\gamma \in \operatorname{Hom}_R(C, P)$ and suppose $g^*(\gamma) = 0$, i.e., $\gamma \circ g = 0$ as a map $B \to P$. The original sequence is exact at $C$, meaning $g: B \to C$ is surjective. For any $c \in C$, there exists $b \in B$ with $g(b) = c$. Then $\gamma(c) = \gamma(g(b)) = (\gamma \circ g)(b) = 0$. Since this holds for every $c \in C$, we have $\gamma = 0$.
[/step]
[step:Part (2) — Verify exactness at $\operatorname{Hom}_R(B, P)$: show $\operatorname{im}(g^*) \subseteq \ker(f^*)$]
Let $\gamma \in \operatorname{Hom}_R(C, P)$. We must show $f^*(g^*(\gamma)) = 0$, i.e., $\gamma \circ g \circ f = 0$. Since the original sequence is exact at $B$, we have $\operatorname{im}(f) = \ker(g)$, so $g \circ f = 0$. Hence $\gamma \circ g \circ f = 0$.
[/step]
[step:Part (2) — Verify exactness at $\operatorname{Hom}_R(B, P)$: show $\ker(f^*) \subseteq \operatorname{im}(g^*)$]
Let $\beta \in \operatorname{Hom}_R(B, P)$ with $f^*(\beta) = 0$, i.e., $\beta \circ f = 0$. We must find $\gamma \in \operatorname{Hom}_R(C, P)$ with $\gamma \circ g = \beta$.
Since $\beta \circ f = 0$, we have $\operatorname{im}(f) \subseteq \ker(\beta)$. By exactness at $B$, $\operatorname{im}(f) = \ker(g)$, so $\ker(g) \subseteq \ker(\beta)$. This means $\beta$ factors through the quotient by $\ker(g)$: there exists a unique $R$-module homomorphism
\begin{align*}
\bar{\beta}: B / \ker(g) \to P
\end{align*}
satisfying $\bar{\beta} \circ \pi = \beta$, where $\pi: B \to B / \ker(g)$ is the canonical projection. This is the universal property of quotient modules applied to the map $\beta: B \to P$ with $\ker(g) \subseteq \ker(\beta)$.
By the first isomorphism theorem, $g$ induces an isomorphism $\bar{g}: B / \ker(g) \xrightarrow{\sim} \operatorname{im}(g)$. Since the original sequence is exact at $C$, $g$ is surjective, so $\operatorname{im}(g) = C$. Hence $\bar{g}: B / \ker(g) \xrightarrow{\sim} C$ is an isomorphism.
Define $\gamma := \bar{\beta} \circ \bar{g}^{-1}: C \to P$. This is a composition of $R$-module homomorphisms, hence an $R$-module homomorphism. For any $b \in B$:
\begin{align*}
\gamma(g(b)) = \bar{\beta}(\bar{g}^{-1}(g(b))) = \bar{\beta}(\pi(b)) = \beta(b),
\end{align*}
where we used $\bar{g}^{-1}(g(b)) = \pi(b)$ (since $\bar{g}(\pi(b)) = g(b)$ by definition of $\bar{g}$). Hence $\gamma \circ g = \beta$, i.e., $g^*(\gamma) = \beta$, so $\beta \in \operatorname{im}(g^*)$.
[guided]
The construction of $\gamma$ uses a standard factorisation argument. We have a map $\beta: B \to P$ that vanishes on $\ker(g)$. By the universal property of quotient modules, $\beta$ factors through $B / \ker(g)$, yielding $\bar{\beta}: B / \ker(g) \to P$.
Now we need to "transfer" $\bar{\beta}$ from a map on $B / \ker(g)$ to a map on $C$. The first isomorphism theorem provides the bridge: $g$ induces an isomorphism $\bar{g}: B / \ker(g) \xrightarrow{\sim} \operatorname{im}(g) = C$ (the surjectivity of $g$ ensures $\operatorname{im}(g) = C$). Composing with $\bar{g}^{-1}$ gives $\gamma = \bar{\beta} \circ \bar{g}^{-1}: C \to P$.
The verification that $\gamma \circ g = \beta$ amounts to tracing the diagram:
\begin{align*}
B \xrightarrow{\pi} B / \ker(g) \xrightarrow{\bar{g}} C \xrightarrow{\bar{g}^{-1}} B / \ker(g) \xrightarrow{\bar{\beta}} P.
\end{align*}
The composition $\bar{g}^{-1} \circ g = \pi$ (by definition of $\bar{g}$), so $\gamma \circ g = \bar{\beta} \circ \bar{g}^{-1} \circ g = \bar{\beta} \circ \pi = \beta$.
Why did we need $g$ to be surjective? Without surjectivity, $\operatorname{im}(g)$ would be a proper submodule of $C$, and $\bar{g}$ would not be an isomorphism onto $C$ but only onto $\operatorname{im}(g)$. We would then only be able to define $\gamma$ on $\operatorname{im}(g)$, not on all of $C$.
[/guided]
[/step]