Counting III: Pascal’s Triangle, Polynomials, and Vector Programs Great Theoretical Ideas In Computer Science Steven RudichCS 15-251 Spring 2003 Lecture.

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 Chapter 6 With Question/Answer Animations.
Sequences, Series, and the Binomial Theorem
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.
Counting I: One To One Correspondence and Choice Trees Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2004 Lecture 9Feb 10,
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}:
Counting II: Pascal, Binomials, and Other Tricks Great Theoretical Ideas In Computer Science A. Gupta D. Sleator CS Fall 2010 Lecture 8Sept. 16,
The Golden Ratio, Fibonacci Numbers, And Other Recurrences Great Theoretical Ideas In Computer Science John LaffertyCS Fall 2006 Lecture 13October.
1 1.0 Students solve equations and inequalities involving absolute value. Algebra 2 Standards.
Fibonacci Numbers, Polynomial Coefficients, and Vector Programs.
Rev.S08 MAC 1140 Module 12 Introduction to Sequences, Counting, The Binomial Theorem, and Mathematical Induction.
Lecture 11 Feb 17, 1998 Doug Beeferman Carnegie Mellon University Count your blessings... … faster !
Multiplying and Dividing Real Numbers Objective: To multiply and divide real numbers.
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.
2.4 Sequences and Summations
Section 2.4. Section Summary Sequences. Examples: Geometric Progression, Arithmetic Progression Recurrence Relations Example: Fibonacci Sequence Summations.
MATH – High School Common Core Vs Tested Kansas Standards Please note: For informational purposes, all Common Core standards are listed, and the tested.
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.
Slide 7- 1 Copyright © 2006 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Great Theoretical Ideas in Computer Science.
Matrices CHAPTER 8.1 ~ 8.8. Ch _2 Contents  8.1 Matrix Algebra 8.1 Matrix Algebra  8.2 Systems of Linear Algebra Equations 8.2 Systems of Linear.
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.
Polynomials P4.
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.
Copyright © Cengage Learning. All rights reserved. CHAPTER 9 COUNTING AND PROBABILITY.
Polynomials. The Degree of ax n If a does not equal 0, the degree of ax n is n. The degree of a nonzero constant is 0. The constant 0 has no defined degree.
COMPSCI 102 Discrete Mathematics for Computer Science.
Great Theoretical Ideas in Computer Science.
Fibonacci Numbers, Vector Programs and a new kind of science.
COMPSCI 102 Discrete Mathematics for Computer Science.
Counting II: Recurring Problems And Correspondences Great Theoretical Ideas In Computer Science John LaffertyCS Fall 2005 Lecture 7Sept 20, 2005Carnegie.
Counting I: One To One Correspondence and Choice Trees Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2004 Lecture 9Feb 10,
Choose Your Representation! Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2005 Lecture 14 Feb 24, 2005 Carnegie Mellon University.
Spring 2016 COMP 2300 Discrete Structures for Computation
Counting II: Recurring Problems And Correspondences Great Theoretical Ideas In Computer Science V. AdamchikCS Spring 2006 Lecture 6Feb 2, 2005Carnegie.
Binomial Coefficients: Selected Exercises
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
Essential Questions How do we multiply polynomials?
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.
Developing Your Counting Muscles
Add, Subtract, Multiply Polynomials
Induction: One Step At A Time
Counting III: Pascal’s Triangle, Polynomials, and Vector Programs
Sum and Product of Roots
Created by Mr. Lafferty Maths Dept.
Generating Functions II
Section 11.2 The Quadratic Formula.
Counting I: Bijection and Choice Trees
Great Theoretical Ideas in Computer Science
Basic Counting.
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
Add, Subtract, Multiply Polynomials
Counting I: Choice Trees and Correspondences
Presentation transcript:

Counting III: Pascal’s Triangle, Polynomials, and Vector Programs Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2003 Lecture 11Feb 14, 2004Carnegie Mellon University X1 X1 X2 X2 + + X3 X3

1 + X 1 + X 2 + X 3 + … + X n-1 + X n = 1 + X 1 + X 2 + X 3 + … + X n-1 + X n = X n X - 1 The Geometric Series

1 + X 1 + X 2 + X 3 + … + X n + ….. = 1 + X 1 + X 2 + X 3 + … + X n + ….. = X The Infinite Geometric Series

(X-1) ( 1 + X 1 + X 2 + X 3 + … + X n + … ) = X 1 + X 2 + X 3 + … + X n + X n+1 + … X 1 - X 2 - X 3 - … - X n-1 – X n - X n+1 - … = X 1 + X 2 + X 3 + … + X n + ….. = 1 + X 1 + X 2 + X 3 + … + X n + ….. = X

1 + x + ….. ____________________ 1-x | 1 -[1 – x] _____ x -[x – x 2 ] ______ x X 1 + X 2 + X 3 + … + X n + ….. = 1 + X 1 + X 2 + X 3 + … + X n + ….. = X

1 + aX 1 + a 2 X 2 + a 3 X 3 + … + a n X n + ….. = 1 + aX 1 + a 2 X 2 + a 3 X 3 + … + a n X n + ….. = aX Geometric Series (Linear Form)

( 1 + aX 1 + a 2 X 2 + … + a n X n + ….. ) ( 1 + bX 1 + b 2 X 2 + … + b n X n + ….. ) = 1 (1 – aX)(1-bX) Geometric Series (Quadratic Form)

( 1 + aX 1 + a 2 X 2 + … + a n X n + ….. ) ( 1 + bX 1 + b 2 X 2 + … + b n X n + ….. ) = 1 + c 1 X c k X k + … Suppose we multiply this out to get a single, infinite polynomial. What is an expression for C n ?

( 1 + aX 1 + a 2 X 2 + … + a n X n + ….. ) ( 1 + bX 1 + b 2 X 2 + … + b n X n + ….. ) = 1 + c 1 X c k X k + … a 0 b n + a 1 b n-1 +… a i b n-i … + a n-1 b 1 + a n b 0 c n = a 0 b n + a 1 b n-1 +… a i b n-i … + a n-1 b 1 + a n b 0

( 1 + aX 1 + a 2 X 2 + … + a n X n + ….. ) ( 1 + bX 1 + b 2 X 2 + … + b n X n + ….. ) = 1 + c 1 X c k X k + … a 0 b n + a 1 b n-1 +… a i b n-i … + a n-1 b 1 + a n b 0 If a = b then c n = (n+1)(a n ) a 0 b n + a 1 b n-1 +… a i b n-i … + a n-1 b 1 + a n b 0

a 0 b n + a 1 b n-1 +… a i b n-i … + a n-1 b 1 + a n b 0 (a-b) ( a 0 b n + a 1 b n-1 +… a i b n-i … + a n-1 b 1 + a n b 0 ) a 1 b n +… a i+1 b n-i … + a n b 1 + a n+1 b 0 = a 1 b n +… a i+1 b n-i … + a n b 1 + a n+1 b 0 a 0 b n+1 – a 1 b n … a i+1 b n-i … - a n-1 b 2 - a n b 1 - a 0 b n+1 – a 1 b n … a i+1 b n-i … - a n-1 b 2 - a n b 1 = - b n+1 + a n+1 = a n+1 – b n+1 a 0 b n + a 1 b n-1 +… a i b n-i … + a n-1 b 1 + a n b 0 = a n+1 – b n+1 a - b

( 1 + aX 1 + a 2 X 2 + … + a n X n + ….. ) ( 1 + bX 1 + b 2 X 2 + … + b n X n + ….. ) = 1 + c 1 X c k X k + … a 0 b n + a 1 b n-1 +… a i b n-i … + a n-1 b 1 + a n b 0 if a  b then c n = a 0 b n + a 1 b n-1 +… a i b n-i … + a n-1 b 1 + a n b 0 a n+1 – b n+1 a - b

( 1 + aX 1 + a 2 X 2 + … + a n X n + ….. ) ( 1 + bX 1 + b 2 X 2 + … + b n X n + ….. ) = 1 (1 – aX)(1-bX) Geometric Series (Quadratic Form) a n+1 – b n+1 a - b  n=0.. 1 XnXn = = XnXn or (n+1)a n when a=b

Previously, we saw that Polynomials Count!

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.

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

The Binomial Formula binomial expression Binomial Coefficients

The Binomial Formula

One polynomial, two representations “Product form” or “Generating form” “Additive form” or “Expanded form”

“Closed form” or “Generating form” “Power series” (“Taylor series”) expansion Power Series Representation

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

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.

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. Complementing maps evens to evens! 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,    

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

The Binomial Formula (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: 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,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” Al-Karaji, Baghdad Chu Shin-Chieh 1303 The Precious Mirror of the Four Elements... Known in Europe by 1529 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 many shortest routes from A to B? B A

Manhattan k’th Avenue j’th Street

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

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

..... level n k’th Avenue

..... level n k’th Avenue

..... level n k’th Avenue

..... level n k’th Avenue

By convention: (empty product = 1)

..... level n k’th Avenue

Application (Al-Karaji):

Vector Programs Let’s define a (parallel) programming language called VECTOR that operates on possibly infinite vectors of numbers. Each variable V ! can be thought of as:

Vector Programs Let k stand for a scalar constant will stand for the vector = V ! + T ! means to add the vectors position-wise. + =

Vector Programs RIGHT(V ! ) means to shift every number in V ! one position to the right and to place a 0 in position 0. RIGHT( ) =

Vector Programs Example: V ! := ; V ! := RIGHT(V ! ) + ; V ! = V ! = Stare V ! = V ! = V ! =

Vector Programs Example: V ! := ; Loop n times: V ! := V ! + RIGHT(V ! ); V ! = n th row of Pascal’s triangle. Stare V ! = V ! = V ! =

X1 X1 X2 X2 + + X3 X3 Vector programs can be implemented by polynomials!

Programs -----> Polynomials The vector V ! = will be represented by the polynomial:

Formal Power Series The vector V ! = will be represented by the formal power series:

V ! = is represented by 0 is represented by k RIGHT(V ! ) is represented by (P V X) V ! + T ! is represented by (P V + P T )

Vector Programs Example: V ! := ; Loop n times: V ! := V ! + RIGHT(V ! ); V ! = n th row of Pascal’s triangle. P V := 1; P V := P V + P V X;

Vector Programs Example: V ! := ; Loop n times: V ! := V ! + RIGHT(V ! ); V ! = n th row of Pascal’s triangle. P V := 1; P V := P V (1+ X);

Vector Programs Example: V ! := ; Loop n times: V ! := V ! + RIGHT(V ! ); V ! = n th row of Pascal’s triangle. P V = (1+ X) n