1Counting III: Pascal’s Triangle, Polynomials, and Vector ProgramsCarnegie Mellon UniversityFeb 14, 2004Lecture 11CS 15-251 Spring 2003Steven RudichGreat Theoretical Ideas In Computer Science X1 X2 + + X31 + X1+ X2+ X 3+ … + Xn-1+ Xn=Xn+1 - 1X-1The Geometric Series1 + X1+ X2+ X 3+ … + Xn+ ….. =11 -XThe Infinite Geometric Series(X-1) ( 1 + X1+ X2+ X 3+ … + Xn+ … )= X1+ X2+ X 3+ … + Xn+ Xn+1 + ….- 1 - X1- X2- X 3- … - Xn-1 – Xn- Xn+1- …= 11 + X1+ X2+ X 3+ … + Xn+ ….. =11 -X1 + x + …..____________________1-x | 1-[1 – x]_____x-[x – x2]______x2-....1 + X1+ X2+ X 3+ … + Xn+ ….. =11 -X1 + aX1+ a2X2+ a3X 3+ … + anXn+ ….. =11 -aXGeometric Series (Linear Form)2(1 + aX1+ a2X2+ … + anXn+ …..) (1 + bX1+ b2X2+ … + bnXn+ …..) =1(1 – aX)(1-bX)Geometric Series (Quadratic Form)(1 + aX1+ a2X2+ … + anXn+ …..) (1 + bX1+ b2X2+ … + bnXn+ …..) =1 + c1X1+ .. + ckXk+ …Suppose we multiply this out to get a single, infinite polynomial.What is an expression for Cn?(1 + aX1+ a2X2+ … + anXn+ …..) (1 + bX1+ b2X2+ … + bnXn+ …..) =1 + c1X1+ .. + ckXk+ …cn=a0bn+ a1bn-1+…aibn-i… + an-1b1+ anb0(1 + aX1+ a2X2+ … + anXn+ …..) (1 + bX1+ b2X2+ … + bnXn+ …..) =1 + c1X1+ .. + ckXk+ …If a = b then cn= (n+1)(an)a0bn+ a1bn-1+…aibn-i… + an-1b1+ anb0(a-b) (a0bn+ a1bn-1+…aibn-i… + an-1b1+ anb0)= a1bn+… ai+1bn-i… + anb1+ an+1b0- a0bn+1 – a1bn… ai+1bn-i… - an-1b2- anb1= - bn+1+ an+1= an+1 – bn+1a0bn+ a1bn-1+… aibn-i… + an-1b1+ anb0=an+1 – bn+1a-b(1 + aX1+ a2X2+ … + anXn+ …..) (1 + bX1+ b2X2+ … + bnXn+ …..) =1 + c1X1+ .. + ckXk+ …if a ≠ b then cn=a0bn+ a1bn-1+…aibn-i… + an-1b1+ anb0an+1 – bn+1a-b3(1 + aX1+ a2X2+ … + anXn+ …..) (1 + bX1+ b2X2+ … + bnXn+ …..) =1(1 – aX)(1-bX)Geometric Series (Quadratic Form)an+1 – bn+1a-b∑n=0..1Xn==∑n=0..1Xnor(n+1)anwhen a=bPreviously, we saw thatPolynomials Count!What is the coefficient of BA3N2in the expansion of(B + A + N)6?The number of ways to rearrange the letters in the word BANANA.1 X 1 X1 X 1 X1 X1 X1 XChoice tree for terms of (1+X)31 XX X2X X2X2X3Combine like terms to get 1 + 3X + 3X2+ X3The Binomial Formula(1 X)+ =FHGIKJ+FHGIKJ+FHGIKJ+ +FHGIKJ+ +FHGIKJn k nnnXnXnkXnnX0 1 22... ...binomial expressionBinomial Coefficients0(1)nnkknxxk=+=⋅∑The Binomial Formula40(1)nnkknxxk=+=⋅∑One polynomial, two representations“Product form” or“Generating form” “Additive form” or“Expanded form”00(1)nnkkkknxxknxk=∞=+=⋅=⋅∑∑“Closed form” or“Generating form”“Power series” (“Taylor series”) expansionSince 0 if nknk=>Power Series RepresentationBy playing these two representations againsteach other we obtain a new representation ofa previous insight:00(1)2nnkknnknxxknk==+=⋅=∑∑123Let x=1. The number ofsubsets of an n-element set001 even odd(1)0(1)2nnkknkknnnkknxxknknnkk==−+=⋅=⋅−==∑∑∑∑Let x= -1. Equivalently, By varying x, we can discover new identities001 even odd(1)0(1)2nnkknkknnnkknxxknknnkk==−+=⋅=⋅−==∑∑∑∑Let x= -1. Equivalently, The number of even-sized subsets of an n element set is the same as the number of odd-sized subsets.We could discover new identities by substituting in different numbers for X. One cool idea is to try complex roots of unity, however, the lecture is going in another direction.0(1)nnkknxxk=+=⋅∑5Proofs that work by manipulating algebraic forms are called “algebraic” arguments. Proofs that build a 1-1 onto correspondence are called “combinatorial” arguments.0(1)nnkknxxk=+=⋅∑Let Onbe the set of binary strings of length n with an odd number of ones.Let Enbe the set of binary strings of length n with an even number of ones.We gave an algebraic proof that|On | = | En|1 even odd2nnnkknnkk−==∑∑A Combinatorial ProofLet Onbe the set of binary strings of length nwith an odd number of ones.Let Enbe the set of binary strings of length nwith an even number of ones.A combinatorial proof must construct a one-to -one correspondence between On and En An attempt at a correspondenceLet fnbe the function that takes an n-bit string and flips all its bits....but do even n work? In f6we have110011 à 001100101010 à 010101Uh oh. Complementing maps evens to evens!fnis clearly a one-to-one and onto function for odd n. E.g. in f7we have0010011 à 11011001001101 à 0110010A correspondence that works for all nLet fnbe the function that takes an n-bit string and flips only the first bit.For example,0010011 à 10100111001101 à 0001101110011 à 010011101010 à 001010The binomial coefficients have so many representations that many fundamental mathematical identities emerge…0(1)nnkknxxk=+=⋅∑6The Binomial Formula(1+X)1 =(1+X)0 =(1+X)2=(1+X)3=11 + 1X1 + 2X + 1X21 + 3X + 3X2 + 1X3(1+X)4= 1 + 4X + 6X2 + 4X3 + 1X4Pascal’s Triangle:kthrow are the coefficients of (1+X)k(1+X)1 =(1+X)0 =(1+X)2=(1+X)3=11 + 1X1 + 2X + 1X21 + 3X + 3X2 + 1X3(1+X)4= 1 + 4X + 6X2 + 4X3 + 1X4kthRow Of Pascal’s Triangle:(1+X)1 =(1+X)0 =(1+X)2=(1+X)3=11 + 1X1 + 2X + 1X21 + 3X + 3X2 + 1X3(1+X)4= 1 + 4X + 6X2 + 4X3 + 1X4,,,...,,...012nnnnnknInductive definition of kth entry of nth row:Pascal(n,0) = Pacal (n,n) = 1; Pascal(n,k) = Pascal(n-1,k-1) + Pascal(n,k)(1+X)1 =(1+X)0 =(1+X)2=(1+X)3=11 + 1X1 + 2X + 1X21 + 3X + 3X2 + 1X3(1+X)4= 1 + 4X + 6X2 + 4X3 + 1X4001101222111121133012333031312==========“Pascal’s Triangle”Al-Karaji, Baghdad 953-1029Chu Shin-Chieh 1303The Precious Mirror of the Four Elements. . . Known in Europe by 1529Blaise Pascal 1654Pascal’s Triangle11 11 2 11 3 3 11 4 6 4 11 5 10 10 5 11 6 15 20 15 6 1NOM“It is extraordinaryhow fertile inproperties thetriangle is.Everyone cantry hishand.”7Summing The Rows11 +
View Full Document