# How to list all subgroups of symmetry group S_6?

I learned from https://oeis.org/A005432 that $$S_6$$ has $$1455$$ subgroups, how can I list them all in mathematica?

As the comment says, the direct approach cannot solve the problem.

• Does this answer your question? Listing all subgroups May 11, 2023 at 13:56
• @Domen , yode's answer cannot even list the subgroups of $S_4$, I think we may need other methods. May 11, 2023 at 14:08
• Then please mention this in your question. May 11, 2023 at 14:14
• groupprops.subwiki.org/wiki/… fails to list them. I think any (semi) brute force method is likely to fail. FiniteGroupData[] fails to list all "Subgroups" (just isomorphism classes are listed, I think), and "SubgroupElements", which lists all subgroups in general, fails on $S_6$. -- Sage/GAP seems to be able to do it: math.stackexchange.com/questions/3191186/… May 11, 2023 at 14:35
• @userrandrand Report it to WRI. I don't know about the limitations of FiniteGroupData. I imagine it was created in part by data entry and contains errors. $D_4$ shows up here: FiniteGroupData[{"SymmetricGroup", 4}, "SylowSubgroups"]. To the matter at hand: Is FiniteGroupData[{"SymmetricGroup", 6}, "Subgroups"] complete? Note that equivalences up to conjugacy, automorphism, and isomorphism are different. I think "Subgroups" (supposedly) gives isomorphism classes, but I don't know for a fact that is what it's supposed to do. May 12, 2023 at 14:39

Purpose of this answer: mainly to check whether FiniteGroupData is outputting correct results up to isomorphisms.

TL;DR:

• The output of FiniteGroupData[{"SymmetricGroup", 4}, "Subgroups"] is missing the dihedral group.

• The distribution of group orders in FiniteGroupData[{"SymmetricGroup", 6}, "Subgroups"] seems correct although it could be a fluke as the output of FiniteGroupData[{"SymmetricGroup", 6}, "Subgroups"] seems to be removed of duplicates of isomorphisms (see text for further detail of how that makes a comparison with available data difficult)

I used the online magma calculator http://magma.maths.usyd.edu.au/calc/ . The magma code first calculates all subgroups up to conjugation and then identifies each subgroup with a canonical reference group up to isomorphism.

I am not an expert in magma programming, I used a combination of https://mathoverflow.net/questions/82873/using-magma-for-group-theory/82881#82881, https://math.stackexchange.com/questions/3324896/determine-subgroup-langle-12-1324-rangle-of-group-s-4, magma documentation and Phind which is a search engine that has GPT4 and where search results can be toggled on or off (sometimes I feel its better to ask its memory rather than rely on keyword searches)

Note: In the following : •=\[Bullet] and ⎵=\[UnderBracket]

## Verifying FiniteGroupData for $$S_4$$

It does not seem like the output of FiniteGroupData is complete. The dihedral group which is present in https://groupprops.subwiki.org/wiki/Subgroup_structure_of_symmetric_group:S4 and https://math.stackexchange.com/questions/379841/how-to-enumerate-subgroups-of-each-order-of-s-4-by-hand is missing. The dihedral group is of order 8 whereas the other subgroups listed by FiniteGroupData are not as shown from the output of :

FiniteGroupData[{"SymmetricGroup", 4}, "Subgroups"] // Map[FiniteGroupData[#, "Order"] &]

(*{1, 2, 3, 4, 4, 6, 12, 24}*)


This group is present in the output of the following Magma code that can be used in the online calculator. The results are presented in table format at the end of this section.

// Group definition
G := SymmetricGroup(4);

// Find all subgroups of G
subgroups := Subgroups(G);

// identify each subgroup
for S in subgroups do
id := IdentifyGroup(Ssubgroup);
groupName := GroupName(SmallGroup(id[1], id[2]));
print "SubGroup:\n";
Ssubgroup;
"\n-\n\nIsomorphic to :\n";
groupName;
print "\n---\n";
end for;


I used Mathematica to rewrite the string as a table:

StringCases[magma⎵output,
"Order = " ~~ (a : DigitCharacter ..) ~~
Shortest[___] ~~ ("Isomorphic to :

" ~~ Shortest[b__] ~~ "

---") :> {b, ToExpression@a}] // SortBy[Last] //
TableForm[#, TableHeadings -> {None, {"SubGroup", "Order"}}] &


Output:

$$\begin{array}{cc} \text{SubGroup} & \text{Order} \\ \hline \text{C1} & 1 \\ \text{C2} & 2 \\ \text{C2} & 2 \\ \text{C3} & 3 \\ \text{C2{}^{\wedge}2} & 4 \\ \text{C2{}^{\wedge}2} & 4 \\ \text{C4} & 4 \\ \text{S3} & 6 \\ \text{D4} & 8 \\ \text{A4} & 12 \\ \text{S4} & 24 \\ \end{array}$$

The list is the same up to isomorphism as that of https://groupprops.subwiki.org/wiki/Subgroup_structure_of_symmetric_group:S4 .

Compare this result with that of FiniteGroupData :

FiniteGroupData[{"SymmetricGroup", 4}, "Subgroups"] //
Map[{#, FiniteGroupData[#, "Order"]} &] //
TableForm[#,
TableHeadings -> {None, {"Subgroup", "Order"}}] & // TeXForm


$$\begin{array}{cc} \text{Subgroup} & \text{Order} \\ \hline \text{Trivial} & 1 \\ \text{\{CyclicGroup, 2\}} & 2 \\ \text{\{CyclicGroup, 3\}} & 3 \\ \text{\{CyclicGroup, 4\}} & 4 \\ \text{Vierergruppe} & 4 \\ \text{\{SymmetricGroup, 3\}} & 6 \\ \text{\{AlternatingGroup, 4\}} & 12 \\ \text{\{SymmetricGroup, 4\}} & 24 \\ \end{array}$$

Notice that:

• FiniteGroupData does not show duplicates of isomorphism groups. I am not sure but this might make it difficult to reconstruct the permutation groups even with FiniteGroupData[#, "PermutationGroupRepresentation"] & as naively information seems to be removed by creating isomorphisms and deleting duplicates.

• $$D_4$$ which is a group of order 8 is missing in the output from FiniteGroupData. It is however present in FiniteGroupData[{"SymmetricGroup", 4}, "SylowSubgroups"] as mentioned in the comments.

## Verifying FiniteGroupData for $$S_6$$

The outputs are given at the end of this section but they are quite long. As a quick check, I removed the duplicate subgroups (notice that this is potentially a risk as some of the subgroups in the output of FiniteGroupData for $$S_4$$ were isomorphic to each other). I sorted the orders in both lists and I checked that the sorted lists of orders are the same

I got the following outputs :

### Magma (with duplicates)

I used the same code with $$S_6$$. Changing the group in the magma code to G := SymmetricGroup(6);

$$\begin{array}{cc} \text{SubGroup} & \text{Order} \\ \hline \text{C1} & 1 \\ \text{C2} & 2 \\ \text{C2} & 2 \\ \text{C2} & 2 \\ \text{C3} & 3 \\ \text{C3} & 3 \\ \text{C2{}^{\wedge}2} & 4 \\ \text{C2{}^{\wedge}2} & 4 \\ \text{C2{}^{\wedge}2} & 4 \\ \text{C2{}^{\wedge}2} & 4 \\ \text{C2{}^{\wedge}2} & 4 \\ \text{C4} & 4 \\ \text{C4} & 4 \\ \text{C5} & 5 \\ \text{C6} & 6 \\ \text{C6} & 6 \\ \text{S3} & 6 \\ \text{S3} & 6 \\ \text{S3} & 6 \\ \text{S3} & 6 \\ \text{C2{}^{\wedge}3} & 8 \\ \text{C2{}^{\wedge}3} & 8 \\ \text{C2*C4} & 8 \\ \text{D4} & 8 \\ \text{D4} & 8 \\ \text{D4} & 8 \\ \text{D4} & 8 \\ \text{C3{}^{\wedge}2} & 9 \\ \text{D5} & 10 \\ \text{A4} & 12 \\ \text{A4} & 12 \\ \text{D6} & 12 \\ \text{D6} & 12 \\ \text{C2*D4} & 16 \\ \text{C3*S3} & 18 \\ \text{C3*S3} & 18 \\ \text{C3:S3} & 18 \\ \text{F5} & 20 \\ \text{C2*A4} & 24 \\ \text{C2*A4} & 24 \\ \text{S4} & 24 \\ \text{S4} & 24 \\ \text{S4} & 24 \\ \text{S4} & 24 \\ \text{C3:S3.C2} & 36 \\ \text{S3{}^{\wedge}2} & 36 \\ \text{S3{}^{\wedge}2} & 36 \\ \text{C2*S4} & 48 \\ \text{C2*S4} & 48 \\ \text{A5} & 60 \\ \text{A5} & 60 \\ \text{S3wrC2} & 72 \\ \text{S5} & 120 \\ \text{S5} & 120 \\ \text{A6} & 360 \\ \text{S6} & 720 \\ \end{array}$$

### FiniteGroupData+ Magma

In the code below, the magma⎵output is the string output from the magma calculator :

FiniteGroupData•SubGroups =
FiniteGroupData[{"SymmetricGroup", 6}, "Subgroups"];

orders =
FiniteGroupData[{"SymmetricGroup", 6}, "Subgroups"] //
Map[FiniteGroupData[#, "Order"] &] // Sort;

output =
StringCases[magma⎵output,
"Order = " ~~ (a : DigitCharacter ..) ~~
Shortest[___] ~~ ("Isomorphic to :

" ~~ Shortest[b__] ~~ "

---") :> {b, ToExpression@a}] // SortBy[Last];

magma⎵subgroups =
output // DeleteDuplicatesBy[First] // Map[First];
{FiniteGroupData\[Bullet]SubGroups, magma\[UnderBracket]subgroups,
orders} // Transpose // TableForm


The output is wide the reader might need to use the horizontal scroll at the bottom.

NOTE that the table is only sorted by group order, the subgroups between the output of Magma and that of Mathematica do not necessarily correspond on each line.

$$\begin{array}{ccc} \text{FiniteGroupData} & \text{Magma} & \text{Order} \\ \hline \text{Trivial} & \text{C1} & 1 \\ \text{\{CyclicGroup, 2\}} & \text{C2} & 2 \\ \text{\{CyclicGroup, 3\}} & \text{C3} & 3 \\ \text{\{CyclicGroup, 4\}} & \text{C2{}^{\wedge}2} & 4 \\ \text{Vierergruppe} & \text{C4} & 4 \\ \text{\{CyclicGroup, 5\}} & \text{C5} & 5 \\ \text{\{CyclicGroup, 6\}} & \text{C6} & 6 \\ \text{\{AbelianGroup, \{2, 2, 2\}\}} & \text{S3} & 6 \\ \text{\{AbelianGroup, \{4, 2\}\}} & \text{C2{}^{\wedge}3} & 8 \\ \text{\{SymmetricGroup, 3\}} & \text{C2*C4} & 8 \\ \text{\{DihedralGroup, 4\}} & \text{D4} & 8 \\ \text{\{AbelianGroup, \{3, 3\}\}} & \text{C3{}^{\wedge}2} & 9 \\ \text{\{DihedralGroup, 5\}} & \text{D5} & 10 \\ \text{\{DihedralGroup, 6\}} & \text{A4} & 12 \\ \text{\{AlternatingGroup, 4\}} & \text{D6} & 12 \\ \text{\{DirectProduct, \{\{CyclicGroup, 2\}, \{DihedralGroup, 4\}\}\}} & \text{C2*D4} & 16 \\ \text{\{SemidirectProduct, \{\{CyclicGroup, 2\}, \{AbelianGroup, \{3, 3\}\}\}\}} & \text{C3*S3} & 18 \\ \text{\{DirectProduct, \{\{CyclicGroup, 3\}, \{SymmetricGroup, 3\}\}\}} & \text{C3:S3} & 18 \\ \text{\{SemidirectProduct, \{\{CyclicGroup, 4\}, \{CyclicGroup, 5\}\}\}} & \text{F5} & 20 \\ \text{\{DirectProduct, \{\{CyclicGroup, 2\}, \{AlternatingGroup, 4\}\}\}} & \text{C2*A4} & 24 \\ \text{\{SymmetricGroup, 4\}} & \text{S4} & 24 \\ \text{\{DirectProduct, \{\{SymmetricGroup, 3\}, \{SymmetricGroup, 3\}\}\}} & \text{C3:S3.C2} & 36 \\ \text{\{SemidirectProduct, \{\{CyclicGroup, 4\}, \{AbelianGroup, \{3, 3\}\}\}\}} & \text{S3{}^{\wedge}2} & 36 \\ \text{\{DirectProduct, \{\{CyclicGroup, 2\}, \{SymmetricGroup, 4\}\}\}} & \text{C2*S4} & 48 \\ \text{\{AlternatingGroup, 5\}} & \text{A5} & 60 \\ \text{\{SemidirectProduct, \{\{CyclicGroup, 2\}, \{DirectProduct, \{\{SymmetricGroup, 3\}, \{SymmetricGroup, 3\}\}\}\}\}} & \text{S3wrC2} & 72 \\ \text{\{SymmetricGroup, 5\}} & \text{S5} & 120 \\ \text{\{AlternatingGroup, 6\}} & \text{A6} & 360 \\ \text{\{SymmetricGroup, 6\}} & \text{S6} & 720 \\ \end{array}$$

You can install GAP and parse the output:

gapsubgroups = RunProcess[
{"/Applications/gap-4.12.2/gap", "-q"}, (* change loc as needed *)
"StandardOutput",
"AllSubgroups(SymmetricGroup(6));"];

subgroups = gapsubgroups // (* ad hoc parsing -- sorry *)
StringReplace[#, "(())" -> "{Cycles@{}}"] & //
StringReplace[#, {"[" -> "{", "]" -> "}",
"(" ~~ c : ("," | DigitCharacter) ... ~~ ")" :>
"cyc[" <> c <> "]"}] & //
StringReplace[#, "Group" -> "PermutationGroup@"] & //
ToExpression //
ReplaceAll[{c : Verbatim[Times][__cyc] :>
Cycles[List @@ c /. cyc -> List], c_cyc :> Cycles[{List @@ c}]}];


Checks:

Length[subgroups]
(*  1455  *)

GroupOrder /@ subgroups //
Counts //
BarChart[#, ChartLabels -> Automatic, ImageSize -> 500] &


• As documentation says "For users of Windows 10, we strongly recommend using GAP via the Windows Subsystem for Linux", As far as I understand it, this installation is programming aerobatics. May 12, 2023 at 20:48
• It could have maybe been interesting to sort the subgroups by their order to see if there is some sort of scaling law for large groups May 12, 2023 at 21:31
• @userrandrand I think the subgroup list produced by GAP is ordered by order. May 12, 2023 at 22:38
• @MichaelE2 Sorry I might have misunderstood the y-axis and even then my comment did not make sense, never mind. I posted as an answer some computations with the online magma calculator and found that the distribution of orders, up to isomorphism, seems to be the same as in FiniteGroupData. May 13, 2023 at 1:08
• @user64494 Windows has stack memory that expands into heap, Linux does not allow it. WSL v1 and Windows give one default float registry state, Linux another. And finally, glibc math.h is more accurate than AMD's fork of the math library that is used on Windows. May 14, 2023 at 16:09

In 13.2.1 on Windows 10

 FiniteGroupData[{"SymmetricGroup", 6}, "Subgroups"]


{Trivial,{CyclicGroup,2},{CyclicGroup,3},{CyclicGroup,4},Vierergruppe,{CyclicGroup,5},{CyclicGroup,6},{AbelianGroup,{2,2,2}},{AbelianGroup,{4,2}},{SymmetricGroup,3},{DihedralGroup,4},{AbelianGroup,{3,3}},{DihedralGroup,5},{DihedralGroup,6},{AlternatingGroup,4},{DirectProduct,{{CyclicGroup,2},{DihedralGroup,4}}},{SemidirectProduct,{{CyclicGroup,2},{AbelianGroup,{3,3}}}},{DirectProduct,{{CyclicGroup,3},{SymmetricGroup,3}}},{SemidirectProduct,{{CyclicGroup,4},{CyclicGroup,5}}},{DirectProduct,{{CyclicGroup,2},{AlternatingGroup,4}}},{SymmetricGroup,4},{DirectProduct,{{SymmetricGroup,3},{SymmetricGroup,3}}},{SemidirectProduct,{{CyclicGroup,4},{AbelianGroup,{3,3}}}},{DirectProduct,{{CyclicGroup,2},{SymmetricGroup,4}}},{AlternatingGroup,5},{SemidirectProduct,{{CyclicGroup,2},{DirectProduct,{{SymmetricGroup,3},{SymmetricGroup,3}}}}},{SymmetricGroup,5},{AlternatingGroup,6},{SymmetricGroup,6}}

and then, for example,

FiniteGroupData[{"DihedralGroup", 6}, "Subgroups"]


{"Trivial", {"CyclicGroup", 2}, {"CyclicGroup", 3}, {"CyclicGroup", 6}, {"DihedralGroup", 2}, {"DihedralGroup", 3}, {"DihedralGroup", 6}}

and so on.

• As it was pointed to you in your previous answer, this does not list all of the subgroups. May 11, 2023 at 14:21
• @Domen: Please, ground your claim. What subgroup of $S_6$ cannot be obtained in such a way? May 11, 2023 at 16:39
• I don't see 1455 subgroups listed in your answer. Please, ground your claim that there are not 1455 subgroups. May 11, 2023 at 16:53
• I am not sure how trustworthy FiniteGroupData is. For example, For $S_4$, FiniteGroupData[{"SymmetricGroup", 4}, "Subgroups"] // Map[FiniteGroupData[#, "Order"] &] does not show a subgroup of order 8. However there are dihedral subgroups of order 8 according to groupprops.subwiki.org/wiki/… and math.stackexchange.com/questions/379841/… May 12, 2023 at 9:56