Lesson 5 of 15
Permutation Groups
Permutation Groups
A permutation of a set is a bijection from the set to itself. The set of all permutations of elements forms the symmetric group under composition.
Representing Permutations
We represent a permutation as a list where is the image of :
# sigma: 0->1, 1->2, 2->0
sigma = [1, 2, 0]
Composition
The composition applies first, then :
def compose(sigma, tau):
n = len(sigma)
return [sigma[tau[i]] for i in range(n)]
Identity and Inverse
The identity permutation is .
The inverse satisfies :
def inverse(sigma):
n = len(sigma)
inv = [0] * n
for i in range(n):
inv[sigma[i]] = i
return inv
Order of a Permutation
The order of is the smallest such that . It equals the least common multiple of the lengths of its disjoint cycles.
Cycle Notation
A permutation can be decomposed into disjoint cycles. For example, decomposes as .
Your Task
Implement compose(sigma, tau), inverse(sigma), and perm_order(sigma) (the order of a permutation).
Pyodide loading...
Loading...
Click "Run" to execute your code.