Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 15-251 Lecture 8 Developing Your Counting Muscles.

Similar presentations


Presentation on theme: "CS 15-251 Lecture 8 Developing Your Counting Muscles."— Presentation transcript:

1

2 CS 15-251 Lecture 8 Developing Your Counting Muscles

3 Addition Rule Let A and B be two disjoint, finite sets. The size of A  B is the sum of the size of A and the size of B.

4 Correspondence Principle If two finite sets can be placed into 1-1 onto correspondence, then they have the same size.

5 Product Rule Suppose that all objects of a certain type can be constructed by a sequence of choices with P 1 possibilities for the first choice, P 2 for the second, and so on. IF 1) Each sequence of choices constructs some object AND 2) Each object has exactly one sequence that constructs it THEN there are P 1 P 2 P 3 …P n objects of that type.

6 The Sleuth’s Criterion Condition (2) of the product rule: For any object it should be possible to reconstruct the sequence of choices that lead to it.

7 The number of subsets of size r that can be formed from an n-element set is:

8 How many sequences of seven letters contain at least 2 of the same letter? 26 7 – 26*25*24*23*22*21*20

9 Counting Poker Hands…

10 52 Card Deck 5 card hands 4 possible suits:  13 possible ranks: 2,3,4,5,6,7,8,9,10,J,Q,K,A

11 52 Card Deck 5 card hands 4 possible suits:  13 possible ranks: 2,3,4,5,6,7,8,9,10,J,Q,K,A Pair: set of two cards of the same rank Straight: 5 cards of consecutive rank Flush: set of 5 cards with the same suit

12 Ranked Poker Hands Straight Flush A straight and a flush 4 of a kind 4 cards of the same rank Full House 3 of one kind and 2 of anotherFlush A flush, but not a straightStraight A straight, but not a flush 3 of a kind 3 of the same rank, but not a full house or 4 of a kind 2 Pair 2 pairs, but not 4 of a kind or a full house A Pair

13 Straight Flush

14 4 Of A Kind

15 Flush

16 Straight

17 3 Of A Kind

18 Question: How many ways to rearrange the letters in the word “SYSTEMS” ?

19 SYSTEMS 1) 1)7 places to put the Y, 6 places to put the T, 5 places to put the E, 4 places to put the M, and the S’s are forced. 7 X 6 X 5 X 4 = 8402)

20 SYSTEMS 3) Let’s pretend that the S’s are distinct: S 1 YS 2 TEMS 3 There are 7! permutations of S 1 YS 2 TEMS 3 But when we stop pretending we see that we have counted each arrangement of SYSTEMS 3! times, once for each of 3! rearrangements of S 1 S 2 S 3.

21 Arrange n symbols r 1 of type 1, r 2 of type 2, …, r k of type k

22 CARNEGIEMELLON

23 What is a closed form expression for c k ?

24 What is a closed for expression for c n ? n times Before combining like terms, when we multiply things out we get 2 n cross terms. There is a natural correspondence between sequences with k X’s and (n-k) 1’s and cross terms evaluating to X k.

25 The Binomial Formula binomial expression Binomial Coefficients

26 The Binomial Formula (1+X) 1 = (1+X) 0 = (1+X) 2 = (1+X) 3 = 1 1 + 1X 1 + 2X + 1X 2 1 + 3X + 3X 2 + 1X 3 (1+X) 4 = 1 + 4X + 6X 2 + 4X 3 + 1X 4

27 The Binomial Formula

28

29 What is the coefficient of EMSTY in the expansion of (E + M + S + T + Y) 5 ? 5!

30 What is the coefficient of EMS 3 TY in the expansion of (E + M + S + T + Y) 7 ? The number of ways to rearrange the letters in the word SYSTEMS.

31 What is the coefficient of BA 3 N 2 in the expansion of (B + A + N) 6 ? The number of ways to rearrange the letters in the word BANANA.

32 What is the coefficient of in the expansion of (X 1 +X 2 +X 3 +…+X k ) n ?

33 The Multinomial Formula

34 Multinomial Coefficients

35 5 distinct pirates want to divide 20 identical, indivisible bars of gold How many different ways to divide up the loot?

36 Sequences with 20 G’s and 4 /’s GG/G//GGGGGGGGGGGGGGGGG/ represents the following division among the pirates: 2, 1, 0, 17, 0 In general, the i th pirate gets the number of G’s after / i-1 and before / i. This gives a correspondence between divisions of the gold and sequences with 20 G’s and 4 /’s.

37 Sequences with 20 G’s and 4 /’s How many different ways to divide up the loot? Sequences with 20 G’s and 4 /’s

38 How many different ways can n distinct pirates divide k identical, indivisible bars of gold?

39 How many integer solutions to the following equations?

40

41 Counting with repetitions allowed Suppose that we roll seven dice. How many different outcomes are there? 6767 What if order doesn’t matter? (E.g., Yahtzee)

42 Counting with repetitions allowed How many ways are there of choosing k items from n items, where an item may be chosen more than once, but order doesn’t matter? E.g., the following are equivalent: 2 1 3 2 6 2 1, 1 3 2 1 2 2 6, 1 1 2 2 2 3 6 C C / C C C / C / / / C Place n-1 partitions / among k choices C

43 Back to the pirates How many ways are there of choosing 20 pirates from a set of 5, with repetitions allowed?

44 Future homework problem:

45


Download ppt "CS 15-251 Lecture 8 Developing Your Counting Muscles."

Similar presentations


Ads by Google