Ch. 12.1: Permutations The Mathematics of Counting The field of mathematics concerned with counting is properly known as combinatorics. Whenever we ask a question such as “how many different ways can we make this choice”, or “how many different arrangements are possible”, we are asking a combinatoric question. The following is a very general rule that is foundational to the subject: The Fundamental Counting Principle Suppose an experiment consists of k sub-experiments, performed one after the other. If the 1st sub-experiment has n1 possible outcomes, the 2nd sub-experiment has n2 possible outcomes, ... and the kth subexperiment has nk possible outcomes, then then the combined experiment has n1 ×n2 ×. . .×nk possible outcomes. The justification for this principle is due to tree diagrams (discussed in the book an in class). It may seem a bit vague, so it is best illustrated with an example: Example 1: Suppose we perform an experiment in which we first flip a coin twice, and then roll a dice. How many possible outcomes are there? ANSWER: This experiment consists of 3 sub-experiments: (1) flip a coin, (2) flip a coin, (3) roll a dice. 1st outcome: coin flip 2nd outcome: coin flip 3rd outcome: dice roll (1) The 1st sub-experiment has 2 possible outcomes: {H, T }. (2) The 2nd sub-experiment has 2 possible outcomes: {H, T }. (2) The 3rd sub-experiment has 6 possible outcomes: { , , , , , }. Thus, by the Fundamental Counting Principle, there are 2 × 2 × 6 = 24 possible outcomes. 1 It is important to remember that when using the Fundamental Counting Principle, the order of the sub-experiments matters. For instance in the previous example, the outcome (H, T, ) is NOT the same as (T, H, ) because the order of the coin-flip outcomes is reversed. Example 2: Consider an ATM PIN. (a) How many different 4-digit PINs can be made using the digits 0, . . . , 9? (b) How many can be made if the 1st digit cannot be a zero? ANSWER: (a) Note that in this example, the order of the digits does matter: for instance, 1234 and 4321 are different PINs. We can think of this problem as an experiment in which we choose one digit after another. 1st digit 2nd digit 3rd digit 4rd digit For each of the 4 spaces, we can choose from 10 different digits. Thus, there are 10 × 10 × 10 × 10 = 104 = 10, 000 different outcomes, each outcome giving us a different PIN. (b) Here our counting procedure is the same as above, except that for our 1st digit, we can only choose from 9 possible digits (since the digit 0 is not allowed). Thus, in this case, there are 9 × 10 × 10 × 10 = 9 × 103 = 9, 000 different ways to make a unique PIN. 2 Factorial Notation When working in combinatorics, we often run across very long products of numbers. The factorial notation is often helpful in simplifying such expressions, as we will shortly see. Factorial For any counting number, n, the factorial of n is defined by n! = n(n − 1)(n − 2) . . . (3)(2)(1). By convention, 0! = 1! = 1. Also note the useful property that n! = n × (n − 1)! for any n ≥ 1. Example 3: Evaluate the following: (a) 5! = 5 × 4 × 3 × 2 × 1 = 120 (b) 5! − 3! = 120 − 6 = 114 (c) (5 − 3)! = 2! = 2 (d) 100! 98! = 100 × 99 = 9900 3 Permutations without Repetitions In the most general terms, a permutation is just an ordered list of elements selected from some set. In some usages, elements can be repeated, while in other usages this is not allowed. Example 4: Here are some example permutations: (3, 1, 2) and (2, 1, 3) are both distinct permutations of the set {1, 2, 3}, without repetitions allowed. (5, 6) is a 2-permutation of the set {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, without repetition allowed. The word abracadabra is an 11-permutation of the set of letters {a,b,c,d,r}, with repetition allowed. Note that elements of a permutation are often (though not always) listed between parentheses, (. . .), and that unlike set notation, the order of the list does matter. A common type of combinatoric problem is to determine the total number of possible permutations of a given set, when no repetitions are allowed. Example 5: Consider a club consisting of 6 members: { Tom, Calvin, Doug, Jane, Mary, Iris }. Suppose the club is giving a presentation in which 3 members have to give speeches, one after another, and no two speeches are given by the same person. How many different line-ups are possible? ANSWER: Let’s consider the experiment in which we choose each speaker, one after the other, to form a particular line-up: Mary Doug Iris 1st speaker 2nd speaker 3rd speaker For the 1st speaker, we can choose among 5 members. Once that choice is made, however, we have only 4 members left to choose from for the 2nd speaker, and then only 3 members left to choose from for the 3rd speaker. Thus, by the Fundamental Counting Principle, there are 5 × 4 × 3 = 60 ways to choose a distinct line up. 4 This type of problem occurs so often, that we use a special notation to describe the solution... Number of Permutations without Repetitions The total number of permutations of r elements selected from a set of n elements without repetition is given by the formula n Pr = n(n − 1)(n − 2) . . . (n − r + 1) = By convention, n P0 n! (n − r)! = 1, for any n. Example 6: Consider a lottery in which 6 balls are consecutively drawn at random from an urn containing 99 balls, each printed with a unique number 1, ..., 99. What are the total number of possible outcomes of this draw? ANSWER: Each drawing is a permutation of 6 numbers chosen from a set of 99, without repetition. Thus, the total number of possible permutations is: 99 P6 = 99 × 98 × 97 × 96 × 95 × 94 = 806, 781, 064, 320. This is a very large number, over 800 billion possible permutations. (As a prelude to the next chapter, think of trying to guess the exact permutation that is chosen. What would be your probability of guessing correctly?) 5 Permutations with Specific Repetitions In some problems, we need to deal with permutations in which some elements are repeated a specific number of times. For instance, we might want to know the number of ways of uniquely arranging 4 pictures on a wall (in a line) if 2 of the pictures are identical. Here’s a simpler example Example 7: How many distinguishable permutations can be made using all letters in the word needle? ANSWER: In this case, we have a total of 6 letters, and 3 of them (the Es) are identical. Let the unknown N be the answer that we’re looking for. If we temporarily assume that all 3 Es are distinguishable (say we denote them with different colors, E, E, E), then we have permutations with NO repetitions, and the total number possible is 6 P6 = 6! Now, note that each of the N permutations in which the Es are identical correspond to 3! possible permutations in which the Es are distinguishable (since we can permute those Es in place without changing the identity of the word). For example: NEEDLE = { nEEdlE, nEEdlE, nEEdlE, nEEdlE, nEEdlE, nEEdlE. } Thus, N × 3! = 6!, and so N = (6!)/(3!) = 120. The same reasoning leads us to the following general formula: Number of Permutaions with given Repetitions The total number of distinguishable permutations of k elements, in which the 1st element is repeated n1 times, the 2nd element is repeated n2 times, . . . and the kth element is repeated nk times, is given by the multinomial coefficient: n n1 , n2 , . . . , nk = where n = n1 + n2 + · · · + nk . 6 n! n1 ! n2 ! . . . nk ! Example 8: How many distinguishable permutations of the word MISSISSIPPI are possible? ANSWER: We have n = 11 letters in total: n1 n2 n3 n4 =1 =4 =4 =2 M’s, I’s, S’s, P’s. Thus, the total number of permutations is... n 11! = = 34, 650 n1 , n2 , n3 , n4 1! 4! 4! 2! 7