Counting III: Pigeonhole principal, Pascal’s Triangle and more Great Theoretical Ideas In Computer Science S. Rudich V. Adamchik CS 15-251 Spring 2006.

Slides:



Advertisements
Similar presentations
CompSci 102 Discrete Math for Computer Science March 27, 2012 Prof. Rodger Lecture adapted from Bruce Maggs/Lecture developed at Carnegie Mellon, primarily.
Advertisements

Counting. Counting = Determining the number of elements of a finite set.
Counting Chapter 6 With Question/Answer Animations.
Number Theory and Cryptography
Counting III: Pascal’s Triangle, Polynomials, and Vector Programs Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2003 Lecture.
Algebraic Structures: Group Theory II
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.
Copyright © Zeph Grunschlag, Counting Techniques Zeph Grunschlag.
COMP 170 L2 Page 1 L03: Binomial Coefficients l Purpose n Properties of binomial coefficients n Related issues: the Binomial Theorem and labeling.
Counting I: One To One Correspondence and Choice Trees Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2004 Lecture 9Feb 10,
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.
Counting II: Pascal, Binomials, and Other Tricks Great Theoretical Ideas In Computer Science A. Gupta D. Sleator CS Fall 2010 Lecture 8Sept. 16,
Chapter 7 Functions Dr. Curry Guinn. Outline of Today Section 7.1: Functions Defined on General Sets Section 7.2: One-to-One and Onto Section 7.3: The.
Functions A B f( ) =. This Lecture We will define a function formally, and then in the next lecture we will use this concept in counting. We will also.
College Algebra Sixth Edition James Stewart Lothar Redlin Saleem Watson.
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 !
Copyright © Cengage Learning. All rights reserved.
Discrete Mathematics, 1st Edition Kevin Ferland
The Basics of Counting Section 6.1.
Chapter 8. Section 8. 1 Section Summary Introduction Modeling with Recurrence Relations Fibonacci Numbers The Tower of Hanoi Counting Problems Algorithms.
Basic Counting. This Lecture We will study some basic rules for counting. Sum rule, product rule, generalized product rule Permutations, combinations.
Binomial Coefficients, Inclusion-exclusion principle
Week 15 - Wednesday.  What did we talk about last time?  Review first third of course.
Chapter 6 With Question/Answer Animations 1. Chapter Summary The Basics of Counting The Pigeonhole Principle Permutations and Combinations Binomial Coefficients.
Great Theoretical Ideas in Computer Science.
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.
Sets Defined A set is an object defined as a collection of other distinct objects, known as elements of the set The elements of a set can be anything:
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.
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 II: Recurring Problems And Correspondences Great Theoretical Ideas In Computer Science John LaffertyCS Fall 2005 Lecture 7Sept 20, 2005Carnegie.
Spring 2016 COMP 2300 Discrete Structures for Computation
CS Lecture 11 To Exclude Or Not To Exclude? + -
1 Melikyan/DM/Fall09 Discrete Mathematics Ch. 7 Functions Instructor: Hayk Melikyan Today we will review sections 7.3, 7.4 and 7.5.
Counting II: Recurring Problems And Correspondences Great Theoretical Ideas In Computer Science V. AdamchikCS Spring 2006 Lecture 6Feb 2, 2005Carnegie.
Binomial Coefficients: Selected Exercises
1 Finding a decomposition of a graph T into isomorphic copies of a graph G is a classical problem in Combinatorics. The G-decomposition of T is balanced.
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
Polynomials Count! CS Lecture 9 X1 X1 X2 X2 + + X3 X3.
Pigeonhole Principle. If n pigeons fly into m pigeonholes and n > m, then at least one hole must contain two or more pigeons A function from one finite.
Week 15 - Wednesday.  What did we talk about last time?  Review first third of course.
Combinatorics. What is Combinatorics? Wide ranging field involving the study of discrete objects.
L14: Permutations, Combinations and Some Review
Copyright © Zeph Grunschlag,
Induction: One Step At A Time
Counting III: Pascal’s Triangle, Polynomials, and Vector Programs
Great Theoretical Ideas In Computer Science
To Exclude Or Not To Exclude?
Copyright © Zeph Grunschlag,
Generating Functions II
Counting I: Bijection and Choice Trees
Basic Counting.
CSE 321 Discrete Structures
Great Theoretical Ideas in Computer Science
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 III: Pigeonhole principal, Pascal’s Triangle and more Great Theoretical Ideas In Computer Science S. Rudich V. Adamchik CS Spring 2006 Lecture 7Feb. 07, 2006Carnegie Mellon University X1 X1 X2 X2 + + X3 X3

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

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

Pigeonhole Principle If there are more pigeons than pigeonholes, then some pigeonholes must contain two or more pigeons Problem: among any n integer numbers, there are some whose sum is divisible by n.

Pigeonhole Principle Problem: among any n integer numbers, there are some whose sum is divisible by n. Proof: Consider s i =x 1 +…+x i modulo n. Remainders are either zero or {1, 2, …, n-1}. Exist s i = s k (mod n). Take s i - s k

Pigeonhole Principle If there are more pigeons than pigeonholes, then some pigeonholes must contain two or more pigeons Problem: Prove that among any subset of n+1 integers selected from the set {1,2,3,…,2n} there are two elements a and b such that a is a multiple of b.

Pigeonhole Principle Problem: Prove that among any subset of n+1 integers selected from the set {1,2,3,…,2n} there are two elements a and b such that a is a multiple of b. Proof. Let S = {x 1,x 2,..., x n+1 } be a set of n+1 integers x k =2 r(k) *y k where y k is odd.

Pigeonhole Principle Problem: Prove that among any subset of n+1 integers selected from the set {1,2,3…,2n} there are two elements a and b such that a is a multiple of b. Proof. x k =2 r(k) *y k The set {1,2,3…,2n} has n odd integers. Therefore, exist y k = y i.

To Exclude Or Not To Exclude? + -

1.A school has 100 students. 50 take French, 40 take Latin, and 20 take both. How many students take neither language? 2.How many positive integers less than 70 are relatively prime to 70? (70=2  5  7)

French Latin French AND Latin students: |F  L|=20 |F  L|= F  French students L  Latin students |F|=50 |L|=40 French OR Latin students: Neither language: 100 – 70 = 30 |F|+|L|-|F  L| = – 20 = 70

Lesson: |A  B| = |A| + |B| - |A  B| U  universe of elements A B U

2.How many positive integers less than 70 are relatively prime to 70? 70 = 2  5  7 U = [1..70] A 1  integers in U divisible by 2 A 2  integers in U divisible by 5 A 3  integers in U divisible by 7 |A 1 | = 35 |A 2 | = 14 |A 3 |=10 A1A1 A3A3 A2A2 U

A1A1 A3A3 A2A2 U Lesson: Let S k be the sum of the sizes of All k -tuple intersections of the A i ’s.

The Principle of Inclusion and Exclusion Let A 1,A 2,…,A n be sets in a universe U. Let S k denote the sum of size of all k -tuple intersections of A i ’s.

Let x  A 1   A n be an element appearing in m of the A i ’s. x gets counted times by S 1 “ “ “ times by S 2 “ “ “ times by S 3 “ “ “ times by S n The formula counts x

1 time.

The Binomial Formula

One polynomial, two representations “Closed form” or “Generating form” “Power series” or “Expanded form”

By playing these two representations against each other we obtain a new representation of a previous insight: Let x=1. The number of subsets of an n-element set

Let x= -1. Equivalently, By varying x, we can discover new identities

Proofs that work by manipulating algebraic forms are called “algebraic” arguments. Proofs that build a 1-1 onto correspondence are called “combinatorial” arguments.

Let O n be the set of binary strings of length n with an odd number of ones. Let E n be the set of binary strings of length n with an even number of ones. We gave an algebraic proof that  O n  =  E n   O n  =  E n 

A Combinatorial Proof Let O n be the set of binary strings of length n with an odd number of ones. Let E n be the set of binary strings of length n with an even number of ones. A combinatorial proof must construct a one-to- one correspondence between O n and E n

An attempt at a correspondence Let f n be the function that takes an n-bit string and flips all its bits....but do even n work? In f 6 we have   Uh oh… f n is clearly a one-to-one and onto function for odd n. E.g. in f 7 we have  

A correspondence that works for all n Let f n be the function that takes an n-bit string and flips only the first bit. For example,    

Problem. Consider all words of length n made from {a,b,c,d}. How many such words have an even number of a’s?

Pascal’s Triangle

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

k 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

Inductive definition of kth entry of nth row: Pascal(n,0) = Pacal (n,n) = 1; Pascal(n,k) = Pascal(n-1,k-1) + Pascal(n-1,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

“Pascal’s Triangle” Blaise Pascal 1654

Pascal’s Triangle “It is extraordinary how fertile in properties the triangle is. Everyone can try his hand.”

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

=

Summing on 1 st Avenue

Summing on k th Avenue

=2 =5 =13 =3 =8

Al-Karaji Squares * * * * * =0=1=4=9=16=25=36

All these properties can be proved inductively and algebraically. We will give combinatorial proofs using the Manhattan block walking representation of binomial coefficients.

How to count pathways Meandering in a nameless modern metropolis Scenario: You’re in a city where all the streets, numbered 0 through x, run north-south, 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

Meandering in a nameless modern metropolis All paths require exactly x+y steps: All paths require exactly x+y steps: x steps east, y steps north x steps east, y steps north Counting paths is the same as counting which of the x+y steps are northward steps: Counting paths is the same as counting which of the x+y steps are northward steps: 1 y x 0 0

Meandering in a nameless modern metropolis Now, what if we add the constraint that the path must go through a certain intersection, call it (i,j)? 1 y x 0 0 (i,j)

Manhattan k’th Avenue j’th Street

Manhattan k’th Avenue Level n ……… …………………… ………………………… ………………………………… ………….

..... level n k’th Avenue

..... level n k’th Avenue

..... level n k’th Avenue

Any path from the green point to the red point must go through one of the blue points. Let a blue point has coordinates (i, n-i) There are C(n-i+i, i) paths from (0,0) to this blue point On the other hand, there are C(n,i) paths from (i,n-i) to the red point.

Study Bee Pigeonhole principal In- Exclusion principal Combinatorial proofs of binomial identities