Group representations.
  Take two permutations and construct the group generated by them.

a=Cycles[{{1,4,5}}];
b=Cycles[{{3,4}}];
group=PermutationGroup[{a,b}];

This is the list of all permutations in the group.

list=GroupElements[group]

Length[list]

Both generators fix point 2, thus so do all permutations in the group. This generated group is isomorphic to the symmetric group on the set {1,3,4,5}, with 4!=24 permutations.

PermutationReplace[{1,2,3,4,5},list]

%===(Insert[#,2,2]&/@Permutations[{1,3,4,5}])

For small groups, it is possible to construct better representations of a group. They are the Cayley multiplication table and Cayley graph, the latter representing mixed information about both the whole group and the generating set being used.

For small groups, all products can be represented using a Cayley multiplication table.

TableForm[GroupMultiplicationTable[group],TableHeadings->Automatic]

Each row and each column is itself a permutation of the numbers 1–24. The array is symmetric if and only if the group is Abelian. The group (Subscript[S, 4]) is not Abelian.

Position[list,PermutationProduct[list[[2]],list[[3]]]]

Position[list,PermutationProduct[list[[3]],list[[2]]]]

You can also use a Cayley graph. Multiplication by permutation a is represented in red and by b in blue.

CayleyGraph[group,VertexLabels->Placed["Name",Center],VertexSize->0.4]

It is clear in the graph that the first generator (in red) has order 3 and the second one (in blue) has order 2.

PermutationOrder/@GroupGenerators[group]

Any closed loop in the graph represents a relation giving the identity. For example, the loop 1->3->19->20->17->11->10->16->1 corresponds to the following.

PermutationProduct[b,InversePermutation[a],b,InversePermutation[a],b,InversePermutation[a],b,InversePermutation[a]]

In other words, a permutation of order 4 has been found.

PermutationOrder[PermutationProduct[b,InversePermutation[a]]]

Orbits and Stabilizers

Given any generating set of a permutation group acting on a set of points, it is possible to find which other points can be related with a given point. This is called the orbit of that point.

Orbit computation.

Take two new permutations and form a generating set with them.

perm1=Cycles[{{1,28,5,3,13,25,27,8,4,17,11,29,7,2,21,23,10,6},{9,16,22,30,18,15,20,19,14}}];
perm2=Cycles[{{1,4},{2,5,3}}];
group=PermutationGroup[{perm1,perm2}];

This is the orbit of point 3. Orbits are given with points sorted lexicographically.

GroupOrbits[group,{3}]

Each of the points in the orbit uniquely identifies the same orbit.

GroupOrbits[group,{10}]

Points cannot belong to two different orbits and hence orbits partition the set of points on which the group acts.

In this example the maximum point of the support is 30.

PermutationMax[group]

Hence, the orbits partition the range of the first 30 points.

GroupOrbits[group]

Orbits can be selected by supplying more points.

GroupOrbits[group,{2,12,13,26}]

If a larger range is partitioned, all other points are stable.

GroupOrbits[group,Range[40]]

Take a group generated by two random permutations of equal large degree.

randomgroup=PermutationGroup[{RandomPermutation[100000],RandomPermutation[100000]}];

In most cases the group acts transitively, with a single orbit.

Length/@GroupOrbits[randomgroup,{1}]

Now take two generators of very different support length.

randomgroup=PermutationGroup[{RandomPermutation[100000],RandomPermutation[1000]}];

Then usually there is still one large orbit, but not of maximal length.

Length/@GroupOrbits[randomgroup]

Using more general actions it is possible to form other types of orbits, like conjugacy classes.

This is the conjugacy class of a permutation in the symmetric group.

GroupOrbits[SymmetricGroup[5],{Cycles[{{1,2},{3,4,5}}]}]

Complementary to the information given by orbits, describing how points move, it is also possible to compute stabilizers, namely the subgroups of elements fixing one or several points.

Computation of stabilizers.

Take this group again.

group

This is the subgroup of permutations fixing point 3. The cyclic notation shows that none of its generators moves point 3.

stabilizer=GroupStabilizer[group,{3}]

Recall the orbit of point 3 under this group has length 18.

GroupOrbits[group,{3}]

First[%]//Length

By the orbit stabilizer theorem, that must be also the quotient between the group orders.

GroupOrder[group]/GroupOrder[stabilizer]

Strong Generating Set Representation

For larger permutation groups it becomes increasingly infeasible to list or draw all their elements. In such cases it is necessary to resort to alternative methods that can infer information about a group from a generating set of the group without actually computing all its permutations. The key ideas were developed in the late 1960s, and are based on the construction of a new equivalent generating set for the same group, but from which it is easy to form a hierarchy of subgroups that allow fast manipulation of the full group. This special type of generating set is called a strong generating set.

Basic functionality with strong generating set representations.

Take this group generated by two permutations with support {1,…,24}.

perm1=Cycles[{{1,22},{2,11},{3,15},{4,17},{5,9},{6,19},{7,13},{8,20},{10,16},{12,21},{14,18},{23,24}}];
perm2=Cycles[{{1,11,21},{2,15,10},{3,17,14},{4,9,16},{5,19,8},{6,13,18},{7,20,12},{22,24,23}}];
group=PermutationGroup[{perm1,perm2}];

Orbit computations can be done directly from standard generators. However, in order to compute the group order, the Wolfram Language internally computes strong generators for the group.

Timing[GroupOrder[group]]

That representation is stored, to avoid recomputing it for the same original set of generators.

Timing[GroupOrder[group]]

Now it is possible to do things like testing for membership.

perm=RandomPermutation[24]

GroupElementQ[group,perm]

Any product of generators must belong to the group.

PermutationProduct[perm1,perm1,perm2,perm1,perm2,perm2]

GroupElementQ[group,%]

Now return to the properties of a strong generating set. Strong generators are defined with respect to a base: this is an ordered subset of points of the domain of action of the group, such that the identity is the only element that fixes them all. That implies that knowing the images of the points in a base under a permutation uniquely identifies that permutation. Groups for which a short base is known can be manipulated highly efficiently. The base defines a very useful hierarchy of stabilizer subgroups, known as the stabilizer chain, which plays a central role in the manipulation of permutation groups, very much like the Gauss-elimination hierarchy of vector spaces in linear algebra. Finally, the condition that characterizes a set of generators as being strong with respect to a base is that it contains generating subsets for all subgroups in the corresponding stabilizer chain.

Stabilizer chain, base, and strong generators.

This is a stabilizer chain of the previous group, with respect to a base {1,2,3} automatically chosen by the Wolfram Language.

stabchain=GroupStabilizerChain[group]

These are the orders of the subgroups in the stabilizer chain.

stabchain/.gr_PermutationGroup:>GroupOrder[gr]//Column

The base and strong generators of the chain can be extracted as follows.

base=stabchain[[-1,1]]

strongGS=GroupGenerators[stabchain[[1,-1]]]

Those are still generators for the original group.

group==PermutationGroup[strongGS]

The second group in the chain is the stabilizer of 1, a subgroup of order 253.

subgroup1=GroupStabilizer[group,base[[{1}]]]

GroupOrbits[subgroup1]

The stabilizer subgroup has two permutations less, precisely those moving point 1.

Complement[strongGS,GroupGenerators[subgroup1]]

The other permutations in the strong generating set do not move point 1.

PermutationReplace[1,GroupGenerators[subgroup1]]

You can repeat the stabilization for the first two points in the base.

subgroup2=GroupStabilizer[group,base[[{1,2}]]]

GroupOrbits[subgroup2]

Finally, the third stabilizer is the trivial group, because it is the stabilizer of the full base.

subgroup3=GroupStabilizer[subgroup2,base]

Check Lagrange's theorem by showing that the size of a subgroup always divides that of the group.

GroupOrder/@stabchain[[All,2]]

Apply[Divide,Partition[%,2,1],1]

The product of those numbers is the size of the full original group.

Times@@%

%==GroupOrder[group]

The option (RefLink[GroupActionBase, paclet:ref/GroupActionBase]) allows specifying an alternative base. If it is not a true base, the Wolfram Language will complete it with additional points.

GroupStabilizerChain[group,GroupActionBase->{10,20}]//Column

Example: The Rubik Group

One of the most famous permutation groups is that associated with the rotations of a Rubik cube. In the following diagram moving facelets are numbered from 1 to 48. The central facelets do not move, and define six respective basic rotations.

These are the six basic rotations.

rot1=Cycles[{{1,3,8,6},{2,5,7,4},{9,48,15,12},{10,47,16,13},{11,46,17,14}}];
rot2=Cycles[{{6,15,35,26},{7,22,34,19},{8,30,33,11},{12,14,29,27},{13,21,28,20}}];
rot3=Cycles[{{1,12,33,41},{4,20,36,44},{6,27,38,46},{9,11,26,24},{10,19,25,18}}];
rot4=Cycles[{{1,24,40,17},{2,18,39,23},{3,9,38,32},{41,43,48,46},{42,45,47,44}}];
rot5=Cycles[{{3,43,35,14},{5,45,37,21},{8,48,40,29},{15,17,32,30},{16,23,31,22}}];
rot6=Cycles[{{24,27,30,43},{25,28,31,42},{26,29,32,41},{33,35,40,38},{34,37,39,36}}];
RubikGroup=PermutationGroup[{rot1,rot2,rot3,rot4,rot5,rot6}];

This is the number of elements in that group.

GroupOrder[RubikGroup]

Internally the following chain of stabilizers has been constructed. The number of permutations that fix the corresponding list of points is indicated. The last line gives a base of the group, because only one permutation (the identity) fixes the given 18 points.

stabchain=GroupStabilizerChain[RubikGroup];

stabchain/.gr_PermutationGroup:>GroupOrder[gr]//Column

A set of strong generators is given by the group in the first line of the chain.

stabchain[[1,-1]]//GroupGenerators

Now you can test membership of some moves. For example, swapping two neighbor edge facelets is not allowed.

GroupElementQ[RubikGroup,Cycles[{{2,47}}]]

But the simultaneous switching of two of those is allowed.

GroupElementQ[RubikGroup,Cycles[{{2,47},{31,37}}]]

This is the superflip move, which switches all those pairs simultaneously.

superflip=Cycles[{{2,47},{4,10},{7,13},{5,16},{20,19},{21,22},{28,34},{18,44},{25,36},{45,23},{42,39},{31,37}}]

GroupElementQ[RubikGroup,superflip]

Other Examples

These are two examples of groups of larger support, but with very short bases.

The largest symplectic group given in the ATLAS of Finite Groups is (Subscript[S, 10]), represented as permutations on 496 points.

perm1=Cycles[{{2,4},{9,11},{13,15},{14,17},{19,25},{23,30},{27,35},{29,38},{45,54},{46,48},{52,61},{53,60},{56,66},{58,68},{59,69},{65,74},{67,77},{71,80},{72,81},{73,83},{75,87},{79,93},{85,101},{91,108},{95,113},{96,115},{97,105},{98,118},{99,112},{100,121},{102,116},{103,126},{107,114},{111,136},{117,145},{120,149},{125,155},{127,153},{131,163},{137,166},{147,182},{148,184},{151,189},{152,191},{174,210},{176,213},{179,217},{185,190},{187,224},{193,231},{194,211},{196,234},{201,240},{203,214},{204,243},{219,259},{221,262},{229,271},{230,273},{233,276},{238,283},{239,284},{242,288},{245,292},{248,295},{250,296},{256,301},{260,279},{261,307},{264,311},{267,314},{269,316},{270,318},{272,285},{274,325},{275,291},{277,329},{281,333},{289,342},{290,343},{294,348},{298,353},{300,355},{308,358},{309,324},{310,366},{319,369},{323,379},{326,382},{332,387},{335,388},{336,346},{344,384},{347,397},{352,400},{354,402},{356,404},{362,411},{367,416},{368,417},{371,420},{372,422},{373,414},{383,430},{394,439},{405,448},{407,418},{409,451},{421,459},{425,462},{431,442},{433,437},{469,481},{470,483},{472,485},{473,486},{475,488},{478,489},{487,490},{495,496}}];
perm2=Cycles[{{1,2,4,6,8,10,12,9,7,5,3},{11,13,16,21,28,37,42,32,24,18,14},{15,19,26,34,44,53,56,47,36,27,20},{17,22,29,39,49,58,60,51,41,31,23},{25,30,40,50,59,70,71,62,52,43,33},{35,45,38,48,57,67,69,61,65,55,46},{54,63,72,82,98,119,122,100,84,73,64},{66,75,88,105,129,161,162,130,106,89,76},{68,78,92,109,134,167,172,138,112,94,79},{74,85,81,97,117,146,181,156,125,102,86},{77,90,107,131,164,188,150,120,99,83,91},{80,95,114,141,175,212,216,178,144,116,96},{87,103,127,159,199,238,239,200,160,128,104},{93,110,135,168,205,245,248,208,171,137,111},{101,123,153,193,232,275,277,233,194,154,124},{108,132,165,203,242,289,291,244,204,166,133},{113,139,173,209,249,295,298,252,211,174,140},{115,142,176,214,254,300,283,255,215,177,143},{118,147,183,221,263,225,187,149,186,185,148},{121,151,190,180,145,179,218,258,230,192,152},{126,157,197,236,281,334,335,282,237,198,158},{136,169,206,246,293,347,349,294,247,207,170},{155,195,202,163,201,241,287,332,280,235,196},{182,219,260,306,361,410,413,364,308,261,220},{184,222,264,312,368,394,344,290,243,265,223},{189,226,268,231,274,326,383,373,317,269,227},{191,228,270,319,375,424,427,378,322,272,229},{210,250,213,253,299,354,333,348,352,297,251},{217,256,302,343,393,438,450,407,358,303,257},{224,266,313,369,418,456,429,381,325,315,267},{234,278,330,341,288,340,382,428,379,331,279},{240,285,338,366,415,384,328,276,327,339,286},{259,304,359,408,401,353,397,442,409,360,305},{262,309,365,414,387,417,380,324,273,323,310},{271,320,376,425,433,388,355,403,426,377,321},{284,336,389,434,465,471,447,404,435,390,337},{292,345,395,440,420,458,476,468,441,396,346},{296,350,398,443,469,482,484,470,444,399,351},{301,356,405,432,386,329,385,431,449,406,357},{307,362,311,367,316,372,318,374,423,412,363},{314,370,419,457,437,392,342,391,436,421,371},{400,402,446,451,472,455,416,454,475,462,445},{411,452,473,487,478,461,422,460,477,474,453},{430,463,479,490,480,467,439,466,448,459,464},{481,486,492,495,494,489,483,488,493,491,485}}];
Symplectic10Group=PermutationGroup[{perm1,perm2}];

PermutationMax/@GroupGenerators[Symplectic10Group]

Timing[GroupOrder[Symplectic10Group]]

These are the orders of the subgroups in its stabilizer chain.

GroupStabilizerChain[Symplectic10Group]/.group_PermutationGroup:>GroupOrder[group]//Column

This is the exceptional twisted group T3D4, represented with permutations on 819 points.

perm1=Cycles[{{1,2},{3,5},{4,7},{6,10},{8,13},{9,15},{11,18},{12,20},{14,23},{16,26},{17,28},{19,31},{21,34},{22,35},{24,38},{25,33},{27,42},{29,45},{30,47},{32,50},{36,55},{37,57},{39,60},{40,62},{41,64},{43,67},{44,54},{46,71},{48,74},{51,78},{52,80},{53,82},{56,86},{58,89},{59,91},{61,94},{63,96},{65,99},{66,98},{68,103},{69,104},{70,106},{72,109},{73,111},{75,114},{76,116},{77,118},{79,121},{81,124},{83,127},{84,129},{85,131},{88,135},{90,138},{92,141},{93,143},{95,146},{97,148},{100,152},{101,154},{102,156},{105,159},{107,162},{108,164},{110,165},{112,167},{113,169},{115,171},{117,174},{119,177},{120,179},{122,182},{123,183},{125,186},{126,188},{128,190},{130,193},{132,196},{133,198},{134,200},{136,203},{137,205},{139,207},{140,209},{142,212},{144,215},{145,217},{147,220},{149,222},{150,224},{151,226},{153,229},{155,232},{157,235},{158,236},{160,239},{161,241},{163,244},{166,247},{168,250},{170,253},{172,255},{173,257},{175,260},{176,262},{178,265},{181,269},{184,273},{185,275},{187,277},{191,281},{192,283},{195,242},{197,288},{199,290},{201,293},{202,295},{204,297},{206,300},{208,303},{210,305},{211,307},{213,310},{214,311},{216,274},{218,316},{219,318},{221,321},{223,285},{225,325},{227,328},{228,330},{230,280},{231,334},{233,336},{234,338},{237,339},{238,341},{240,344},{243,346},{245,349},{246,351},{248,354},{249,356},{251,359},{252,361},{254,364},{256,367},{258,263},{259,371},{261,373},{264,376},{266,317},{267,379},{268,375},{270,383},{271,385},{272,387},{276,391},{278,358},{279,393},{282,397},{284,399},{286,401},{287,403},{289,406},{291,408},{292,410},{294,413},{296,416},{298,419},{299,421},{301,340},{304,426},{306,429},{308,312},{309,432},{313,436},{314,437},{315,439},{319,444},{320,446},{322,448},{324,450},{326,402},{327,452},{329,455},{331,457},{335,462},{337,463},{342,465},{343,467},{345,380},{347,352},{348,471},{350,474},{353,476},{355,478},{357,480},{360,422},{362,386},{363,484},{365,425},{366,423},{368,487},{369,488},{372,491},{374,492},{377,495},{378,496},{381,497},{382,499},{384,502},{388,506},{389,508},{390,510},{392,513},{394,516},{395,459},{398,518},{400,521},{404,524},{405,525},{407,515},{409,529},{411,532},{412,534},{414,536},{415,537},{417,540},{418,539},{420,544},{424,546},{427,549},{428,551},{430,553},{431,550},{433,557},{434,559},{435,561},{438,565},{440,568},{441,569},{442,571},{443,573},{445,576},{447,578},{449,579},{451,581},{453,584},{454,586},{456,589},{458,591},{460,594},{461,545},{464,596},{468,585},{469,483},{470,601},{472,602},{473,604},{475,606},{477,608},{479,609},{481,612},{482,614},{486,616},{489,595},{490,619},{493,621},{494,519},{498,625},{500,620},{501,628},{504,629},{505,631},{507,632},{509,634},{511,600},{512,638},{514,641},{517,535},{520,592},{522,647},{523,640},{526,651},{527,563},{528,654},{530,657},{531,603},{533,643},{538,661},{541,659},{542,653},{547,574},{548,635},{552,618},{554,665},{555,673},{556,660},{558,676},{560,679},{562,682},{564,633},{566,658},{567,613},{570,688},{572,666},{575,693},{577,694},{580,697},{582,698},{583,639},{587,683},{590,704},{593,663},{597,691},{598,702},{599,709},{605,715},{607,717},{610,687},{611,720},{615,723},{617,669},{622,727},{624,728},{626,675},{627,730},{630,732},{636,648},{637,736},{642,664},{644,655},{645,722},{646,672},{649,745},{650,746},{652,716},{656,749},{662,701},{667,708},{668,754},{670,707},{671,695},{674,719},{677,755},{678,737},{680,726},{684,706},{685,765},{686,767},{689,770},{692,773},{696,775},{699,712},{700,739},{703,778},{705,763},{710,782},{711,783},{713,784},{714,785},{718,786},{721,789},{724,791},{725,757},{729,793},{731,794},{733,760},{734,795},{735,787},{738,798},{740,799},{741,801},{742,753},{743,744},{747,796},{748,756},{750,772},{751,804},{752,805},{758,780},{759,777},{761,766},{762,807},{764,790},{768,808},{769,809},{771,810},{774,797},{776,800},{779,788},{781,812},{792,816},{802,817},{803,811},{806,815},{813,818},{814,819}}];
perm2=Cycles[{{1,3,6,11,19,32,51,79,122},{2,4,8,14,24,39,61,95,147},{5,9,16,27,43,68,67,102,157},{7,12,21},{10,17,29,46,72,110,166,248,355},{13,22,36,56,87,134,201,294,414},{15,25,40,63,97,149,223,324,109},{18,30,48,75,115,172,256,368,446},{20,33,52,81,125,187,278,89,137},{23,37,58,90,139,208,179,267,380},{26,41,65,100,153,230,333,460,595},{28,44,69,105,160,240,260,71,108},{31,49,76,117,175,261,361,482,62},{34,53,83,128,191,282,257,369,489},{35,54,84,130,194,285,182,271,386},{38,59,92,142,213,167,249,357,354},{42,66,101,155,233,337,106,161,242},{45,70,107,163,245,350,475,255,366},{47,73,112,168,251,360,481,613,722},{50,77,119,178,266,159,238,342,466},{55,85,132,197,224,156,234,300,423},{57,88,136,204,298,420,437,564,684},{60,93,144,216,314,438,566,686,768},{64,98,150,225,326,451,582,604,714},{74,113,138,206,301,424,547,608,719},{78,120,180,268,381,498,626,359,462},{80,123,184,274,389,509,635,253,363},{82,126,189,280,395,517,643,325,235},{86,133,199,291,409,530,183,272,310},{91,140,210,306,269,382,500,413,448},{94,145,218,317,442,572,307,430,554},{96,121,181,270,384,503,399,520,645},{99,151,227,329,200,292,411,533,103},{104,158,237,340,464,597,124,185,276},{111,131,195,286,402,523,648,744,732},{114,170,164,246,352,471,452,583,699},{116,173,258,370,379,196,287,404,502},{118,176,263,375,346,273,388,507,236},{127,177,264,377,406,527,653,647,743},{129,192,174,259,372,436,563,683,764},{135,202,229,332,459,593,706,478,165},{141,211,308,431,555,674,760,783,673},{143,214,312,435,562,467,599,710,186},{146,219,319,445,577,621,344,468,600},{148,221,322,449,580,651,364,485,303},{152,228,331,458,592,499,627,731,717},{154,231,335,339,367,486,617,497,624},{162,243,347,470,429,450,484,615,724},{169,252,362,483,349,473,605,581,474},{171,254,365,262,374,493,622,586,701},{188,279,394,283,398,519,594,707,629},{190,193,284,400,522,232,207,302,425},{198,289,239,343,265,378,492,222,323},{203,296,417,541,664,755,328,454,587},{205,299,422,457,455,588,702,463,373},{209,304,427,550,250,358,247,353,477},{212,309,433,558,677,602,712,606,716},{215,313,341,290,407,496,488,618,403},{217,315,440,444,575,679,534,659,752},{220,320,351,387,505,416,539,662,754},{226,327,453,585,700,777,808,579,696},{241,345,469,601,711,356,479,610,576},{244,348,472,603,713,775,786,549,669},{275,390,511,637,737,778,559,678,762},{277,392,514,642,741,297,418,542,665},{281,396,397,518,644,536,421,545,516},{288,405,526,652,748,791,694,321,447},{293,412,535,660,753,439,567,383,501},{295,415,538,540,663,619,725,792,789},{305,428,552,671,759,785,401,338,336},{311,434,560,680,763,318,443,574,692},{316,441,570,689,771,784,814,697,776},{330,456,590,596,708,730,782,813,804},{334,461,408,528,655,578,695,510,636},{371,490,620,726,521,646,742,802,584},{376,494,623,682,727,591,705,780,811},{385,504,630,733,551,670,614,723,487},{391,512,639,532,557,675,513,640,739},{393,515,569,657,750,628,632,571,690},{410,531,658,751,537,508,633,491,506},{419,543,666,756,616,561,681,544,661},{426,548,668,758,806,654,495,465,598},{432,556,480,611,546,667,757,529,656},{476,607,718,787,815,816,568,687,769},{524,649,612,721,790,638,738,794,773},{525,650,747,704,779,693,774,688,728},{553,672,609,573,691,772,745,589,703},{565,685,766,805,736,797,749,631,734},{625,729,676,761,799,746,803,709,781},{634,735,796,807,818,810,765,801,795},{641,740,800,817,798,812,770,767,715},{720,788,809}}];
T3D4Group=PermutationGroup[{perm1,perm2}];

Timing[GroupOrder[T3D4Group]]

It also admits a very short base.

GroupStabilizerChain[T3D4Group]/.group_PermutationGroup:>GroupOrder[group]//Column