Presentation is loading. Please wait.

Presentation is loading. Please wait.

Mathematics for Computer Science MIT 6.042J/18.062J

Similar presentations


Presentation on theme: "Mathematics for Computer Science MIT 6.042J/18.062J"— Presentation transcript:

1 Mathematics for Computer Science MIT 6.042J/18.062J
Combinatorics II Copyright © Radhika Nagpal, 2002. Prof. Albert Meyer & Dr. Radhika Nagpal

2 Last Week: Counting I Sets Pigeonhole Principle Permutations
Bijections, Sum Rule, Inclusion-Exclusion, Product Rule Pigeonhole Principle Permutations Tree Diagrams

3 This Week: Counting II Division Rule
Combinations (binomial coefficients) Binomial Theorem and Identities Permutations with limited repetition (multinomial coefficients) Combinations with repetition (stars and bars)

4 The Real Agenda: Poker How many different hands could I get, if I played 5-card draw?

5 The Real Agenda: Poker (52) (51) (50) (49) (48)
How many different hands could I get, if I played 5-card draw? (52) (51) (50) (49) (48)

6 The Real Agenda: Poker (52) (51) (50) (49) (48)
How many different hands could I get, if I played 5-card draw? (52) (51) (50) (49) (48) r-permutation, P(52,5)

7 Problem: Over-counting
These two hands are the same:

8 Problem: Over-counting
These two hands are the same:

9 Problem: Over-counting
These two hands are the same: In fact any permutation of these cards is the same hand (order is irrelevant)

10 Number of 5-card Hands How much have we over-counted?

11 Number of 5-card Hands How much have we over-counted?
Over-counted EVERY HAND by 5!

12 Number of 5-card Hands …… How much have we over-counted?
Over-counted EVERY HAND by 5! ……

13 Number of 5-card Hands …… How much have we over-counted?
Over-counted EVERY HAND by 5! …… Still approximately 2.5 million possible hands

14 Combinations C(n,r) = number of different subsets of size r from a set with n elements. C(n,r) = P(n,r) / r!

15 Combinations C(n,r) = P(n,r)/r! =

16 Combinations C(n,r) = P(n,r)/r! =

17 Combinations C(n,r) = P(n,r)/r! =

18 Combinations C(n,r) = P(n,r)/r! =

19 Poker: Gambling Table Straight Flush > Four-of-a-kind
> Full House > Flush > Straight > Three-of-a-kind > Two pair > One pair > No pair

20 Poker: Four-of-a-kind
Card: value (13) + suit (4) Four-of-a-kind 4 cards with the same value 1 with a different value EXAMPLE: 9s 9d 9c 9h 5h

21 Poker: Four-of-a-kind
2 spades 2 clubs 2 hearts 2 diamonds . K hearts K diamonds 1 2 3 . 11 (jack) 12 (queen) 13 (king)

22 Poker: Four-of-a-kind
2 spades 2 clubs 2 hearts 2 diamonds . K hearts K diamonds 1 2 3 . 11 (jack) 12 (queen) 13 (king) Four-of-a-kind = = 624

23 Poker: Full House Full House 9s 9c 9d 5s 5c
= choose value for the triple + choose 3 suits + choose value for pair + choose 2 suits

24 In-class Problem 1: Each table should write their solution on their whiteboard.

25 Incorrect Counting Argument
Two pair = Every hand is counted twice

26 Correct Counting Arguments
1. Divide the Theory Pig’s estimate by 2 2. Choose the values of the two pairs together 2-pair =

27 Division Rule If set B over-counts every element of A by k times then,
|B| = k |A|

28 Permutations vs Combinations
Combinations: subsets of size r, order does not matter Permutations: strings of length r, order of elements does matter.

29 Calculating Permutations and Combinations
Closely related: C(n,r) = P(n,r) / r! C(n,r) = count all r-permutations, every combination is over-counted by r! P(n,r) = choose r items, then take all permutations of the items

30 Counting Powerset of A P(A) = set of all subsets of A A = {a,b}
P(A) = {{}, {a}, {b}, {a,b}}

31 Counting P(A) Bijection : P(A) and binary strings of length |A|
A = {a1 a2 a3 a4 a5……an} Binary String = …..0 Subset of A = {a1, a3, a5} | P(A) | = 2n

32 Counting P(A) |P(A)| = = subsets + subsets + subsets…..subsets
of size 0 of size 1 of size 2 of size n

33 Counting P(A) Identity: |P(A)| =
= subsets + subsets + subsets…..subsets of size 0 of size 1 of size 2 of size n Identity:

34 Poker: Gambling Table Straight Flush = 40 Four-of-a-kind = 624
Full house = 3744 Flush = 5148 Straight = 10240 Three-of-a-kind = 54,912 Two pair =123,552 One pair = 1,098,240 No pair = 1,317,388

35 In-class Problems


Download ppt "Mathematics for Computer Science MIT 6.042J/18.062J"

Similar presentations


Ads by Google