Sage Tutorial for Permutation Groups

You can use sage for a lot of group theory tests. The following should give you an idea of how things work in Sage.

Sage has a lot of built-in groups that you can call. The following are a few examples.

In [1]:
S4 = SymmetricGroup(4) 
In [2]:
D4 = DihedralGroup(4)

These are a few examples of groups. There is a whole lot of other groups that Sage has; you can google for it.

Even if you find a new group, and you want to understand it more, you can ask for it to print the multiplication table:

In [3]:
D4.cayley_table()
Out[3]:
*  a b c d e f g h
 +----------------
a| a b c d e f g h
b| b a d c f e h g
c| c d b a h g e f
d| d c a b g h f e
e| e f g h a b c d
f| f e h g b a d c
g| g h f e d c a b
h| h g e f c d b a

Or just list the elements:

In [4]:
D4.list()
Out[4]:
[(), (1,3)(2,4), (1,4,3,2), (1,2,3,4), (2,4), (1,3), (1,4)(2,3), (1,2)(3,4)]

Or even show the Cayley graph of it:

In [5]:
show(D4.cayley_graph())

Whenever you are unsure of what a specific command does, you can always ask for help

In [6]:
D4.cayley_graph?
In [7]:
for g in D4:
    print(g.inverse()), #the comma means the print command will not print a newline at the end
    print(g)
() ()
(1,3)(2,4) (1,3)(2,4)
(1,2,3,4) (1,4,3,2)
(1,4,3,2) (1,2,3,4)
(2,4) (2,4)
(1,3) (1,3)
(1,4)(2,3) (1,4)(2,3)
(1,2)(3,4) (1,2)(3,4)

You can also use the disjoint cycle notation to refer to a specific element of the group.

In [8]:
rho = D4([(1,2),(3,4)])
pi = D4([(1,4),(2,3)])
In [9]:
tau = rho * pi * rho.inverse()
tau
Out[9]:
(1,4)(2,3)

You can also make membership queries (and a LOT more)

In [10]:
print(S4([(1,2,3,4)]) in D4)
print(S4([(1,2)])) in D4
True
False

Let us consider the rotations of the cube:

In [11]:
S8 = SymmetricGroup(8)
rotX = S8([(1,2,3,4),(5,6,7,8)])
rotY = S8([(1,5,8,4),(2,6,7,3)])
rotZ = S8([(1,2,6,5),(4,3,7,8)])
G = PermutationGroup([rotX,rotY,rotZ])
G.order()
Out[11]:
24
In [12]:
G.is_isomorphic(SymmetricGroup(4))
Out[12]:
True

Some tutorials online

You have a pretty good tutorial here. Play around with sage to get a better hang of things.