We’ve covered direct sums in the case of abelian groups — that is,
-modules — but the concept extends to modules over arbitrary rings. This gives me a good chance to go back and clean up my coverage.
We build the direct sum of two
-modules
and
on the product
of the underlying sets. We define an abelian group structure by
, and an action of
by
.
Now, here’s the diagram:

The direct sum
of two left
-modules
and
comes equipped with four module homomorphisms. For
we have the pair
and
. These are defined as follows:
There is a similar pair with a similar definition for
. These homomorphisms satisfy the identities
where
is the identity homomorphism on the module
, and
is the homomorphism between two modules sending every element of the domain to the element
in the codomain.
Now if we have any two homomorphisms
and
from a module
to
and
respectively, then there is a unique homomorphism
making the two triangles on the top commute. That is,
, and similarly for
. In fact, we can define
, for then

and so on. Similarly, given two homomorphisms
and
from
and
to a module
, then the homomorphism
is the unique homomorphism making the lower two triangles commute.
The upshot of all this is that the direct sum
behaves like both the direct product and the free product of two groups, since it satisfies both universal properties. For any finite number of modules
we can build the direct sum
and it also satisfies the analogous universal properties, and comes equipped with analogous injections and projections satisfying analogous relations to those above.
The upshot of all this is that the direct sum of a finite collection of
-modules behaves like both the direct product and the free product of groups. In fact, we can take that as the definition, derive the relations between the injections and projections, and use the above construction to show such a thing actually exists. On the other hand, we can take the relations between injections and projections as the definitions, use the construction to show existence, and derive the universal property from the relations as above.
For an infinite index set
the situation is a bit more complicated. Here we use the definition from the injections and projections with the specified relations. Then the underlying set of the infinite direct sum
is not the infinite cartesian product of the underlying sets. It’s actually the list of all such “
-tuples” where all but a finite number of the entries are the
elements of the respective modules. This only satisfies the universal property for the
— the bottom of the diagram above. For the top we really do need the infinite direct product of the modules, which uses the whole infinite cartesian product of the underlying sets. However, for most purposes the direct sum is all we need, and the relations between the injections and the projections are the most useful part of this definition.