External direct product of a family of group homomorphisms

The following is from Hungerford's Algebra book:

Theorem 8.10. Let $\{f_i\colon G_i\to H_i\mid i\in I\}$ be a family of homomorphisms of groups and let $f=\prod f_i$ be the map $\prod\limits_{i\in I}G_i \to \prod\limits_{i\in I}H_i$, given by $\{a_i\}\longmapsto \{f_i(a_i)\}$. Then $f$ is a homomorphism of groups such that $f\left({\prod\limits_{i\in I}}^w G_i\right)\subset {\prod\limits_{i\in I}}^w H_i$, $\ker f = \prod\limits_{i\in I}\ker f_i$, and $\mathrm{Im}\,f = \prod\limits_{i\in i}f_i$. Consequently, $f$ is a monomorphism [resp. epimorphism] if and only if each $f_i$ is.

The only part that I am struggling with is that $f$ is a homomorphism of groups, which I don't think to be true, since for that each $H_i$ needs to be Abelian but the theorem doesn't mention that. So how is $f$ a group homomorphism?


An element $\mathbf{x}=(x_i)_{i\in I}$ of a product $\prod K_i$ is completely determined by its "components", that is, the values $\pi_j(\mathbf{x})=x_j$. We know that $\mathbf{x}=\mathbf{y}$ if and only if $\pi_j(\mathbf{x}) = \pi_j(\mathbf{y})$ for all indices $j$.

Now, if $(a_i),(b_i)\in \prod G_i$, then their product is define "pointwise", that is, $$\pi_j\Bigl( (a_i)(b_i)\Bigr) = \pi_j(a_i)\pi_j(b_i) = a_jb_j.$$

The definition of $\prod f_i$ is that $$\pi_j\left(\left(\prod f_i\right)(x_k)\right) = f_j\Bigl(\pi_j(x_k)\Bigr) = f_j(x_j).$$

Thus, we have: $$\begin{align*} \pi_j\left(\left(\prod f_i\right)\bigl((a_i)(b_i)\bigr)\right) &= f_j\Bigl(\pi_j\bigl((a_i)(b_i)\bigr)\Bigr)\\ &= f_j\Bigl(\pi_j(a_i)\pi_j(b_i)\Bigr)\\ &= f_j\Bigl(a_jb_j\Bigr)\\ &= f_j(a_j)f_j(b_j).\\ \pi_j\left(\left( \left(\prod f_i\right)(a_i)\right)\left(\left(\prod f_i\right)(b_i)\right)\right) &=\pi_j\left( \left(\prod f_i\right)(a_i)\right) \pi_j\left(\left(\prod f_i\right)(b_i)\right)\\ &= f_j(\pi_j(a_i))f_j(\pi_j(b_i))\\ &= f_j(a_j)f_j(b_j). \end{align*}$$

Therefore, $$\left(\prod f_i\right)\Bigl( (a_i)(b_i)\Bigr) = \left( \left(\prod f_i\right)(a_i)\right) \left( \left(\prod f_i\right)(b_i)\right),$$ proving that we have a homomorphism.