# Abstract Algebra with GAP

## GAP log - Monday July 14, 10 am - 11:30 am

```gap> G:= SymmetricGroup(6);
Sym( [ 1 .. 6 ] )
gap> r:= (1,3,4,5,6);
(1,3,4,5,6)
gap> s:= (1,3,2);
(1,3,2)
gap> K:= Subgroup(G, [r,s]);
Group([ (1,3,4,5,6), (1,3,2) ])
gap> Elements(K);
[ (), (4,5,6), (4,6,5), (3,4)(5,6), (3,4,5), (3,4,6), (3,5,4), (3,5,6), (3,5)(4,6), (3,6,4), (3,6,5), (3,6)(4,5), (2,3)(5,6),
(2,3)(4,5), (2,3)(4,6), (2,3,4), (2,3,4,5,6), (2,3,4,6,5), (2,3,5,6,4), (2,3,5), (2,3,5,4,6), (2,3,6,5,4), (2,3,6), (2,3,6,4,5),
(2,4,3), (2,4,5,6,3), (2,4,6,5,3), (2,4)(5,6), (2,4,5), (2,4,6), (2,4)(3,5), (2,4,3,5,6), (2,4,6,3,5), (2,4)(3,6), (2,4,3,6,5),
(2,4,5,3,6), (2,5,6,4,3), (2,5,3), (2,5,4,6,3), (2,5,4), (2,5,6), (2,5)(4,6), (2,5,6,3,4), (2,5)(3,4), (2,5,3,4,6), (2,5,3,6,4),
(2,5,4,3,6), (2,5)(3,6), (2,6,5,4,3), (2,6,3), (2,6,4,5,3), (2,6,4), (2,6,5), (2,6)(4,5), (2,6,5,3,4), (2,6)(3,4), (2,6,3,4,5),
(2,6,3,5,4), (2,6,4,3,5), (2,6)(3,5), (1,2)(5,6), (1,2)(4,5), (1,2)(4,6), (1,2)(3,4), (1,2)(3,4,5,6), (1,2)(3,4,6,5), (1,2)(3,5,6,4),
(1,2)(3,5), (1,2)(3,5,4,6), (1,2)(3,6,5,4), (1,2)(3,6), (1,2)(3,6,4,5), (1,2,3), (1,2,3)(4,5,6), (1,2,3)(4,6,5), (1,2,3,4)(5,6),
(1,2,3,4,5), (1,2,3,4,6), (1,2,3,5,4), (1,2,3,5,6), (1,2,3,5)(4,6), (1,2,3,6,4), (1,2,3,6,5), (1,2,3,6)(4,5), (1,2,4,3)(5,6),
(1,2,4,5,3), (1,2,4,6,3), (1,2,4), (1,2,4,5,6), (1,2,4,6,5), (1,2,4)(3,5,6), (1,2,4,3,5), (1,2,4,6)(3,5), (1,2,4)(3,6,5), (1,2,4,3,6),
(1,2,4,5)(3,6), (1,2,5,4,3), (1,2,5,6,3), (1,2,5,3)(4,6), (1,2,5,6,4), (1,2,5), (1,2,5,4,6), (1,2,5,3,4), (1,2,5,6)(3,4),
(1,2,5)(3,4,6), (1,2,5,4)(3,6), (1,2,5)(3,6,4), (1,2,5,3,6), (1,2,6,4,3), (1,2,6,5,3), (1,2,6,3)(4,5), (1,2,6,5,4), (1,2,6),
(1,2,6,4,5), (1,2,6,3,4), (1,2,6,5)(3,4), (1,2,6)(3,4,5), (1,2,6,4)(3,5), (1,2,6)(3,5,4), (1,2,6,3,5), (1,3,2), (1,3,2)(4,5,6),
(1,3,2)(4,6,5), (1,3,4,2)(5,6), (1,3,4,5,2), (1,3,4,6,2), (1,3,5,4,2), (1,3,5,6,2), (1,3,5,2)(4,6), (1,3,6,4,2), (1,3,6,5,2),
(1,3,6,2)(4,5), (1,3)(5,6), (1,3)(4,5), (1,3)(4,6), (1,3,4), (1,3,4,5,6), (1,3,4,6,5), (1,3,5,6,4), (1,3,5), (1,3,5,4,6), (1,3,6,5,4),
(1,3,6), (1,3,6,4,5), (1,3)(2,4), (1,3)(2,4,5,6), (1,3)(2,4,6,5), (1,3,2,4)(5,6), (1,3,2,4,5), (1,3,2,4,6), (1,3,5,2,4),
(1,3,5,6)(2,4), (1,3,5)(2,4,6), (1,3,6,2,4), (1,3,6,5)(2,4), (1,3,6)(2,4,5), (1,3)(2,5,6,4), (1,3)(2,5), (1,3)(2,5,4,6), (1,3,2,5,4),
(1,3,2,5,6), (1,3,2,5)(4,6), (1,3,4)(2,5,6), (1,3,4,2,5), (1,3,4,6)(2,5), (1,3,6,4)(2,5), (1,3,6)(2,5,4), (1,3,6,2,5), (1,3)(2,6,5,4),
(1,3)(2,6), (1,3)(2,6,4,5), (1,3,2,6,4), (1,3,2,6,5), (1,3,2,6)(4,5), (1,3,4)(2,6,5), (1,3,4,2,6), (1,3,4,5)(2,6), (1,3,5,4)(2,6),
(1,3,5)(2,6,4), (1,3,5,2,6), (1,4,3,2)(5,6), (1,4,5,3,2), (1,4,6,3,2), (1,4,2), (1,4,5,6,2), (1,4,6,5,2), (1,4,2)(3,5,6), (1,4,3,5,2),
(1,4,6,2)(3,5), (1,4,2)(3,6,5), (1,4,3,6,2), (1,4,5,2)(3,6), (1,4,3), (1,4,5,6,3), (1,4,6,5,3), (1,4)(5,6), (1,4,5), (1,4,6),
(1,4)(3,5), (1,4,3,5,6), (1,4,6,3,5), (1,4)(3,6), (1,4,3,6,5), (1,4,5,3,6), (1,4,2,3)(5,6), (1,4,5,2,3), (1,4,6,2,3), (1,4)(2,3),
(1,4,5,6)(2,3), (1,4,6,5)(2,3), (1,4)(2,3,5,6), (1,4,2,3,5), (1,4,6)(2,3,5), (1,4)(2,3,6,5), (1,4,2,3,6), (1,4,5)(2,3,6), (1,4,2,5,3),
(1,4,3)(2,5,6), (1,4,6,3)(2,5), (1,4)(2,5,6,3), (1,4,3,2,5), (1,4,6)(2,5,3), (1,4)(2,5), (1,4,2,5,6), (1,4,6,2,5), (1,4)(2,5,3,6),
(1,4,2,5)(3,6), (1,4,3,6)(2,5), (1,4,2,6,3), (1,4,3)(2,6,5), (1,4,5,3)(2,6), (1,4)(2,6,5,3), (1,4,3,2,6), (1,4,5)(2,6,3), (1,4)(2,6),
(1,4,2,6,5), (1,4,5,2,6), (1,4)(2,6,3,5), (1,4,2,6)(3,5), (1,4,3,5)(2,6), (1,5,4,3,2), (1,5,6,3,2), (1,5,3,2)(4,6), (1,5,6,4,2),
(1,5,2), (1,5,4,6,2), (1,5,3,4,2), (1,5,6,2)(3,4), (1,5,2)(3,4,6), (1,5,4,2)(3,6), (1,5,2)(3,6,4), (1,5,3,6,2), (1,5,6,4,3), (1,5,3),
(1,5,4,6,3), (1,5,4), (1,5,6), (1,5)(4,6), (1,5,6,3,4), (1,5)(3,4), (1,5,3,4,6), (1,5,3,6,4), (1,5,4,3,6), (1,5)(3,6), (1,5,4,2,3),
(1,5,6,2,3), (1,5,2,3)(4,6), (1,5,6,4)(2,3), (1,5)(2,3), (1,5,4,6)(2,3), (1,5,2,3,4), (1,5,6)(2,3,4), (1,5)(2,3,4,6), (1,5,4)(2,3,6),
(1,5)(2,3,6,4), (1,5,2,3,6), (1,5,6,3)(2,4), (1,5,2,4,3), (1,5,3)(2,4,6), (1,5,3,2,4), (1,5,6)(2,4,3), (1,5)(2,4,6,3), (1,5,6,2,4),
(1,5)(2,4), (1,5,2,4,6), (1,5,2,4)(3,6), (1,5,3,6)(2,4), (1,5)(2,4,3,6), (1,5,3)(2,6,4), (1,5,4,3)(2,6), (1,5,2,6,3), (1,5,4)(2,6,3),
(1,5)(2,6,4,3), (1,5,3,2,6), (1,5,2,6,4), (1,5,4,2,6), (1,5)(2,6), (1,5,3,4)(2,6), (1,5)(2,6,3,4), (1,5,2,6)(3,4), (1,6,4,3,2),
(1,6,5,3,2), (1,6,3,2)(4,5), (1,6,5,4,2), (1,6,2), (1,6,4,5,2), (1,6,3,4,2), (1,6,5,2)(3,4), (1,6,2)(3,4,5), (1,6,4,2)(3,5),
(1,6,2)(3,5,4), (1,6,3,5,2), (1,6,5,4,3), (1,6,3), (1,6,4,5,3), (1,6,4), (1,6,5), (1,6)(4,5), (1,6,5,3,4), (1,6)(3,4), (1,6,3,4,5),
(1,6,3,5,4), (1,6,4,3,5), (1,6)(3,5), (1,6,4,2,3), (1,6,5,2,3), (1,6,2,3)(4,5), (1,6,5,4)(2,3), (1,6)(2,3), (1,6,4,5)(2,3),
(1,6,2,3,4), (1,6,5)(2,3,4), (1,6)(2,3,4,5), (1,6,4)(2,3,5), (1,6)(2,3,5,4), (1,6,2,3,5), (1,6,5,3)(2,4), (1,6,2,4,3), (1,6,3)(2,4,5),
(1,6,3,2,4), (1,6,5)(2,4,3), (1,6)(2,4,5,3), (1,6,5,2,4), (1,6)(2,4), (1,6,2,4,5), (1,6,2,4)(3,5), (1,6,3,5)(2,4), (1,6)(2,4,3,5),
(1,6,3)(2,5,4), (1,6,4,3)(2,5), (1,6,2,5,3), (1,6,4)(2,5,3), (1,6)(2,5,4,3), (1,6,3,2,5), (1,6,2,5,4), (1,6,4,2,5), (1,6)(2,5),
(1,6,3,4)(2,5), (1,6)(2,5,3,4), (1,6,2,5)(3,4) ]
gap> Factorization(K,(2,3,4));
x1^4*x2*x1
gap>
gap> Factorization(K,(4,5,6));
x1^2*x2*x1*x2*x1^2
gap> Size(K);
360
gap> Size(G);
720
gap> Factorization(K,(2,3));
fail
gap> r;
(1,3,4,5,6)
gap> H:= Subgroup(G, [(1,4,5,6),(1,2,3,4)]);
Group([ (1,4,5,6), (1,2,3,4) ])
gap> Size(H);
120
gap> Factorization(H,(4,5,6));
fail
gap> HELP("random");
gap> HELP("5");
gap> Random(SymmetricGroup(6));
(1,6)(2,5,4,3)
gap> a:= Random(SymmetricGroup(9));
(1,4,7,6)(2,9,3)
gap> b:= (1,2,3,4,5,6,7,8,9);
(1,2,3,4,5,6,7,8,9)
gap> b*a*b^-1
> ;
(1,8,2)(3,6,5,9)
gap> b:= Random(SymmetricGroup(9));
(1,4,2,8)(3,9,7,5,6)
gap> b*a*b^-1;
(1,9,5,8)(3,6,4)
gap> a:= Random(SymmetricGroup(9));
(1,6,9,2,4)(3,8,7,5)
gap> b:= Random(SymmetricGroup(9));
(1,6,9,2,8,3,7)(4,5)
gap> b*a*b^-1;
(1,6,9,5,7)(2,3,4,8)
gap> a:= Random(SymmetricGroup(9));
(1,2,6,8,9,3,4)(5,7)
gap> b:= Random(SymmetricGroup(9));
(1,5,6)(2,3,7,4,8,9)
gap> b*a*b^-1;
(1,3)(2,7,6,9,5,4,8)
gap> CycleStructurePerm(a);
[ 1,,,,, 1 ]
gap> d50:= DihedralGroup(IsPermGroup,100);
<permutation group with 2 generators>
gap> a:= Random(d50);
(1,30,9,38,17,46,25,4,33,12,41,20,49,28,7,36,15,44,23,2,31,10,39,18,47,26,5,34,13,42,21,50,29,8,37,16,45,24,3,32,11,40,19,48,27,6,35,14,
43,22)
gap> b:= Random(d50);
(1,40,29,18,7,46,35,24,13,2,41,30,19,8,47,36,25,14,3,42,31,20,9,48,37,26,15,4,43,32,21,10,49,38,27,16,5,44,33,22,11,50,39,28,17,6,45,34,
23,12)
gap> CycleStructurePerm(b*a*b^-1);
[ ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 1 ]
gap> CycleStructurePerm(a);
[ ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 1 ]
gap> a:= Random(SymmetricGroup(9));
(1,7,3,9,6,8)(4,5)
gap> b:= Random(SymmetricGroup(9));
(1,9,3,2,7,8)(4,5,6)
gap> Order(a*b); Order(b*a);
10
10
gap> Order(Random(SymmetricGroup(9))*Random(SymmetricGroup(9));
Syntax error: ) expected
Order(Random(SymmetricGroup(9))*Random(SymmetricGroup(9));
^
gap> Order(Random(SymmetricGroup(9))*Random(SymmetricGroup(9)));
10
gap> a:= Random(SymmetricGroup(9));
(1,8,5,4,6,2)
gap> b:= Random(SymmetricGroup(9));
(1,8,5,7,3)(2,6,4)
gap> Order(a*b); Order(b*a);
6
6
gap>
gap> a:= Random(SymmetricGroup(9));
(1,4,5,6,3,7,8)
gap> b:= Random(SymmetricGroup(9));
(1,9,2,6,8,4,3,5,7)
gap> Order(a*b); Order(b*a);
10
10
gap> G:=SymmetricGroup(8);
Sym( [ 1 .. 8 ] )
gap> f:=(1,2,3,4)(5,6,7,8);
(1,2,3,4)(5,6,7,8)
gap> l:=(1,5,6,2)(3,4,8,7);
(1,5,6,2)(3,4,8,7)
gap> K:= Subgroup(G, [f,l]);
Group([ (1,2,3,4)(5,6,7,8), (1,5,6,2)(3,4,8,7) ])
gap> Size(K);
24
gap> Elements(K);
[ (), (2,4,5)(3,8,6), (2,5,4)(3,6,8), (1,2)(3,5)(4,6)(7,8), (1,2,3,4)(5,6,7,8), (1,2,6,5)(3,7,8,4), (1,3,6)(4,7,5), (1,3)(2,4)(5,7)(6,8),
(1,3,8)(2,7,5), (1,4,3,2)(5,8,7,6), (1,4,8,5)(2,3,7,6), (1,4)(2,8)(3,5)(6,7), (1,5,6,2)(3,4,8,7), (1,5,8,4)(2,6,7,3),
(1,5)(2,8)(3,7)(4,6), (1,6,3)(4,5,7), (1,6)(2,5)(3,8)(4,7), (1,6,8)(2,7,4), (1,7)(2,3)(4,6)(5,8), (1,7)(2,6)(3,5)(4,8),
(1,7)(2,8)(3,4)(5,6), (1,8,6)(2,4,7), (1,8,3)(2,5,7), (1,8)(2,7)(3,6)(4,5) ]
gap> f*l;
(2,4,5)(3,8,6)
gap> f^2;
(1,3)(2,4)(5,7)(6,8)
gap> f^2*l^2;
(1,8)(2,7)(3,6)(4,5)
gap> G:=SymmetricGroup(6);
Sym( [ 1 .. 6 ] )
gap> f:=(1,5,6,3);
(1,5,6,3)
gap> l:=(1,4,6,2);
(1,4,6,2)
gap> K:=SubGroup(G,[f,l]);
Variable: 'SubGroup' must have a value

gap> K:=Subgroup(G,[f,l]);
Group([ (1,5,6,3), (1,4,6,2) ])
gap> Size(K);
24
gap> Elements(K);
[ (), (2,3,4,5), (2,4)(3,5), (2,5,4,3), (1,2)(3,5)(4,6), (1,2,3)(4,5,6), (1,2,5)(3,6,4), (1,2,6,4), (1,3,2)(4,6,5), (1,3,6,5),
(1,3)(2,4)(5,6), (1,3,4)(2,6,5), (1,4,6,2), (1,4,5)(2,3,6), (1,4,3)(2,5,6), (1,4)(2,6)(3,5), (1,5,2)(3,4,6), (1,5,6,3),
(1,5)(2,4)(3,6), (1,5,4)(2,6,3), (1,6)(3,5), (1,6)(2,3)(4,5), (1,6)(2,4), (1,6)(2,5)(3,4) ]
gap> Factorization(K,(1,3,4)(2,6,5));
x1*x2*x1^2
gap> Factorization(K,(1,6)(2,5)(3,4));
x1*x2*x1
gap> G:=SymmetricGroup(4);
Sym( [ 1 .. 4 ] )
gap> f:=(1,3,2,4);
(1,3,2,4)
gap> l:=(1,2,4,3);
(1,2,4,3)
gap> K:=Subgroup(G,[f,l]);
Group([ (1,3,2,4), (1,2,4,3) ])
gap> Size(K);
24
gap> Elements(K);
[ (), (3,4), (2,3), (2,3,4), (2,4,3), (2,4), (1,2), (1,2)(3,4), (1,2,3), (1,2,3,4), (1,2,4,3), (1,2,4), (1,3,2), (1,3,4,2),
(1,3), (1,3,4), (1,3)(2,4), (1,3,2,4), (1,4,3,2), (1,4,2), (1,4,3), (1,4), (1,4,2,3), (1,4)(2,3) ]
gap> f*l;
(2,3,4)
gap> G:=Symmetric(4);
Variable: 'Symmetric' must have a value

gap> G:=SymmetricGroup(4);
Sym( [ 1 .. 4 ] )
gap> a:=(1,3,4); b:=(1,3,2);
(1,3,4)
(1,3,2)
gap> K:=Subgroup(G,[a,b]);
Group([ (1,3,4), (1,3,2) ])
gap> Size(K);
12
gap> G:=SymmetricGroup(5);
Sym( [ 1 .. 5 ] )
gap> a:=(1,3,4,5); b:=(1,3,2);
(1,3,4,5)
(1,3,2)
gap> K:=Subgroup(G,[a,b]);
Group([ (1,3,4,5), (1,3,2) ])
gap> Size(K);
120
gap> LogTo();

```