20180918 Remember that represents the set of all permutations of {1, 2,... n} There are some basic facts about that we need to have in hand: 1. Closure: If and then 2. Associativity: If and and then 3. Identity Element: There is a permutation such that 4. Inverse: If then and Property 1 says that the composition of two permutations is another permutation. This sounds trivial but it is our frst look at a very important concept: closure. When we apply an operation to two elements of a set and always get another element of the same set, we say that set is closed under that operation. Not all sets are closed under all operations. For example, is not closed under the operation of subtraction (for instance, and, but, which is not in ). However is closed under addition and multiplication. This concept is vital to us as computer scientists because we frequently work with strongly typed programming languages, where each variable has a specifc type that cannot change. If we are dealing with integer variables, we need to be sure the operations we perform will only produce integer values. Property 2 is called the associative property. It says that if we are composing a sequence of permutations we can group them with parentheses in diferent ways without changing the result. We will see an application of this later in these notes. Property 3 asserts that the identity permutation can be composed with any permutation without changing it. Once again, we can draw a parallel to other sets and operations. For example, in the set and the operation of multiplication, we know that Property 4 asserts that every permutation has an inverse. This property is also true for some sets and operations but not all. For example, in the set and the operation of addition, the
identity element is 0 and every element has an inverse (for instance, the inverse of 7 is -7). However in the set and the operation of addition, the identity element is still 0 but the nonzero values do not have inverses (for instance there is no integer such that ). Property 4 is particularly important when we use permutations in cryptography there s not much point encoding information with a permutation if there is not some other permutation that will do the decoding. Each of these properties follows from the defnition of permutations and the properties of functions. I recommend that you do some examples and convince yourself that these are true. (Side note: A set and an operation that satisfy these four properties are called a group. Group theory is one of the most important branches of mathematics, with applications in communications, theoretical physics, applied physics, biology, chemistry, robotics and many other felds. We don t have time in CISC-203 to explore this topic but I encourage you to spend some time looking into it.) Note that there is property possessed by many operations that is not true of the composition of permutations: commutativity. Commutativity holds when we can switch the left-to-right order of the operands without changing the result. For example, when we are multiplying integers, we know that... and the same is true for addition. Not all operations are commutative. For example, subtraction is not commutative: except when Composition of permutations is not commutative. In general, we will see some special cases where they are equal.... although In class I posed a challenge: given permutations and in, can you always fnd a permutation such that?
The answer is yes. Here s how: we can solve this equation for in much the same way as we would solve an equation involving numbers... we just try to get by itself on one side. (What I mean is, if we are asked to solve we isolate the by adding to both sides getting, which simplifes to, and fnally. But here the only operation we have is composition. So what can we do with composition to get rid of the on the left side? Well, remember that... and So we can start with (in which and are known, and is the unknown) and apply the following operations that maintain equality and we are done! It s exactly the same process as solving for in It s easy to check that this is correct. If we take and replace by we get which equals which equals which equals Cycle Notation for Permutations Now we introduce another representation for permutations... one that makes it possible to work with permutations very easily. Consider this permutation: What happens if we imagine composing with itself? Let s trace what happens to the element 1. We are going to apply twice: the frst application maps 1 to 4, and the second
application maps that 4 to 2. If we compose with again, that 2 is mapped back to 1. Treating as a function, we see,, and (It is traditional to write as and as etc.) Composing with even more times will cycle through 4 then 2 then 1 then 4 then 2 then 1 etc. We can write this behaviour as etc. If we trace what happens to 2 when we repeatedly compose with itself and apply the resulting function to 2, we see exactly the same pattern : etc. The same thing happens if we start with 4 and trace what happens to it when we repeatedly compose with itself and apply the resulting function to 4: we get the pattern 4 etc So in this sense, 1, 4 and 2 form a cycle: 1 goes to 4, 4 goes to 2, and 2 goes to 1. We write this cycle as (1, 4, 2) - it is a notational device that describes the three ordered pairs (1,4),(4,2), (2,1) which belong to What about the rest of? Since we have dealt with 1, 2 and 4, let s see what happens to 3. Following the same analysis as we did for 1, 2 and 4 (but skipping over some of the details) we see this pattern: etc. which we write as (3, 5, 7, 6). Again we can see that this is a non-ambiguous shorthand way to represent the four ordered pairs (3,5), (5,7), (7,6), (6,3) that make up the rest of Thus we can express the entire defnition of with the two cycles (1,4,2)(3,5,7,6) - we call this the cycle notation for All of the information that defnes is there, expressed in a diferent way (in other words, we can reconstruct the standard representation from the cycle notation). Notice that from each permutation, we can only get one cycle notation version. (We saw this for above: no matter which elements we start with, we always get the same repeating patterns for 1, 4 and 2, and for 3, 5, 7, and 6.) Similarly, from any cycle notation representation, we can only reconstruct one permutation in standard notation. This means that the cycle notation for each permutation is unique (up to changing the order of the cycles, because (1,4,2)(3,5,7,6) gives the same information as (3,5,7,6)(1,4,2) and up to rotating the elements within each cycle, since (1,4,2) and (4,2,1) and (2,1,4) all represent the same information). We can also extract the cycle notation for a permutation without going through the efort of composing with itself over and over. We can just build the cycles directly from by observing 1 goes to 4, 4 goes to 2, and 2 goes to 1 to get the cycle (1, 4, 2). Then we can say What happens to 3? and observe 3 goes to 5, 5 goes to 7, 7 goes to 6, and 6 goes to 3 to get
the cycle (3, 5, 7, 6). We can also represent the permutation by a diagram with each ordered pair represented by an arrow. This is what we did in class. The diagram for looks like this: This is as far as we got on Tuesday, but there were a couple of other things to say about permutations in cycle notation. I m including them here, and I will present them in class on Thursday. So what can we do with a permutation expressed in cycle notation? Computing the Inverse of a Permutation in Cycle Notation Suppose we have a permutation and we need to compute. We could do it from standard representation... For example, consider To compute, we could see that
4 is in the frst position, so the ordered pair (1,4) must be in... which means the ordered pair (4,1) must be in. Similarly, 2 is in the fourth position, so the ordered pair (4,2) is in, so (2,4) must be in, and so on... it s not that hard but it s a bit tedious. But with the permutation expressed in cycle notation, computing is trivially easy: we just reverse each cycle. So the inverse of (1,4,2)(3,5,7,6) is simply (2,4,1)(6,7,5,3). You can check the details of this example to confrm that it works, but the logic of it is pretty straightforward: contains the ordered pair (1,4) this is encoded in the frst cycle, so must contain the ordered pair (4,1) and this is encoded in the reverse of the frst cycle. Note that reversing a cycle is very diferent from rotating a cycle: the cycles (a, b, c, d) and (c, d, a, b) represent exactly the same information, but (d, c, b, a) represents the inverse. Composition of Two Permutations in Cycle Notation Now suppose we have two permutations and and we want to compute. (Remember, this means the permutation that results when we apply, then apply ) Once again cycle notation makes this very easy, and an example will show how this is done. Let s use and. In cycle notation, = (1,4,2)(3,5,6,7) and = (1,4)(2,7)(3,6)(5) - you should check this. (Why is 5 all by itself in? Because maps 5 to itself... 5 forms a cycle of length 1.) We can build the cycle notation for as follows: Start with 1. Apply to it, giving 4 (that is to say ). Then apply to that 4, giving 2 (that is, ). So in, we see that 1 2 (that is, ). So our frst cycle in starts (1, 2...) Now let s see what does to 2. takes 2 to 7, and takes 7 to 6. So. So our cycle in now looks like (1, 2, 6...) Now let s see what does with 6. takes 6 to 3 and takes 3 to 5, so. The cycle in we are building now looks like (1, 2, 6, 5...)
Following the same steps we see that. Then we discover that So we have discovered that in, is a cycle, and in cycle notation this is (1,2,6,5,7) We still haven t dealt with 3 and 4. It doesn t matter which we start with, so let s start with 4. and, so. In cycle notation this is just (4) You can verify for yourself that, giving (3) as the last cycle in Putting all the cycles together, we get = (1,2,6,5,7)(4)(3) You should check this too! Shorthand Notation for Cycles When using cycle notation, sometimes we leave out the cycles of length 1. This can be ambiguous unless we know we are dealing with permutations from a particular In the previous example, if we specify that and are in then we can write and just leave out the (4) and (3). The reader will know they are cycles of length 1 because if they weren t we would have included them.
****** Bonus Material For Those Who Just Can t Say No to Permutations ****** This material will not be on any of our tests, but I hope some members of the class will fnd it interesting. Consider these permutations of {1,2,3,4,5,6,7,8}: and When we put these into cycle notation, we get and They look very diferent... and yet in a certain sense they are identical! Each has two cycles of length 3 and a single cycle of length 2. Their essential structure is the same we have just re-labelled the elements. Compare this to the permutation It s clear that has a fundamentally diferent structure from and. And what can we do with this? We can defne an equivalence relation on permutations! For permutations and, both in, we can say if and have the same cycle structure. It should be clear that is reflexive, symmetric and transitive. Now we can ask questions about this equivalence relation. For example, how many equivalence classes are there for? We can answer this by looking at the number of diferent cycle structures. Let s consider permutations of [1 2 3]. The cycle structure of a permutation of this set must be either (...) - a single cycle containing all three values, or (.)(..) - a cycle of length 1 and a cycle of length 2, or (.)(.)(.) - three cycles of length 1 (there is only one permutation with this structure : ) and this means that in a very real sense, there are only 3 ways to permute a set with 3 elements.
Now consider permutations of [1 2 3 4]. The possible cycle structures are (....) (.)(...) (.)(.)(..) (..)(..) (.)(.)(.)(.) so there are 5 ways to permute a set with 4 elements. Unfortunately there is no simple formula to compute the number of equivalence classes of for arbitrary values of n (there is a formula but it s not simple). It turns out that these are known as partition numbers. Wikipedia has a good article about them : https://en.wikipedia.org/wiki/partition((number(theory). We can also use the cycle representation to prove this claim: Let be a permutation. Then there exists a positive integer such that Proof: Suppose contains a cycle c of length t. where x is any positive multiple of t will restore the elements of c to their natural positions. Thus if contains cycles with lengths in the set then