# Question about products of group elements using GAP

Background: In GAP I created the DihedralGroup of an octagon as a quotient of the freegroup on 2 variables and the presentation $r^8=s^2=s*r*(r^7*s)^{-1}=e \$ as follows:

 gap> f:=FreeGroup(2);
<free group on the generators [ f1, f2 ]>
gap> r:=f.1;
f1
gap> s:=f.2;
f2
gap> G:=f/[r^8,s^2,s*r*(r^7*s)^-1];
<fp group on the generators [ f1, f2 ]>
gap> str(G);
"D16"
gap> r^8;
f1^8
gap> Elements(G);
[ <identity ...>, f1, f2, f1^2, f1^4, f1*f2, f1^3, f1^5, f1^6*f2, f1^4*f2,
f1^6, f1^7*f2, f1^5*f2, f1^7, f1^2*f2, f1^3*f2 ]
gap>


I would have expected that r^8 would return the identity element, instead it leaves r^8 unevaluated.

Question: What should I do so that GAP evaluates $r^8$ to $e$?

-

You wantSetReducedMultiplicationwhich handles the monoid conversion for you.

 gap> f := FreeGroup( "r", "s" );;
gap> g := f/ParseRelators(f,"r^8,s^2,rsr=s");;
gap> SetReducedMultiplication( g );;
gap> AssignGeneratorVariables(g);;
#I  Assigned the global variables [ r, s ]
gap> r^8;
<identity ...>
gap> (r*s)^5;
r*s

-

You have defined ${\mathrm r}$ to be the first generator of the free group, so there is no way of getting it to evaluate to the identity of $G$!

But you would have the same problem with $\mathrm{G.1^8}$. With a small finite group like this one, you could do the following:

gap> elts := Elements(G);;
gap> elts[Position(elts,G.1^8)];
<identity ...>
gap> elts[Position(elts, G.1^-3 * G.2 * G.1^6 * G.1^-1 * G.1)];
f1^7*f2


There are things called rewriting systems in GAP that you can use to attempt to reduce words in finitely presented groups to a normal form, but they are a little complicated, and you have to start by converting the group to a monoid.

-
So, I'll find the 'proper' way of doing it in chapter 36 of the manual, is that right? Please let me know, if there is more. – nilo de roock Feb 7 '12 at 12:32