Recurrence Relations and Generating
Functions
Ngy 8 thng 12 nm 2010
Recurrence Relations and Generating Functions
Recursive Problem Solving
Question
Certain bacteria divide into two bacteria every second. It was
noticed that when one bacterium is placed in a bottle, it fills it up
in 3 minutes. How long will it take to fill half the bottle?
Recurrence Relations and Generating Functions
Recursive Problem Solving
Question
Certain bacteria divide into two bacteria every second. It was
noticed that when one bacterium is placed in a bottle, it fills it up
in 3 minutes. How long will it take to fill half the bottle?
Discussion
Many processes lend themselves to recursive handling. Many
sequences are determined by previous members of the
sequence.
Recurrence Relations and Generating Functions
Recursive Problem Solving
Question
Certain bacteria divide into two bacteria every second. It was
noticed that when one bacterium is placed in a bottle, it fills it up
in 3 minutes. How long will it take to fill half the bottle?
Discussion
Many processes lend themselves to recursive handling. Many
sequences are determined by previous members of the
sequence.
Recurrence Relations and Generating Functions
Recursive Problem Solving
Question
Certain bacteria divide into two bacteria every second. It was
noticed that when one bacterium is placed in a bottle, it fills it up
in 3 minutes. How long will it take to fill half the bottle?
Discussion
Many processes lend themselves to recursive handling. Many
sequences are determined by previous members of the
sequence.
How many got the bacteria process right?
Recurrence Relations and Generating Functions
Recursive Problem Solving
Question
Certain bacteria divide into two bacteria every second. It was
noticed that when one bacterium is placed in a bottle, it fills it up
in 3 minutes. How long will it take to fill half the bottle?
Discussion
Many processes lend themselves to recursive handling. Many
sequences are determined by previous members of the
sequence.
How many got the bacteria process right?
If we denote the number of bacteria at second number k by bk
then we have: bk+1 = 2bk , b1 = 1.
This is a recurrence relation.
Recurrence Relations and Generating Functions
The Towers of Hanoi
Another example of a problem that lends itself to a recurrence
relation is a famous puzzle: The towers of Hanoi
Recurrence Relations and Generating Functions
Recurrence Realtions
This puzzle asks you to move the disks from the left tower to
the right tower, one disk at a time so that a larger disk is never
placed on a smaller disk. The goal is to use the smallest
number of moves.
Recurrence Relations and Generating Functions
Recurrence Realtions
This puzzle asks you to move the disks from the left tower to
the right tower, one disk at a time so that a larger disk is never
placed on a smaller disk. The goal is to use the smallest
number of moves.
Clearly, before we move the large disk from the left to the right,
all but the bottom disk, have to be on the middle tower. So if we
denote the smallest number of moves by hn then we have:
hn+1 = 2hn + 1
A simple technic for solving recurrence relation is called
telescoping.
Recurrence Relations and Generating Functions
Recurrence Realtions
This puzzle asks you to move the disks from the left tower to
the right tower, one disk at a time so that a larger disk is never
placed on a smaller disk. The goal is to use the smallest
number of moves.
Clearly, before we move the large disk from the left to the right,
all but the bottom disk, have to be on the middle tower. So if we
denote the smallest number of moves by hn then we have:
hn+1 = 2hn + 1
A simple technic for solving recurrence relation is called
telescoping.
Start from the first term and sequntially produce the next terms
until a clear pattern emerges. If you want to be mathematically
rigoruous you may use induction.
Recurrence Relations and Generating Functions
Example
Solving bn+1 = 2bn , b1 = 1.
Recurrence Relations and Generating Functions
Example
Solving bn+1 = 2bn , b1 = 1.
Recurrence Relations and Generating Functions
Example
Solving bn+1 = 2bn , b1 = 1.
b1 = 1, b2 = 2, b3 = 4, . . . bn = 2n1 .
Recurrence Relations and Generating Functions
Example
Solving bn+1 = 2bn , b1 = 1.
b1 = 1, b2 = 2, b3 = 4, . . . bn = 2n1 .
Solving the Towers of Hanoi recurrence relation:
h1 = 1, h2 = 3, h3 = 7, h4 = 15, . . . hn = 2n 1
Proof by induction:
1 h1 = 1 = 21 1
Recurrence Relations and Generating Functions
Example
Solving bn+1 = 2bn , b1 = 1.
b1 = 1, b2 = 2, b3 = 4, . . . bn = 2n1 .
Solving the Towers of Hanoi recurrence relation:
h1 = 1, h2 = 3, h3 = 7, h4 = 15, . . . hn = 2n 1
Proof by induction:
1 h1 = 1 = 21 1
2 Assume hn = 2n 1
Recurrence Relations and Generating Functions
Example
Solving bn+1 = 2bn , b1 = 1.
b1 = 1, b2 = 2, b3 = 4, . . . bn = 2n1 .
Solving the Towers of Hanoi recurrence relation:
h1 = 1, h2 = 3, h3 = 7, h4 = 15, . . . hn = 2n 1
Proof by induction:
1 h1 = 1 = 21 1
2 Assume hn = 2n 1
3 Prove: hn+1 = 2n+1 1.
Recurrence Relations and Generating Functions
Example
Solving bn+1 = 2bn , b1 = 1.
b1 = 1, b2 = 2, b3 = 4, . . . bn = 2n1 .
Solving the Towers of Hanoi recurrence relation:
h1 = 1, h2 = 3, h3 = 7, h4 = 15, . . . hn = 2n 1
Proof by induction:
1 h1 = 1 = 21 1
2 Assume hn = 2n 1
3 Prove: hn+1 = 2n+1 1.
4 hn+1 = 2hn + 1 = 2(2n 1) + 1 = 2n+1 1.
Recurrence Relations and Generating Functions
Example
Solving bn+1 = 2bn , b1 = 1.
b1 = 1, b2 = 2, b3 = 4, . . . bn = 2n1 .
Solving the Towers of Hanoi recurrence relation:
h1 = 1, h2 = 3, h3 = 7, h4 = 15, . . . hn = 2n 1
Proof by induction:
1 h1 = 1 = 21 1
2 Assume hn = 2n 1
3 Prove: hn+1 = 2n+1 1.
4 hn+1 = 2hn + 1 = 2(2n 1) + 1 = 2n+1 1.
1
5 Solve: an = 1+an1 , a1 = 1.
Recurrence Relations and Generating Functions
Example
Solving bn+1 = 2bn , b1 = 1.
b1 = 1, b2 = 2, b3 = 4, . . . bn = 2n1 .
Solving the Towers of Hanoi recurrence relation:
h1 = 1, h2 = 3, h3 = 7, h4 = 15, . . . hn = 2n 1
Proof by induction:
1 h1 = 1 = 21 1
2 Assume hn = 2n 1
3 Prove: hn+1 = 2n+1 1.
4 hn+1 = 2hn + 1 = 2(2n 1) + 1 = 2n+1 1.
1
5 Solve: an = 1+an1 , a1 = 1.
6 Telescoping yields: 1, 12 , 2 3 5 8
3 , 5 , 8 , 13
Recurrence Relations and Generating Functions
1, 12 , 2 3 5 8
3 , 5 , 8 , 13
Recurrence Relations and Generating Functions
1, 12 , 2 3 5 8
3 , 5 , 8 , 13
Do we see a pattern?
Recurrence Relations and Generating Functions
1, 12 , 2 3 5 8
3 , 5 , 8 , 13
Do we see a pattern?
fn1
Looks like an = fn where fn are the Fibonacci numbers.
Can we prove it?
Recurrence Relations and Generating Functions
1, 12 , 2 3 5 8
3 , 5 , 8 , 13
Do we see a pattern?
fn1
Looks like an = fn where fn are the Fibonacci numbers.
Can we prove it?
Chng minh.
Recurrence Relations and Generating Functions
1, 12 , 2 3 5 8
3 , 5 , 8 , 13
Do we see a pattern?
fn1
Looks like an = fn where fn are the Fibonacci numbers.
Can we prove it?
Chng minh.
f0
1 By induction: a1 = 1 = f1 .
Recurrence Relations and Generating Functions
1, 12 , 2 3 5 8
3 , 5 , 8 , 13
Do we see a pattern?
fn1
Looks like an = fn where fn are the Fibonacci numbers.
Can we prove it?
Chng minh.
f0
1 By induction: a1 = 1 = f1 .
fn1
2 Induction hypothesis: assume an = fn
Recurrence Relations and Generating Functions
1, 12 , 2 3 5 8
3 , 5 , 8 , 13
Do we see a pattern?
fn1
Looks like an = fn where fn are the Fibonacci numbers.
Can we prove it?
Chng minh.
f0
1 By induction: a1 = 1 = f1 .
fn1
2 Induction hypothesis: assume an = fn
3
1 1 fn fn
an+1 = = f
= =
1 + an 1 + n1 fn + fn1 fn+1
fn
Recurrence Relations and Generating Functions
Recurrence Relations Terminology
Definition
A recurrence relation for a sequence an is a relation of the form
an+1 = f (a1 , a2 , . . . , an ).
We do not expect to have a useful method to solve all
recurrence relations. This definition actually applies to any
sequence! We shall break down the functions for which we do
have effective methods to solve the recurrence relation. By
solving we mean obtaining an explicit expression of the form
an = g(n). To accomplish this we need some terminology.
Recurrence Relations and Generating Functions
Recurrence Relations Terminology
Definition
A recurrence relation for a sequence an is a relation of the form
an+1 = f (a1 , a2 , . . . , an ).
We do not expect to have a useful method to solve all
recurrence relations. This definition actually applies to any
sequence! We shall break down the functions for which we do
have effective methods to solve the recurrence relation. By
solving we mean obtaining an explicit expression of the form
an = g(n). To accomplish this we need some terminology.
Definition
A recurrence relation is linear if:
n
X
f (a1 , a2 , . . . , an ) = hi ai + h(n) Where h(n) is a function of n.
i=1
Recurrence Relations and Generating Functions
Definition
Recurrence Relations and Generating Functions
Definition
1 A recurrence relation is:
Recurrence Relations and Generating Functions
Definition
1 A recurrence relation is:
2 homogeneous if h(n) = 0
Recurrence Relations and Generating Functions
Definition
1 A recurrence relation is:
2 homogeneous if h(n) = 0
3 With constant coefficients: if all hi are constants.
Recurrence Relations and Generating Functions
Definition
1 A recurrence relation is:
2 homogeneous if h(n) = 0
3 With constant coefficients: if all hi are constants.
Of order k if f (a1 , a2 , . . . , an ) = ni=nk hi ai
P
4
Recurrence Relations and Generating Functions
Definition
1 A recurrence relation is:
2 homogeneous if h(n) = 0
3 With constant coefficients: if all hi are constants.
Of order k if f (a1 , a2 , . . . , an ) = ni=nk hi ai
P
4
Example
Recurrence Relations and Generating Functions
Definition
1 A recurrence relation is:
2 homogeneous if h(n) = 0
3 With constant coefficients: if all hi are constants.
Of order k if f (a1 , a2 , . . . , an ) = ni=nk hi ai
P
4
Example
1 fn = fn1 + fn2 is a linear, homogeneous recurrence
relation of order 2 with constant coefficients.
Recurrence Relations and Generating Functions
Definition
1 A recurrence relation is:
2 homogeneous if h(n) = 0
3 With constant coefficients: if all hi are constants.
Of order k if f (a1 , a2 , . . . , an ) = ni=nk hi ai
P
4
Example
1 fn = fn1 + fn2 is a linear, homogeneous recurrence
relation of order 2 with constant coefficients.
2 an = an1 + n is a linear, non-homogeneous recurrence
relation of order 1 and constant coefficients.
Recurrence Relations and Generating Functions
Definition
1 A recurrence relation is:
2 homogeneous if h(n) = 0
3 With constant coefficients: if all hi are constants.
Of order k if f (a1 , a2 , . . . , an ) = ni=nk hi ai
P
4
Example
1 fn = fn1 + fn2 is a linear, homogeneous recurrence
relation of order 2 with constant coefficients.
2 an = an1 + n is a linear, non-homogeneous recurrence
relation of order 1 and constant coefficients.
3 dn = (n 1)dn1 + (n 1)dn2 is a linear, homogeneous
recurrence relation of order 2. It does not have constant
coefficients.
Recurrence Relations and Generating Functions
Definition
1 A recurrence relation is:
2 homogeneous if h(n) = 0
3 With constant coefficients: if all hi are constants.
Of order k if f (a1 , a2 , . . . , an ) = ni=nk hi ai
P
4
Example
1 fn = fn1 + fn2 is a linear, homogeneous recurrence
relation of order 2 with constant coefficients.
2 an = an1 + n is a linear, non-homogeneous recurrence
relation of order 1 and constant coefficients.
3 dn = (n 1)dn1 + (n 1)dn2 is a linear, homogeneous
recurrence relation of order 2. It does not have constant
coefficients.
4 an = an1 + 2an2 + 4an5 + 2n is a non-homogeneous,
linear recurrence relation with constant coefficients of order
5. Recurrence Relations and Generating Functions
Definition
1 A recurrence relation is:
2 homogeneous if h(n) = 0
3 With constant coefficients: if all hi are constants.
Of order k if f (a1 , a2 , . . . , an ) = ni=nk hi ai
P
4
Example
1 fn = fn1 + fn2 is a linear, homogeneous recurrence
relation of order 2 with constant coefficients.
2 an = an1 + n is a linear, non-homogeneous recurrence
relation of order 1 and constant coefficients.
3 dn = (n 1)dn1 + (n 1)dn2 is a linear, homogeneous
recurrence relation of order 2. It does not have constant
coefficients.
4 an = an1 + 2an2 + 4an5 + 2n is a non-homogeneous,
linear recurrence relation with constant coefficients of order
5. Recurrence Relations and Generating Functions
Recurrence Relations
A few more examples coming from verbal problems.
Question
Recurrence Relations and Generating Functions
Recurrence Relations
A few more examples coming from verbal problems.
Question
1 In how many ways can you write the integer n as a sum of
k distinct positive integers?
Recurrence Relations and Generating Functions
Recurrence Relations
A few more examples coming from verbal problems.
Question
1 In how many ways can you write the integer n as a sum of
k distinct positive integers?
2 In how many ways can you write n as a sum of 5 distinct
positive integers?
Recurrence Relations and Generating Functions
Recurrence Relations
A few more examples coming from verbal problems.
Question
1 In how many ways can you write the integer n as a sum of
k distinct positive integers?
2 In how many ways can you write n as a sum of 5 distinct
positive integers?
Answer
Recurrence Relations and Generating Functions
Recurrence Relations
A few more examples coming from verbal problems.
Question
1 In how many ways can you write the integer n as a sum of
k distinct positive integers?
2 In how many ways can you write n as a sum of 5 distinct
positive integers?
Answer
1 To answer the first question we split the set of answers into
two sets:
Recurrence Relations and Generating Functions
Recurrence Relations
A few more examples coming from verbal problems.
Question
1 In how many ways can you write the integer n as a sum of
k distinct positive integers?
2 In how many ways can you write n as a sum of 5 distinct
positive integers?
Answer
1 To answer the first question we split the set of answers into
two sets:
First set contains all solutions that include the number 1.
Recurrence Relations and Generating Functions
Recurrence Relations
A few more examples coming from verbal problems.
Question
1 In how many ways can you write the integer n as a sum of
k distinct positive integers?
2 In how many ways can you write n as a sum of 5 distinct
positive integers?
Answer
1 To answer the first question we split the set of answers into
two sets:
First set contains all solutions that include the number 1.
The second is the set of solutions for which every integer is
> 1.
Recurrence Relations and Generating Functions
Recurrence Relations
A few more examples coming from verbal problems.
Question
1 In how many ways can you write the integer n as a sum of
k distinct positive integers?
2 In how many ways can you write n as a sum of 5 distinct
positive integers?
Answer
1 To answer the first question we split the set of answers into
two sets:
First set contains all solutions that include the number 1.
The second is the set of solutions for which every integer is
> 1.
2 If we denote the number of solutions by an,k then we get:
an,k = an1,k1 + ank,k
Recurrence Relations and Generating Functions
Recurrence Relations
A few more examples coming from verbal problems.
Question
1 In how many ways can you write the integer n as a sum of
k distinct positive integers?
2 In how many ways can you write n as a sum of 5 distinct
positive integers?
Answer
1 To answer the first question we split the set of answers into
two sets:
First set contains all solutions that include the number 1.
The second is the set of solutions for which every integer is
> 1.
2 If we denote the number of solutions by an,k then we get:
an,k = an1,k1 + ank,k
Recurrence Relations and Generating Functions
Answer (continued)
Recurrence Relations and Generating Functions
Answer (continued)
1 For the second equation we have:
Recurrence Relations and Generating Functions
Answer (continued)
1 For the second equation we have:
2
bn,5 = bn,4 + bn5,5
Recurrence Relations and Generating Functions
Answer (continued)
1 For the second equation we have:
2
bn,5 = bn,4 + bn5,5
3 Again, this is a linear, homogeneous recurrence relation
with constant coefficients, of order ?.
Recurrence Relations and Generating Functions
Answer (continued)
1 For the second equation we have:
2
bn,5 = bn,4 + bn5,5
3 Again, this is a linear, homogeneous recurrence relation
with constant coefficients, of order ?.
Remark
Linear, homogeneous recurrence relations have many
solutions. Indeed if f (n) and g(n) are solutions then so is
f (n) + g(n).
Recurrence Relations and Generating Functions
Answer (continued)
1 For the second equation we have:
2
bn,5 = bn,4 + bn5,5
3 Again, this is a linear, homogeneous recurrence relation
with constant coefficients, of order ?.
Remark
Linear, homogeneous recurrence relations have many
solutions. Indeed if f (n) and g(n) are solutions then so is
f (n) + g(n).
Recurrence Relations and Generating Functions
Answer (continued)
1 For the second equation we have:
2
bn,5 = bn,4 + bn5,5
3 Again, this is a linear, homogeneous recurrence relation
with constant coefficients, of order ?.
Remark
Linear, homogeneous recurrence relations have many
solutions. Indeed if f (n) and g(n) are solutions then so is
f (n) + g(n).
If f (n) and g(n) are solutions to a non homgeneous recurrence
relation then f (n) g(n) is a solution to the associated
homogeneous recurrence relation.
Recurrence Relations and Generating Functions
Remark
This means that in order to solve a non homogeneous linear
recurrence relation all we need to do is find the general solution
g(n) to the homogeneous part and a particular solution p(n) to
the non homogenesous equation.
The general solution will be: g(n) + p(n).
The following example demonstrates this:
Recurrence Relations and Generating Functions
Remark
This means that in order to solve a non homogeneous linear
recurrence relation all we need to do is find the general solution
g(n) to the homogeneous part and a particular solution p(n) to
the non homogenesous equation.
The general solution will be: g(n) + p(n).
The following example demonstrates this:
Example
Solve: an = 2an1 + 3n 1.
Recurrence Relations and Generating Functions
Remark
This means that in order to solve a non homogeneous linear
recurrence relation all we need to do is find the general solution
g(n) to the homogeneous part and a particular solution p(n) to
the non homogenesous equation.
The general solution will be: g(n) + p(n).
The following example demonstrates this:
Example
Solve: an = 2an1 + 3n 1.
1 The homogeneous part is: bn = 2bn1 .
Recurrence Relations and Generating Functions
Remark
This means that in order to solve a non homogeneous linear
recurrence relation all we need to do is find the general solution
g(n) to the homogeneous part and a particular solution p(n) to
the non homogenesous equation.
The general solution will be: g(n) + p(n).
The following example demonstrates this:
Example
Solve: an = 2an1 + 3n 1.
1 The homogeneous part is: bn = 2bn1 .
2 The general solution is: bn = 2n .
Recurrence Relations and Generating Functions
Remark
This means that in order to solve a non homogeneous linear
recurrence relation all we need to do is find the general solution
g(n) to the homogeneous part and a particular solution p(n) to
the non homogenesous equation.
The general solution will be: g(n) + p(n).
The following example demonstrates this:
Example
Solve: an = 2an1 + 3n 1.
1 The homogeneous part is: bn = 2bn1 .
2 The general solution is: bn = 2n .
3 To find a particular solution we try pn = cn + d.
Recurrence Relations and Generating Functions
Remark
This means that in order to solve a non homogeneous linear
recurrence relation all we need to do is find the general solution
g(n) to the homogeneous part and a particular solution p(n) to
the non homogenesous equation.
The general solution will be: g(n) + p(n).
The following example demonstrates this:
Example
Solve: an = 2an1 + 3n 1.
1 The homogeneous part is: bn = 2bn1 .
2 The general solution is: bn = 2n .
3 To find a particular solution we try pn = cn + d.
4 Substituting in the original recurrence relation we get:
cn + d = 2(c(n 1) + d) + 3n 1.
Recurrence Relations and Generating Functions
Remark
This means that in order to solve a non homogeneous linear
recurrence relation all we need to do is find the general solution
g(n) to the homogeneous part and a particular solution p(n) to
the non homogenesous equation.
The general solution will be: g(n) + p(n).
The following example demonstrates this:
Example
Solve: an = 2an1 + 3n 1.
1 The homogeneous part is: bn = 2bn1 .
2 The general solution is: bn = 2n .
3 To find a particular solution we try pn = cn + d.
4 Substituting in the original recurrence relation we get:
cn + d = 2(c(n 1) + d) + 3n 1.
5 Solving for c and d we get: an = 2n 3n 5
Recurrence Relations and Generating Functions
Solving Linear Homogeneous Recurrence Relations
Remark
To simplify notation we shall limit our discussion to second
order recurrence relations. The extension to higher order is
straight forward.
Recurrence Relations and Generating Functions
Solving Linear Homogeneous Recurrence Relations
Remark
To simplify notation we shall limit our discussion to second
order recurrence relations. The extension to higher order is
straight forward.
Theorem (observation)
Let an = b an1 + c an2 + g(n), a1 = , a2 = .
For each k 3, ak is uniquely determined.
Recurrence Relations and Generating Functions
Solving Linear Homogeneous Recurrence Relations
Remark
To simplify notation we shall limit our discussion to second
order recurrence relations. The extension to higher order is
straight forward.
Theorem (observation)
Let an = b an1 + c an2 + g(n), a1 = , a2 = .
For each k 3, ak is uniquely determined.
Definition
a1 = , a2 = are called the initial conditions.
Recurrence Relations and Generating Functions
Solving Linear Homogeneous Recurrence Relations
Remark
To simplify notation we shall limit our discussion to second
order recurrence relations. The extension to higher order is
straight forward.
Theorem (observation)
Let an = b an1 + c an2 + g(n), a1 = , a2 = .
For each k 3, ak is uniquely determined.
Definition
a1 = , a2 = are called the initial conditions.
Corolary
Any solution that satisfies the recurrence relation and initial
conditions is THE ONLY solution.
Recurrence Relations and Generating Functions
Definition
Let an = ban1 + can2 .
The quadratic equation x 2 bx c = 0 is called the
characteritic equation of the recurrence relation.
Recurrence Relations and Generating Functions
Definition
Let an = ban1 + can2 .
The quadratic equation x 2 bx c = 0 is called the
characteritic equation of the recurrence relation.
Theorem (Solving Linear Homogeneous RR with Constant
Coefficients)
Recurrence Relations and Generating Functions
Definition
Let an = ban1 + can2 .
The quadratic equation x 2 bx c = 0 is called the
characteritic equation of the recurrence relation.
Theorem (Solving Linear Homogeneous RR with Constant
Coefficients)
1 Let an = b an1 + c an2 .
Recurrence Relations and Generating Functions
Definition
Let an = ban1 + can2 .
The quadratic equation x 2 bx c = 0 is called the
characteritic equation of the recurrence relation.
Theorem (Solving Linear Homogeneous RR with Constant
Coefficients)
1 Let an = b an1 + c an2 .
2 Let r1 , r2 be the roots of the characteristic equation.
Recurrence Relations and Generating Functions
Definition
Let an = ban1 + can2 .
The quadratic equation x 2 bx c = 0 is called the
characteritic equation of the recurrence relation.
Theorem (Solving Linear Homogeneous RR with Constant
Coefficients)
1 Let an = b an1 + c an2 .
2 Let r1 , r2 be the roots of the characteristic equation.
3 Then the general solution of this recurrence relation is
an = r1n + r2n .
Recurrence Relations and Generating Functions
Definition
Let an = ban1 + can2 .
The quadratic equation x 2 bx c = 0 is called the
characteritic equation of the recurrence relation.
Theorem (Solving Linear Homogeneous RR with Constant
Coefficients)
1 Let an = b an1 + c an2 .
2 Let r1 , r2 be the roots of the characteristic equation.
3 Then the general solution of this recurrence relation is
an = r1n + r2n .
4 If r1 = r2 then the general solution is an = r n + nr n
Recurrence Relations and Generating Functions
Chng minh.
We need to show two things:
We note that since the recurrence relation is linear it is enough
to prove that rin = brin1 + crin2
Recurrence Relations and Generating Functions
Chng minh.
We need to show two things:
1 an = br1n + cr2n is a solution (or an = br n + cnr n is a
solution in case r1 = r2 ).
We note that since the recurrence relation is linear it is enough
to prove that rin = brin1 + crin2
Recurrence Relations and Generating Functions
Chng minh.
We need to show two things:
1 an = br1n + cr2n is a solution (or an = br n + cnr n is a
solution in case r1 = r2 ).
2 Every other solution is of this form.
We note that since the recurrence relation is linear it is enough
to prove that rin = brin1 + crin2
Recurrence Relations and Generating Functions
Chng minh.
We need to show two things:
1 an = br1n + cr2n is a solution (or an = br n + cnr n is a
solution in case r1 = r2 ).
2 Every other solution is of this form.
We note that since the recurrence relation is linear it is enough
to prove that rin = brin1 + crin2
1 brin1 + crin2 = rin2 (bri + c)
Recurrence Relations and Generating Functions
Chng minh.
We need to show two things:
1 an = br1n + cr2n is a solution (or an = br n + cnr n is a
solution in case r1 = r2 ).
2 Every other solution is of this form.
We note that since the recurrence relation is linear it is enough
to prove that rin = brin1 + crin2
1 brin1 + crin2 = rin2 (bri + c)
2 Since ri are roots of the characteristic equation we have:
ri2 = bri + c.
Recurrence Relations and Generating Functions
Chng minh.
We need to show two things:
1 an = br1n + cr2n is a solution (or an = br n + cnr n is a
solution in case r1 = r2 ).
2 Every other solution is of this form.
We note that since the recurrence relation is linear it is enough
to prove that rin = brin1 + crin2
1 brin1 + crin2 = rin2 (bri + c)
2 Since ri are roots of the characteristic equation we have:
ri2 = bri + c.
3 Substituting we get: brin1 + crin2 = rin
Recurrence Relations and Generating Functions
Chng minh.
We need to show two things:
1 an = br1n + cr2n is a solution (or an = br n + cnr n is a
solution in case r1 = r2 ).
2 Every other solution is of this form.
We note that since the recurrence relation is linear it is enough
to prove that rin = brin1 + crin2
1 brin1 + crin2 = rin2 (bri + c)
2 Since ri are roots of the characteristic equation we have:
ri2 = bri + c.
3 Substituting we get: brin1 + crin2 = rin
4 Thus r1n + r2n solves the recurrence relation.
Recurrence Relations and Generating Functions
Chng minh.
We need to show two things:
1 an = br1n + cr2n is a solution (or an = br n + cnr n is a
solution in case r1 = r2 ).
2 Every other solution is of this form.
We note that since the recurrence relation is linear it is enough
to prove that rin = brin1 + crin2
1 brin1 + crin2 = rin2 (bri + c)
2 Since ri are roots of the characteristic equation we have:
ri2 = bri + c.
3 Substituting we get: brin1 + crin2 = rin
4 Thus r1n + r2n solves the recurrence relation.
5 As previously proved, r n = br n1 + cr n2 . Taking the
derivative we get: nr n1 = b(n 1)r n2 + c(n 2)r n3 and
if we multiply both sides by r we get:
nr n = b(n 1)r n1 + c(n 2)r n2
Recurrence Relations and Generating Functions
continued.
It remains to show that these are the general solutions.
Recurrence Relations and Generating Functions
continued.
It remains to show that these are the general solutions.
Recurrence Relations and Generating Functions
continued.
It remains to show that these are the general solutions.
It is enough to show that if for any choice of a0 , a1 there is a
solution of these forms for which a0 , a1 will be matched.
1 Let a0 = m, a1 = k. We need to show that we can choose
and so that r10 + r20 = m and r1 + r2 = k.
Recurrence Relations and Generating Functions
continued.
It remains to show that these are the general solutions.
It is enough to show that if for any choice of a0 , a1 there is a
solution of these forms for which a0 , a1 will be matched.
1 Let a0 = m, a1 = k. We need to show that we can choose
and so that r10 + r20 = m and r1 + r2 = k.
2 This is a set of two linear equations in two unknowns. Its
determinant is r1 r2 6= 0 hence it has a solution.
Recurrence Relations and Generating Functions
continued.
It remains to show that these are the general solutions.
It is enough to show that if for any choice of a0 , a1 there is a
solution of these forms for which a0 , a1 will be matched.
1 Let a0 = m, a1 = k. We need to show that we can choose
and so that r10 + r20 = m and r1 + r2 = k.
2 This is a set of two linear equations in two unknowns. Its
determinant is r1 r2 6= 0 hence it has a solution.
3 In the second case we have: = m and + = k which
obviously has a solution.
Recurrence Relations and Generating Functions
Particular solutions
It remains to deal with identifying particular solutions. The best
approach is an intelligent guess.
Recurrence Relations and Generating Functions
Particular solutions
It remains to deal with identifying particular solutions. The best
approach is an intelligent guess.
If f(n) is a polynomial, try a polynomial of same degree, or
higher.
Recurrence Relations and Generating Functions
Particular solutions
It remains to deal with identifying particular solutions. The best
approach is an intelligent guess.
If f(n) is a polynomial, try a polynomial of same degree, or
higher.
If it is an try an exponential function if a is not a root of the
characteristic equation.
Recurrence Relations and Generating Functions
Particular solutions
It remains to deal with identifying particular solutions. The best
approach is an intelligent guess.
If f(n) is a polynomial, try a polynomial of same degree, or
higher.
If it is an try an exponential function if a is not a root of the
characteristic equation.
If it is, try cnan .
Recurrence Relations and Generating Functions
Particular solutions
It remains to deal with identifying particular solutions. The best
approach is an intelligent guess.
If f(n) is a polynomial, try a polynomial of same degree, or
higher.
If it is an try an exponential function if a is not a root of the
characteristic equation.
If it is, try cnan .
In general, try a function similar to f (n). The following
examples will demonstrate the general approach.
Recurrence Relations and Generating Functions
Example
Recurrence Relations and Generating Functions
Example
1 Solve: an = 3an1 + 2n .
Recurrence Relations and Generating Functions
Example
1 Solve: an = 3an1 + 2n .
Try: p(n) = c2n .
Recurrence Relations and Generating Functions
Example
1 Solve: an = 3an1 + 2n .
Try: p(n) = c2n .
Substitute we get: c 2n = 3 c 2n1 + 2n
Recurrence Relations and Generating Functions
Example
1 Solve: an = 3an1 + 2n .
Try: p(n) = c2n .
Substitute we get: c 2n = 3 c 2n1 + 2n
Solution: an = k 3n 2n+1 .
Recurrence Relations and Generating Functions
Example
1 Solve: an = 3an1 + 2n .
Try: p(n) = c2n .
Substitute we get: c 2n = 3 c 2n1 + 2n
Solution: an = k 3n 2n+1 .
2 Solve an = 3an1 + 3n .
Recurrence Relations and Generating Functions
Example
1 Solve: an = 3an1 + 2n .
Try: p(n) = c2n .
Substitute we get: c 2n = 3 c 2n1 + 2n
Solution: an = k 3n 2n+1 .
2 Solve an = 3an1 + 3n .
Try cn3n .
Recurrence Relations and Generating Functions
Example
1 Solve: an = 3an1 + 2n .
Try: p(n) = c2n .
Substitute we get: c 2n = 3 c 2n1 + 2n
Solution: an = k 3n 2n+1 .
2 Solve an = 3an1 + 3n .
Try cn3n .
Substitute: cn3n = 3c(n 1)3n1 + 3n .
Recurrence Relations and Generating Functions
Example
1 Solve: an = 3an1 + 2n .
Try: p(n) = c2n .
Substitute we get: c 2n = 3 c 2n1 + 2n
Solution: an = k 3n 2n+1 .
2 Solve an = 3an1 + 3n .
Try cn3n .
Substitute: cn3n = 3c(n 1)3n1 + 3n .
Solve for c: c = 1
Recurrence Relations and Generating Functions
Example
1 Solve: an = 3an1 + 2n .
Try: p(n) = c2n .
Substitute we get: c 2n = 3 c 2n1 + 2n
Solution: an = k 3n 2n+1 .
2 Solve an = 3an1 + 3n .
Try cn3n .
Substitute: cn3n = 3c(n 1)3n1 + 3n .
Solve for c: c = 1
General solution: an = 3n + n 3n
Recurrence Relations and Generating Functions
Example
1 Solve: an = 3an1 + 2n .
Try: p(n) = c2n .
Substitute we get: c 2n = 3 c 2n1 + 2n
Solution: an = k 3n 2n+1 .
2 Solve an = 3an1 + 3n .
Try cn3n .
Substitute: cn3n = 3c(n 1)3n1 + 3n .
Solve for c: c = 1
General solution: an = 3n + n 3n
3 Solve: an = 2an1 an2 + 2n.
Recurrence Relations and Generating Functions
Example
1 Solve: an = 3an1 + 2n .
Try: p(n) = c2n .
Substitute we get: c 2n = 3 c 2n1 + 2n
Solution: an = k 3n 2n+1 .
2 Solve an = 3an1 + 3n .
Try cn3n .
Substitute: cn3n = 3c(n 1)3n1 + 3n .
Solve for c: c = 1
General solution: an = 3n + n 3n
3 Solve: an = 2an1 an2 + 2n.
2n is a solution of the homogeneous equation, so we try
p(n) = cn2 a polynomial of degree 2.
Recurrence Relations and Generating Functions
Example
1 Solve: an = 3an1 + 2n .
Try: p(n) = c2n .
Substitute we get: c 2n = 3 c 2n1 + 2n
Solution: an = k 3n 2n+1 .
2 Solve an = 3an1 + 3n .
Try cn3n .
Substitute: cn3n = 3c(n 1)3n1 + 3n .
Solve for c: c = 1
General solution: an = 3n + n 3n
3 Solve: an = 2an1 an2 + 2n.
2n is a solution of the homogeneous equation, so we try
p(n) = cn2 a polynomial of degree 2.
Substitute: cn2 = 2c(n 1)2 c(n 2)2 + 2n. Does not
produce a solution.
Recurrence Relations and Generating Functions
Example
1 Solve: an = 3an1 + 2n .
Try: p(n) = c2n .
Substitute we get: c 2n = 3 c 2n1 + 2n
Solution: an = k 3n 2n+1 .
2 Solve an = 3an1 + 3n .
Try cn3n .
Substitute: cn3n = 3c(n 1)3n1 + 3n .
Solve for c: c = 1
General solution: an = 3n + n 3n
3 Solve: an = 2an1 an2 + 2n.
2n is a solution of the homogeneous equation, so we try
p(n) = cn2 a polynomial of degree 2.
Substitute: cn2 = 2c(n 1)2 c(n 2)2 + 2n. Does not
produce a solution.
So we try a polynomial of degree 3 : p(n) = cn2 + dn3 .
Recurrence Relations and Generating Functions
Example
1 Solve: an = 3an1 + 2n .
Try: p(n) = c2n .
Substitute we get: c 2n = 3 c 2n1 + 2n
Solution: an = k 3n 2n+1 .
2 Solve an = 3an1 + 3n .
Try cn3n .
Substitute: cn3n = 3c(n 1)3n1 + 3n .
Solve for c: c = 1
General solution: an = 3n + n 3n
3 Solve: an = 2an1 an2 + 2n.
2n is a solution of the homogeneous equation, so we try
p(n) = cn2 a polynomial of degree 2.
Substitute: cn2 = 2c(n 1)2 c(n 2)2 + 2n. Does not
produce a solution.
So we try a polynomial of degree 3 : p(n) = cn2 + dn3 .
Substitute and solve for c, d we find that 13 n3 + n2 is a
particular solution.
Recurrence Relations and Generating Functions
Example
1 Solve: an = 3an1 + 2n .
Try: p(n) = c2n .
Substitute we get: c 2n = 3 c 2n1 + 2n
Solution: an = k 3n 2n+1 .
2 Solve an = 3an1 + 3n .
Try cn3n .
Substitute: cn3n = 3c(n 1)3n1 + 3n .
Solve for c: c = 1
General solution: an = 3n + n 3n
3 Solve: an = 2an1 an2 + 2n.
2n is a solution of the homogeneous equation, so we try
p(n) = cn2 a polynomial of degree 2.
Substitute: cn2 = 2c(n 1)2 c(n 2)2 + 2n. Does not
produce a solution.
So we try a polynomial of degree 3 : p(n) = cn2 + dn3 .
Substitute and solve for c, d we find that 13 n3 + n2 is a
particular solution.
So the general solution is: an = + n + n2 + 13 n3 .
Recurrence Relations and Generating Functions
Generating Functions
With every sequence an we can associate a power series:
X
f (x) = an x n
i=0
and vice versa, every power series expansion of a function f (x)
gives rise to a sequence an . Are there any uses of this
relationship in counting?
Recurrence Relations and Generating Functions
Generating Functions
With every sequence an we can associate a power series:
X
f (x) = an x n
i=0
and vice versa, every power series expansion of a function f (x)
gives rise to a sequence an . Are there any uses of this
relationship in counting?
In this section we shall explore the interaction among
polynomials, power series and counting.
Recurrence Relations and Generating Functions
Generating Functions
With every sequence an we can associate a power series:
X
f (x) = an x n
i=0
and vice versa, every power series expansion of a function f (x)
gives rise to a sequence an . Are there any uses of this
relationship in counting?
In this section we shall explore the interaction among
polynomials, power series and counting.
Definition
The function
X
f (x) = an x n
i=0
is the genrating function of the sequence an .
Recurrence Relations and Generating Functions
Examples
1 Let us start with an example we visited before: how many
different solutions in non-negative integers does the
equation x + y + z + t = 27 have?
Recurrence Relations and Generating Functions
Examples
1 Let us start with an example we visited before: how many
different solutions in non-negative integers does the
equation x + y + z + t = 27 have?
2 Consider the function f (x) = (1 + x + x 2 + . . . x 27 )4 .
Recurrence Relations and Generating Functions
Examples
1 Let us start with an example we visited before: how many
different solutions in non-negative integers does the
equation x + y + z + t = 27 have?
2 Consider the function f (x) = (1 + x + x 2 + . . . x 27 )4 .
3 It is not difficult to see that the coefficient of x 27 is the
answer, but how easy is it to calculate it?
Recurrence Relations and Generating Functions
Examples
1 Let us start with an example we visited before: how many
different solutions in non-negative integers does the
equation x + y + z + t = 27 have?
2 Consider the function f (x) = (1 + x + x 2 + . . . x 27 )4 .
3 It is not difficult to see that the coefficient of x 27 is the
answer, but how easy is it to calculate it?
4 Well, if you have a nice math program, it will be very easy.
Recurrence Relations and Generating Functions
Examples
1 Let us start with an example we visited before: how many
different solutions in non-negative integers does the
equation x + y + z + t = 27 have?
2 Consider the function f (x) = (1 + x + x 2 + . . . x 27 )4 .
3 It is not difficult to see that the coefficient of x 27 is the
answer, but how easy is it to calculate it?
4 Well, if you have a nice math program, it will be very easy.
5 But we can
P do better, Consider the function
g(x) = ( i=0 x i )4 .
Recurrence Relations and Generating Functions
Examples
1 Let us start with an example we visited before: how many
different solutions in non-negative integers does the
equation x + y + z + t = 27 have?
2 Consider the function f (x) = (1 + x + x 2 + . . . x 27 )4 .
3 It is not difficult to see that the coefficient of x 27 is the
answer, but how easy is it to calculate it?
4 Well, if you have a nice math program, it will be very easy.
5 But we can
P do better, Consider the function
g(x) = ( i=0 x i )4 .
6 Again, the coefficient of x 27 in the Taylor expansion of this
function is the answer.
Recurrence Relations and Generating Functions
Examples
1 Let us start with an example we visited before: how many
different solutions in non-negative integers does the
equation x + y + z + t = 27 have?
2 Consider the function f (x) = (1 + x + x 2 + . . . x 27 )4 .
3 It is not difficult to see that the coefficient of x 27 is the
answer, but how easy is it to calculate it?
4 Well, if you have a nice math program, it will be very easy.
5 But we can
P do better, Consider the function
g(x) = ( i=0 x i )4 .
6 Again, the coefficient of x 27 in the Taylor expansion of this
function is the answer.
We notice that i 1
P
i=0 x = 1x .
7
Recurrence Relations and Generating Functions
Examples
1 Let us start with an example we visited before: how many
different solutions in non-negative integers does the
equation x + y + z + t = 27 have?
2 Consider the function f (x) = (1 + x + x 2 + . . . x 27 )4 .
3 It is not difficult to see that the coefficient of x 27 is the
answer, but how easy is it to calculate it?
4 Well, if you have a nice math program, it will be very easy.
5 But we can
P do better, Consider the function
g(x) = ( i=0 x i )4 .
6 Again, the coefficient of x 27 in the Taylor expansion of this
function is the answer.
We notice that i 1
P
i=0 x = 1x .
7
8 So the answer will be the coefficient of x 27 in the
expansion of (1 x)4 .
Recurrence Relations and Generating Functions
Examples, continued
Would it be nice if we could use an extended Binomial
Coefficient and write the answer:
4 4
or in general
27 k
.
Example
Recurrence Relations and Generating Functions
Examples, continued
Would it be nice if we could use an extended Binomial
Coefficient and write the answer:
4 4
or in general
27 k
.
Example
1 A box contains 30 red, 40 blue and 50 white balls. In how
many ways can you select 70 balls?
Recurrence Relations and Generating Functions
Examples, continued
Would it be nice if we could use an extended Binomial
Coefficient and write the answer:
4 4
or in general
27 k
.
Example
1 A box contains 30 red, 40 blue and 50 white balls. In how
many ways can you select 70 balls?
2 The coefficient of x 70 in the product
(1 + x + . . . + x 30 )(1 + x + . . . + x 40 )(1 + x + . . . + x 50 )
is the answer.
Recurrence Relations and Generating Functions
Examples, continued
Would it be nice if we could use an extended Binomial
Coefficient and write the answer:
4 4
or in general
27 k
.
Example
1 A box contains 30 red, 40 blue and 50 white balls. In how
many ways can you select 70 balls?
2 The coefficient of x 70 in the product
(1 + x + . . . + x 30 )(1 + x + . . . + x 40 )(1 + x + . . . + x 50 )
is the answer.
3 Note that:
(1 + x + . . . + x 30 )(1 + x + . . . + x 40 )(1 + x + . . . + x 50 . . .) =
1x 31 1x 41 1x 51 3 31 41 51
1x 1x 1x = (1 x) (1 x )(1 x )(1 x ).
Recurrence Relations and Generating Functions
Examples
All we need is to find the coefficient of x 70 in:
!
X 3 i
x (1 x 31 x 41 x 51 + . . .)
i
i=0
which turns out to be 1061 once we understand the meaning of
3
i
.
Drill
Use this technique to find the number of distinct solution to:
x1 + x2 + x3 + x4 = 50
10 x1 25, 15 x2 30, 10 x3 , 15 x4 25.
Recurrence Relations and Generating Functions
The Generalized Binomial Theorem
Theorem (The generalized binomial theorem)
r
X r i r r (r 1) . . . (r i + 1)
(1 + x) = x =
i i i!
i=0
For negative integers we get:
r r (r 1) . . . (r i + 1) i r + i 1
= = (1)
i i! r 1
Recurrence Relations and Generating Functions
The Generalized Binomial Theorem
Theorem (The generalized binomial theorem)
r
X r i r r (r 1) . . . (r i + 1)
(1 + x) = x =
i i i!
i=0
Chng minh.
Follows directly from Taylors expansion of (1 + x)r .
For negative integers we get:
r r (r 1) . . . (r i + 1) i r + i 1
= = (1)
i i! r 1
Recurrence Relations and Generating Functions
The Generalized Binomial Theorem
Theorem (The generalized binomial theorem)
r
X r i r r (r 1) . . . (r i + 1)
(1 + x) = x =
i i i!
i=0
Chng minh.
Follows directly from Taylors expansion of (1 + x)r .
For negative integers we get:
r r (r 1) . . . (r i + 1) i r + i 1
= = (1)
i i! r 1
Drill
Show that: 1
(1)k 2k
2 =
k 4k k
.
Recurrence Relations and Generating Functions
Catalan Numbers
Question
You need to calculate the product of n matrices
A1 A2 . . . An . How do we parenthesize the expression to
do it in the most economical way?
Recurrence Relations and Generating Functions
Catalan Numbers
Question
You need to calculate the product of n matrices
A1 A2 . . . An . How do we parenthesize the expression to
do it in the most economical way?
Recurrence Relations and Generating Functions
Catalan Numbers
Question
You need to calculate the product of n matrices
A1 A2 . . . An . How do we parenthesize the expression to
do it in the most economical way?
In how many ways can you parethesize the product?
Recurrence Relations and Generating Functions
Catalan Numbers
Question
You need to calculate the product of n matrices
A1 A2 . . . An . How do we parenthesize the expression to
do it in the most economical way?
In how many ways can you parethesize the product?
Why does it matter?
Drill
Let A[m, n] denote an m n matrix (m rows and n columns).
For each possible multiplication of the following product
calculate the number of multiplications of real numbers needed
to calculate the product.
A[10, 20]A[20, 40]A[40, 50]A[50, 10]
Recurrence Relations and Generating Functions
Catalan Numbers
Example
Recurrence Relations and Generating Functions
Catalan Numbers
Example
1 A B C can be parethesized in two different ways.
Recurrence Relations and Generating Functions
Catalan Numbers
Example
1 A B C can be parethesized in two different ways.
2 A B C D can be parethesized in 5 different ways.
Recurrence Relations and Generating Functions
Catalan Numbers
Example
1 A B C can be parethesized in two different ways.
2 A B C D can be parethesized in 5 different ways.
3 Let mn be the number of ways to properly parenthesize the
product of n + 1 matrices.
Recurrence Relations and Generating Functions
Catalan Numbers
Example
1 A B C can be parethesized in two different ways.
2 A B C D can be parethesized in 5 different ways.
3 Let mn be the number of ways to properly parenthesize the
product of n + 1 matrices.
4 m1 = 1, m2 = 2, m3 = 5, mn =? (for convenience, we set
m0 = 0).
Recurrence Relations and Generating Functions
Catalan Numbers
Example
1 A B C can be parethesized in two different ways.
2 A B C D can be parethesized in 5 different ways.
3 Let mn be the number of ways to properly parenthesize the
product of n + 1 matrices.
4 m1 = 1, m2 = 2, m3 = 5, mn =? (for convenience, we set
m0 = 0).
5
n
X
mn = mi mni
i=0
Recurrence Relations and Generating Functions
Catalan Numbers
1 The generating function of the sequence mn is:
X
A(x) = mi x i
i=0
Recurrence Relations and Generating Functions
Catalan Numbers
1 The generating function of the sequence mn is:
X
A(x) = mi x i
i=0
2
X k
X
A2 (x) = bi x k bk = mj mkj
k=0 j=0
Recurrence Relations and Generating Functions
Catalan Numbers
1 The generating function of the sequence mn is:
X
A(x) = mi x i
i=0
2
X k
X
A2 (x) = bi x k bk = mj mkj
k=0 j=0
Pn
3 For n = 0, 1 i=0 mi mni = 0. Since m1 = 1 this means
that:
X
X
A2 (x) = bi x i = mi x i x = A(x) x
i=0 i=0
Recurrence Relations and Generating Functions
Catalan Numbers
1
Or: A(x) = (1 1 4x).
2x
Recurrence Relations and Generating Functions
Catalan Numbers
1
Or: A(x) = (1 1 4x).
2x
Substituting the initial condition m0 = A(0) = 0 we get:
1
A(x) = (1 1 4x)
2x
.
1 X 1/2 X 2k k
(1 4x) 2 = (4)k x k = x
k k
k=0 k=0
1/2 k 2k
Using : k = (1/4) k .
Recurrence Relations and Generating Functions
Catalan Numbers
1
Or: A(x) = (1 1 4x).
2x
Substituting the initial condition m0 = A(0) = 0 we get:
1
A(x) = (1 1 4x)
2x
.
1 X 1/2 X 2k k
(1 4x) 2 = (4)k x k = x
k k
k=0 k=0
1/2 k 2k
Using : k = (1/4) k .
mn isthe coefficient of x n in the expansion of:
(1 1 4x)/(1/2x)
A simple calculation yields:
1 2n
mn =
n+1 n
. Recurrence Relations and Generating Functions
Summary
These are the Catalan Numbers. They count many other
objects, for instance the number of binary trees, the number bof
grid paths from (0, 0) to (0, 2n) that stay above the x-axis, the
number of binary sequences of length 2n with n 10 s such that
when scanning from left to right the number of 1s is never less
than the number of 0s and more.
Recurrence Relations and Generating Functions
Summary
These are the Catalan Numbers. They count many other
objects, for instance the number of binary trees, the number bof
grid paths from (0, 0) to (0, 2n) that stay above the x-axis, the
number of binary sequences of length 2n with n 10 s such that
when scanning from left to right the number of 1s is never less
than the number of 0s and more.
In most of these cases, we show that these sequences satisfy
the same recurrence relation and initial conditions.
Recurrence Relations and Generating Functions
Summary
These are the Catalan Numbers. They count many other
objects, for instance the number of binary trees, the number bof
grid paths from (0, 0) to (0, 2n) that stay above the x-axis, the
number of binary sequences of length 2n with n 10 s such that
when scanning from left to right the number of 1s is never less
than the number of 0s and more.
In most of these cases, we show that these sequences satisfy
the same recurrence relation and initial conditions.
Recurrence relations are a powerful tool for solving many
problems. There are many types of generating function, we
only scratched the surface of this beautiful theory.
Some more challenging problems will be posted in our
assignments folder.
Recurrence Relations and Generating Functions