Product and coproduct coinsides in the category of Abelian groups
It's rather beautiful that product and coproduct (sum) coinsides in the category of Abelian groups. Recall that product object is a universal construct which satisfies a spectial pattern:
Given two groups $A, B$, there can be constructed a product object $A \times B$ with two projections $p$ and $q$ so that $p(a, b) = a$ and $q(a, b) = b$.
The product must satisfy a universal property which can be demostrated as the following commutative graph:
Accroding to above graph, given any group $X$ with projections:
there exists unique homomorphism $h: X \rightarrow A \times B$ satisfying
Apparently, $h$ can be defined as:
Now, let's prove that the product constructed above is also a coproduct is all groups are abelian.
First of all, we define two injections:
$j: B \rightarrow A \times B,\ j(b) = (b, 0)$
Given other injections:
We need to find a unique morphism $h: A \times B \rightarrow X$ so that
Fortunately, $h$ can be defined as
It's easy to verify that $h$ is a homomorphism:
$h(a_1,b_1)+h(a_2,b_2)$
$= f(a_1)+g(b_1)+f(a_2)+g(b_2)$
$= f(a_1+a_2)+g(b_1+b_2)$
$= h((a_1,b_1)+(a_2,b_2))$
and
$h \circ j(b) = h(0,b) = g(b)$