# Direct product of abelian groups

Let $G_1,\dots,G_n$ be groups. Prove that the direct product $G_1\times\cdots\times G_n$ is abelian if, and only if, each of $G_1,\dots,G_n$ is abelian. To prove that the direct product is abelian is straightforward but what I don't understand is the converse.

The main point in this problem is that two elements of $$G_1 \times \cdots \times G_n$$ are equal iff their components are equal. You can use this fact for showing both directions. In fact since the operation on $$G_1 \times \cdots \times G_n$$ is made component-wise. So $$(a_1, \dots, a_n) \cdot (b_1, \dots, b_n) = (b_1, \dots, b_n) \cdot (a_1, \dots, a_n)$$ then $$(a_1b_1, \dots, a_nb_n) = (b_1a_1, \dots, b_na_n)$$ and so $$\forall ~i, ~a_ib_i=b_ia_i$$ and vice versa.
HINT: $G_1 \times \cdots \times G_n \rightarrow G_i: (g_1,\ldots,g_n) \mapsto g_i$ is a homomorphism and the homomorphic image of an abelian group is abelian.