390 likes | 526 Views
Great Theoretical Ideas In Computer Science. Polynomials Count!. X 1. X 2. +. +. X 3. Lecture 9. CS 15-251. Review: the binomial formula. Review: The multinomial formula. Representation: Understand the relationship between different representations of the same information or idea.
E N D
Great Theoretical Ideas In Computer Science Polynomials Count! • X1 • X2 • + • + • X3 Lecture9 CS 15-251
Representation:Understand the relationship between different representations of the same information or idea 1 2 3
The binomial formula gives two representations of the same function: “Closed form” or “Generating form” or “Generating function” “Power series” (“Taylor series”) expansion
Let x=1. We find that The number of subsets of an n-element set By playing these two representations against each other we obtain a new representation of a previous insight: There are 2n subsets of an n element set.
By by setting x to –1 we obtain a new insight: Let x= -1. We find that …or equivalently, that The number of even sized subsets of an n element set is the same as the number of odd sized subsets.
More odds and evens Let On be the set of`binary strings of length n with an odd number of ones. Let En be the set of`binary strings of length n with an even number of ones. We have just presented an algebraic proof that On= En An elegant combinatorial proof can be had by putting Onand Enin 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 fn be the function that takes an n-bit string and flips all its bits. ...but do even n work? In f6 we have 110011 001100 101010 010101 Uh oh. Complementing maps evens to evens! fn is clearly a one-to-one and onto function for odd n. E.g. in f7 we have 0010011 1101100 1001101 0110010
A correspondence that works for all n Let fn be the function that takes an n-bit string and flips only the first bit. For example, 0010011 1010011 1001101 0001101 110011 010011 101010 001010 Check: 1. fn: OnEn? 2. fn is one-to-one? i.e.x y fn (x) fn (y) 3. fn is onto? i.e.for all y En, there exists an x On such that fn (x)=y
What is the coefficient of BA3N2 in the expansion of (B + A + N)6? Keeping counts in coefficients The number of ways to rearrange the letters in the word BANANA.
How many integer solutions to the following equations? kitems n -1 breakpoints ///////
We obtain xkfor each way of choosing a power of x from each of n expressions in such a way that the exponents sum to k, i.e., once for each solution to
The # of solutions to The coefficient of xk in(1-x)-n =
The fact that the manipulation of polynomial equations can encode the same theorems that are proved by combinatorial reasoning is very significant! Never underestimate the insights encoded into the coefficients of a polynomial!
You could give the generating function to a good calculus student and ask for the power series expansion. Using the method of partial fractions, the student would discover:
The “method of generating functions” is so powerful that it can solve: • Most recurrences • Most sums • Most of the neat math facts that we have ever seen Generating-Functionology by Herbert S. Wilf (Academic Press) Is HIGHLY recommended!
Getting to know the binomial coefficients… Three binomial identities we that have seen: 1. 2. 3.
By convention: (empty product = 1)
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 x y 0
Meandering in a nameless modern metropolis • All paths require exactly x+y steps: • x steps east, y steps north • Counting paths is the same as counting which of the x+y steps are northward steps: (i,j) 0 x y 1 Now, what if we add the constraint that the path must go through a certain intersection, call it (i,j)? 0
An important identity for binomial coefficients 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.
0 k’th Avenue 0 3 4 2 1 . . . . Level n 1 . . . . . . . 2 . . . . . . . . . . 3 . . . . . . . . . . . . . . . 4 . . . . . . . . . . . . . . . . . . Manhattan
. . . . . k’th Avenue 1 . . . . . level n 1 1 . . . . . 2 1 1 . . . . . 3 3 1 1 . . . . . 4 1 6 1 4 1 1 5 5 10 10 6 6 15 15 20
. . . . . k’th Avenue 1 . . . . . level n 1 1 . . . . . 2 1 1 . . . . . 3 3 1 1 . . . . . 4 1 6 1 4 1 1 5 5 10 10 6 6 15 15 20
. . . . . k’th Avenue 1 . . . . . level n 1 1 . . . . . 2 1 1 . . . . . 3 3 1 1 . . . . . 4 1 6 1 4 1 1 5 5 10 10 6 6 15 15 20
. . . . . k’th Avenue 1 . . . . . level n 1 1 . . . . . 2 1 1 . . . . . 3 3 1 1 . . . . . 4 1 6 1 4 1 1 5 5 10 10 6 6 15 15 20
“Pascal’s Triangle” Chu Shin-Chieh 1303 The Precious Mirror of the Four Elements . . . Known in Europe by 1529 Blaise Pascal 1654
Pascal’s Triangle 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 1 6 15 20 15 6 1 “It is extraordinary how fertile in properties the triangle is. everyone can try his hand.”
Summing the rows… gives us powers of 2 1 1 + 1 1 + 2 + 1 1 + 3 + 3 + 1 1 + 4 + 6 + 4 + 1 1 + 5 + 10 + 10 + 5 + 1 1 + 6 + 15 + 20 + 15 + 6 + 1 =1 =2 =4 =8 =16 =32 =64
6+20+6 = 1+15+15+1 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 1 6 15 20 15 6 1
Summing the diagonals… yields Little Gauss’s formula and more! 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 1 6 15 20 15 6 1
1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 1 6 15 20 15 6 1 =2 =3 =5 =8 =13
1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 1 6 15 20 15 6 1 2 2 2 2 2 2 2