permutations & combinations: selected exercises

25
Permutations & Combinations: Selected Exercises

Upload: moana-marshall

Post on 01-Jan-2016

52 views

Category:

Documents


9 download

DESCRIPTION

Permutations & Combinations: Selected Exercises. Preliminaries. Denote the # of arrangements of some k elements of a set of n elements as P(n,k) . Use the product rule to derive a formula for P(n,k) . Let C(n,k) be the # of subsets of k elements drawn from a set of n elements. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Permutations & Combinations:  Selected Exercises

Permutations & Combinations: Selected Exercises

Page 2: Permutations & Combinations:  Selected Exercises

2

Preliminaries

Denote the # of arrangements of some k elements of a set of n elements as P(n,k).

Use the product rule to derive a formula for P(n,k).

Let C(n,k) be the # of subsets of k elements drawn from a set of n elements.

Use the product rule to derive a formula for C(n,k) in terms of P(n,k) & P(k,k).

Page 3: Permutations & Combinations:  Selected Exercises

3

10

There are 6 different candidates for governor.

In how many different orders can the names of the candidates be printed on a ballot?

Page 4: Permutations & Combinations:  Selected Exercises

4

10 Solution

The # of different orders that the candidate names can be

printed on a ballot is described by the following procedure:

1. Pick the candidate that appears on top (6)

2. Pick the candidate that appears below that (5)

3. Pick the candidate that appears below that (4)

4. Pick the candidate that appears below that (3)

5. Pick the candidate that appears below that (2)

6. Pick the candidate that appears below that (1)

The composite number is 6 . 5 . 4 . 3 . 2 . 1 = 720.

This also is known as P(6,6).

Page 5: Permutations & Combinations:  Selected Exercises

5

20 (a)

How many bit strings of length 10 have exactly 3 0s?

Page 6: Permutations & Combinations:  Selected Exercises

6

20 (a) Solution

The bit string has 10 positions: 1, 2, …, 10.

A bit string with exactly 3 0s can be described as a 3-

subset of the numbers 1, 2, …, 10.

These are the bit positions where the 0s go.

There are C(10, 3) such 3-subsets.

For each such 3-subset, the other positions take 1s.

There is 1 way to do that.

The answer thus is C(10, 3) = 10 . 9 . 8 / 3 . 2 . 1 = 120.

Page 7: Permutations & Combinations:  Selected Exercises

7

20 (b)

How many bit strings of length 10 have more 0s than 1s?

Page 8: Permutations & Combinations:  Selected Exercises

8

20 (b) Solution 1

We can decompose this problem into disjoint sub-problems,

and count each sub-problem:

1. 6 0s and 4 1s: C(10, 6) = C(10, 4) = 10.9.8.7 / 4.3.2 = 210

2. 7 0s and 3 1s: C(10, 7) = C(10, 3) = 10 . 9 . 8 / 3 . 2 = 120

3. 8 0s and 2 1s: C(10, 8) = C(10, 2) = 10 . 9 / 2 = 45

4. 9 0s and 1 1: C(10, 9) = C(10, 1) = 10

5. 10 0s and 0 1s : C(10, 10) = C(10, 0) = 1

The answer thus is

C(10, 4) + C(10, 3) + C(10, 2) + C(10, 1) + C(10, 0)

= 210 + 120 + 45 + 10 + 1 = 386.

Page 9: Permutations & Combinations:  Selected Exercises

9

20 (b) Solution 1

Is the following analysis right?1. Pick the positions of 6 0s:

C(10, 6) = C(10, 4)

2. Fill in the other 4 positions: 24

C(10, 4) 24 = 3,360 386.

What is wrong?

Page 10: Permutations & Combinations:  Selected Exercises

10

20 (b) Solution 2

1. There is a 1-to-1 correspondence between

• strings with more 0s than 1s

• strings with more 1s than 0s

2. Strategy:

1. C(10, 5) = the # of strings with an equal # of 1s & 0s.

2. 210 – C(10, 5) = the # with an unequal # of 1s & 0s.

3. (210 – C(10, 5) ) / 2 = the # with more 0s than 1s.

C(10, 5) = 10.9.8.7.6 / 5.4.3.2.1 = 252

(1024 – 252)/2 = 386.

Page 11: Permutations & Combinations:  Selected Exercises

11

20 (c)

How many bit strings of length 10 have ≥ 7 1s?

Page 12: Permutations & Combinations:  Selected Exercises

12

20 (c) Solution

We can decompose this problem into disjoint sub-problems,

and count each sub-problem:

1. 7 1s and 3 0s: C(10, 7) = C(10, 3) = 10 . 9 . 8 / 3 . 2 = 120

2. 8 1s and 2 0s : C(10, 8) = C(10, 2) = 10 . 9 / 2 = 45

3. 9 1s and 1 0: C(10, 9) = C(10, 1) = 10

4. 10 1s and 0 0s : C(10, 10) = C(10, 0) = 1

The answer thus is

C(10, 3) + C(10, 2) + C(10, 1) + C(10, 0) = 120 + 45 + 10 + 1 = 176.

Page 13: Permutations & Combinations:  Selected Exercises

13

20 (d)

How many bit strings of length 10 have ≥ 3 1s?

Page 14: Permutations & Combinations:  Selected Exercises

14

20 (d) Solution

We can decompose this problem into disjoint sub-problems,

and count each sub-problem.

In this case, it is easier to count the number of 10-bit strings

w/o the property & subtract from the # of 10-bit strings

(210):

1. 0 1s and 10 0s: C(10, 0) = 1

2. 1 1 and 9 0s: C(10, 1) = 10

3. 2 1s and 8 0s: C(10, 2) = 45

The answer thus is

210 – (1 + 10 + 45) = 1024 – 56 = 968.

Page 15: Permutations & Combinations:  Selected Exercises

15

30 (a)

There are 7 women & 9 men.

How many ways are there to select a committee of 5

members, with at least 1 woman?

Note: In such problems, it is customary and implicit to take

individuals as distinct.

Page 16: Permutations & Combinations:  Selected Exercises

16

30 (a)

Consider using the product rule:

1. Pick 1 woman: C(7,1).

2. Pick 4 people from the remaining 6

women & 9 men: C(15,4).

Is the answer: C(7,1) C(15,4)?

Given a committee of men & women, can you identify

the stage at which each woman was chosen?

Page 17: Permutations & Combinations:  Selected Exercises

17

30 (a) Solution

Decompose the problem into disjoint sub-problems:1. The committee has 1 woman:

1. Pick the woman: C(7, 1) = 72. Pick the men: C(9, 4) = 9 . 8 . 7 . 6 / 4 . 3 . 2 = 126

2. The committee has 2 women:1. Pick the women: C(7, 2) = 7 . 6 / 2 = 212. Pick the men: C(9, 3) = 9 . 8 . 7 / 3 . 2 = 84

– The committee has 3 women: C(7, 3) . C(9, 2) = 35 . 36– The committee has 4 women: C(7, 4) . C(9, 1) = 35 . 9– The committee has 5 women: C(7, 5) . C(9, 0) = 21 . 1

The answer is C(7, 1)C(9, 4) + C(7, 2)C(9, 3) + C(7, 3)C(9, 2) + C(7, 4)C(9, 1) +

C(7,5)C(9, 0) = 7 . 126 + 21 . 84 + 35 . 36 + 35 . 9 + 21 . 1 = 4,242.

Page 18: Permutations & Combinations:  Selected Exercises

18

30 (a) More Elegant Solution

The set of all committees with 5 members is the

universe. Its size is C(7 + 9, 5).

Subtract all committees w/o women: C(9, 5).

The answer is C(16, 5) – C(9, 5) = 4,368 – 126 = 4,242.

Page 19: Permutations & Combinations:  Selected Exercises

19

30 (b)

There are 7 women & 9 men.

How many ways are there to select a committee of 5

members, with ≥ 1 woman and ≥ 1 man?

Page 20: Permutations & Combinations:  Selected Exercises

20

30 (b) Solution

Subtract “bad” committees from all 5-committees:

1. The # of all 5-committees: C(16, 5)

2. The # of 5-committees w/o women: C(9, 5)

3. The # of 5-committees w/o men: C(7, 5)

The answer: C(16, 5) – C(9, 5) – C(7, 5)

= 4,368 – 126 – 21 = 4,221.

Page 21: Permutations & Combinations:  Selected Exercises

21

40

How many ways are there to seat 6 people around a

circular table, where 2 seatings, A & B, are

equivalent if A is a rotation of B?

A

1

5

6 2

3

4

B

6

4

5 1

23

equivalent

Page 22: Permutations & Combinations:  Selected Exercises

22

40 Solution

If the people sat in a line the answer is 6!

If we drag the line seating into a circle, 6 rotations

(permutations) of that “line seating” are equivalent.

The answer is 6!/6 = 5!

The equivalence relation has 5! equivalence classes, each with 6

elements.

Alternatively:

1. Fix person1 at the head of the table: 1

2. Arrange the other 5 people at the table: 5!

Page 23: Permutations & Combinations:  Selected Exercises

23

Computing C(n,k)

How many ways are there to select a team of k players from a set of n players, with a particular player named as captain?

1. Pick the k players: C(n,k)

2. Pick the captain: C(k,1) = k

Equivalently,1. Pick the captain: C(n,1) = n

2. Pick the remainder of the team: C(n-1,k-1)

Page 24: Permutations & Combinations:  Selected Exercises

24

Computing C(n,k)

C(n,k)k = n C(n-1,k-1)

C(n,k) = n/k C(n-1,k-1).

Apply the above recursively, with a base case of C(n,1) = n:C(n,k) = n(n-1) . . . (n - k +1) /k!

For example,C(1000, 4) = 1000 . 999 . 998 . 997 / 4 . 3 . 2 . 1

Give an argument why, in general, each factor in the denominator divides some factor in the numerator.

Page 25: Permutations & Combinations:  Selected Exercises

25

Characters

. ≥ ≡ ~

Ω Θ

Σ ¢