Counting II: Pascal, Binomials, and Other Tricks Great Theoretical Ideas In Computer Science A. Gupta D. Sleator CS 15-251 Fall 2010 Lecture 8Sept. 16,

Slides:



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

Counting. Counting = Determining the number of elements of a finite set.
Permutations and Combinations Rosen 4.3. Permutations A permutation of a set of distinct objects is an ordered arrangement these objects. An ordered arrangement.
Counting Chapter 6 With Question/Answer Animations.
Counting III: Pascal’s Triangle, Polynomials, and Vector Programs Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2003 Lecture.
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.
Binomial Identities.
Lecture 5 Counting 4.3, Permutations r-permutation: An ordered arrangement of r elements of a set of n distinct elements. Example: S={1,2,3}:
CSE 321 Discrete Structures Winter 2008 Lecture 16 Counting.
Recursive Definitions Rosen, 3.4 Recursive (or inductive) Definitions Sometimes easier to define an object in terms of itself. This process is called.
Applied Combinatorics, 4th Ed. Alan Tucker
CompSci 102 Discrete Math for Computer Science March 22, 2012 Prof. Rodger Lecture adapted from Bruce Maggs/Lecture developed at Carnegie Mellon, primarily.
Combinatorics 3/15 and 3/ Counting A restaurant offers the following menu: Main CourseVegetablesBeverage BeefPotatoesMilk HamGreen BeansCoffee.
Lecture 11 Feb 17, 1998 Doug Beeferman Carnegie Mellon University Count your blessings... … faster !
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
Binomial Coefficients, Inclusion-exclusion principle
Chapter 6 With Question/Answer Animations 1. Chapter Summary The Basics of Counting The Pigeonhole Principle Permutations and Combinations Binomial Coefficients.
Slide 7- 1 Copyright © 2006 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Fall 2002CMSC Discrete Structures1 One, two, three, we’re… Counting.
Great Theoretical Ideas in Computer Science.
March 10, 2015Applied Discrete Mathematics Week 6: Counting 1 Permutations and Combinations How many different sets of 3 people can we pick from a group.
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.
Lecture 5 Counting 4.3, Permutations r-permutation: An ordered arrangement of r elements of a set of n distinct elements. Example: S={1,2,3}:
1 Binomial Coefficients CS 202 Epp, section ??? Aaron Bloomfield.
Simple Arrangements & Selections. Combinations & Permutations A permutation of n distinct objects is an arrangement, or ordering, of the n objects. An.
1 Lecture 4 (part 2) Combinatorics Reading: Epp Chp 6.
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.
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?”
Counting II: Recurring Problems And Correspondences Great Theoretical Ideas In Computer Science John LaffertyCS Fall 2005 Lecture 7Sept 20, 2005Carnegie.
1 CS 140 Discrete Mathematics Combinatorics And Review Notes.
Counting II: Recurring Problems And Correspondences Great Theoretical Ideas In Computer Science V. AdamchikCS Spring 2006 Lecture 6Feb 2, 2005Carnegie.
Binomial Coefficients: Selected Exercises
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.
Copyright © Peter Cappello 2011 Simple Arrangements & Selections.
Counting I: One To One Correspondence and Choice Trees Great Theoretical Ideas In Computer Science John LaffertyCS Fall 2005 Lecture 6Sept 15,
Section 6.4. Powers of Binomial Expressions Definition: A binomial expression is the sum of two terms, such as x + y. (More generally, these terms can.
Binomial Coefficients and Identities
L14: Permutations, Combinations and Some Review EECS 203: Discrete Mathematics.
Polynomials Count! CS Lecture 9 X1 X1 X2 X2 + + X3 X3.
Counting III: Pigeonhole principal, Pascal’s Triangle and more Great Theoretical Ideas In Computer Science S. Rudich V. Adamchik CS Spring 2006.
Discrete Mathematics Counting.
L14: Permutations, Combinations and Some Review
The Pigeonhole Principle
Introduction to Discrete Mathematics
Developing Your Counting Muscles
COCS DISCRETE STRUCTURES
Counting III: Pascal’s Triangle, Polynomials, and Vector Programs
Permutations and Combinations
CS100: Discrete structures
Permutations and Combinations
Basic Counting.
Great Theoretical Ideas in Computer Science
Permutations and Combinations
Michael Duquette & Whitney Sherman
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: Pascal, Binomials, and Other Tricks Great Theoretical Ideas In Computer Science A. Gupta D. Sleator CS Fall 2010 Lecture 8Sept. 16, 2010Carnegie Mellon University + + ( ) + ( ) = ?

Plan Pirates and Gold Pigeonhole Principal Pascal’s Triangle Combinatorial Proofs Manhattan Walk

Permutations vs. Combinations n! (n-r)! n! r!(n-r)! = n r Ordered Unordered Subsets of r out of n distinct objects

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

SYSTEMS 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 = 840 _,_,_,_,_,_,_

SYSTEMS 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 7! 3! = 840

Arrange n symbols: r 1 of type 1, r 2 of type 2, …, r k of type k n r1r1 n-r 1 r2r2 … n - r 1 - r 2 - … - r k-1 rkrk n! (n-r 1 )!r 1 ! (n-r 1 )! (n-r 1 -r 2 )!r 2 ! = … = n! r 1 !r 2 ! … r k !

How many ways to rearrange the letters in the word ? How many ways to rearrange the letters in the word “CARNEGIEMELLON”? 14! 2!3!2! = 3,632,428,800

Multinomial Coefficients

Four ways of choosing We will choose 2-letters word from the alphabet (L,U,C,K,Y} 1)C(5,2) no repetitions, the order is NOT important LU = UL

Four ways of choosing We will choose 2-letters word from the alphabet (L,U,C,K,Y} 2)P(5,2) no repetitions, the order is important LU != UL P(n,r)=n*(n-1)*…*(n-r+1)

Four ways of choosing We will choose 2-letters word from the alphabet (L,U,C,K,Y} 3)5 2 =25 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} = 15

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

1st pirate gets 2 2 nd pirate gets 1 3 rd gets nothing 4 th gets 16 5 th gets 1 GG/G//GGGGGGGGGGGGGGGG/G represents the following division among the pirates

Sequences with 20 G’s and 4 /’s GG/G//GGGGGGGGGGGGGGGG/G In general, the k th pirate gets the number of G’s after the k-1 st / and before the k 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? How many sequences with 20 G’s and 4 /’s?

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

How many different ways to put k indistinguishable balls into n distinguishable urns. Another interpretation

How many integer solutions to the following equations? Another interpretation Think of x k as being the number of gold bars that are allotted to pirate k.

How many integer nonnegative solutions to the following equations?

How many integer positive solutions to the following equations? x 1 + x 2 + x 3 + … + x n = k x 1, x 2, x 3, …, x n > 0 bijection with solutions to y 1 + y 2 + y 3 + … + y n = k-n y 1, y 2, y 3, …, y n ≥ 0 Think of x k -> y k +1

Remember to distinguish between Identical / Distinct Objects If we are putting k objects into n distinct bins. k objects are distinguishable k objects are indistinguishable n+k-1 k nknk

Pigeonhole Principle If there are more pigeons than pigeonholes, then some pigeonholes must contain two or more pigeons

Pigeonhole Principle If there are more pigeons than pigeonholes, then some pigeonholes must contain two or more pigeons Example: two people in Pittsburgh must have the same number of hairs on their heads

Pigeonhole Principle Problem: among any n integer numbers, there are some whose sum is divisible by n.

Among any n integer numbers, there are some whose sum is divisible by n. Exist s i = s k (mod n). Take x i+1 + … + x k Consider s i =x 1 +…+x i modulo n. How many s i ? Remainders are {0, 1, 2, …, n-1}.

Pigeonhole Principle Problem: The numbers 1 to 10 are arranged in random order around a circle. Show that there are three consecutive numbers whose sum is at least 17. What are pigeons? And what are pigeonholes?

The numbers 1 to 10 are arranged in random order around a circle. Show that there are three consecutive numbers whose sum is at least 17 Pigeons: S S 10 = 3 (a 1 +a 2 +a 10 ) = 3*55 = 165 Let S 1 =a 1 +a 2 +a 3, … S 10 Let S 1 =a 1 +a 2 +a 3, … S 10 =a 10 +a 1 +a 2 There are 10 pigeonholes. Since 165 > 10 *16, at least one pigeon-hole has at least pigeons Actually, we’re using a generalization of the PHP If naturals x1+x2+…xn > k then one of xi > k/n

Pigeonhole Principle Problem: Show that for some integer k > 1, 3 k ends with 0001 (in its decimal representation). What are pigeons? And what are pigeonholes?

Show that for some integer k > 1, 3 k ends with k = 3 m mod (10000), m < k Choose numbers: 3 1,3 2,…, k-m = q* ends with k-m = 1 mod (10000) 3 k - 3 m = 0 mod (10000), m < k 3 m (3 k-m - 1) = 0 mod (10000), m < k But 3 is relatively prime to 10000, so

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 b 1 t1t1 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? In how many ways can we create a x 2 term?

What is a closed form expression for c k ? In how many ways can we create a x 2 term?

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

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 ? 5!

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

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

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

Multinomial Coefficients

The Multinomial Formula

On to Pascal…

The binomial coefficients have so many representations that many fundamental mathematical identities emerge…

Pascal’s Triangle: k th row are the coefficients of (1+X) k (1+X) 1 = (1+X) 0 = (1+X) 2 = (1+X) 3 = X 1 + 2X + 1X X + 3X 2 + 1X 3 (1+X) 4 = 1 + 4X + 6X 2 + 4X 3 + 1X 4

n th Row Of Pascal’s Triangle: (1+X) 1 = (1+X) 0 = (1+X) 2 = (1+X) 3 = X 1 + 2X + 1X X + 3X 2 + 1X 3 (1+X) 4 = 1 + 4X + 6X 2 + 4X 3 + 1X 4

Pascal’s Triangle ” Blaise Pascal 1654

Summing The Rows =1=2=4=8=16=32=64

= n k  k even n n k  k odd n =

Summing on 1 st Avenue

Summing on k th Avenue Hockey-stick identity

=2 =5 =13 =3 =8 Fibonacci Numbers

Sums of Squares n n n k  k = 0 n 2 =

All these properties can be proved inductively and algebraically. We will give combinatorial proofs. The art of combinatorial proof

How many ways we can create a size k committee of n people? LHS : By definition RHS : We choose n-k people to exclude from the committee.

The art of combinatorial proof How many ways we can create a size k committee of n people? LHS : By definition RHS : Pick a person, say n. There are committees that exclude person x There are committees that include person x

The art of combinatorial proof How many ways we can create an even size committee of n people? LHS : There are so many such committees RHS : Choose n-1 people. The fate of the nth person is completely determined.

The art of combinatorial proof LHS : We create a size k committee, then we select a chairperson. RHS : We select the chair out of n, then from the remaining n-1 choose a size k-1 committee.

The art of combinatorial proof LHS : Count committees of any size, one is a chair. RHS : Select the chair out of n, then from the remaining n-1 choose a subset.

The art of combinatorial proof LHS : m-males, n–females, choose size k. RHS : Select a committee with j men, the remaining k-j members are women.

The art of combinatorial proof LHS : The number of (k+1)-subsets in {1,2,…,n+1} RHS : Count (k+1)-subsets with the largest element m+1, where k ≤ m ≤ n.

All these properties can be proved by using the Manhattan walking representation of binomial coefficients.

Manhattan walk You’re in a city where all the streets, numbered through, run north-south, numbered 0 through x, run north-south, and all the avenues, numbered through, and all the avenues, numbered 0 through y, run east-west. How many [sensible] ways are there to walk from the corner of 0th st. and 0th avenue to the opposite corner of the city? 0 y x 0

All paths require exactly steps: All paths require exactly x+y steps: steps east, steps north x steps east, y steps north Counting paths is the same as counting which of the steps are northward steps: Counting paths is the same as counting which of the x+y steps are northward steps: 1 Manhattan walk y (x,y) 0

..... level n k’th Avenue Manhattan walk

We break all routes into: reach a star + 1 right and all left turns

Manhattan walk

Now, what if we add the constraint that the path must go through a certain intersection, call it ? Now, what if we add the constraint that the path must go through a certain intersection, call it (n,k) ? 1 y (2n,n) 0 0 (n, k) Manhattan walk

The number of routes from (0,0) to (n,k) is 1 y (2n,n) 0 0 (n, k) Manhattan walk The number of routes from (n,k) to (2n,n) is the same as from(0,0) to (n,n-k)

Study Bee Binomials and Multinomials Pirates and Gold Pigeonhole principal Combinatorial proofs of binomial identities Manhattan walk