Ma/CS 6a Class 6: Permutations By Adam Sheffer The 5 Puzzle Problem. Start with the configuration on the left and move the tiles to obtain the configuration on the right.
The 5 Puzzle (cont.) The game became a craze in the U.S. in 880. Sam Loyd, a famous chess player and puzzle composer, offered a $,000 prize for anyone who could provide a solution. Reminder: Permutations Problem. Given a set,,, n, in how many ways can we order it? The case n =. Six distinct orders / permutations:,,,,,. The general case. n! = n n Options for placing Options for placing Options for placing n
The 5 Puzzle and Permutations How can a configuration of the 5-puzzle be described as a permutation? Denote the missing tile as 6. The board below corresponds to the permutation 6 4 6 0 5 8 7 9 4 5 Permutations as Functions We can consider a permutation as a bijection from the set,,, n to itself. 5 4 5 6 6 4 Denote the bijection as α. α = 5. α =.
The Permutation Set S n S n The set of permutations of N n =,,,, n. We have S n = n!. The set S : Composition of Permutations α =, α = 4, α = 5, α 4 =, α 5 =. β =, β = 5, β =, β 4 = 4, β 5 =. What is the function βα? α: β: 4 5 4 4 5 5 First apply α and then β 4
Closure of S n Claim. If α and β are in S n, so is αβ. By definition, αβ is a function from N n to itself. It remains to show that for every i N n there is a unique j N n such that i = αβ j. Since α S n, there is a unique k such that i = α k. Since β S n, there is a unique j such that k = β j. Commutativity Is it true that for every α, β S n, we have αβ = βα? No! Consider S and α = αβ = β =. βα =. 5
Associativity Is it true that for every α, β, γ S n, we have αβ γ = α βγ? Yes. In both cases we get the function: γ: 4 β: α: 5 4 4 5 5 4 5 The Identity Element of S n Identity. The identity permutation is defined as id r = r for every r N n. For any α S n, we have id α = α id = α. 6
Inverse Is it true that for every α S n, there exists an inverse permutation α S n satisfying αα = α α = id. Yes. Just reverse the arrows. α: α : 4 4 5 5 4 5 Cycle Notation We can consider a permutation as a set of cycles. 4 5 6 5 6 4 5 6 4 We write this permutation as 5 6 4. 7
Converting to Cycle Notation α =, α = 4, α = 5, α 4 =, α 5 =. We start with and construct its cycle: 4. We then choose a number that was not considered yet: 5. We got all the numbers of N 5, so the cycle notation is ( 4)( 5). Counting Cycles Problem. How many distinct cycles of length k exist in S n? Solution. n There are ways of choosing k elements k for the cycle. There are k! ways to order this elements. Each cycle has k different representations. n k k! k = n! k n k!. 8
Card Shuffling Problem. Cards numbered to are picked up in row order and re-dealt in column order: 5 9 4 5 6 7 8 9 0 6 0 7 4 8 How many times do we need to repeat this procedure until the cards return to their original positions? Finding a Permutation 4 5 6 7 0 8 9 A reshuffling corresponds to a permutation. 5 9 6 7 0 4 8 For example, after each reshuffling 6 moves to the position of 5. 9
Solution 4 5 6 7 8 9 0 5 9 6 7 0 4 8 The cycle structure of the permutation: α = 5 6 0 4 9 8 7. Every cycle has length or 5, so after five reshufflings we return to the original position. Classification of Permutations The type of a permutation of S n is the number of cycles of each length in its cycle structure. Both ( 4)( 5) and ()(4 5) are of the same type: one cycle of length and one of length. We denote this type as. In general, we write a type as α α α 4 α 4. 0
Counting Permutations of a Given Type Problem. How many permutations of S 4 are of the type 4? We need to insert the numbers,,, 4 into the cycle pattern. We can place every permutation of N 4 into this pattern. 5 6 4 4 7 8 9 0 Is the solution 4!? Fixing the Solution The following permutations are identical: 5 6 4 4 7 8 9 0 5 6 4 4 7 8 9 0 So is the answer 4!!! Another identical permutation: 5 6 4 4 7 8 9 0 So is the answer Yes! 4!!! 4?
Counting Instances of a Type In general, the number of permutations of S n of type α α α 4 α 4 is n! α! α! α! α 4! α α α 4 α 4 Types of S 5 Type Example Number 5 id ()(4)(5) 0 ()(4)(5) 0 ( 4)(5) 5 4 4 5 0 4 5 0 5 4 5 4
Conjugate Permutations Permutations α, β S n are said to be conjugate if there exists σ S n such that σασ = β. Let α = and β =. The two permutations are conjugate, since we can take σ = and σ =. σ α σ Conjugation and Types Theorem. Two permutations of S n are conjugate iff they are of the same type. α =, β =, σ =. σασ = β
Proof: One Direction Suppose that α, β are conjugate, so there exists σ such that σασ = β. Consider a cycle α x = x, α x = x,, α x k = x. Set y i = σ x i. Then β y i = σασ σ x i = σ x i+ = y i+. Proof: One Direction (cont.) σ is a bijection between cycles of α and cycles of β. That is, α and β are of the same type. 4
Proof: The Other Direction Suppose α and β have the same type. To prove conjugation, we need to find σ. Set up a bijection between the cycles of α and β, so that corresponding cycles have the same length. For every two such cycles x x x k and y y y k, we set σ x i = y i. Then σασ y i = σα x i = σ x i+ = y i+ = β(y i ) That is, σασ = β. The End So how can we solve this? In the next class but you can try before that! 5