Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

Zhen

40 views
Kernel: SageMath (stable)

Math 157: Intro to Mathematical Software

UC San Diego, fall 2018

Created by Zhen Duan on December 5th.

December 6, 2018: Permutation groups in Sage

In this lecture, we are going to discuss permutation groups. We will learn about its basic concepts, and its expressive method and usage in Sage.

Permutations

Before we discuss permutation groups, let's make sure we are clear about permutations. A permutation of a set is a bijection function from this set to this set.

Examples:
  1. Let AA be a set, where A={0,1,2,3}A=\{0,1,2,3\} So, a permutation of set AA would be: 131\rightarrow3 242\rightarrow4 313\rightarrow1 424\rightarrow2 We can see that a permutation is a function or a relation from set AA to itself. Let σ\sigma be a permutation of AA Then, we can denote σ\sigma as: σ=(1 3)(2 4)\sigma=(1\space3)(2\space4)

  2. Let BB be a set, where B={0,1,2,3,4,5,6,7,8,9}B=\{0,1,2,3,4,5,6,7,8,9\} A permutation of BB is: 121\rightarrow2 232\rightarrow3 343\rightarrow4 414\rightarrow1 555\rightarrow5 696\rightarrow9 777\rightarrow7 868\rightarrow6 989\rightarrow8 This permutation would be denoted as (1 2 3 4)(5)(6 9 8)(7)(1\space2\space3\space4)(5)(6\space9\space8)(7)

Permutations in Sage:

Sage uses “disjoint cycle notation” for permutations. Composition occurs left to right, which is not what you might expect and is exactly the reverse of what Judson and many others use. (There are good reasons to support either direction, you just need to be certain you know which one is in play.) There are two ways to write the permutation σ=(1 2 3)(4 5 6)σ=(1\space2\space3)(4\space5\space6):

  • As a text string (include quotes): "(1,2,3) (4,5,6)"

  • As a Python list of “tuples”: [(1,2,3), (4,5,6)]

(see details at Sage Documentation v8.4)

In Sage, we use command SymmetricGroup(n) to build symmetric group of all possible permutations of 11 to nn.

G = SymmetricGroup(6)
# use a text string to represent a permutation sigma = G("(1,2,3) (4,5,6)") sigma
(1,2,3)(4,5,6)
# use a Python list to represent a permutation pi = G([(1,2,3), (4,5,6)]) pi
(1,2,3)(4,5,6)

Also, we can do multiplication of permutation in Sage

sigma*pi
(1,3,2)(4,6,5)

We will get the same permutation if it's multipled by identity.

# define identity of symmetric group for n=6 identity = G("(1)(2)(3)(4)(5)(6)") identity
()
sigma*identity == sigma
True

Also, we have sign as one of attributes of permutatin, where

  • even permutations have sign of 1

  • odd permutations have sign of -1

sigma.sign()
1
G2 = SymmetricGroup(3) p = G2("(1)(2,3)") print(t) p.sign()
(2,3)
-1

The order of a permutation is the smallest number kk such that σkσ^k equals the identity permutation.

sigma.order()
3

This line of code shows that the order of σ\sigma is 33, which means σ3\sigma^3 is equal to the identity, (1)(2)(3)(4)(5)(6)(1)(2)(3)(4)(5)(6), and 33 is the smallest number that satisfies this equation. We can use permutation multiplication to verify it.

sigma # sigma to the power of 1
(1,2,3)(4,5,6)
sigma^2 # sigma to the power of 2
(1,3,2)(4,6,5)
sigma^3 # sigma to the power of 3
()

Here we go! The third power of σ\sigma is ()(), which is the identity!

p.order() # order of t
2
p^2 == G2([]) # check if p to the power of 2 equals to identity
True

Permutation Groups

In mathematics, a permutation group is a group GG whose elements are permutations of a given set MM and whose group operation is the composition of permutations in GG. The group of all permutations of a set MM is the symmetric group of MM, often written as Sym(M)Sym(M). The term permutation group thus means a subgroup of the symmetric group. If M={1,2,...,n}M = \{1,2,...,n\} then, Sym(M)Sym(M), the symmetric group on nn letters is usually denoted by SnS_n. (from wikipedia permutation group)

Creating Groups

Following are some popular permutation groups, and commands to build them in Sage.

  • SymmetricGroup(n): All n!n! permutations on nn symbols.

  • DihedralGroup(n): Symmetries of an ngonn-gon. Rotations and flips, 2n2n in total.

  • CyclicPermutationGroup(n): Rotations of an ngonn-gon (no flips), nn in total.

  • AlternatingGroup(n): Alternating group on nn symbols having n!/2n!/2 elements.

  • KleinFourGroup(): The non-cyclic group of order 44.

G_1 = SymmetricGroup(5) G_1
Symmetric group of order 5! as a permutation group
G_2 = DihedralGroup(6) G_2
Dihedral group of order 12 as a permutation group
G_3 = CyclicPermutationGroup(6) G_3
Cyclic group of order 6 as a permutation group
G_4 = AlternatingGroup(6) G_4
Alternating group of order 6!/2 as a permutation group
G_5 = KleinFourGroup() G_5
The Klein 4 group of order 4, as a permutation group
Abelian

An Abelian group, also known as commutative group, is a group that satisfies the operation on its elements but not depend on the order of element as operands. In sage, we can use a simple command is_ablelian() to check if a group is a Abeliam group.

G_1.is_abelian()
False

We can briefly check this.

f = G_1([(1,2), (3,5,4)]) g = G_1([(2,3,4)])
f*g
(1,3,5,2)
g*f
(1,2,5,4)
f*g == g*f
False