Counting II: Recurring Problems And Correspondences Great Theoretical Ideas In Computer Science V. AdamchikCS 15-251 Spring 2006 Lecture 6Feb 2, 2005Carnegie.

Slides:



Advertisements
Similar presentations
Great Theoretical Ideas in Computer Science for Some.
Advertisements

5.3 Permutations and Combinations
Counting Chapter 6 With Question/Answer Animations.
Counting Chapter 6 With Question/Answer Animations.
Great Theoretical Ideas in Computer Science.
Counting III: Pascal’s Triangle, Polynomials, and Vector Programs Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2003 Lecture.
Multiplication Rule. A tree structure is a useful tool for keeping systematic track of all possibilities in situations in which events happen in order.
Discrete Structures & Algorithms Counting Counting I: One-To-One Correspondence and Choice Trees.
Discrete Structures & Algorithms More Counting. + + ( ) + ( ) = ? Counting II: Recurring Problems and Correspondences.
CSE115/ENGR160 Discrete Mathematics 04/17/12
Counting II: Recurring Problems And Correspondences Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2004 Lecture 10Feb 12, 2004Carnegie.
Counting I: One To One Correspondence and Choice Trees Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2004 Lecture 9Feb 10,
Counting II: Pascal, Binomials, and Other Tricks Great Theoretical Ideas In Computer Science A. Gupta D. Sleator CS Fall 2010 Lecture 8Sept. 16,
Counting Elements in a List How many integers in the list from 1 to 10? How many integers in the list from m to n? (assuming m
CompSci 102 Discrete Math for Computer Science March 22, 2012 Prof. Rodger Lecture adapted from Bruce Maggs/Lecture developed at Carnegie Mellon, primarily.
How many ways are there to pass through city A where the arrows represent one-way streets? Answer: mn ways The counting principal: Suppose two experiments.
4. Counting 4.1 The Basic of Counting Basic Counting Principles Example 1 suppose that either a member of the faculty or a student in the department is.
Exam 1 Review 5.1, , 8.1, 8.2.
More Counting Lecture 16: Nov 9 A B …… f. This Lecture We will study how to define mappings to count. There will be many examples shown. Bijection rule.
Lecture 11 Feb 17, 1998 Doug Beeferman Carnegie Mellon University Count your blessings... … faster !
Review of 5.1, 5.3 and new Section 5.5: Generalized Permutations and Combinations.
The Basics of Counting Section 6.1.
Basic Counting Lecture 12: Oct 28. This Lecture We will study some basic rules for counting. Sum rule, product rule, generalized product rule Permutations,
1 Melikyan/DM/Fall09 Discrete Mathematics Ch. 6 Counting and Probability Instructor: Hayk Melikyan Today we will review sections 6.4,
Basic Counting. This Lecture We will study some basic rules for counting. Sum rule, product rule, generalized product rule Permutations, combinations.
Chapter The Basics of Counting 5.2 The Pigeonhole Principle
Generalized Permutations and Combinations
Chapter 6 With Question/Answer Animations 1. Chapter Summary The Basics of Counting The Pigeonhole Principle Permutations and Combinations Binomial Coefficients.
Fall 2002CMSC Discrete Structures1 One, two, three, we’re… Counting.
Great Theoretical Ideas in Computer Science.
Counting III: Pascal’s Triangle, Polynomials, and Vector Programs Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2003 Lecture.
More Combinatorics Sections /5/2004Discrete Mathematics for Teachers, UT Math 504, Lecture 11 2 Generating Permutations and Combinations This.
Chapter 6, Counting and Probability
COMPSCI 102 Discrete Mathematics for Computer Science.
Discrete Mathematics for Computer Science. + + ( ) + ( ) = ? Counting II: Recurring Problems and Correspondences Chapter 9 slides 1-54.
Great Theoretical Ideas in Computer Science.
Counting CSC-2259 Discrete Structures Konstantin Busch - LSU1.
COMPSCI 102 Discrete Mathematics for Computer Science.
The Pigeonhole Principle. The pigeonhole principle Suppose a flock of pigeons fly into a set of pigeonholes to roost If there are more pigeons than pigeonholes,
Counting Discrete Mathematics. Basic Counting Principles Counting problems are of the following kind: “How many different 8-letter passwords are there?”
CompSci 102 Discrete Math for Computer Science March 20, 2012 Prof. Rodger Lecture adapted from Bruce Maggs/Lecture developed at Carnegie Mellon, primarily.
Counting II: Recurring Problems And Correspondences Great Theoretical Ideas In Computer Science John LaffertyCS Fall 2005 Lecture 7Sept 20, 2005Carnegie.
Counting I: One To One Correspondence and Choice Trees Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2004 Lecture 9Feb 10,
CS Lecture 8 Developing Your Counting Muscles.
2/24/20161 One, two, three, we’re… Counting. 2/24/20162 Basic Counting Principles Counting problems are of the following kind: “How many different 8-letter.
Counting I: One To One Correspondence and Choice Trees Great Theoretical Ideas In Computer Science John LaffertyCS Fall 2005 Lecture 6Sept 15,
CS Lecture 6 How To Count Without Counting.
L14: Permutations, Combinations and Some Review EECS 203: Discrete Mathematics.
Polynomials Count! CS Lecture 9 X1 X1 X2 X2 + + X3 X3.
Section The Product Rule  Example: How many different license plates can be made if each plate contains a sequence of three uppercase English letters.
Section 6.3. Section Summary Permutations Combinations.
L14: Permutations, Combinations and Some Review
Introduction to Discrete Mathematics
Developing Your Counting Muscles
CSE15 Discrete Mathematics 04/19/17
Generalized Permutations and Combinations
CS100: Discrete structures
Mathematics for Computer Science MIT 6.042J/18.062J
Counting I: Bijection and Choice Trees
Counting I: One-To-One Correspondence and Choice Trees
Basic Counting.
Great Theoretical Ideas in Computer Science
Basic Counting Lecture 9: Nov 5, 6.
Counting III: Pascal’s Triangle, Polynomials, and Vector Programs
Counting II: Recurring Problems And Correspondences
Great Theoretical Ideas in Computer Science
Discrete Mathematics for Computer Science
Introduction to Discrete Mathematics
Counting II: Recurring Problems And Correspondences
Counting I: Choice Trees and Correspondences
Presentation transcript:

Counting II: Recurring Problems And Correspondences Great Theoretical Ideas In Computer Science V. AdamchikCS Spring 2006 Lecture 6Feb 2, 2005Carnegie Mellon University + + ( ) + ( ) = ?

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

A choice tree is a rooted, directed tree with an object called a “choice” associated with each edge and a label on each leaf. Choice Tree

Product Rule IF S has a choice tree representation with P 1 possibilities for the first choice, P 2 for the second, and so on, THEN there are P 1 P 2 P 3 …P n objects in S Note, choices must be independent.

Warm-up Problem How many distinct five- letters words can be produced by rearranging the letters of the word LUCKY?

The number of permutations of n distinct objects is n!

Warm-up Problem How many four-letters words can be produced by rearranging the letters of the word TOOL?

How many ways to rearrange the letters in the word SYSTEMS?

Are you ready for MISSISSIPPI?

arrange n symbols with r 1 of type 1, r 2 of type 2, …, r k of type k is: The number of ways to arrange n symbols with r 1 of type 1, r 2 of type 2, …, r k of type k is:

MISSISSIPPI

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

Multinomial Coefficients

Four ways of choosing We will choose 2-letter words from the alphabet {L,U,C,K,Y} 1)??, no repetitions, the order does not matter

Four ways of choosing We will choose 2-letter words from the alphabet (L,U,C,K,Y} 2)??, no repetitions, the order is important

Four ways of choosing We will choose 2-letter words from the alphabet (L,U,C,K,Y} 3)?? with repetitions, the order is important

Four ways of choosing We will choose 2-letter words from the alphabet {L,U,C,K,Y} 4)???? repetitions, the order is NOT important C(5,2) + {LL,UU,CC,KK,YY}

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

Sequences with 20 G’s and 4 /’s 1 st pirate gets 2 bars 2 nd and 5 th pirate get 1 bar each 3 rd gets nothing 4 th gets 16 bars GG/G//GGGGGGGGGGGGGGGG/G represents the above division among the pirates

Sequences with 20 G’s and 4 /’s GG/G//GGGGGGGGGGGGGGGG/G In general, the i th pirate gets the number of G’s after the i-1 st / and before the i th /. This gives a correspondence between divisions of the gold and 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

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

In how many ways 10 items can be chosen from {A,B,C,D,E}? with repetitions and order does not matter

How many integer solutions to the following equations?

How many nonnegative integer solutions to the following equations?

How many integer positive solutions to the following equations?

How many integer solutions x + y + z = 20 x>=1, y>=2, z>=3?

Identical/Distinct Dice Suppose that we roll seven dice. How many different outcomes are there, if order matters? What if order doesn’t matter? (E.g., Yahtzee)

7 Identical Dice How many different outcomes? Corresponds to 6 pirates and 7 bars of gold!

Multisets A multiset is a set of elements, each of which has a multiplicity. The size of the multiset is the sum of the multiplicities of all the elements. Example: {X, Y, Z} with m(X)=0 m(Y)=3, m(Z)=2 Unary visualization: {Y, Y, Y, Z, Z}

Counting Multisets There are ways to choose a multiset of size k from n types of elements

Now, something completely different…

POLYNOMIALS EXPRESS CHOICES AND OUTCOMES Products of Sum = Sums of Products + + ( ) + ( ) =

b2b2 b3b3 b1b1 t1t1 t2t2 t1t1 t2t2 t1t1 t2t2

b2b2 b3b3 b1b1 t1t1 t2t2 t1t1 t2t2 t1t1 t2t2 b1b1 t1t1 b1b1 t2t2 b2b2 t2t2 b2b2 t1t1 b3b3 t1t1 b3b3 t2t2 (b 1 + b 2 + b 3 )(t 1 + t 2 ) = b 1 t 1 + b 1 t 2 + b 2 t 1 + b 2 t 2 + b 3 t 1 + b 3 t 2

There is a correspondence between paths in a choice tree and the cross terms of the product of polynomials!

1X1X1X1X 1X 1X 1X Choice tree for terms of (1+X) 3 1 X X X2X2 X X2X2 X2X2 X3X3 Combine like terms to get 1 + 3X + 3X 2 + X 3

1X1X1X1X 1X 1X 1X (1+X) 3= 1 + 3X + 3X 2 + X 3 1 X X X2X2 X X2X2 X2X2 X3X3 What is the combinatorial meaning of those coefficients?

What is a closed form expression for c k ?

What is a closed form expression for c n ? n times After multiplying things out, but before combining like terms, we get 2 n cross terms, each corresponding to a path in the choice tree. c k, the coefficient of X k, is the number of paths with exactly k X’s.

The Binomial Theorem binomial expression Binomial Coefficients

The Binomial Formula

What is the coefficient of EMPTY in the expansion of (E + M + P + T + Y) 5 ?

What is the coefficient of EMP 3 TY in the expansion of (E + M + P + T + Y) 7 ?

What is the coefficient of M 2 P 2 T 3 in the expansion of (E + M + P + T + Y) 7 ?

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

Multinomial Coefficients

The Multinomial Formula

Now, something completely different…

Storing Poker Hands…

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

Storing Poker Hands How many bits per hand? I want to store a 5 card poker hand using the smallest number of bits (space efficient).

30 bits Can we do better??? How???

Order all Poker hands lexicographically [or in any fixed manner] To store a hand all I need is to store its index of size  log 2 (2,598,560)  =22 bits. Hand Hand Hand

A binary (Boolean) choice tree is a choice tree where each internal node has degree 2. Usually the choices will be labeled 0 and 1. Binary (Boolean) Choice Tree

22 Bits Is OPTIMAL 2 21 = < 2,598,560 A binary choice tree of depth 21 can have at most 2 21 leaves. Hence, there are not enough leaves for Hence, you can’t have a leaf for each hand.

An n-element set can be stored so that each element uses  log 2 (n)  bits. Furthermore, any representation of the set will have some string of that length.

Information Counting Principle: If each element of a set can be represented using k bits, the size of the set is bounded by 2 k

ONGOING MEDITATION: Let S be any set and T be a binary choice tree representation of S. We can think of each element of S being encoded by the binary sequences of choices that lead to its leaf. We can also start with a binary encoding of a set and make a corresponding binary choice tree.

Study Bee Go Steelers!!!