# How to write down the coproduct of two groups explicitly?

Let $G_1, G_2$ be groups. Find a group $G$ and homomorphisms $\iota_1: G_1 \rightarrow G, \iota_2: G_2 \rightarrow G$ which satisfy the following property:

For every group $A$ and any homomorphisms $\phi_i: G_i \rightarrow A,\quad i=1,2$ there is a unique homomorphism $f: G \rightarrow A$ with $\phi_i=f \circ\iota$ for $i=1,2$.

I know this is the property of the coproduct but I think that I should write down $(G, \iota_1,\iota_2)$ explicitly. I know that for abelian groups the kartesian product $G=G_1 \times G_2$ and the maps $g_1 \mapsto (g_1,e_{G_1})$, $g_2 \mapsto (e_{G_2},g_2)$ would satisfy the property. But in the category of groups $G_{1,2}=\mathbb{Z}$ the construction I just stated would fail.

I had another idea of constructing G via the product the free groups but this didn't take me very far because it opened more question for me then it answered, especially how to choose the homomorphisms $\iota_{1,2}$.

I should prove that $\iota_1, \iota_2$ are injective if $(C, \iota_1, \iota_2)$ is the coproduct of the groups $G_1, G_2$. And argue why this isn't the case in the class of all rings with unit.

My proof: Since $C$ is a the coproduct there is a unique homomorphism $f: C \rightarrow D$ for a homomorphism $\phi_1: G_1 \rightarrow G_1$ with $\phi=f \circ \iota_1$. Let $D:=G_1$ and $\phi_1=id_{G_1}$.

$\iota_1(g)=\iota_1(h) \Rightarrow f(\iota_1(g))=f(\iota_1(h)) \Rightarrow \phi_1(g)=\phi_1(h) \Rightarrow g=h$

Hence $\iota_1$ is injective. Analogous for $\iota_2.$

First of all, have I missed something? And secondly which step doesn't work for rings with unit? (My guess was that the zero ring could make troubles but that's not more then a guess right now.)

The coproduct of groups $G_1,G_2$ is called their free product denoted by $G_1 \ast G_2$. See e.g. https://en.wikipedia.org/wiki/Free_product or any book on group theory.
Note that the free product of nontrival abelian groups is non-abelian and particular $\ne G_1 \oplus G_2$.