Free algebras by means of a universal property
Consider a vector space , when is a basis of , we say that is a free vector space on 1. For any vector space and and a basis of , if there is a map then there exists a unique linear map from to that extends . That is, there is a unique linear map making the following diagram commute,
where is the inclusion map (in fact, any map satisfying this property turns out to be injective) 1. In other words there exists a unique map such that .
We can use this to define free in terms of a universal property. In order to do this we define the following category. Let be a full subcategory of with objects in called -algebras, and let be a set. Define to be the category of pairs , in which is a -algebra and a map from to . A morphism in is a homomorphism such that 2. That is, a morphism in is a map making the following diagram commute.
A free algebra on is then an initial object in 2.
The example of a free -vector space above can be constructed in terms of this definition. Let be a field and the category of -vector spaces. The free -algebra on a set is the free -vector space on where is the set of all maps such that is finite. The -vector space structure on is defined by
for , , and . The map is defined by
for all .
Now, for every map there exists a unique morphism of -vector spaces with , that is, making the diagram
commute and this map is explicitly given by
2. Hence, is initial since this morphism always exists for any object of . In fact, every -vector space is the free-semimodule over a field and so every -vector space is free.
We can apply this definition to other algebraic structures. Consider as the category of magmas. Then a free magma on is an initial object in . Similarly, for groups, if we consider the category of groups, the free group on is the initial object in .