- Home
- Documents
*L14: Permutations, Combinations and Some L14: Permutations, Combinations and Some Review EECS 203:...*

prev

next

out of 58

View

2Download

0

Embed Size (px)

L14: Permutations, Combinations and Some Review

EECS 203: Discrete Mathematics

Last time we did a number of things

• Looked at the sum, product, subtraction and division rules.

– Don’t need to know by name.

• Spent a while on the Pigeonhole Principle

– Including the generalized version.

– Worked a few complex examples.

• They were tricky!

• Started on Combinations and Permutations.

Review: Pigeonhole Principle

• “Simple” problem:

– Prove that if you have 51 unique numbers 1 to 100 there exists a pair in that 51 which sum to 100.

Review: Pigeonhole Principle

• “Old” problem

– Say we have five distinct points (xi, yi) for i= 1 to 5. And say all x and y values are integers. Now draw lines connecting each pair of points. Prove that the midpoint of at least one of those lines has an x,y location where both x and y are integers.

And a tricky one

• Claim: Every sequence of n2+1 distinct real numbers contains a subsequence of length n+1 that is either strictly increasing or strictly decreasing

• Example: Seq of 32+1 numbers (3,1,0,2,6,5,4,9,8,7) has increasing subsequence of length 3+1 (0,2,6,9)

• Proof using PP

– What are the pigeons?

– What are the holes?

Permutations & Combinations

• n! = n(n-1)(n-2)…321

• Permutations

– P(n,k) = Number of ways to choose k things (order counts!) out of n thingsngs in order: 6 (brush, floss), (brush, gargle), (floss, brush), (floss, gargle), (gargle, brush), (gargle, floss)

P(n,3) = #ways to do three things in order: 6 (brush, floss, gargle), (brush, gargle, floss), (floss, brush, gargle), (floss, gargle, brush), (gargle, brush, floss), (gargle, floss, brush)

Permutations & Combinations

• n! = n(n-1)(n-2)…321

• Permutations

– P(n,k) = Number of ways to choose k things (order counts!) out of n things

– Example. n=3. Three things: {brush teeth, floss, gargle}

P(n,1) = #ways to do one thing: 3 (brush), (floss), (gargle)

P(n,2) = #ways to do two things in order: 6 (brush, floss), (brush, gargle), (floss, brush), (floss, gargle), (gargle, brush), (gargle, floss)

P(n,3) = #ways to do three things in order: 6 (brush, floss, gargle), (brush, gargle, floss), (floss, brush, gargle), (floss, gargle, brush), (gargle, brush, floss), (gargle, floss, brush)

Permutations & Combinations

• n! = n(n-1)(n-2)…321

• Permutations

– P(n,k) = Number of ways to choose k things (order counts!) out of n things

– P(n,k) = n(n-1)…(n-k+1) =

n choices for

first thing n-1 choices for

second thing

n-k+1 choices

for kth thing

n!

(n - k)!

Permutations & Combinations

• n! = n(n-1)(n-2)…321 • Permutations

– P(n,k) = Number of ways to choose k things (order counts!) out of n things

• Combinations – C(n,k) = Number of ways to choose a set of k things (order

doesn’t matter) out of n things

Example: {brush, floss, gargle} C(n,1) = #ways to choose one thing: 3 {brush}, {floss}, {gargle} C(n,2) = #ways to do choose two things: 3 {brush, floss}, {brush, gargle}, {floss, gargle} C(n,3) = #ways to choose three things: 1 {brush, floss, gargle}

Permutations & Combinations

• n! = n(n-1)(n-2)…321

• Permutations – P(n,k) = Number of ways to choose k things (order counts!) out of n things

• Combinations – C(n,k) = Number of ways to choose a set of k things (order

doesn’t matter) out of n things

– Example: n=3. Three things: {brush, floss, gargle}

C(n,1) = #ways to choose one thing: 3 {brush}, {floss}, {gargle}

C(n,2) = #ways to choose two things: 3 {brush, floss}, {brush, gargle}, {floss, gargle} C(n,3) = #ways to choose three things: 1 {brush, floss, gargle}

Permutations & Combinations • n! = n(n-1)(n-2)…321

• Permutations – P(n,k) = Number of ways to choose k things (order counts!) out of n things

• Combinations

– C(n,k) = Number of ways to choose a set of k things (order doesn’t matter) out of n things

– C(n,k) =

P(n,k)

k! =

n!

(n - k)! k! =

n

k

æ

è ç

ö

ø ÷ read “n choose k”

Poker Hands

How many ways to make a pair?

Number of different hands:

Lowest

Highest

52

5

æ

è ç

ö

ø ÷ =

52 × 51× 50 × 49 × 48

5! = 2,598,960

Problem 2: How many ways to make a pair?

• Select a hand with one pair in stages: – Stage 1: Pair of what? Choose a number or face card

Stage 2: Choose which suits (from stage 1)

= 6 choices

Stage 3: Choose third card (different than stage 1)

(52-4) = 48 choices Stage 4: Choose fourth card (different than stages 1&3)

(52-8) = 44 choices Stage 5: Choose fifth card (different than stages 1,3,4)

(52-12) = 40 choices

Problem 2: How many ways to make a pair?

• Select a hand with one pair in stages: – Stage 1: Pair of what? Choose a number or face card

13 choices – Stage 2: Choose which suits (from stage 1)

Stage 3: Choose third card (different than stage 1)

(52-4) = 48 choices Stage 4: Choose fourth card (different than stages 1&3)

(52-8) = 44 choices Stage 5: Choose fifth card (different than stages 1,3,4)

(52-12) = 40 choices

Problem 2: How many ways to make a pair?

• Select a hand with one pair in stages: – Stage 1: Pair of what? Choose a number or face card

13 choices – Stage 2: Choose which suits (from stage 1)

6 choices

– Stage 3: Choose third card (different than stage 1)

Stage 4: Choose fourth card (different than stages 1&3) (52-8) = 44 choices

Stage 5: Choose fifth card (different than stages 1,3,4) (52-12) = 40 choices

Problem 2: How many ways to make a pair?

• Select a hand with one pair in stages: – Stage 1: Pair of what? Choose a number or face card

13 choices – Stage 2: Choose which suits (from stage 1)

6 choices

– Stage 3: Choose third card (different than stage 1)

(52-4) = 48 choices – Stage 4: Choose fourth card (different than stages 1&3)

– Stage 5: Choose fifth card (different than stages 1,3,4)

Problem 2: How many ways to make a pair?

• Select a hand with one pair in stages: – Stage 1: Pair of what? Choose a number or face card

13 choices – Stage 2: Choose which suits (from stage 1)

6 choices

– Stage 3: Choose third card (different than stage 1)

(52-4) = 48 choices – Stage 4: Choose fourth card (different than stages 1&3)

(52-8) = 44 choices – Stage 5: Choose fifth card (different than stages 1,3,4)

(52-12) = 40 choices

3! ways to arrange these

Problem 2: How many ways to make a pair?

• Select a hand with one pair in stages: – Stage 1: Pair of what? Choose a number or face card

13 choices

– Stage 2: Choose which suits (from stage 1)

6 choices

– Stage 3: Choose third card (different than stage 1)

(52-4) = 48 choices

– Stage 4: Choose fourth card (different than stages 1&3)

(52-8) = 44 choices

– Stage 5: Choose fifth card (different than stages 1,3,4)

(52-12) = 40 choices

• Number of ways: (136484440)/3! = 1,098,240

40% chance of getting a pair (and nothing better)

Problem 2: How many ways to make a pair?

• Wikipedia has:

– C(13,1)*C(2,4)*C(3,12)*43.

• Same number.

• Can you justify it?

• What are the odds of making nothing?

• What are the odds of making nothing?

All contain a pair

(or more)

Problem 3: How many ways to make nothing?

• We’re counting hands:

(1) without pairs

(2) that also do not contain straights or flushes

Counting hands without pairs

• Pick a hand without a pair

– Stage 1: ??

2nd card: 48 choices (not same number/face as 1st card)

3rd card: 44 choices (different from 1st & 2nd)

4th card: 40 choices (different from 1st,2nd,3rd)

5th card: 36 choices (different from 1st,2nd,3rd,4th)

Division rule: Each hand could have been chosen in exactly 5! different ways.

Total = (5248444036)/5! = 1,317,888

Counting hands without pairs

• Pick a hand without a pair

– 1st card:

2nd card: 48 choices (not same number/face as 1st card)

3rd card: 44 choices (different from 1st & 2nd)

4th card: 40 choices (different from 1st,2nd,3rd)

5th card: 36 choices (different from 1st,2nd,3rd,4th)

Division rule: Each hand could have been chosen in exactly 5! different ways.

Total = (5248444036)/5! = 1,3