## Hom commutes with finite direct products in both slots

Let $R$ be a ring with 1 and let $A$, $B$, and $M$ be unital left $R$-modules. Prove that $\mathsf{Hom}_R(A \times B, M) \cong_R \mathsf{Hom}_R(A,M) \times \mathsf{Hom}_R(B,M)$ and $\mathsf{Hom}_R(M,A \times B) \cong_R \mathsf{Hom}_R(M,A) \times \mathsf{Hom}_R(M,B)$. (Where $\cong_R$ means “isomorphic as $R$-modules”.)

Given $R$-module homomorphisms $\alpha : A \rightarrow M$ and $\beta : B \rightarrow M$, define $\Phi(\alpha,\beta) : A \times B \rightarrow M$ by $\Phi(\alpha,\beta)(a,b) = \alpha(a) + \beta(b)$. Note that, for all $a_1,a_2 \in A$, $b_1,b_2 \in B$, and $r \in R$, we have

 $\Phi(\alpha,\beta)((a_1,b_1) + r \cdot (a_2,b_2))$ = $\Phi(\alpha,\beta)((a_1 + r \cdot a_2, b_1 + r \cdot b_2))$ = $\alpha(a_1 + r \cdot a_2) + \beta(b_1 + r \cdot b_2)$ = $\alpha(a_1) + r \cdot \alpha(a_2) + \beta(b_1) + r \cdot \beta(b_2)$ = $\Phi(\alpha,\beta)(a_1,b_1) + r \cdot \Phi(\alpha,\beta)(a_2,b_2)$.

So $\Phi(\alpha,\beta) : A \times B \rightarrow M$ is an $R$-module homomorphism. Consider the map $\Phi : \mathsf{Hom}_R(A,M) \times \mathsf{Hom}_R(B,M) \rightarrow \mathsf{Hom}_R(A \times B, M)$. We claim that $\Phi$ is an $R$-module homomorphism. To see this, let $\alpha_1,\alpha_2 : A \rightarrow M$ and $\beta_1,\beta_2 : B \rightarrow M$ be $R$-module homomorphisms and let $r \in R$. Now

 $\Phi((a_1,b_1) + r \cdot (a_2,b_2))(a,b)$ = $\Phi(\alpha_1 + r \cdot \alpha_2, \beta_1 + r \cdot \beta_2)(a,b)$ = $(\alpha_1 + r \cdot \alpha_2)(a) + (\beta_1 + r \cdot \beta_2)(b)$ = $\alpha_1(a) + r \cdot \alpha_2(a) + \beta_1(b) + r \cdot \beta_2(b)$ = $\Phi(\alpha_1,\beta_1)(a,b) + r \cdot \Phi(\alpha_2,\beta_2)(a,b)$ = $(\Phi(\alpha_1,\beta_1) + r \cdot \Phi(\alpha_2,\beta_2))(a,b)$.

So $\Phi$ is an $R$-module homomorphism. Now suppose $(\alpha,\beta) \in \mathsf{ker}\ \Phi$. In particular, $0 = \Phi(\alpha,\beta)(a,0) = \alpha(a)$ for all $a \in A$, so that $\alpha = 0$. Similarly, $\beta = 0$. Thus $(\alpha,\beta) = 0$, and in fact $\mathsf{ker}\ \Phi = 0$. Hence $\Phi$ is injective. Finally, let $\theta : A \times B \rightarrow M$ be an $R$-module homomorphism, and define $\alpha_\theta : A \rightarrow M$ and $\beta_\theta : B \rightarrow M$ by $\alpha_\theta(a) = \theta(a,0)$ and $\beta_\theta(b) = \theta(0,b)$. Note that $\alpha_\theta(a_1 + r \cdot a_2) = \theta(a_1 + r \cdot a_2,0 = \theta(a_1,0) + r \cdot \theta(a_2,0)$ $= \alpha_\theta(a_1) + r \cdot \alpha_\theta(a_2)$, so that $\alpha_\theta$ is an $R$-module homomorphism. Similarly, $\beta_\theta$ is an $R$-module homomorphism. Since $\Phi(\alpha_\theta, \beta_\theta)(a,b) = \alpha_\theta(a) + \beta_\theta(b)$ $= \theta(a,0) + \theta(0,b)$ $= \theta(a,b)$, we have $\Phi(\alpha_\theta,\beta_\theta) = \theta$. Hence $\Phi$ is surjective. Thus, we have $\mathsf{Hom}_R(A \times B, M) \cong_R \mathsf{Hom}_R(A,M) \times \mathsf{Hom}_R(B,M)$.

Now let $\pi_A : A \times B \rightarrow A$ and $\pi_B : A \times B \rightarrow B$ be the left and right coordinate projections; certainly these are $R$-module homomorphisms. Define $\Psi : \mathsf{Hom}_R(M,A \times B) \rightarrow \mathsf{Hom}_R(M,A) \times \mathsf{Hom}_R(M,B)$ by $\Psi(\varphi) = (\pi_A \circ \varphi, \pi_B \circ \varphi)$. If $\varphi, \psi \in \mathsf{Hom}_R(M,A \times B)$ and $r \in R$, then

 $\Psi(\varphi + r \cdot \psi)$ = $(\pi_A \circ (\varphi + r \cdot \psi), \pi_B \circ (\varphi + r \cdot \psi))$ = $(\pi_A \circ \varphi + r \cdot (\pi_A \circ \psi), \pi_B \circ \varphi + r \cdot (\pi_B \circ \psi))$ = $(\pi_A \circ \varphi, \pi_A \circ \psi) + r \cdot (\pi_B \circ \varphi, \pi_B \circ \psi)$ = $\Psi(\varphi) + r \cdot \Psi(\psi)$.

Thus $\Psi$ is an $R$-module homomorphism. Now suppose $\varphi \in \mathsf{ker}\ \Psi$. In particular, if $m \in M$, then $0 = \Psi(\varphi)(m,m) = ((\pi_A \circ \varphi)(m), (\pi_b \circ \psi)(m))$ $= (\pi_A(\varphi(m)), \pi_B(\varphi(m))$ $= \varphi(m)$. So $\varphi = 0$, hence $\mathsf{ker}\ \Psi = 0$, and thus $\Psi$ is injective. Finally, suppose $(\alpha,\beta) \in \mathsf{Hom}_R(M,A) \times \mathsf{Hom}_R(M,B)$. Define $\varphi_{\alpha,\beta} : M \rightarrow A \times B$ by $\varphi_{\alpha,\beta}(m) = (\alpha(m), \beta(m)$. Certainly $\varphi_{\alpha,\beta}$ is an $R$-module homomorphism. Moreover, we have $\Psi(\varphi_{\alpha,\beta})(m) = ((\pi_A \circ \varphi_{\alpha,\beta})(m), (\pi_B \circ \varphi_{\alpha,\beta})(m))$ $= (\alpha(m), \beta(m))$. Thus $\Psi(\varphi_{\alpha,\beta}) = (\alpha,\beta)$, and so $\Psi$ is surjective. Hence $\mathsf{Hom}_R(M, A \times B) \cong_R \mathsf{Hom}_R(M,A) \times \mathsf{Hom}_R(M,B)$.