You can construct the following permutation groups:
of order
(n can also be a list
of distinct
or order
(n can also be a list
– DihedralGroup,
of order 
– CyclicPermutationGroup,
of order 
– DiCyclicGroup, nonabelian groups of order
with a unique element of order 2
transitive group of degree 
– TransitiveGroups(d), TransitiveGroups(), set of all of the above
– MathieuGroup(degree), Mathieu group of degree 9, 10, 11, 12, 21, 22, 23, or 24.
– KleinFourGroup, subgroup of
of order
which is not 
– QuaternionGroup, non-abelian group of order
, 
matrices over
matrices over
matrices
matrices having
matrices having– SuzukiGroup(q), Suzuki group over GF(q),
.
Bases: sage.groups.perm_gps.permgroup_named.PermutationGroup_symalt
The alternating group of order
, as a permutation group.
INPUT:
n – a positive integer, or list or tuple thereof
EXAMPLES:
sage: G = AlternatingGroup(6)
sage: G.order()
360
sage: G
Alternating group of order 6!/2 as a permutation group
sage: G.category()
Category of finite permutation groups
sage: TestSuite(G).run()
sage: G = AlternatingGroup([1,2,4,5])
sage: G
Alternating group of order 4!/2 as a permutation group
sage: G.domain()
{1, 2, 4, 5}
sage: G.category()
Category of finite permutation groups
sage: TestSuite(G).run()
Bases: sage.groups.perm_gps.permgroup_named.PermutationGroup_unique
A cyclic group of order n, as a permutation group.
EXAMPLES:
sage: G = CyclicPermutationGroup(8)
sage: G.order()
8
sage: G
Cyclic group of order 8 as a permutation group
sage: G.category()
Category of finite permutation groups
sage: TestSuite(G).run()
sage: C = CyclicPermutationGroup(10)
sage: C.is_abelian()
True
sage: C = CyclicPermutationGroup(10)
sage: C.as_AbelianGroup()
Multiplicative Abelian Group isomorphic to C2 x C5
Returns the corresponding Abelian Group instance.
Return True if this group is abelian.
Return True if this group is commutative.
Bases: sage.groups.perm_gps.permgroup_named.PermutationGroup_unique
The dicyclic group of order
, for
.
OUTPUT:
This is a nonabelian group similar in some respects to the dihedral group of the same order, but with far fewer elements of order 2 (it has just one). The permutation representation constructed here is based on the presentation

For
this is the group of quaternions
(
), which is the nonabelian
group of order 8 that is not the dihedral group
,
the symmetries of a square. For
this is the nonabelian
group of order 12 that is not the dihedral group
nor the alternating group
. This group of order 12 is
also the semi-direct product of of
by
,
. [CONRAD2009]
When the order of the group is a power of 2 it is known as a “generalized quaternion group.”
IMPLEMENTATION:
The presentation above means every element can be written as
with
,
. We code
as the symbol
and code
as the symbol
. The two generators
are then represented using a left regular representation.
EXAMPLES:
A dicyclic group of order 384, with a large power of 2 as a divisor:
sage: n = 3*2^5
sage: G = DiCyclicGroup(n)
sage: G.order()
384
sage: a = G.gen(0)
sage: x = G.gen(1)
sage: a^(2*n)
()
sage: a^n==x^2
True
sage: x^-1*a*x==a^-1
True
A large generalized quaternion group (order is a power of 2):
sage: n = 2^10
sage: G=DiCyclicGroup(n)
sage: G.order()
4096
sage: a = G.gen(0)
sage: x = G.gen(1)
sage: a^(2*n)
()
sage: a^n==x^2
True
sage: x^-1*a*x==a^-1
True
Just like the dihedral group, the dicyclic group has an element whose order is half the order of the group. Unlike the dihedral group, the dicyclic group has only one element of order 2. Like the dihedral groups of even order, the center of the dicyclic group is a subgroup of order 2 (thus has the unique element of order 2 as its non-identity element).
sage: G=DiCyclicGroup(3*5*4)
sage: G.order()
240
sage: two = [g for g in G if g.order()==2]; two
[(1,5)(2,6)(3,7)(4,8)(9,13)(10,14)(11,15)(12,16)]
sage: G.center().order()
2
For small orders, we check this is really a group we do not have in Sage otherwise.
sage: G = DiCyclicGroup(2)
sage: H = DihedralGroup(4)
sage: G.is_isomorphic(H)
False
sage: G = DiCyclicGroup(3)
sage: H = DihedralGroup(6)
sage: K = AlternatingGroup(6)
sage: G.is_isomorphic(H) or G.is_isomorphic(K)
False
REFERENCES:
[CONRAD2009] Groups of order 12. Keith Conrad, accessed 21 October 2009.
Return True if this group is abelian.
EXAMPLES:
sage: D = DiCyclicGroup(12)
sage: D.is_abelian()
False
Return True if this group is commutative.
EXAMPLES:
sage: D = DiCyclicGroup(12)
sage: D.is_commutative()
False
Bases: sage.groups.perm_gps.permgroup_named.PermutationGroup_unique
The Dihedral group of order
for any integer
.
sage: DihedralGroup(1) Dihedral group of order 2 as a permutation group
sage: DihedralGroup(2) Dihedral group of order 4 as a permutation group sage: DihedralGroup(2).gens() [(3,4), (1,2)]
sage: DihedralGroup(5).gens() [(1,2,3,4,5), (1,5)(2,4)] sage: list(DihedralGroup(5)) [(), (2,5)(3,4), (1,2)(3,5), (1,2,3,4,5), (1,3)(4,5), (1,3,5,2,4), (1,4)(2,3), (1,4,2,5,3), (1,5,4,3,2), (1,5)(2,4)]
sage: G = DihedralGroup(6) sage: G.order() 12 sage: G = DihedralGroup(5) sage: G.order() 10 sage: G Dihedral group of order 10 as a permutation group sage: G.gens() [(1,2,3,4,5), (1,5)(2,4)]
sage: DihedralGroup(0) Traceback (most recent call last): ... ValueError: n must be positive
TESTS:
sage: TestSuite(G).run()
sage: G.category()
Category of finite permutation groups
sage: TestSuite(G).run()
Bases: sage.groups.perm_gps.permgroup_named.PermutationGroup_unique
The Klein 4 Group, which has order
and exponent
, viewed
as a subgroup of
.
TESTS:
sage: G.category()
Category of finite permutation groups
sage: TestSuite(G).run()
Bases: sage.groups.perm_gps.permgroup_named.PermutationGroup_unique
The Mathieu group of degree
.
EXAMPLES:
sage: G = MathieuGroup(12)
sage: G
Mathieu group of degree 12 and order 95040 as a permutation group
TESTS:
sage: G.category()
Category of finite permutation groups
sage: TestSuite(G).run(skip=["_test_enumerated_set_contains", "_test_enumerated_set_iter_list"])
Note: this is a fairly big group, so we skip some tests that currently require to list all the elements of the group, because there is no proper iterator yet.
Bases: sage.groups.perm_gps.permgroup_named.PermutationGroup_plg
The projective general linear groups over GF(q).
sage: G = PGL(2,3); G Permutation Group with generators [(3,4), (1,2,4)] sage: print G The projective general linear group of degree 2 over Finite Field of size 3 sage: G.base_ring() Finite Field of size 3 sage: G.order() 24
sage: G = PGL(2, 9, ‘b’); G Permutation Group with generators [(3,10,9,8,4,7,6,5), (1,2,4)(5,6,8)(7,9,10)] sage: G.base_ring() Finite Field in b of size 3^2
sage: G.category() Category of finite permutation groups sage: TestSuite(G).run()
Bases: sage.groups.perm_gps.permgroup_named.PermutationGroup_pug
The projective general unitary groups over GF(q).
sage: PGU(2,3) The projective general unitary group of degree 2 over Finite Field of size 3
sage: G = PGU(2, 8, name=’alpha’); G The projective general unitary group of degree 2 over Finite Field in alpha of size 2^3 sage: G.base_ring() Finite Field in alpha of size 2^3
Bases: sage.groups.perm_gps.permgroup_named.PermutationGroup_plg
The projective special linear groups over GF(q).
sage: G = PSL(2, 4, ‘b’); G Permutation Group with generators [(3,4,5), (1,2,3)] sage: G.base_ring() Finite Field in b of size 2^2 sage: G = PSL(2, 8); G Permutation Group with generators [(3,8,6,4,9,7,5), (1,2,3)(4,7,5)(6,9,8)] sage: G.base_ring() Finite Field in a of size 2^3
sage: G.category() Category of finite permutation groups sage: TestSuite(G).run()
Helps compute the decomposition of the ramification module
for the Hurwitz curves X (over CC say) with automorphism group
G = PSL(2,q), q a “Hurwitz prime” (ie, p is
).
Using this computation and Borne’s formula helps determine the
G-module structure of the RR spaces of equivariant
divisors can be determined explicitly.
The output is a list of integer multiplicities: [m1,...,mn], where n is the number of conj classes of G=PSL(2,p) and mi is the multiplicity of pi_i in the ramification module of a Hurwitz curve with automorphism group G. Here IrrRepns(G) = [pi_1,...,pi_n] (in the order listed in the output of self.character_table()).
This means, for example, that the trivial representation does not occur in the ramification module of a Hurwitz curve with automorphism group PSL(2,13), since the trivial representation is listed first and that entry has multiplicity 0. The “randomness” is due to the fact that GAP randomly orders the conjugacy classes of the same order in the list of all conjugacy classes. Similarly, there is some randomness to the ordering of the characters.
If you try to use this function on a group PSL(2,q) where q is not a (smallish) “Hurwitz prime”, an error message will be printed.
Helps compute the decomposition of the ramification module for the modular curve X(p) (over CC say) with automorphism group G = PSL(2,q), q a prime > 5. Using this computation and Borne’s formula helps determine the G-module structure of the RR spaces of equivariant divisors can be determined explicitly.
The output is a list of integer multiplicities: [m1,...,mn], where n is the number of conj classes of G=PSL(2,p) and mi is the multiplicity of pi_i in the ramification module of a modular curve with automorphism group G. Here IrrRepns(G) = [pi_1,...,pi_n] (in the order listed in the output of self.character_table()).
This means, for example, that the trivial representation does not occur in the ramification module of X(7), since the trivial representation is listed first and that entry has multiplicity 0. The “randomness” is due to the fact that GAP randomly orders the conjugacy classes of the same order in the list of all conjugacy classes. Similarly, there is some randomness to the ordering of the characters.
Bases: sage.groups.perm_gps.permgroup_named.PermutationGroup_pug
The projective special unitary groups over GF(q).
sage: PSU(2,3) The projective special unitary group of degree 2 over Finite Field of size 3
sage: G = PSU(2, 8, name=’alpha’); G The projective special unitary group of degree 2 over Finite Field in alpha of size 2^3 sage: G.base_ring() Finite Field in alpha of size 2^3
Bases: sage.groups.perm_gps.permgroup_named.PermutationGroup_plg
The projective symplectic linear groups over GF(q).
sage: G = PSp(2,3); G Permutation Group with generators [(2,3,4), (1,2)(3,4)] sage: G.order() 12 sage: G = PSp(4,3); G Permutation Group with generators [(3,4)(6,7)(9,10)(12,13)(17,20)(18,21)(19,22)(23,32)(24,33)(25,34)(26,38)(27,39)(28,40)(29,35)(30,36)(31,37), (1,5,14,17,27,22,19,36,3)(2,6,32)(4,7,23,20,37,13,16,26,40)(8,24,29,30,39,10,33,11,34)(9,15,35)(12,25,38)(21,28,31)] sage: G.order() 25920 sage: print G The projective symplectic linear group of degree 4 over Finite Field of size 3 sage: G.base_ring() Finite Field of size 3
sage: G = PSp(2, 8, name=’alpha’); G Permutation Group with generators [(3,8,6,4,9,7,5), (1,2,3)(4,7,5)(6,9,8)] sage: G.base_ring() Finite Field in alpha of size 2^3
Bases: sage.groups.perm_gps.permgroup_named.PermutationGroup_unique
INPUT:
OUTPUT:
EXAMPLES:
We explicitly construct the alternating group on four elements:
sage: A4 = PermutationGroup([[(1,2,3)],[(2,3,4)]]); A4
Permutation Group with generators [(2,3,4), (1,2,3)]
sage: A4.__init__([[(1,2,3)],[(2,3,4)]]); A4
Permutation Group with generators [(2,3,4), (1,2,3)]
sage: A4.center()
Subgroup of (Permutation Group with generators [(2,3,4), (1,2,3)]) generated by [()]
sage: A4.category()
Category of finite permutation groups
sage: TestSuite(A4).run()
TESTS:
sage: TestSuite(PermutationGroup([[]])).run()
sage: TestSuite(PermutationGroup([])).run()
sage: G = PGL(2,3) sage: G.base_ring() Finite Field of size 3
sage: G = PSL(2,3) sage: G.base_ring() Finite Field of size 3
Bases: sage.groups.perm_gps.permgroup_named.PermutationGroup_plg
INPUT:
OUTPUT:
EXAMPLES:
We explicitly construct the alternating group on four elements:
sage: A4 = PermutationGroup([[(1,2,3)],[(2,3,4)]]); A4
Permutation Group with generators [(2,3,4), (1,2,3)]
sage: A4.__init__([[(1,2,3)],[(2,3,4)]]); A4
Permutation Group with generators [(2,3,4), (1,2,3)]
sage: A4.center()
Subgroup of (Permutation Group with generators [(2,3,4), (1,2,3)]) generated by [()]
sage: A4.category()
Category of finite permutation groups
sage: TestSuite(A4).run()
TESTS:
sage: TestSuite(PermutationGroup([[]])).run()
sage: TestSuite(PermutationGroup([])).run()
Bases: sage.groups.perm_gps.permgroup_named.PermutationGroup_unique
This is a class used to factor out some of the commonality in the SymmetricGroup and AlternatingGroup classes.
Deprecated since version Sage: Version 4.7.1. Use domain() instead.
Bases: sage.structure.unique_representation.UniqueRepresentation, sage.groups.perm_gps.permgroup.PermutationGroup_generic
INPUT:
OUTPUT:
EXAMPLES:
We explicitly construct the alternating group on four elements:
sage: A4 = PermutationGroup([[(1,2,3)],[(2,3,4)]]); A4
Permutation Group with generators [(2,3,4), (1,2,3)]
sage: A4.__init__([[(1,2,3)],[(2,3,4)]]); A4
Permutation Group with generators [(2,3,4), (1,2,3)]
sage: A4.center()
Subgroup of (Permutation Group with generators [(2,3,4), (1,2,3)]) generated by [()]
sage: A4.category()
Category of finite permutation groups
sage: TestSuite(A4).run()
TESTS:
sage: TestSuite(PermutationGroup([[]])).run()
sage: TestSuite(PermutationGroup([])).run()
Bases: sage.groups.perm_gps.permgroup_named.DiCyclicGroup
The quaternion group of order 8.
EXAMPLES:
The quaternion group is one of two non-abelian groups of order 8,
the other being the dihedral group
. One way to describe this
group is with three generators,
, so the whole group is
then given as the set
with relations
such as
,
and
.
The examples below illustrate how to use this group in a similar manner, by testing some of these relations. The representation used here is the left-regular representation.
sage: Q = QuaternionGroup()
sage: I = Q.gen(0)
sage: J = Q.gen(1)
sage: K = I*J
sage: [I,J,K]
[(1,2,3,4)(5,6,7,8), (1,5,3,7)(2,8,4,6), (1,8,3,6)(2,7,4,5)]
sage: neg_one = I^2; neg_one
(1,3)(2,4)(5,7)(6,8)
sage: J^2 == neg_one and K^2 == neg_one
True
sage: J*I == neg_one*K
True
sage: Q.center().order() == 2
True
sage: neg_one in Q.center()
True
Bases: sage.groups.perm_gps.permgroup_named.PermutationGroup_unique
The Suzuki group over GF(q),
.
A wrapper for the GAP function SuzukiGroup.
OUTPUT:
EXAMPLES:
sage: SuzukiGroup(8)
Permutation Group with generators [(1,2)(3,10)(4,42)(5,18)(6,50)(7,26)(8,58)(9,34)(12,28)(13,45)(14,44)(15,23)(16,31)(17,21)(19,39)(20,38)(22,25)(24,61)(27,60)(29,65)(30,55)(32,33)(35,52)(36,49)(37,59)(40,54)(41,62)(43,53)(46,48)(47,56)(51,63)(57,64), (1,28,10,44)(3,50,11,42)(4,43,53,64)(5,9,39,52)(6,36,63,13)(7,51,60,57)(8,33,37,16)(12,24,55,29)(14,30,48,47)(15,19,61,54)(17,59,22,62)(18,23,34,31)(20,38,49,25)(21,26,45,58)(27,32,41,65)(35,46,40,56)]
sage: print SuzukiGroup(8)
The Suzuki group over Finite Field in a of size 2^3
sage: G = SuzukiGroup(32, name='alpha')
sage: G.order()
32537600
sage: G.order().factor()
2^10 * 5^2 * 31 * 41
sage: G.base_ring()
Finite Field in alpha of size 2^5
REFERENCES:
Bases: sage.groups.perm_gps.permgroup_named.PermutationGroup_symalt
The full symmetric group of order
, as a permutation group.
If n is a list or tuple of positive integers then it returns the
symmetric group of the associated set.
INPUT:
- n - a positive integer, or list or tuple thereof
EXAMPLES:
sage: G = SymmetricGroup(8)
sage: G.order()
40320
sage: G
Symmetric group of order 8! as a permutation group
sage: G.degree()
8
sage: S8 = SymmetricGroup(8)
sage: G = SymmetricGroup([1,2,4,5])
sage: G
Symmetric group of order 4! as a permutation group
sage: G.domain()
{1, 2, 4, 5}
sage: G = SymmetricGroup(4)
sage: G
Symmetric group of order 4! as a permutation group
sage: G.domain()
{1, 2, 3, 4}
sage: G.category()
Join of Category of finite permutation groups and Category of finite weyl groups
sage: TestSuite(G).run()
TESTS:
sage: TestSuite(SymmetricGroup(0)).run()
Indexing sets of descent of the symmetric group.
EXAMPLES:
sage: S8 = SymmetricGroup(8)
sage: S8.index_set()
[1, 2, 3, 4, 5, 6, 7]
sage: S = SymmetricGroup([3,1,4,5])
sage: S.index_set()
[3, 1, 4]
Returns the major index generating polynomial of self, which is a gadget counting the elements of self by major index.
INPUT:

EXAMPLES:
sage: S4 = SymmetricGroup(4)
sage: S4.major_index()
q^6 + 3*q^5 + 5*q^4 + 6*q^3 + 5*q^2 + 3*q + 1
sage: K.<t> = QQ[]
sage: S4.major_index(t)
t^6 + 3*t^5 + 5*t^4 + 6*t^3 + 5*t^2 + 3*t + 1
For
in the index set of self, this returns the
elementary transposition
.
EXAMPLES:
sage: A = SymmetricGroup(5)
sage: A.simple_reflection(3)
(3,4)
sage: A = SymmetricGroup([2,3,7])
sage: A.simple_reflections()
Finite family {2: (2,3), 3: (3,7)}
Bases: sage.groups.perm_gps.permgroup_named.PermutationGroup_unique
The transitive group from the GAP tables of transitive groups.
EXAMPLES:
sage: TransitiveGroup(0,1)
Transitive group number 1 of degree 0
sage: TransitiveGroup(1,1)
Transitive group number 1 of degree 1
sage: G = TransitiveGroup(5, 2); G # requires optional database_gap
Transitive group number 2 of degree 5
sage: G.gens() # requires optional database_gap
[(1,2,3,4,5), (1,4)(2,3)]
sage: G.category() # requires optional database_gap
Category of finite permutation groups
Warning
this follows GAP’s naming convention of indexing the transitive groups starting from 1:
sage: TransitiveGroup(5,0)
Traceback (most recent call last):
...
assert n > 0
AssertionError
Warning
only transitive groups of “small” degree are available in GAP’s database:
sage: TransitiveGroup(31,1) # requires optional database_gap
Traceback (most recent call last):
...
NotImplementedError: Only the transitive groups of order less than 30 are available in GAP's database
TESTS:
sage: TestSuite(TransitiveGroup(0,1)).run()
sage: TestSuite(TransitiveGroup(1,1)).run()
sage: TestSuite(TransitiveGroup(5,2)).run()# requires optional database_gap
sage: TransitiveGroup(1,5)
Traceback (most recent call last):
...
AssertionError: n should be in {1,..,1}
INPUT:
- d – an integer (optional)
Returns the set of all transitive groups of a given degree d. If d is not specified, it returns the set of all transitive groups.
Warning: TransitiveGroups requires the optional GAP database package. Please install it with sage -i database_gap.
EXAMPLES:
sage: TransitiveGroups(3)
Transitive Groups of degree 3
sage: TransitiveGroups(7)
Transitive Groups of degree 7
sage: TransitiveGroups(8)
Transitive Groups of degree 8
sage: TransitiveGroups()
Transitive Groups
Warning
in practice, the database currently only contains transitive groups up to degree 30:
sage: TransitiveGroups(31).cardinality() # requires optional database_gap
Traceback (most recent call last):
...
NotImplementedError: Only the transitive groups of order less than 30 are available in GAP's database
Bases: sage.sets.disjoint_union_enumerated_sets.DisjointUnionEnumeratedSets
The infinite set of all transitive groups.
EXAMPLES:
sage: L = TransitiveGroups(); L
Transitive Groups
sage: L.category()
Category of infinite enumerated sets
sage: L.cardinality()
+Infinity
sage: p = L.__iter__() # requires optional database_gap
sage: (p.next(), p.next(), p.next(), p.next(), p.next(), p.next(), p.next(), p.next()) # requires optional database_gap
(Transitive group number 1 of degree 0, Transitive group number 1 of degree 1, Transitive group number 1 of degree 2, Transitive group number 1 of degree 3, Transitive group number 2 of degree 3, Transitive group number 1 of degree 4, Transitive group number 2 of degree 4, Transitive group number 3 of degree 4)
TESTS:
sage: TestSuite(TransitiveGroups()).run() # requires optional database_gap # long time
Bases: sage.structure.unique_representation.UniqueRepresentation, sage.structure.parent.Parent
The set of all transitive groups of a given (small) degree.
EXAMPLES:
sage: S = TransitiveGroups(4); S # requires optional database_gap
Transitive Groups of degree 4
sage: list(S) # requires optional database_gap
[Transitive group number 1 of degree 4, Transitive group number 2 of degree 4, Transitive group number 3 of degree 4, Transitive group number 4 of degree 4, Transitive group number 5 of degree 4]
sage: TransitiveGroups(5).an_element() # requires optional database_gap
Transitive group number 1 of degree 5
We write the cardinality of all transitive groups of degree 5:
sage: for G in TransitiveGroups(5): # requires optional database_gap
... print G.cardinality()
5
10
20
60
120
TESTS:
sage: TestSuite(TransitiveGroups(3)).run() # requires optional database_gap
Returns the cardinality of self, that is the number of transitive groups of a given degree.
EXAMPLES:
sage: TransitiveGroups(0).cardinality() # requires optional database_gap
1
sage: TransitiveGroups(2).cardinality() # requires optional database_gap
1
sage: TransitiveGroups(7).cardinality() # requires optional database_gap
7
sage: TransitiveGroups(12).cardinality() # requires optional database_gap
301
sage: [TransitiveGroups(i).cardinality() for i in range(11)] # requires optional database_gap
[1, 1, 1, 2, 5, 5, 16, 7, 50, 34, 45]
Warning
The database_gap contains all transitive groups up to degree 30:
sage: TransitiveGroups(31).cardinality() # requires optional database_gap
Traceback (most recent call last):
...
NotImplementedError: Only the transitive groups of order less than 30 are available in GAP's database
TESTS:
sage: type(TransitiveGroups(12).cardinality()) # requires optional database_gap
<type 'sage.rings.integer.Integer'>
sage: type(TransitiveGroups(0).cardinality())
<type 'sage.rings.integer.Integer'>