28

Permutations and Combinations

  • Upload
    dyre

  • View
    30

  • Download
    0

Embed Size (px)

DESCRIPTION

Permutations and Combinations. Lesson 8 HAND OUT REFERENCE SHEET AND GO OVER IT. Permutations vs. Combinations. Both are ways to count the possibilities The difference between them is whether order matters or not Consider a poker hand: A ♦, 5♥, 7♣, 10♠, K♠ Is that the same hand as: - PowerPoint PPT Presentation

Citation preview

Page 1: Permutations and Combinations
Page 2: Permutations and Combinations

22

Permutations and Permutations and CombinationsCombinations

Lesson 8Lesson 8

HAND OUT REFERENCE SHEET HAND OUT REFERENCE SHEET AND GO OVER ITAND GO OVER IT

Page 3: Permutations and Combinations

33

Permutations vs. CombinationsPermutations vs. Combinations

Both are ways to count the possibilitiesBoth are ways to count the possibilitiesThe difference between them is whether order The difference between them is whether order matters or notmatters or notConsider a poker hand:Consider a poker hand: AA♦, 5♥, 7♣, 10♠, K♠♦, 5♥, 7♣, 10♠, K♠

Is that the same hand as:Is that the same hand as: K♠, 10♠, 7♣, 5♥, K♠, 10♠, 7♣, 5♥, AA♦♦

Does the order the cards are handed out Does the order the cards are handed out matter?matter? If yes, then we are dealing with permutationsIf yes, then we are dealing with permutations If no, then we are dealing with combinationsIf no, then we are dealing with combinations

Page 4: Permutations and Combinations

44

PermutationsPermutations

A permutation is an ordered arrangement of the A permutation is an ordered arrangement of the elements of some set elements of some set SS Let Let SS = {a, b, c} = {a, b, c} c, b, a is a permutation of Sc, b, a is a permutation of S b, c, a is a b, c, a is a different different permutation of Spermutation of S

An An rr-permutation is an ordered arrangement of -permutation is an ordered arrangement of rr elements of the setelements of the set AA♦, 5♥, 7♣, 10♠, K♠ is a 5-permutation of the set of ♦, 5♥, 7♣, 10♠, K♠ is a 5-permutation of the set of

cardscards

The notation for the number of The notation for the number of rr-permutations: -permutations: PP((nn,,rr))

The poker hand is one of P(52,5) permutationsThe poker hand is one of P(52,5) permutations

Page 5: Permutations and Combinations

55

PermutationsPermutations

Number of poker hands (5 cards):Number of poker hands (5 cards): PP(52,5) = 52*51*50*49*48 = 311,875,200(52,5) = 52*51*50*49*48 = 311,875,200

Number of (initial) blackjack hands (2 cards):Number of (initial) blackjack hands (2 cards): PP(52,2) = 52*51 = 2,652(52,2) = 52*51 = 2,652

rr-permutation notation: -permutation notation: PP((nn,,rr)) The poker hand is one of P(52,5) permutationsThe poker hand is one of P(52,5) permutations

)1)...(2)(1(),( rnnnnrnP

)!(

!

rn

n

n

rni

i1

Page 6: Permutations and Combinations

66

rr-permutations example-permutations example

How many ways are there for 5 people in How many ways are there for 5 people in this class to give presentations?this class to give presentations?

There are 27 students in the classThere are 27 students in the class P(27,5) = 27*26*25*24*23 = 9,687,600P(27,5) = 27*26*25*24*23 = 9,687,600 Note that the order they go in does matter in Note that the order they go in does matter in

this example!this example!

Page 7: Permutations and Combinations

77

Permutation formula proofPermutation formula proof

There are There are nn ways to choose the first ways to choose the first elementelement nn-1 ways to choose the second-1 ways to choose the second nn-2 ways to choose the third-2 ways to choose the third …… nn--rr+1 ways to choose the +1 ways to choose the rrthth element element

By the product rule, that gives us:By the product rule, that gives us:

PP((nn,,rr) = ) = nn((nn-1)(-1)(nn-2)…(-2)…(nn--rr+1)+1)

Page 8: Permutations and Combinations

88

Permutations vs. Permutations vs. rr-permutations-permutations

rr-permutations: Choosing an ordered 5 -permutations: Choosing an ordered 5 card hand is card hand is PP(52,5)(52,5) When people say “permutations”, they almost When people say “permutations”, they almost

always mean always mean rr-permutations-permutationsBut the name can refer to bothBut the name can refer to both

Permutations: Choosing an order for all 52 Permutations: Choosing an order for all 52 cards is cards is PP(52,52) = 52!(52,52) = 52! Thus, Thus, PP((nn,,nn) = ) = nn!!

Page 9: Permutations and Combinations

99

Question 3Question 3

How many permutations of {a, b, c, d, e, f, g} How many permutations of {a, b, c, d, e, f, g} end with a?end with a? Note that the set has 7 elementsNote that the set has 7 elements

The last character must be aThe last character must be a The rest can be in any orderThe rest can be in any order

Thus, we want a 6-permutation on the set {b, c, Thus, we want a 6-permutation on the set {b, c, d, e, f, g} d, e, f, g} P(6,6) = 6! = 720P(6,6) = 6! = 720

Why is it not P(7,6)?Why is it not P(7,6)?

Page 10: Permutations and Combinations

1010

CombinationsCombinations

What if order What if order doesn’tdoesn’t matter? matter?

In poker, the following two hands are equivalent:In poker, the following two hands are equivalent: AA♦, 5♥, 7♣, 10♠, K♠♦, 5♥, 7♣, 10♠, K♠ K♠, 10♠, 7♣, 5♥, K♠, 10♠, 7♣, 5♥, AA♦♦

The number of The number of rr-combinations of a set with -combinations of a set with nn elements, where elements, where nn is non-negative and 0≤ is non-negative and 0≤rr≤≤nn is: is:

)!(!

!),(

rnr

nrnC

Page 11: Permutations and Combinations

1111

Combinations exampleCombinations example

How many different poker hands are there How many different poker hands are there (5 cards)?(5 cards)?

How many different (initial) blackjack How many different (initial) blackjack hands are there?hands are there?

2,598,960!47*1*2*3*4*5

!47*48*49*50*51*52

!47!5

!52

)!552(!5

!52)5,52(

C

1,3261*2

51*52

!50!2

!52

)!252(!2

!52)2,52(

C

Page 12: Permutations and Combinations

1212

Combination formula proofCombination formula proof

Let Let CC(52,5) be the number of ways to generate (52,5) be the number of ways to generate unordered poker handsunordered poker hands

The number of ordered poker hands is The number of ordered poker hands is PP(52,5) = (52,5) = 311,875,200311,875,200

The number of ways to order a single poker The number of ways to order a single poker hand is hand is PP(5,5) = 5! = 120(5,5) = 5! = 120

The total number of unordered poker hands is The total number of unordered poker hands is the total number of ordered hands divided by the the total number of ordered hands divided by the number of ways to order each handnumber of ways to order each hand

Thus, Thus, CC(52,5) = (52,5) = PP(52,5)/(52,5)/PP(5,5)(5,5)

Page 13: Permutations and Combinations

1313

Combination formula proofCombination formula proof

Let Let CC((nn,,rr) be the number of ways to generate ) be the number of ways to generate unordered combinationsunordered combinationsThe number of ordered combinations (i.e. The number of ordered combinations (i.e. rr--permutations) is permutations) is PP((nn,,rr))The number of ways to order a single one of The number of ways to order a single one of those those rr-permutations -permutations PP((r,rr,r) ) The total number of unordered combinations is The total number of unordered combinations is the total number of ordered combinations (i.e. the total number of ordered combinations (i.e. rr--permutations) divided by the number of ways to permutations) divided by the number of ways to order each combinationorder each combinationThus, Thus, CC((n,rn,r) = ) = PP((n,rn,r)/)/PP((r,rr,r))

Page 14: Permutations and Combinations

1414

Combination formula proofCombination formula proof

Note that the textbook explains it slightly Note that the textbook explains it slightly differently, but it is same proofdifferently, but it is same proof

)!(!

!

)!/(!

)!/(!

),(

),(),(

rnr

n

rrr

rnn

rrP

rnPrnC

Page 15: Permutations and Combinations

1515

Question 11Question 11

How many bit strings of length 10 contain:How many bit strings of length 10 contain:a)a) exactly four 1’s?exactly four 1’s?

Find the positions of the four 1’sFind the positions of the four 1’sDoes the order of these positions matter?Does the order of these positions matter?

Nope!Nope!Positions 2, 3, 5, 7 is the same as positions 7, 5, 3, 2Positions 2, 3, 5, 7 is the same as positions 7, 5, 3, 2

Thus, the answer is Thus, the answer is CC(10,4) = 210(10,4) = 210

b)b) at most four 1’s?at most four 1’s?There can be 0, 1, 2, 3, or 4 occurrences of 1There can be 0, 1, 2, 3, or 4 occurrences of 1Thus, the answer is:Thus, the answer is:

CC(10,0) + (10,0) + CC(10,1) + (10,1) + CC(10,2) + (10,2) + CC(10,3) + (10,3) + CC(10,4)(10,4)= 1+10+45+120+210= 1+10+45+120+210= 386= 386

Page 16: Permutations and Combinations

1616

Question 11Question 11

How many bit strings of length 10 contain:How many bit strings of length 10 contain:c)c) at least four 1’s?at least four 1’s?

There can be 4, 5, 6, 7, 8, 9, or 10 occurrences of 1There can be 4, 5, 6, 7, 8, 9, or 10 occurrences of 1Thus, the answer is:Thus, the answer is:

c)c) CC(10,4) + (10,4) + CC(10,5) + (10,5) + CC(10,6) + (10,6) + CC(10,7) + (10,7) + CC(10,8) + (10,8) + CC(10,9) (10,9) + + CC(10,10)(10,10)= 210+252+210+120+45+10+1= 210+252+210+120+45+10+1= 848= 848

Alternative answer: subtract from 2Alternative answer: subtract from 21010 the number of the number of strings with 0, 1, 2, or 3 occurrences of 1strings with 0, 1, 2, or 3 occurrences of 1

an equal number of 1’s and 0’s?an equal number of 1’s and 0’s?Thus, there must be five 0’s and five 1’sThus, there must be five 0’s and five 1’sFind the positions of the five 1’sFind the positions of the five 1’sThus, the answer is Thus, the answer is CC(10,5) = 252(10,5) = 252

Page 17: Permutations and Combinations

1717

Corollary 1Corollary 1

Let Let nn and and rr be non-negative integers with be non-negative integers with rr ≤ ≤ nn. Then . Then CC((nn,,rr) = ) = CC((nn,,n-rn-r))

Proof:Proof:

)!(!

!),(

rnr

nrnC

! )()!(

!),(

rnnrn

nrnnC

)!(!

!

rnr

n

Page 18: Permutations and Combinations

1818

Corollary exampleCorollary example

There are C(52,5) ways to pick a 5-card poker There are C(52,5) ways to pick a 5-card poker handhand

There are C(52,47) ways to pick a 47-card handThere are C(52,47) ways to pick a 47-card hand

P(52,5) = 2,598,960 = P(52,47)P(52,5) = 2,598,960 = P(52,47)

When dealing 47 cards, you are picking 5 cards When dealing 47 cards, you are picking 5 cards to not dealto not deal As opposed to picking 5 card to dealAs opposed to picking 5 card to deal Again, the order the cards are dealt in does matterAgain, the order the cards are dealt in does matter

Page 19: Permutations and Combinations

1919

Combinatorial proofCombinatorial proof

A A combinatorial proofcombinatorial proof is a proof that uses counting arguments to is a proof that uses counting arguments to prove a theoremprove a theorem

Rather than some other method such as algebraic techniquesRather than some other method such as algebraic techniques

Essentially, show that both sides of the proof manage to count the Essentially, show that both sides of the proof manage to count the same objectssame objects

In a typical Rosen example, he does not do much with this proof In a typical Rosen example, he does not do much with this proof method in this sectionmethod in this section

We will see more in the next sectionsWe will see more in the next sections

Most of the questions in this section are phrased as, “find out how Most of the questions in this section are phrased as, “find out how many possibilities there are if …”many possibilities there are if …”

Instead, we could phrase each question as a theorem:Instead, we could phrase each question as a theorem: ““Prove there are Prove there are xx possibilities if …” possibilities if …” The same answer could be modified to be a combinatorial proof to the The same answer could be modified to be a combinatorial proof to the

theoremtheorem

Page 20: Permutations and Combinations

2020

Question 40Question 40

How many ways are there to sit 6 people around a circular table, How many ways are there to sit 6 people around a circular table, where seatings are considered to be the same if they can be where seatings are considered to be the same if they can be obtained from each other by rotating the table?obtained from each other by rotating the table?

First, place the first person in the north-most chairFirst, place the first person in the north-most chair Only one possibilityOnly one possibility

Then place the other 5 peopleThen place the other 5 people There are P(5,5) = 5! = 120 ways to do thatThere are P(5,5) = 5! = 120 ways to do that

By the product rule, we get 1*120 =120By the product rule, we get 1*120 =120

Alternative means to answer this:Alternative means to answer this:

There are P(6,6)=720 ways to seat the 6 people around the tableThere are P(6,6)=720 ways to seat the 6 people around the table

For each seating, there are 6 “rotations” of the seatingFor each seating, there are 6 “rotations” of the seating

Thus, the final answer is 720/6 = 120Thus, the final answer is 720/6 = 120

Page 21: Permutations and Combinations

2121

Question 42Question 42

How many ways are there for 4 horses to finish if ties are allowed?How many ways are there for 4 horses to finish if ties are allowed? Note that order does matter!Note that order does matter!

Solution by casesSolution by cases No tiesNo ties

The number of permutations is P(4,4) = 4! = 24The number of permutations is P(4,4) = 4! = 24 Two horses tieTwo horses tie

There are There are CC(4,2) = 6 ways to choose the two horses that tie(4,2) = 6 ways to choose the two horses that tieThere are There are PP(3,3) = 6 ways for the “groups” to finish(3,3) = 6 ways for the “groups” to finish

A “group” is either a single horse or the two tying horsesA “group” is either a single horse or the two tying horses

By the product rule, there are 6*6 = 36 possibilities for this caseBy the product rule, there are 6*6 = 36 possibilities for this case Two groups of two horses tieTwo groups of two horses tie

There are There are CC(4,2) = 6 ways to choose the two winning horses(4,2) = 6 ways to choose the two winning horsesThe other two horses tie for second placeThe other two horses tie for second place

Three horses tie with each otherThree horses tie with each otherThere are There are CC(4,3) = 4 ways to choose the two horses that tie(4,3) = 4 ways to choose the two horses that tieThere are There are PP(2,2) = 2 ways for the “groups” to finish(2,2) = 2 ways for the “groups” to finishBy the product rule, there are 4*2 = 8 possibilities for this caseBy the product rule, there are 4*2 = 8 possibilities for this case

All four horses tieAll four horses tieThere is only one combination for thisThere is only one combination for this

By the sum rule, the total is 24+36+6+8+1 = 75By the sum rule, the total is 24+36+6+8+1 = 75

Page 22: Permutations and Combinations

2222

A last note on combinationsA last note on combinations

An alternative (and more common) way to An alternative (and more common) way to denote an denote an rr-combination:-combination:

I’ll use C(I’ll use C(nn,,rr) whenever possible, as it is ) whenever possible, as it is easier to write in PowerPointeasier to write in PowerPoint

r

nrnC ),(

Page 23: Permutations and Combinations

EXAMPLE 1EXAMPLE 1

A home security system had buttons A home security system had buttons numbered 0 through 9. The system can numbered 0 through 9. The system can be disarmed by pressing 3 different be disarmed by pressing 3 different buttons in the correct sequence. How buttons in the correct sequence. How man different 3-button sequences are man different 3-button sequences are possible?possible?

PermutationPermutation

n = 10, r = 3n = 10, r = 32323

Page 24: Permutations and Combinations

Example 2Example 2

Janie has 12 CDs. Her CD player holds 3 Janie has 12 CDs. Her CD player holds 3 CDs at a time. How many ways can she CDs at a time. How many ways can she choose 3 CDs to put into her CD player?choose 3 CDs to put into her CD player?

CombinationCombination

n = 12n = 12

r = 3r = 3

2424

Page 25: Permutations and Combinations

Example 3Example 3

A committee of 3 students is to be chosen A committee of 3 students is to be chosen from a group of 5 students. Jason, Lily, from a group of 5 students. Jason, Lily, and Mariene are students in the group. and Mariene are students in the group. What is the probability that all 3 of them What is the probability that all 3 of them will be chosen for the committee?will be chosen for the committee?

2525

Page 26: Permutations and Combinations

2626

Page 27: Permutations and Combinations

2727

Page 28: Permutations and Combinations

2828