GAP:FreeGroup

Function type
The function takes as input either a nonnegative integer or a set of symbols and outputs a group.

Behavior
If given a nonnegative integer, the function returns the free group of that rank, i.e., the free group generated by that many elements. If given a set of symbols, the function returns the free group with those symbols as generators.

Examples of usage
Here is the example of the free group on zero generators, which turns out to be the trivial group:

gap> F := FreeGroup(0);  gap> IsTrivial(F); true

Here is the example of the free group on one generator, which turns out to be the group of integers:

gap> G := FreeGroup(1);  gap> IsCyclic(G); true

Here is the example of the free group on two generators, which is non-abelian:

gap> H := FreeGroup(2);  gap> IsAbelian(H); false

We can refer to the specific elements of a free group using $$.i$$ for $$i$$ the generator index. Here is an example where we construct a group with the presentation $$\langle a,b \mid a^2 = b^2 = e, ab = ba \rangle$$:

gap> F := FreeGroup(2);  gap> G := F/[F.1^2, F.2^2, F.1 * F.2 * (F.2 * F.1)^(-1)];  gap> IdGroup(G); [ 4, 2 ]