15-299 Lecture 11 Feb 17, 1998 Doug Beeferman Carnegie Mellon University Count your blessings... … faster !

Slides:



Advertisements
Similar presentations
Basic Permutations and Combinations
Advertisements

CompSci 102 Discrete Math for Computer Science March 27, 2012 Prof. Rodger Lecture adapted from Bruce Maggs/Lecture developed at Carnegie Mellon, primarily.
Counting. Counting = Determining the number of elements of a finite set.
1 More Counting by Mapping Lecture 16: Nov 7. 2 This Lecture Division rule Catalan number.
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 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.
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,
The Basics of Counting: Selected Exercises. Copyright © Peter Cappello2 Sum Rule Example There are 3 sizes of pink shirts & 7 sizes of blue shirts. How.
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.
Rev.S08 MAC 1140 Module 12 Introduction to Sequences, Counting, The Binomial Theorem, and Mathematical Induction.
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.
Boolean Algebra – the ‘Lingua Franca’ of the Digital World The goal of developing an automata is based on the following (loosely described) ‘ideal’: if.
Chapter 8. Section 8. 1 Section Summary Introduction Modeling with Recurrence Relations Fibonacci Numbers The Tower of Hanoi Counting Problems Algorithms.
Basic Counting Lecture 12: Oct 28. This Lecture We will study some basic rules for counting. Sum rule, product rule, generalized product rule Permutations,
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
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.
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.
Chapter 5 The Binomial Coefficients
10/24/2015MATH 106, Section 81 Section 8 Pascal’s Triangle Questions about homework? Submit homework!
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.
Week 11 What is Probability? Quantification of uncertainty. Mathematical model for things that occur randomly. Random – not haphazard, don’t know what.
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,
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.
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
CS Lecture 8 Developing Your Counting Muscles.
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.
APC Unit 2 CH-12.5 Binomial Theorem. Warm-up  Take your Homework out  Clearly Label 12.2, 12.3, and 12.4  Ask your Questions  While I’m Checking…
Permutations & Combinations: Selected Exercises. Copyright © Peter Cappello2 Preliminaries Denote the # of arrangements of some k elements of a set of.
Combinatorics. What is Combinatorics? Wide ranging field involving the study of discrete objects.
Binomial Coefficients: Selected Exercises
Introduction to Discrete Mathematics
Developing Your Counting Muscles
Generalized Permutations & Combinations: Selected Exercises
Counting III: Pascal’s Triangle, Polynomials, and Vector Programs
Discrete Structures for Computer Science
Basic Counting.
CSE 321 Discrete Structures
Great Theoretical Ideas in Computer Science
Basic Counting Lecture 9: Nov 5, 6.
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
Presentation transcript:

Lecture 11 Feb 17, 1998 Doug Beeferman Carnegie Mellon University Count your blessings... … faster !

Warm-ups How many different ways are there to seat 121 students in a lecture room of 214 chairs? Q.

How many different ways are there to seat 121 students in a lecture room of 214 chairs? There are often multiple ways to count the same set 1. Choose which seats are filled, then order the students in them 2. Assign an unfilled seat to each student in a fixed succession, e.g. alphabetically.

An easier one How many different subsets of sleeping students are possible in this class of 121 students? Q.

How many different subsets of sleeping students are possible in this class of 121 students? There are often multiple interpretations of the same count Subsets of a 121-element set Subsets of a 121-element set Binary digit strings of length 121 Binary digit strings of length 121 Outcomes of flipping a penny 121 times Outcomes of flipping a penny 121 times Possible committees drawn from 121 people Possible committees drawn from 121 people

Review: The binomial formula

“Closed form” or “Generating form” or “Generating function” “Power series” (“Taylor series”) expansion The binomial formula, take two

Review: The multinomial formula

Multinomial mania Q. What Is the coefficient of (MAGGS) in the expansion of (S+M+A+G) 5 ?

The same as the number of arrangements of “MAGGS”, or A.

Explore different possible representations of the same information or idea, and understand the relationship between them.

Playing with the binomial formula Can you explain this combinatorially? Let x=1. We find that

Playing with the binomial formula The number of subsets of an n-element set The number of k-element subsets of an n-element set, summed over all possible k. Indeed, these mean the same thing!

Combinatorial proofs A combinatorial proof demonstrates that each side of an equation corresponds to the size of the same set. Contrast this to a conventional algebraic proof, in which symbol manipulation is used to carry one side to the other

More binomial formulations Let x= -1. We find that …or equivalently, that

The odds get even The number of length-n binary strings with an number of ones an even number of ones The algebra has spoken. But it’s not yet independently clear why these sides count the same thing. Let’s develop a correspondence from one to the other. The number of length-n binary strings with an odd number of ones

More odds and evens 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 have already presented an algebraic proof that O n =E n An elegant combinatorial proof can be had by putting O n and E n in one-to-one correspondence. The correspondence principle says that if two sets can be placed in one-to-one correspondence, then they are the same size!

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

A correspondence that works for all n Let f n be the function that takes an n-bit bitstring and flips only the first bit. For example,     Check : 1. f n : O n  E n ? 2. f n is one-to-one? i.e. x  y  f n (x)  f n (y) 3. f n is onto? i.e. for all y  E n, there exists an x  O n such that f n (x)=y there exists an x  O n such that f n (x)=y

How to count allocation schemes Example 1: Pirates and gold bars Scenario: You’re a pirate who has just discovered n bars of gold (identical and indivisible). Being a generous buc, you decide to split the loot between the k distinct shipmates on board. How many ways are there to do this?

Example: n=4, k=3 … 15 = allocation schemes! Representation: Partition a string of 4 gold bars into 3 substrings by inserting slashes.

Connecting to a known representation So the number of allocation schemes is the same as the number of strings of bars and slashes with n bars and k-1 slashes... …which is the same as the number of ways to choose k-1 positions to make slashes to choose k-1 positions to make slashes from a set of n+k-1 positions, or from a set of n+k-1 positions, or

How to count allocation schemes Example 2: Solutions to integer equations Q. How many ways are there to solve: A. It’s the same as distributing 10 gold bars to 3 pirates!

How to count allocation schemes Example 3: Solutions to constrained integer equations Q. A twist: what if the solutions must be strictly positive? A. First give every “pirate” his required 1 “gold bar”. Then count the ways to distribute the remaining 10-3=7 “gold bars”:

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 (i,j) Now, what if we add the constraint that the path must go through a certain intersection, call it (i,j)?

Meandering in a nameless modern metropolis Given the constraint, we can decompose each valid path into two subpaths: Given the constraint, we can decompose each valid path into two subpaths: The subpath from the start to (i,j) The subpath from the start to (i,j) The subpath from (i,j) to (y,x) The subpath from (i,j) to (y,x) 1 y x 0 0 (i,j) These subpaths may be independently chosen. By the product rule, the total path count isThese subpaths may be independently chosen. By the product rule, the total path count is

An important identity for binomial coefficients Combinatorial proof? Consider separating all k- element subsets of the set {1,2,…,n} into those that include and those that exclude n Graphical intuition: Let n=x+y be the total steps needed in the city walk problem, and let k=y be the number of northward steps. There are two cases for the very last step taken.

Toward Pascal’s Triangle Associate with each intersection the path count from (0,0),

Toward Pascal’s Triangle Simplifying, we observe startling symmetries

Pascal’s Triangle Credited to Blaise Pascal, 1654 “It is extraordinary how fertile in properties the triangle is. Everyone can try his hand.” - Blaise

Summing the rows… gives us powers of =1=2=4=8=16=32=64

Summing the diagonals… yields Little Gauss’s formula and more!

“It is extraordinary how fertile in properties the triangle is. Everyone can try his hand.” - Blaise Try your hand.