- Home
- Documents
- CHAPTER 7 COMBINATORICS Permutations and the ?· CHAPTER 7 COMBINATORICS ... you should review Section…

Published on

10-Jun-2018View

212Download

0

Embed Size (px)

Transcript

CHAPTER 7

COMBINATORICS Many of the problems that arise in discrete mathematics and its applications involve counting the number of ways in which some operation can be performed or counting the number of items satisfying some given specifications. We first encountered examples of this type of problem at the beginning of Chapter 1 and before starting this chapter, you should review Section 1A and make sure you know and understand the Multiplication Principle, which is the basis for what follows. Permutations and the factorial notation Example 7.1. Four playing cards, the Ace, King, Queen and Jack of hearts, are shuffled and then dealt, face up, in a row. In how many different orders can these cards be laid down? This is a 4stage problem; there are 4 possibilities for the card that is turned up first; when this has been decided, it leaves just 3 possibilities for the card that is turned up next; this in turn leaves 2 possibilities for the card that is turned up third and just 1 possibility for the final card. Thus the total number of different arrangements is (4)(3)(2)(1) = 24, by the Multiplication Principle. Now suppose that we mark the positions, 1 to 4, that the cards are going to occupy when they have been dealt; notice that we get the same answer for the number of different arrangements of the cards in whichever order we fill the positions. So, for example, there are 4 possibilities for the card in position 2; but when we know which that is, there are just 3 possibilities for the card in position 4, leaving 2 possibilities for the card in position 1 and 1 possibility for the card in the final position. Any arrangement of a set of n distinct items that puts these items in an order is called a permutation of the set. Thus we have shown above that there are 24 different permutations of a set containing 4 elements. Example 7.2 Suppose that we repeat Example 7.1 using all the 13 cards in one suit. We now have a 13-stage problem and the total number of permutations of the cards is (13)(12)... (1). We denote this number by the symbol 13!., read 13 factorial. In general, we denote the product n(n-1)(n-2)...(1) by n!, read n factorial, when n 1. For algebraic reasons, it is convenient to define 0! = 1. We shall explain later why this is so. Exercise 7.1 Factorials grow very fast. Illustrate this by tabulating the value of n! for n 0,1,... ,1O. Notice that for n 1, factorials are defined recursively, using the recurrence relation

(n+1)! = (n+1)(n!) Doubtless you used this fact in completing the table in Exercise 7.1.

The following algorithm for calculating n! also uses this recurrence relation. Example 7.3. Here is an algorithm to calculate n! for any non-negative integer n. Step 0. Input a non-negative integer n. Step la. m :=1. Step lb. k :=1. Step 2. If n = 0, then output m and stop. Step 3. While k < n+l, do Step 3a. m:=(m)(k).

Step 3b. k :=k-+l. Step 4. Output m. Step 5. Stop. Exercise 7.2. Implement this algorithm for n = 5, showing the values of m and k at each step. Generalizing Examples 7.1 and 7.2, we have the following result. Result 7.1 Suppose that we have a set of n distinct items. The number of ordered lists without repetition that we can make from these is n!. An alternative statement of Result 7.1 is: The number of permutations of a set of n distinct items is n!. . Example 7.4 Suppose that in Example 7.2, we lay down just four of the13 cards in a row. The number of different arrangements possible is (13)(12)(ll)(10). This number is known as the number of permutations of 4 items chosen from 13 items and is often denoted by P(13,4). Exercise 7.3. A local newspaper receives 278 correct entries for a competition. The correct entries go into a draw to decide the first, second and third prize winners (no entry may receive more that one prize). (a) How many possibilities are there for the list of the first three prize winners? (b) Now suppose you send in a correct entry to the competition. In how many of the possible prize lists will your name appear as winner of the 1st prize? Of the 2nd prize? Of any of the three prizes? (c) Your friends Bernard and Caren also each send in a correct entry to the competition. In how many of the possible prize lists will you each win a prize? Exercise 7.4. How many integers have exactly four digits (in base 10)? How many of these have (a) all their digits distinct; (b) all distinct odd digits; (c) all distinct even digits?

Example 7.5. Since

)1)...(8)(9()1).....(8)(9)(10)(11)(12)(13()10)(11)(12)(13( =

the number (13)(12)(11)(10) can be expressed in factorial notation as 13!/9!. The following result generalizes Example 7.4 above. Result 7.2 Suppose that n and r are positive integers, with rn. Then the number P(n,r) of permutations of r items chosen from n items is given by

)!(!)1)......(2)(1(),(rn

nrnnnnrnP

=+=

Exercise 7.5. Without using a calculator, evaluate (a) P(20,2); (b) P(l0,3). Combinations and the binomial coefficients We next consider the problem of counting the number of ways of choosing a subset from a given set, where the order in which the items are selected is not important. Example 7.6 (a) A President, Secretary and Treasurer for the student Computing Society are elected from among 45 students. Given that no student can fill more than one of these posts, how many different selections are possible? (b) A set of three students is to be chosen from a class of 45 students to represent the class on the StaffStudent Consultative Committee. How many different selections are possible? (a) In this problem, the order of selection is important. So the number of different selections is (45)(44)(43) = P(45,3). (b) There are 45 ways of choosing the first student, then 44 ways of choosing the second and finally 43 ways of choosing the third. This gives us (45)(44)(43) = P(45,3) ways of choosing an ordered list of three students, just as for (a) above. But this time we are not interested in the order in which the students are chosen; all that interests us is the set of students selected. Suppose that A,B,C, is an ordered list of three students. Then we would get the same set {A,B,C} of students from any of the following six ordered lists:

A,B,C; A,C,B; B,A,C; B,C,A; C,A,B; G,B,A. You will recognize that any of the six possible permutations of a set of three items will give rise to the same unordered set. Thus among the (45)(44)(43) different ordered lists of three students, each possible set of three students occurs exactly 6 = 3! times. Thus the number of different sets of three students is (45)(44)(43) p(45,3) 3! 3!

In general, we call a subset of r items chosen from a set of n distinct items a combination of r items chosen from n items. The following result generalizes this example. Result 7.3 The number of different combinations of r items chosen from n items is P(n,r) / r!. Proof. There are P(n,r) different ordered lists that we could make of r items chosen from n items. But given any subset of r items, we can form r! different ordered lists of its elements. Thus the elements of each subset of r items occur on r! different lists. Hence the number of different subsets that can be chosen is P(n,r)/r!. We denote the number of combinations of r items chosen from n items by the symbol

C(n,r) or

rn

read n choose r.

Other notations in the literature that you may have met are n

rC and r

nC but we shall not

be using these symbols on this course.

Using Result 7.3, we can express

rn

in factorials. You will see that we have

rn

=!!)(

!rrn

n

From this expression, we can immediately deduce the following result, which is useful in calculations. .

Result 7.4: !r ! r)-(n

! nrn

rnn

=

=

The following example illustrates why

=

rn

nrn

, without using factorials.

Example 7.7. It is required to make cloth covers for the notice board for each of the 17 different sports clubs in the Athletic Union. There is only sufficient green cloth for 13

boards and the remainder are to be covered in blue. There are

1317

ways of choosing

13 boards to be covered in green, (leaving 4 boards to be covered blue); or, looked at

the other way round, there are

4

17 ways of choosing 4 boards to be covered in blue

(leaving 13 boards to be covered in green). So it is clear that these expressions should give the same answer. Thus,

2380)1)(2)(3)(4(

)14)(15)(16)(17(4

171317

==

=

Exercise 7.6. Evaluate (a)

1820

(b)

7

10

Now there is only one way of selecting a subset of size 0 from a set of n items (we choose none of them); similarly there is only one way of choosing a subset of size n (we choose all of the items). Thus we would

expect

0n

= 1 and 1=

nn

= 1. This is the reason why we defined 0! = 1. You will see

that with this definition, which must have seemed rather mysterious to you at the time,

the expression

rn

= !)!(

! nrn

n

holds for all values of r where nr 0 .

Exercise 7.7. A bridge club has 25 members. It is required to select a team of 6 for a competition. In how many ways can this be done if

(a) all members are equally eligible for selection; (b) a given member has already been selected as captain and must be included in

the team? Exercise 7.8. (a) There are 12 hockey teams in a league and during the season they must each play one another once. How many matches need to be organised in a season? (b) 12 points are marked on the circumference of a circle and a chord is drawn to join each pair of points. How many chords are there altogether? Summary of strategies for counting problems The methods that we have discussed in this chapter and in Chapter 1 have all applied to situations where we can divide the problem into stages, count the number of ways of completing each stage and then apply the multiplication principle of counting. Another way of viewing these problems is that they can all be illustrated by a counting tree, as shown in Chapter 1. When you are faced with a problem of this type, you need to analyse it very carefully before applying one of the formulae we have derived in this chapter. If you rely solely on memorizing the formulae you may use the wrong one! There are three main types of counting problem that students tend to confuse. (1) Sequences with repetition allowed. In this type, we require to find the number of possible sequences where each term is drawn from a given set and repetitions are allowed. Examples: Binary strings; codes, such as telephone numbers, car numbers, codewords, etc.; integers using a given subset of digits. If the number of choices for each term of the sequence is a constant number n, say, then the solution is nr, where r is the length of the sequence.

(2) Sequences with no repetitions allowed. In this type, we require to count the number of different arrangements of a given set. Examples: Permutations of a set; lists; arrangements of objects in a row; integers with distinct digits; teams in which each person is chosen to perform a distinct task, etc. The number of different arrangements of r distinct objects chosen from a set of n distinct objects is P(n,r).

(3) Choosing a subset of a given set. In this case, we are interested only in the subset and the order in which the elements are selected is not important. Examples: teams where the members are not chosen to fulfill different functions; hands of cards, etc. The number of ways of selecting a subset of size r from a set of size n is C(n,r). Now try these mixed problems. Ask yourself in each case the following questions:

A. Does the order of selection matter (types 1 and 2) or am I asked for a subset (type 3)? B. If the order of selection matters, is repetition allowed (type 1)or not allowed (type 2)?

Exercise 7.9. A list of alternative answers is given at the end of this exercise. For each of the following questions, decide which (if any) is the correct answer and say why. (a) The object of the game of Mastermind is to guess a secret code that is formed by placing 4 coloured pegs in a row. There are six different coloured pegs available. How many different secret codes can be formed if (1) repetitions of colours are allowed; (ii) no repetitions are allowed? (b) I have a pile of six pegs, each one in a different colour. I want to choose a set of four of these pegs. How many different ways can this be done? Suggested answers: (1) C(6,4); (2) P(6,4); (3) 46; (4) 64. The Binomial Theorem and Pascals triangle Our next theorem has many applications, not only to combinatorial counting problems and in algebra, but also in probability theory. Theorem 7.5. (The Binomial Theorem). Let n be any non-negative integer. Then

nrrnnnn yxnn

yxrn

yxn

yxn

yx 0110 ..............10

)(

++

++

+

=+

Although this theorem can be proved by induction on n, there is a combinatorial proof that is not only shorter, but gives more insight into how the numbers n choose r1 come to be the coefficients of the terms in this expansion. As a prelude to the proof, work the following problem. Exercise 7.10. Use the distributive laws to expand the products

(a) (x1+y1) (x2 +y2 ) (b) (x1 + y1 ) (x 2+y2 )( x3 + y3)

Your answer to Exercise 7.10 (a) should be the sum of four terms, with the following properties: (1) each term is the product of two letters; (ii) one of the letters in each product has a subscript 1 and the other has subscript 2. Your answer to (b) should be the sum of eight terms, such that each term is the product of three letters, and the letters in each product have subscripts 1, 2 and 3 respectively. Now the role of the subscripts is to tell us which bracket the letters come from, so we can say that one letter in each product comes from each of the three brackets. In general, when we expand the product of n brackets (x1+y1 )(x2+y2 ). . . (x~+yn), each term is the product of n letters, one from each of the brackets (this can be proved quite simply by induction). With this observation, we are ready to prove the Binomial Theorem. Proof of the Binomial Theorem. Consider first the product (x1 + y1 ) (x2 + y2)... (xn+ yn). Each term is the product of n letters, one from each of the brackets. The number of products in which exactly r of the letters are ys (and hence nr letters are xs) is just the number of ways in which we could choose a set of r subscripts {1, 2, 3, 4 .n};

this gives

rn

. Deleting all the subscripts, each product of n letters in which r are ys

becomes x n-ryr, and the product (x1+y1)(x2y2)...(xn+yn) becomes (x+y) n. So we obtain

nnrrnnnn yxnn

yxrn

yxn

yxn

yx

+

++

+

=+ ...............

10)( 110

Because of their occurrence in the Binomial Theorem, the numbers In are often referred to as binomial coefficients. Example 7.8. We use the Binomial Theorem to expand (x+y)5

504114055

55

45

.........15

05

)( yxyxyxyxyx

+

++

+

=+...