Abstract Representation: Your Ancient Heritage PowerPoint PPT Presentation

presentation player overlay
About This Presentation
Transcript and Presenter's Notes

Title: Abstract Representation: Your Ancient Heritage


1
15-251
Great Theoretical Ideas in Computer Science
2
Counting III
Lecture 8 (September 20, 2007)
3
Arrange n symbols r1 of type 1, r2 of type 2, ,
rk of type k

(n-r1)!

(n-r1-r2)!r2!
4
CARNEGIEMELLON
14!
3,632,428,800
2!3!2!
5

5 distinct pirates want to divide 20 identical,
indivisible bars of gold. How many different ways
can they divide up the loot?
6
How many different ways to divide up the loot?
Sequences with 20 Gs and 4 /s
7
How many different ways can n distinct pirates
divide k identical, indivisible bars of gold?

8
How many integer solutions to the following
equations?
x1 x2 x3 xn k
x1, x2, x3, , xn 0

9
Identical/Distinct Dice
Suppose that we roll seven dice
How many different outcomes are there, if order
matters?
67
What if order doesnt matter?(E.g., Yahtzee)
(Corresponds to 6 pirates and 7 bars of gold)
10
Identical/Distinct Objects
If we are putting k objects into n distinct bins.
11
The Binomial Formula
(1X)n
X0

X1

Xn
binomial expression
12
What is the coefficient of (X1r1X2r2Xkrk) in the
expansion of (X1X2X3Xk)n?
n!
r1!r2!...rk!
13
Power Series Representation
n
?
(1X)n
Xk
k 0
For kgtn,
Product form or Generating form
Power Series or Taylor Series Expansion
14
By playing these two representations against each
other we obtain a new representation of a
previous insight
n
?
(1X)n
Xk
k 0
Let x 1,
The number of subsets of an n-element set
15
By varying x, we can discover new identities
n
?
(1X)n
Xk
k 0
Let x -1,
Equivalently,
16
The number of subsets with even size is the same
as the number of subsets with odd size
17
n
?
(1X)n
Xk
k 0
Proofs that work by manipulating algebraic forms
are called algebraic arguments. Proofs that
build a bijection are called combinatorial
arguments
18
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 just saw an algebraic proof that ?On ?
? En ?
19
A Combinatorial Proof
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 A combinatorial proof must construct a
bijection between On and En
20
An Attempt at a Bijection
Let fn be the function that takes an n-bit
string and flips all its bits
fn is clearly a one-to-one and onto function
...but do even n work? In f6 we have
for odd n. E.g. in f7 we have
110011 ? 001100 101010 ? 010101
0010011 ? 1101100 1001101 ? 0110010
Uh oh. Complementing maps evens to evens!
21
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
22
n
?
(1X)n
Xk
k 0
The binomial coefficients have so many
representations that many fundamental
mathematical identities emerge
23


Either wedo not pick n then we have topick k
elementsout of the remaining n-1.
Or wedo pick n then we have topick k-1
elts.out of the remaining n-1.
Set of allk-subsetsof 1..n
24
The Binomial Formula
(1X)0
1
(1X)1
1 1X
(1X)2
1 2X 1X2
(1X)3
1 3X 3X2 1X3
(1X)4
1 4X 6X2 4X3 1X4
Pascals Triangle kth row are coefficients of
(1X)k
Inductive definition of kth entry of nth
rowPascal(n,0) Pascal (n,n) 1 Pascal(n,k)
Pascal(n-1,k-1) Pascal(n-1,k)
25
Pascals Triangle
  • Al-Karaji, Baghdad 953-1029
  • Chu Shin-Chieh 1303
  • Blaise Pascal 1654

26
Pascals Triangle
It is extraordinary how fertile in properties
the triangle is. Everyone can try his hand
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
27
Summing the Rows
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
28
Odds and Evens
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 15 15 1
6 20 6

29
Summing on 1st Avenue
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


30
Summing on kth Avenue
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

31
Fibonacci Numbers
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
32
Sums of Squares
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
33
Al-Karaji Squares
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
2?
9
2?
16
2?
25
2?
36
34
Pascal Mod 2
35
All these properties can be proved inductively
and algebraically. We will give combinatorial
proofs using the Manhattan block walking
representation of binomial coefficients
36
How many shortest routes from A to B?
A
B
37
Manhattan
0
0
1
1
jth street
kth avenue
2
2
3
3
4
4
There are
shortest routes from (0,0) to (j,k)
38
Manhattan
0
0
1
Level n
kth avenue
1
2
2
3
3
4
4
There are
shortest routes from (0,0) to (n-k,k)
39
Manhattan
0
0
1
Level n
kth avenue
1
2
2
3
3
4
4
shortest routes from (0,0) to
There are
level n and kth avenue
40
0
0
1
Level n
kth avenue
1
1
2
1
1
2
3
1
1
2
3
4
1
1
3
3
4
4
4
1
1
6
1
1
5
5
10
10
6
15
6
20
15
41
0
Level n
kth avenue
1
1
1
1
2
1
1
2
3
1
1
3
3
4
4
4
1
1
6
1
1
5
5
10
10

6
15
6
20
15


42
0
0
1
Level n
kth avenue
1
2
2
3
3
4
4

43
0
0
1
Level n
kth avenue
1
2
2
3
3
4
4
44
Vector Programs
Lets define a (parallel) programming language
called VECTOR that operates on possibly infinite
vectors of numbers. Each variable V? can be
thought of as
lt , , , , , , gt
45
Vector Programs
Let k stand for a scalar constant ltkgt will stand
for the vector ltk,0,0,0,gt
lt0gt lt0,0,0,0,gt lt1gt lt1,0,0,0,gt
V? T? means to add the vectors position-wise
lt4,2,3,gt lt5,1,1,.gt lt9,3,4,gt
46
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( lt1,2,3, gt ) lt0,1,2,3,gt
47
Vector Programs
Example
Store
V! lt6gt V! RIGHT(V!) lt42gt V!
RIGHT(V!) lt2gt V! RIGHT(V!) lt13gt
V! lt6,0,0,0,gt
V! lt42,6,0,0,gt
V! lt2,42,6,0,gt
V! lt13,2,42,6,gt
V! lt 13, 2, 42, 6, 0, 0, 0, gt
48
Vector Programs
Example
Store
V! lt1gt Loop n times V! V! RIGHT(V!)
V! lt1,0,0,0,gt
V! lt1,1,0,0,gt
V! lt1,2,1,0,gt
V! lt1,3,3,1,gt
V! nth row of Pascals triangle
49
  • X1
  • X2
  • X3

Vector programs can be implemented by polynomials!
50
Programs ? Polynomials
The vector V! lt a0, a1, a2, . . . gt will be
represented by the polynomial
51
Formal Power Series
The vector V! lt a0, a1, a2, . . . gt will be
represented by the formal power series
52
V! lt a0, a1, a2, . . . gt
lt0gt is represented by
0
ltkgt is represented by
k
V! T! is represented by
(PV PT)
RIGHT(V!) is represented by
(PV X)
53
Vector Programs
Example
V! lt1gt Loop n times V! V! RIGHT(V!)
PV 1
PV PV PV X
V! nth row of Pascals triangle
54
Vector Programs
Example
V! lt1gt Loop n times V! V! RIGHT(V!)
PV 1
PV PV(1X)
V! nth row of Pascals triangle
55
Vector Programs
Example
V! lt1gt Loop n times V! V! RIGHT(V!)
PV (1 X)n
V! nth row of Pascals triangle
56
  • Polynomials count
  • Binomial formula
  • Combinatorial proofs of binomial identities
  • Vector programs

Heres What You Need to Know
Write a Comment
User Comments (0)
About PowerShow.com