Permutation Puzzles a Mathematical Perspective
Total Page:16
File Type:pdf, Size:1020Kb
Permutation Puzzles A Mathematical Perspective Jamie Mulholland Copyright c 2021 Jamie Mulholland SELF PUBLISHED http://www.sfu.ca/~jtmulhol/permutationpuzzles Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 License (the “License”). You may not use this document except in compliance with the License. You may obtain a copy of the License at http://creativecommons.org/licenses/by-nc-sa/4.0/. Unless required by applicable law or agreed to in writing, software distributed under the License is dis- tributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. First printing, May 2011 Contents I Part One: Foundations 1 Permutation Puzzles ........................................... 11 1.1 Introduction 11 1.2 A Collection of Puzzles 12 1.3 Which brings us to the Definition of a Permutation Puzzle 22 1.4 Exercises 22 2 A Bit of Set Theory ............................................ 25 2.1 Introduction 25 2.2 Sets and Subsets 25 2.3 Laws of Set Theory 26 2.4 Examples Using SageMath 28 2.5 Exercises 30 II Part Two: Permutations 3 Permutations ................................................. 33 3.1 Permutation: Preliminary Definition 33 3.2 Permutation: Mathematical Definition 35 3.3 Composing Permutations 38 3.4 Associativity of Permutation Composition 41 3.5 Inverses of Permutations 42 3.6 The Symmetric Group Sn 45 3.7 Rules for Exponents 46 3.8 Order of a Permutation 47 3.9 Exercises 48 4 Permutations: Cycle Notation ................................. 51 4.1 Permutations: Cycle Notation 51 4.2 Products of Permutations: Revisited 54 4.3 Properties of Cycle Form 55 4.4 Order of a Permutation: Revisited 55 4.5 Inverse of a Permutation: Revisited 57 4.6 Summary of Permutations 58 4.7 Working with Permutations in SageMath 59 4.8 Exercises 59 5 From Puzzles To Permutations .................................. 63 5.1 Introduction 63 5.2 Swap 64 5.3 15-Puzzle 66 5.4 Oval Track Puzzle 67 5.5 Hungarian Rings 70 5.6 Rubik’s Cube 71 5.7 Exercises 74 6 Permutations: Products of 2-Cycles ............................ 79 6.1 Introduction 79 6.2 Product of 2-Cycles 80 6.3 Solvability of Swap 81 6.4 Exercises 82 7 Permutations: The Parity Theorem .............................. 83 7.1 Introduction 83 7.2 Variation of Swap 85 7.3 Proof of the Parity Theorem 86 7.4 Exercises 91 8 Permutations: An and 3-Cycles ................................ 95 8.1 Swap Variation: A Challenge 95 8.2 The Alternating Group An 95 8.3 Products of 3-cycles 97 8.4 Variations of Swap: Revisited 99 8.5 Exercises 100 9 The 15-Puzzle ................................................ 103 9.1 Solvability Criteria 103 9.2 Proof of Solvability Criteria 105 9.3 Strategy for Solution 108 9.4 Exercises 109 III Part Three: Group Theory 10 Groups ...................................................... 117 10.1 Group: Definition 117 10.2 Some Everyday Examples of Groups 120 10.3 Further Examples of Groups 122 10.4 Exercises 134 11 Subgroups .................................................. 139 11.1 Subgroups 139 11.2 Examples of Subgroups 140 11.3 The Center of a Group 141 11.4 Lagrange’s Theorem 142 11.5 Cyclic Groups Revisited 143 11.6 Cayley’s Theorem 145 11.7 Exercises 146 12 Puzzle Groups ............................................... 149 12.1 Puzzle Groups 149 12.2 Rubik’s Cube 150 12.3 Hungarian Rings 157 12.4 15-Puzzle 158 12.5 Exercises 158 13 Commutators ............................................... 161 13.1 Commutators 161 13.2 Creating Puzzle moves with Commutators 162 13.3 Exercises 170 14 Conjugates ................................................. 175 14.1 Conjugates 175 14.2 Modifying Puzzle moves with Conjugates 177 14.3 Exercises 183 15 The Oval Track Puzzle ........................................ 187 15.1 Oval Track with T = (1 4)(2 3) 187 15.2 Variations of the Oval Track T move 198 15.3 Exercises 199 16 The Hungarian Rings Puzzle .................................. 203 16.1 Hungarian Rings - Numbered version 203 16.2 Building Small Cycles: Tools for Our End-Game Toolbox 205 16.3 Solving the end-game 210 16.4 Hungarian Rings - Coloured version 210 16.5 Exercises 210 17 Partitions & Equivalence Relations ............................ 211 17.1 Partitions of a Set 211 17.2 Relations 212 17.3 Equivalence Relation 213 17.4 Exercises 217 18 Cosets & Lagrange’s Theorem ................................ 221 18.1 Cosets 221 18.2 Lagrange’s Theorem 224 18.3 Exercises 226 IV Part Four: Rubiks’ Cube 19 Rubik’s Cube: Beginnings .................................... 231 19.1 Rubik’s Cube terminology and notation 231 19.2 Impossible Moves 235 19.3 A Catalog of Basic Move Sequences 236 19.4 Strategy for Solution 237 19.5 Exercises 241 20 Rubik’s Cube: The Fundamental Theorem ..................... 243 20.1 Rubik’s Cube - A Model 243 20.2 The Fundamental Theorem of Cubology 247 20.3 When are two assembled cubes equivalent? 249 20.4 Exercises 252 21 Rubik’s Cube: Subgroups of the Cube Group .................. 257 21.1 Building Big Groups from Smaller Ones 257 21.2 Some Subgroups of RC3 258 21.3 Structure of the Cube Group RC3 260 21.4 Exercises 262 V Part Five: Symmetry & Counting 22 The Orbit-Stabilizer Theorem .................................. 265 22.1 Orbits & Stabilizers 265 22.2 Permutations Acting on Sets: Application of the Orbit-Stabilizer Theorem 269 22.3 Exercises 276 23 Burnside’s Theorem .......................................... 279 23.1 A Motivating Example 279 23.2 Burnside’s Theorem 281 23.3 Applications of Burnside’s Theorem 282 23.4 Exercises 288 VI Part Six: Light’s Out 24 Lights Out ................................................... 293 24.1 Lights Out 293 24.2 Lights Out: A Matrix Model 294 24.3 Summary of 5 × 5 lights out puzzle 303 24.4 Eigenvalues and Eigenvectors 305 24.5 Other sized game boards 305 24.6 Light-Chasing Strategy 306 24.7 Exercises 307 VII Appendix A SageMath ................................................... 311 A.1 SageMath Basics 311 A.2 Variables and Statements 314 A.3 Lists 315 A.4 Sets 317 A.5 Commands/Functions 318 A.6 if, while, and for statements 319 A.7 Exercises 322 B Basic Properties of Integers ................................... 323 B.1 Divisibility and the Euclidean Algorithm 323 B.2 Prime Numbers 326 B.3 Euler’s f-function 327 B.4 Modular Arithmetic 328 B.5 Exercises 329 Bibliography ................................................ 333 Articles 333 Books 333 Web Sites 334 Index ....................................................... 335 I Part One: Foundations 1 Permutation Puzzles .................. 11 1.1 Introduction 1.2 A Collection of Puzzles 1.3 Which brings us to the Definition of a Permutation Puzzle 1.4 Exercises 2 A Bit of Set Theory ................... 25 2.1 Introduction 2.2 Sets and Subsets 2.3 Laws of Set Theory 2.4 Examples Using SageMath 2.5 Exercises 1. Permutation Puzzles 1.1 Introduction Imagine a mixed up Rubik’s cubeTM (for example see Figure 1.1a), or better yet, mix up your own cube. As you begin to try to solve the cube you should notice a few things. Solving a single face (i.e. getting all 9 pieces of the same colour onto the same face) isn’t that difficult. There seems to be enough room to move things around. Continuing in this manner, you then begin to solve the next layer. You’ll soon notice that certain moves will undo your previous work. If you twist a face that contains some pieces that you had previously put in their correct place, then these pieces now move out of place. And this is where the puzzle becomes challenging. It seems the more pieces that are in the correct place, the harder it is to move the remaining ones into place. This is known as the end-game of the Rubik’s cube, and solving it requires a thorough understanding of this part of the puzzle. (a) A mixed up Rubik’s cube (b) An end-game for Rubik’s cube. Only the bottom layer remains to be solved. Figure 1.1: A mixed up Rubik’s cube and end-game. Rubik’s cube is probably one of the most well known puzzles to date. Created by Erno¨ Rubik in1974, it is estimated that by 2009 over 350 million have been sold. What has made it so popular is not certain. Perhaps it looks seemingly innocent, then once a few sides have been twisted, and 12 Chapter 1. Permutation Puzzles the colours begin to mix, the path back home is not so easy to see. The more you twist it the further you seem to be taken away from the solution. Perhaps it is that the number of ways to mix up the cube seems endless. Or perhaps to others, it doesn’t seem endless at all. Despite the reasons for its appeal, it has become one of the most popular puzzles in history. It is rare to find a puzzle, or toy, that has captured the imagination of millions, is accessible to all age levels, is challenging, yet satisfying, and is so mathematically rich. The Rubik’s cube is one such puzzle. Others examples include the 15-puzzle, TopSpin (Oval Track), and Hungarian Rings. What do we mean by mathematically rich? Well it turns out that one area of mathematics that has had an impact on all areas of science, and has even popped up in art, is the field called group theory. Often referred to as the language of symmetry, group theory has led to many new discoveries in theoretical physics, chemistry, and mathematics itself. It underlies the techniques in cryptography (sending private information over public channels), and coding theory (digital communications, digital storage and retrieval of information). It is no surprise that a mathematical theory developed to understand symmetry so adequately describes the Rubik’s cube, however, for us, we are more interested in the opposite.