How to find all subgroups of a group in GAP

With the next group:

gap> G:=Group((1,2,3,4),(1,2));

Group([ (1,2,3,4), (1,2) ])

gap> Order(G);

24

gap> Elements(G);

[ (), (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) ]

Is there any function to list the subgroups of G? Thanks, and sorry if the question looks so easy, i'm a newbie in GAP.


One should think in terms of conjugacy classes of subgroups:

gap> G:=Group((1,2,3,4),(1,2));
Group([ (1,2,3,4), (1,2) ])
gap> cc:=ConjugacyClassesSubgroups(G);
[ Group( () )^G, Group( [ (1,3)(2,4) ] )^G, Group( [ (3,4) ] )^G, 
  Group( [ (2,4,3) ] )^G, Group( [ (1,4)(2,3), (1,3)(2,4) ] )^G, 
  Group( [ (3,4), (1,2)(3,4) ] )^G, Group( [ (1,3,2,4), (1,2)(3,4) ] )^G, 
  Group( [ (3,4), (2,4,3) ] )^G, Group( [ (1,4)(2,3), (1,3)(2,4), (3,4) ] )^G, 
  Group( [ (1,4)(2,3), (1,3)(2,4), (2,4,3) ] )^G, 
  Group( [ (1,4)(2,3), (1,3)(2,4), (2,4,3), (3,4) ] )^G ]

For example, Group( [ (1,3)(2,4) ] )^G means a conjugacy class of a subgroup Group( [ (1,3)(2,4) ] ). The 1st element of the returned list in this example is Group( () )^G - the conjugacy class of the trivial subgroup, but in general the order in which the classes are listed depends on the method chosen by GAP, so you should not rely on it being always the 1st.

Now take, for example, the 2nd conjugacy class from this list. It contains 3 subgroups:

gap> c:=cc[2];
Group( [ (1,3)(2,4) ] )^G
gap> Size(c);
3

We can use Representative to get the representative of the class

gap> Representative(c);
Group([ (1,3)(2,4) ])

and AsList to get all subgroups from this class:

gap> AsList(c);
[ Group([ (1,3)(2,4) ]), Group([ (1,4)(2,3) ]), Group([ (1,2)(3,4) ]) ]

GAP also has a function AllSubgroups (since GAP 4.5), but it is intended primarily for use in class for small examples, and quickly becomes inefficient for larger groups. Instead of using AllSubgroups one should think algorithmically. Do you need all subgroups or only up to conjugacy? Do you want only normal subgroups, or maximal, or maybe of a particular order or isomorphism type? In this case, look at:

  • NormalSubgroups
  • IsomorphicSubgroups
  • RepresentativesPerfectSubgroups
  • RepresentativesSimpleSubgroups
  • ConjugacyClassesMaximalSubgroups
  • ConjugacyClassesPerfectSubgroups

If only $p$-subgroups are needed, it is often faster to compute the subgroup lattice of the Sylow $p$-subgroup (see SylowSubgroup), and then use conjugation to find more, if it is not normal.

Furthermore, LatticeByCyclicExtension and SubgroupsSolvableGroup accept optional arguments which allow to put restrictions on computed subgroups. In the latter case functions SizeConsiderFunction and ExactSizeConsiderFunction may be used.

For more advanced techniques, see also the Chapter "Tables of Marks" and in particular Section "Accessing Subgroups via Tables of Marks" - but that will work only for groups whose tables are contained in the tables of marks library.

Further reading:

  • How do I get the subgroups of my group from GAP F.A.Q.
  • Computing Conjugacy Classes of Subgroups in GAP
  • $p$-subgroups in GAP