![Page 1: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/1.jpg)
Counting III: Pascal’s Triangle, Polynomials, and Vector
Programs
Great Theoretical Ideas In Computer ScienceSteven Rudich
CS 15-251 Spring 2003
Lecture 11 Feb 14, 2004 Carnegie Mellon University
X1 X2 + + X3
![Page 2: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/2.jpg)
1 + X1 + X11 + X + X22 + X + X 33 + … + X + … + Xn-1n-1 + X + Xnn ==
XXn+1 n+1 - 1- 1
XX - 1- 1
The Geometric Series
![Page 3: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/3.jpg)
1 + X1 + X11 + X + X22 + X + X 33 + … + X + … + Xnn + ….. + ….. ==
11
1 - X1 - X
The Infinite Geometric Series
![Page 4: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/4.jpg)
(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 - …
= 1
1 + X1 + X11 + X + X22 + X + X 33 + … + X + … + Xnn + ….. + ….. ==
11
1 - X1 - X
![Page 5: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/5.jpg)
1 + x + ….. ____________________1-x | 1 -[1 – x] _____ x -[x – x2 ]
______ x2 -....
1 + X1 + X11 + X + X22 + X + X 33 + … + X + … + Xnn + ….. + ….. ==
11
1 - X1 - X
![Page 6: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/6.jpg)
1 + aX1 + aX11 + a + a22XX22 + a + a33X X 33 + … + a + … + annXXnn + ….. =+ ….. =
11
1 - aX1 - aX
Geometric Series (Linear Form)
![Page 7: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/7.jpg)
(1 + aX1 + a2X2 + … + anXn + …..) (1 + bX1 + b2X2 + … + bnXn + …..) =
11
(1 – aX)(1-bX)(1 – aX)(1-bX)
Geometric Series (Quadratic Form)
![Page 8: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/8.jpg)
(1 + aX1 + a2X2 + … + anXn + …..) (1 + bX1 + b2X2 + … + bnXn + …..) =
1 + c1X1 + .. + ck Xk + …
Suppose we multiply this out to get a single, infinite
polynomial.
What is an expression for Cn?
![Page 9: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/9.jpg)
(1 + aX1 + a2X2 + … + anXn + …..) (1 + bX1 + b2X2 + … + bnXn + …..) =
1 + c1X1 + .. + ck Xk + …
cn =
aa00bbnn + a + a11bbn-1n-1 +… a +… aiibbn-in-i… + a… + an-1n-1bb11 + + aannbb00
![Page 10: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/10.jpg)
(1 + aX1 + a2X2 + … + anXn + …..) (1 + bX1 + b2X2 + … + bnXn + …..) =
1 + c1X1 + .. + ck Xk + …
If a = b then
cn = (n+1)(an)
aa00bbnn + a + a11bbn-1n-1 +… a +… aiibbn-in-i… + a… + an-1n-1bb11 + + aannbb00
![Page 11: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/11.jpg)
(a-b) (aa00bbnn + a + a11bbn-1n-1 +… a +… aiibbn-in-i… + a… + an-1n-1bb11 + a + annbb00)= aa11bbnn +… a +… ai+1i+1bbn-in-i… + a… + annbb11 + + aan+1n+1bb00
- aa00bbn+1 n+1 – a – a11bbnn… a… ai+1i+1bbn-in-i… - a… - an-1n-1bb22 - a - annbb11
= - bn+1 + an+1
= an+1 – bn+1
aa00bbnn + a + a11bbn-1n-1 +… a +… aiibbn-in-i… + a… + an-1n-1bb11 + a + annbb00 = = aan+1 n+1 – – bbn+1n+1
aa - b- b
![Page 12: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/12.jpg)
(1 + aX1 + a2X2 + … + anXn + …..) (1 + bX1 + b2X2 + … + bnXn + …..) =
1 + c1X1 + .. + ck Xk + …
if a b then
cn =
aa00bbnn + a + a11bbn-1n-1 +… a +… aiibbn-in-i… + a… + an-1n-1bb11 + + aannbb00
aan+1 n+1 – – bbn+1n+1
aa - b- b
![Page 13: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/13.jpg)
(1 + aX1 + a2X2 + … + anXn + …..) (1 + bX1 + b2X2 + … + bnXn + …..) =
11
(1 – aX)(1-bX)(1 – aX)(1-bX)
Geometric Series (Quadratic Form)
aan+1 n+1 – – bbn+1n+1
aa - b- b n=0..1 Xn
=
=
n=0..1 Xnor (n+1)a(n+1)ann
when a=b
![Page 14: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/14.jpg)
Previously, we saw that
Polynomials Count!
![Page 15: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/15.jpg)
What is the coefficient of BA3N2 in the expansion of
(B + A + N)6?
The number of ways to
rearrange the letters in the
word BANANA.
![Page 16: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/16.jpg)
1 X 1 X1 X 1 X
1 X 1 X
1 X
Choice tree for terms of (1+X)3
1 X X X2 X X2 X2 X3
Combine like terms to get 1 + 3X + 3X2 + X3
![Page 17: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/17.jpg)
The Binomial Formula
(1 X) FHGIKJ
FHGIKJ FHGIKJ
FHGIKJ FHGIKJn k nn n X n X n
k X nn X0 1 2
2 ... ...
binomial expression
Binomial Coefficients
![Page 18: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/18.jpg)
0
(1 )n
n k
k
nx x
k
The Binomial Formula
![Page 19: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/19.jpg)
0
(1 )n
n k
k
nx x
k
One polynomial, two representations
“Product form” or“Generating form” “Additive form” or
“Expanded form”
![Page 20: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/20.jpg)
0
0
(1 )n
n k
k
k
k
nx x
k
nx
k
“Closed form” or“Generating form”
“Power series” (“Taylor series”) expansion
Since 0 if n
k nk
Power Series Representation
![Page 21: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/21.jpg)
By playing these two representations againsteach other we obtain a new representation ofa previous insight:
0
0
(1 )
2
nn k
k
nn
k
nx x
k
nk
Let x=1.
The number ofThe number ofsubsets of an subsets of an nn-element set-element set
![Page 22: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/22.jpg)
0
0
1
even odd
(1 )
0 ( 1)
2
nn k
k
nk
k
n nn
k k
nx x
k
nk
n nk k
Let x= -1.
Equivalently,
By varying x, we can discover new identities
![Page 23: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/23.jpg)
0
0
1
even odd
(1 )
0 ( 1)
2
nn k
k
nk
k
n nn
k k
nx x
k
nk
n nk k
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.
![Page 24: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/24.jpg)
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 )n
n k
k
nx x
k
![Page 25: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/25.jpg)
Proofs that work by manipulating algebraic forms
are called “algebraic” arguments. Proofs that build a 1-1 onto correspondence are
called “combinatorial” arguments.
0
(1 )n
n k
k
nx x
k
![Page 26: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/26.jpg)
Let Let OOnn be the set of binary strings of be the set of binary strings of length length nn with an with an oddodd number of ones. number of ones.
Let Let EEnn be the set of binary strings of be the set of binary strings of length length nn with an with an even even number of ones.number of ones.
We gave an We gave an algebraicalgebraic proof that proof that
OOn n = = E Enn
1
even odd
2n n
n
k k
n nk k
![Page 27: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/27.jpg)
A Combinatorial Proof
Let Let OOnn be the set of binary strings of length be the set of binary strings of length nn with an with an oddodd number of ones. number of ones.
Let Let EEnn be the set of binary strings of length be the set of binary strings of length nn with an with an even even number of ones.number of ones.
A A combinatorialcombinatorial proof must construct a proof must construct a one-one-to-one correspondence to-one correspondence betweenbetween OOn n and and EEn n
![Page 28: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/28.jpg)
An attempt at a correspondenceLet 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 11011001001101 0110010
![Page 29: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/29.jpg)
A correspondence that works for all n
Let Let ffnn be the function that takes an be the function that takes an n-bit string and flips only n-bit string and flips only the first bitthe first bit..
For example,For example,
0010011 0010011 1010011 10100111001101 1001101 0001101 0001101
110011 110011 010011 010011101010 101010 001010 001010
![Page 30: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/30.jpg)
The binomial coefficients have so many representations that
many fundamental mathematical identities
emerge…
0
(1 )n
n k
k
nx x
k
![Page 31: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/31.jpg)
The Binomial Formula
(1+X)1 =(1+X)0 =
(1+X)2 =(1+X)3 =
11 + 1X
1 + 2X + 1X2
1 + 3X + 3X2 + 1X3
(1+X)4 = 1 + 4X + 6X2 + 4X3 + 1X4
![Page 32: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/32.jpg)
Pascal’s Triangle:kth row are the coefficients of (1+X)k
(1+X)1 =(1+X)0 =
(1+X)2 =(1+X)3 =
11 + 1X
1 + 2X + 1X2
1 + 3X + 3X2 + 1X3
(1+X)4 = 1 + 4X + 6X2 + 4X3 + 1X4
![Page 33: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/33.jpg)
kth Row Of Pascal’s Triangle:
(1+X)1 =(1+X)0 =
(1+X)2 =(1+X)3 =
11 + 1X
1 + 2X + 1X2
1 + 3X + 3X2 + 1X3
(1+X)4 = 1 + 4X + 6X2 + 4X3 + 1X4
, , ,..., ,...0 1 2n n n n n
k n
![Page 34: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/34.jpg)
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 =
11 + 1X
1 + 2X + 1X2
1 + 3X + 3X2 + 1X3
(1+X)4 = 1 + 4X + 6X2 + 4X3 + 1X4
![Page 35: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/35.jpg)
00
1 10 1
2 2 2
1
1 1
1 2 1
1 3 3
0 1 2
3 3 30 3
13
1 2
“Pascal’s Triangle”
Al-Karaji, Baghdad 953-1029
Chu Shin-Chieh 1303The Precious Mirror of the Four Elements. . . Known in Europe by 1529 Blaise Pascal 1654
![Page 36: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/36.jpg)
Pascal’s Triangle11
1 11 1
1 2 11 2 1
1 3 3 11 3 3 1
1 4 6 4 11 4 6 4 1
1 5 10 10 5 11 5 10 10 5 1
1 6 15 20 15 6 11 6 15 20 15 6 1
“It is extraordinaryhow fertile in
properties thetriangle is.
Everyone cantry hishand.”
![Page 37: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/37.jpg)
Summing The RowsSumming The Rows
11
1 1 ++ 1 1
1 1 ++ 2 2 ++ 1 1
1 1 ++ 3 3 ++ 3 3 ++ 1 1
1 1 ++ 4 4 ++ 6 6 ++ 4 4 ++ 1 1
1 1 ++ 5 5 ++ 10 10 ++ 10 10 ++ 5 5 ++ 1 1
1 1 ++ 6 6 ++ 15 15 ++ 20 20 ++ 15 15 ++ 6 6 ++ 1 1
=1=1
=2=2
=4=4
=8=8
=16=16
=32=32
=64=64
0
2n
n
k
nk
![Page 38: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/38.jpg)
11
1 11 1
1 2 11 2 1
1 3 3 11 3 3 1
1 4 6 4 11 4 6 4 1
1 5 10 10 5 11 5 10 10 5 1
1 6 15 20 15 6 11 6 15 20 15 6 1
6+20+6 1+15+15+1=
![Page 39: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/39.jpg)
Summing on 1Summing on 1stst Avenue Avenue11
1 11 1
1 2 11 2 1
1 3 3 11 3 3 1
1 4 6 4 11 4 6 4 1
1 5 10 10 5 11 5 10 10 5 1
1 6 15 20 15 6 11 6 15 20 15 6 1
1 ( 1)1 2 2
n n
i k i k
i n n ni
![Page 40: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/40.jpg)
11
1 11 1
1 2 11 2 1
1 3 3 11 3 3 1
1 4 6 4 11 4 6 4 1
1 5 10 10 5 11 5 10 10 5 1
1 6 15 20 15 6 11 6 15 20 15 6 1
Summing on kSumming on kthth Avenue Avenue
11
n
i k
i nk k
![Page 41: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/41.jpg)
11
1 11 1
1 2 11 2 1
1 3 3 11 3 3 1
1 4 6 4 11 4 6 4 1
1 5 10 10 5 11 5 10 10 5 1
1 6 15 20 15 6 11 6 15 20 15 6 1
=2=5
=13
=3=8
![Page 42: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/42.jpg)
11
1 11 1
1 2 11 2 1
1 3 3 11 3 3 1
1 4 6 4 11 4 6 4 1
1 5 10 10 5 11 5 10 10 5 1
1 6 15 20 15 6 11 6 15 20 15 6 1
222
2222
![Page 43: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/43.jpg)
Al-Karaji SquaresAl-Karaji Squares
11
1 1 1 1
1 1 2 2 ++ 2*2*11
1 1 3 3 ++ 2*2*3 3 1 1
1 1 4 4 ++ 2*2*6 4 6 4 1 1
1 1 5 5 ++ 2*2*10 10 10 10 5 5 1 1
1 1 6 6 ++ 2*2*15 15 20 20 15 15 6 6 1 1
=0=0
=1=1
=4=4
=9=9
=16=16
=25=25
=36=36
![Page 44: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/44.jpg)
All these properties can be proved inductively and algebraically. We will give combinatorial proofs using
the Manhattan block walking representation of
binomial coefficients.
![Page 45: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/45.jpg)
How many shortest routes from A to B?
B
A
105
![Page 46: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/46.jpg)
Manhattank’th Avenue0
12
34
j’th Street 01
23
4
![Page 47: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/47.jpg)
Manhattank’th Avenue0
12
34
Level n 01
34
2………
…………………… …………………………
…………………………………
………….
![Page 48: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/48.jpg)
Manhattank’th Avenue0
12
34
Level n 01
34
2………
…………………… …………………………
…………………………………
………….
![Page 49: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/49.jpg)
. . . . .. . . . .
. . . . .. . . . .
. . . . .
level nk’th Avenue1
11
11
1
1
11
11
32
34 46
156 65 510 10
1520
![Page 50: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/50.jpg)
. . . . .. . . . .
. . . . .. . . . .
. . . . .
level nk’th Avenue1
11
11
1
1
1
1
11
32
34 46
156 65 510 10
1520
1 11
n n nk k k
![Page 51: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/51.jpg)
. . . . .. . . . .
. . . . .. . . . .
. . . . .
level nk’th Avenue1
11
11
1
1
1
1
11
32
34 46
156 65 510 10
1520
1
even
2nk
nk
![Page 52: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/52.jpg)
. . . . .. . . . .
. . . . .. . . . .
. . . . .
level nk’th Avenue1
11
11
1
1
1
1
11
32
34 46
156 65 510 10
1520
2
0
2n
k
n nk n
![Page 53: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/53.jpg)
0! 1
1 if 0
0 if 0 or
nk
k
nk k n
k
By convention:
(empty product = 1)
![Page 54: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/54.jpg)
1
11
n
i
i nk k
1
Corollary ( 1)1 ( 1)
2 2
n
i
kn n ni
. . . . .. . . . .
. . . . .. . . . .
. . . . .
level nk’th Avenue1
11
11
1
1
1
1
11
32
34 46
156 65 510 10
1520
![Page 55: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/55.jpg)
Application (Al-Karaji):
2 2 2 2 2
0
1
1 2 3
(1 0 1) (2 1 2) (3 2 3) ( ( 1) )
1 0 2 1 3 2 ( 1)
2 3 4 5 12
2 2 2 2 2 2
1 1 (2 1)( 1)23 2 6
n
i
n
i
i n
n n n
n n i
n n
n n n n n
![Page 56: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/56.jpg)
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:
< * , * , * , * , *, *, . . . . . . . . . >
0 1 2 3 4 5 . . . . . . . . .
![Page 57: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/57.jpg)
Vector ProgramsLet k stand for a scalar constant<k> will stand for the vector <k,0,0,0,…>
<0> = <0,0,0,0,….><1> = <1,0,0,0,…>
V! + T! means to add the vectors position-wise.
<4,2,3,…> + <5,1,1,….> = <9,3,4,…>
![Page 58: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/58.jpg)
Vector ProgramsRIGHT(V!) means to shift every number in V! one position to the right and to place a 0 in position 0.
RIGHT( <1,2,3, …> ) = <0,1,2,3,. …>
![Page 59: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/59.jpg)
Vector ProgramsExample:
V! := <6>;V! := RIGHT(V!) + <42>;V! := RIGHT(V!) + <2>;V! := RIGHT(V!) + <13>;
VV!! = < 13, 2, 42, 6, 0, 0, 0, . . . > = < 13, 2, 42, 6, 0, 0, 0, . . . >
Stare
V! = <6,0,0,0,..>V! = <42,6,0,0,..>V! = <2,42,6,0,..> V!
= <13,2,42,6,.>
![Page 60: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/60.jpg)
Vector ProgramsExample:
V! := <1>;
Loop n times: V! := V! + RIGHT(V!);
VV!! = n = nthth row of Pascal’s triangle. row of Pascal’s triangle.
Stare
V! = <1,0,0,0,..>
V! = <1,1,0,0,..>V! = <1,2,1,0,..> V! = <1,3,3,1,.>
![Page 61: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/61.jpg)
X1 X2 + + X3Vector programs
can be implemented by
polynomials!
![Page 62: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/62.jpg)
Programs -----> Polynomials
The vector V! = < a0, a1, a2, . . . > will be represented by the polynomial:
![Page 63: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/63.jpg)
Formal Power Series
The vector V! = < a0, a1, a2, . . . > will be represented by the formal power series:
![Page 64: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/64.jpg)
V! = < a0, a1, a2, . . . >
<0> is represented by 0<k> is represented by k
RIGHT(V! ) is represented by (PV X)
V! + T! is represented by (PV + PT)
![Page 65: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/65.jpg)
Vector ProgramsExample:
V! := <1>;
Loop n times: V! := V! + RIGHT(V!);
VV!! = n = nthth row of Pascal’s triangle. row of Pascal’s triangle.
PV := 1;
PV := PV + PV X;
![Page 66: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/66.jpg)
Vector ProgramsExample:
V! := <1>;
Loop n times: V! := V! + RIGHT(V!);
VV!! = n = nthth row of Pascal’s triangle. row of Pascal’s triangle.
PV := 1;
PV := PV (1+ X);
![Page 67: Counting III: Pascal’s Triangle, Polynomials, and Vector Programs](https://reader036.vdocuments.net/reader036/viewer/2022062500/56815aa3550346895dc82c0d/html5/thumbnails/67.jpg)
Vector ProgramsExample:
V! := <1>;
Loop n times: V! := V! + RIGHT(V!);
VV!! = n = nthth row of Pascal’s triangle. row of Pascal’s triangle.
PV = (1+ X)n