Recurrence Relations...Daniel H. Luecking Recurrence Relations Feb. 17, 20213/18 The rules are as...

Preview:

Citation preview

Recurrence Relations

Daniel H. Luecking

Feb. 17, 2021

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 1 / 18

Combinatorics problems that lead to recurrence relations

The Towers of Hanoi problem is to take a stack of disks and move themall to another stack using only certain allowed moves. The questions are:(1) can this be done? and (2) how can it be done? and (3) how manymoves does it take?

Here is a picture of a possible starting point with 13 disks:

The goal is to move all the disks from the first pole to the last.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 2 / 18

Combinatorics problems that lead to recurrence relations

The Towers of Hanoi problem is to take a stack of disks and move themall to another stack using only certain allowed moves. The questions are:(1) can this be done? and (2) how can it be done? and (3) how manymoves does it take?

Here is a picture of a possible starting point with 13 disks:

The goal is to move all the disks from the first pole to the last.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 2 / 18

The rules are as follows:

There are three poles, two of them empty.

The disks all have a hole in the center and they are stacked on thefirst pole. The disks have different sizes and they are stacked in orderof size with the largest on the bottom.

One disk at a time may be moved from the top of one stack andplaced on any of the other two poles.

It is not allowed to place a disk on top of a smaller disk.

The game ends when all the disks are on the third pole

If we suppose there are n disks, then we can show this is possible asfollows. It is certainly possible if n = 0 (zero moves required) or if n = 1(one move required).

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 3 / 18

The rules are as follows:

There are three poles, two of them empty.

The disks all have a hole in the center and they are stacked on thefirst pole. The disks have different sizes and they are stacked in orderof size with the largest on the bottom.

One disk at a time may be moved from the top of one stack andplaced on any of the other two poles.

It is not allowed to place a disk on top of a smaller disk.

The game ends when all the disks are on the third pole

If we suppose there are n disks, then we can show this is possible asfollows. It is certainly possible if n = 0 (zero moves required) or if n = 1(one move required).

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 3 / 18

The rules are as follows:

There are three poles, two of them empty.

The disks all have a hole in the center and they are stacked on thefirst pole. The disks have different sizes and they are stacked in orderof size with the largest on the bottom.

One disk at a time may be moved from the top of one stack andplaced on any of the other two poles.

It is not allowed to place a disk on top of a smaller disk.

The game ends when all the disks are on the third pole

If we suppose there are n disks, then we can show this is possible asfollows. It is certainly possible if n = 0 (zero moves required) or if n = 1(one move required).

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 3 / 18

The rules are as follows:

There are three poles, two of them empty.

The disks all have a hole in the center and they are stacked on thefirst pole. The disks have different sizes and they are stacked in orderof size with the largest on the bottom.

One disk at a time may be moved from the top of one stack andplaced on any of the other two poles.

It is not allowed to place a disk on top of a smaller disk.

The game ends when all the disks are on the third pole

If we suppose there are n disks, then we can show this is possible asfollows. It is certainly possible if n = 0 (zero moves required) or if n = 1(one move required).

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 3 / 18

The rules are as follows:

There are three poles, two of them empty.

The disks all have a hole in the center and they are stacked on thefirst pole. The disks have different sizes and they are stacked in orderof size with the largest on the bottom.

One disk at a time may be moved from the top of one stack andplaced on any of the other two poles.

It is not allowed to place a disk on top of a smaller disk.

The game ends when all the disks are on the third pole

If we suppose there are n disks, then we can show this is possible asfollows. It is certainly possible if n = 0 (zero moves required) or if n = 1(one move required).

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 3 / 18

The rules are as follows:

There are three poles, two of them empty.

The disks all have a hole in the center and they are stacked on thefirst pole. The disks have different sizes and they are stacked in orderof size with the largest on the bottom.

One disk at a time may be moved from the top of one stack andplaced on any of the other two poles.

It is not allowed to place a disk on top of a smaller disk.

The game ends when all the disks are on the third pole

If we suppose there are n disks, then we can show this is possible asfollows. It is certainly possible if n = 0 (zero moves required) or if n = 1(one move required).

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 3 / 18

If it can be done with n − 1 disks, it can be done with n disks: move thetop n− 1 disks to the second pole (exchanging the roles of poles 2 and 3).

Then move the bottom disk to the third pole. Then move the remainingn − 1 disks onto the third pole (exchanging the roles of poles 1 and 2).

This proves it can always be done.

How can it be done? That is, what sequence of moves are required?Pretty much the only way to do this is to write a computer program thatgenerates the moves: feed it the order of the poles and the number ofdisks, have it call itself with n reduced.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 4 / 18

If it can be done with n − 1 disks, it can be done with n disks: move thetop n− 1 disks to the second pole (exchanging the roles of poles 2 and 3).Then move the bottom disk to the third pole.

Then move the remainingn − 1 disks onto the third pole (exchanging the roles of poles 1 and 2).

This proves it can always be done.

How can it be done? That is, what sequence of moves are required?Pretty much the only way to do this is to write a computer program thatgenerates the moves: feed it the order of the poles and the number ofdisks, have it call itself with n reduced.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 4 / 18

If it can be done with n − 1 disks, it can be done with n disks: move thetop n− 1 disks to the second pole (exchanging the roles of poles 2 and 3).Then move the bottom disk to the third pole. Then move the remainingn − 1 disks onto the third pole (exchanging the roles of poles 1 and 2).

This proves it can always be done.

How can it be done? That is, what sequence of moves are required?Pretty much the only way to do this is to write a computer program thatgenerates the moves: feed it the order of the poles and the number ofdisks, have it call itself with n reduced.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 4 / 18

If it can be done with n − 1 disks, it can be done with n disks: move thetop n− 1 disks to the second pole (exchanging the roles of poles 2 and 3).Then move the bottom disk to the third pole. Then move the remainingn − 1 disks onto the third pole (exchanging the roles of poles 1 and 2).

This proves it can always be done.

How can it be done? That is, what sequence of moves are required?

Pretty much the only way to do this is to write a computer program thatgenerates the moves: feed it the order of the poles and the number ofdisks, have it call itself with n reduced.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 4 / 18

If it can be done with n − 1 disks, it can be done with n disks: move thetop n− 1 disks to the second pole (exchanging the roles of poles 2 and 3).Then move the bottom disk to the third pole. Then move the remainingn − 1 disks onto the third pole (exchanging the roles of poles 1 and 2).

This proves it can always be done.

How can it be done? That is, what sequence of moves are required?Pretty much the only way to do this is to write a computer program thatgenerates the moves: feed it the order of the poles and the number ofdisks, have it call itself with n reduced.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 4 / 18

This program is based on the method just discussed:

def TOH (a,b,c,n) // a = starting pole, c = ending poleif n=1: move a disk from a to c;

else:

call TOH(a,c,b,n-1);

move a disc from a to c;

call TOH(b,a,c,n-1)

endif

enddef

TOH(1,2,3,20) // if n = 20

Be warned: this generates 220 − 1 moves, more than 1 million.

How many moves does it take? Let an be the number of moves for ndisks. The above process requires an−1 moves to get the top n − 1 disksfrom pole 1 to 2, then 1 move to get the bottom disk from 1 to 3 andthen an−1 moves to get the other n − 1 disks from 2 to 3.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 5 / 18

This program is based on the method just discussed:

def TOH (a,b,c,n) // a = starting pole, c = ending poleif n=1: move a disk from a to c;

else:

call TOH(a,c,b,n-1);

move a disc from a to c;

call TOH(b,a,c,n-1)

endif

enddef

TOH(1,2,3,20) // if n = 20

Be warned: this generates 220 − 1 moves, more than 1 million.

How many moves does it take? Let an be the number of moves for ndisks.

The above process requires an−1 moves to get the top n − 1 disksfrom pole 1 to 2, then 1 move to get the bottom disk from 1 to 3 andthen an−1 moves to get the other n − 1 disks from 2 to 3.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 5 / 18

This program is based on the method just discussed:

def TOH (a,b,c,n) // a = starting pole, c = ending poleif n=1: move a disk from a to c;

else:

call TOH(a,c,b,n-1);

move a disc from a to c;

call TOH(b,a,c,n-1)

endif

enddef

TOH(1,2,3,20) // if n = 20

Be warned: this generates 220 − 1 moves, more than 1 million.

How many moves does it take? Let an be the number of moves for ndisks. The above process requires an−1 moves to get the top n − 1 disksfrom pole 1 to 2, then 1 move to get the bottom disk from 1 to 3 andthen an−1 moves to get the other n − 1 disks from 2 to 3.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 5 / 18

That is

an = 2an−1 + 1, n ≥ 1

a0 = 0.

The solution is an = 2n − 1. It’s not hard to work out that a1 = 1, a2 = 3,a3 = 7, a4 = 15 and so on, so this is an easy guess (for CompSci majors).You should test your understanding by checking that this formula works.

The chip stacking problem

You have a lot of poker chips (colored disks) all either blue or white. Howmany ways can you stack n of then so that no white chip is directly onanother white chip?

An equivalent problem is: how many different bitstrings (strings consistingonly of 0’s and 1’s) of length n contain no consecutive 1’s?

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 6 / 18

That is

an = 2an−1 + 1, n ≥ 1

a0 = 0.

The solution is an = 2n − 1. It’s not hard to work out that a1 = 1, a2 = 3,a3 = 7, a4 = 15 and so on, so this is an easy guess (for CompSci majors).

You should test your understanding by checking that this formula works.

The chip stacking problem

You have a lot of poker chips (colored disks) all either blue or white. Howmany ways can you stack n of then so that no white chip is directly onanother white chip?

An equivalent problem is: how many different bitstrings (strings consistingonly of 0’s and 1’s) of length n contain no consecutive 1’s?

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 6 / 18

That is

an = 2an−1 + 1, n ≥ 1

a0 = 0.

The solution is an = 2n − 1. It’s not hard to work out that a1 = 1, a2 = 3,a3 = 7, a4 = 15 and so on, so this is an easy guess (for CompSci majors).You should test your understanding by checking that this formula works.

The chip stacking problem

You have a lot of poker chips (colored disks) all either blue or white. Howmany ways can you stack n of then so that no white chip is directly onanother white chip?

An equivalent problem is: how many different bitstrings (strings consistingonly of 0’s and 1’s) of length n contain no consecutive 1’s?

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 6 / 18

That is

an = 2an−1 + 1, n ≥ 1

a0 = 0.

The solution is an = 2n − 1. It’s not hard to work out that a1 = 1, a2 = 3,a3 = 7, a4 = 15 and so on, so this is an easy guess (for CompSci majors).You should test your understanding by checking that this formula works.

The chip stacking problem

You have a lot of poker chips (colored disks) all either blue or white. Howmany ways can you stack n of then so that no white chip is directly onanother white chip?

An equivalent problem is: how many different bitstrings (strings consistingonly of 0’s and 1’s) of length n contain no consecutive 1’s?

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 6 / 18

Let an be the number of stacks of n chips with no consecutive white chips.We consider what the top chip might be. It might be white or blue.

If it is blue then the one beneath it can be any color and there are an−1

possibilities.

If the top one is a white chip, the one below it must be blue and belowthat can be anything. Thus there are an−2 possibilities.

That is

an = an−1 + an−2, n ≥ 2

a0 = 1, a1 = 2.

So the sequence an looks like 1, 2, 3, 5, 8, 13, . . . .

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 7 / 18

Let an be the number of stacks of n chips with no consecutive white chips.We consider what the top chip might be. It might be white or blue.

If it is blue then the one beneath it can be any color and there are an−1

possibilities.

If the top one is a white chip, the one below it must be blue and belowthat can be anything. Thus there are an−2 possibilities.

That is

an = an−1 + an−2, n ≥ 2

a0 = 1, a1 = 2.

So the sequence an looks like 1, 2, 3, 5, 8, 13, . . . .

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 7 / 18

Let an be the number of stacks of n chips with no consecutive white chips.We consider what the top chip might be. It might be white or blue.

If it is blue then the one beneath it can be any color and there are an−1

possibilities.

If the top one is a white chip, the one below it must be blue and belowthat can be anything. Thus there are an−2 possibilities.

That is

an = an−1 + an−2, n ≥ 2

a0 = 1, a1 = 2.

So the sequence an looks like 1, 2, 3, 5, 8, 13, . . . .

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 7 / 18

Let an be the number of stacks of n chips with no consecutive white chips.We consider what the top chip might be. It might be white or blue.

If it is blue then the one beneath it can be any color and there are an−1

possibilities.

If the top one is a white chip, the one below it must be blue and belowthat can be anything. Thus there are an−2 possibilities.

That is

an = an−1 + an−2, n ≥ 2

a0 = 1, a1 = 2.

So the sequence an looks like 1, 2, 3, 5, 8, 13, . . . .

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 7 / 18

Let an be the number of stacks of n chips with no consecutive white chips.We consider what the top chip might be. It might be white or blue.

If it is blue then the one beneath it can be any color and there are an−1

possibilities.

If the top one is a white chip, the one below it must be blue and belowthat can be anything. Thus there are an−2 possibilities.

That is

an = an−1 + an−2, n ≥ 2

a0 = 1, a1 = 2.

So the sequence an looks like 1, 2, 3, 5, 8, 13, . . . .

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 7 / 18

Our next section will give us the tools to find the formula

an =5 + 3

√5

10

(1 +√

5

2

)n

+5− 3

√5

10

(1−√

5

2

)n

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 8 / 18

Linear recurrence relations

The following is a perfectly valid recurrence relation:

an = an−1 · an−2.

and there are ways to solve problems involving it.

However we will focus,for the moment, only on recurrence relations like the following

an = 3an−1

an = 2an−1 − 5n2an−2

an = 4an−1 + 2an−2 + 5an−3

These are called linear recurrence relations. The definition of linear is thatthey can be written in the following form (this is for second order):

an + b(n)an−1 + c(n)an−2 = h(n)

where b, c and h are explicit functions of n that make no reference to anyterms of the unknown sequence ak . If the function h(n) on the right sideis just 0, the recurrence relation is called homogeneous.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 9 / 18

Linear recurrence relations

The following is a perfectly valid recurrence relation:

an = an−1 · an−2.

and there are ways to solve problems involving it. However we will focus,for the moment, only on recurrence relations like the following

an = 3an−1

an = 2an−1 − 5n2an−2

an = 4an−1 + 2an−2 + 5an−3

These are called linear recurrence relations. The definition of linear is thatthey can be written in the following form (this is for second order):

an + b(n)an−1 + c(n)an−2 = h(n)

where b, c and h are explicit functions of n that make no reference to anyterms of the unknown sequence ak . If the function h(n) on the right sideis just 0, the recurrence relation is called homogeneous.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 9 / 18

Linear recurrence relations

The following is a perfectly valid recurrence relation:

an = an−1 · an−2.

and there are ways to solve problems involving it. However we will focus,for the moment, only on recurrence relations like the following

an = 3an−1

an = 2an−1 − 5n2an−2

an = 4an−1 + 2an−2 + 5an−3

These are called linear recurrence relations. The definition of linear is thatthey can be written in the following form (this is for second order):

an + b(n)an−1 + c(n)an−2 = h(n)

where b, c and h are explicit functions of n that make no reference to anyterms of the unknown sequence ak . If the function h(n) on the right sideis just 0, the recurrence relation is called homogeneous.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 9 / 18

Linear recurrence relations

The following is a perfectly valid recurrence relation:

an = an−1 · an−2.

and there are ways to solve problems involving it. However we will focus,for the moment, only on recurrence relations like the following

an = 3an−1

an = 2an−1 − 5n2an−2

an = 4an−1 + 2an−2 + 5an−3

These are called linear recurrence relations. The definition of linear is thatthey can be written in the following form (this is for second order):

an + b(n)an−1 + c(n)an−2 = h(n)

where b, c and h are explicit functions of n that make no reference to anyterms of the unknown sequence ak .

If the function h(n) on the right sideis just 0, the recurrence relation is called homogeneous.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 9 / 18

Linear recurrence relations

The following is a perfectly valid recurrence relation:

an = an−1 · an−2.

and there are ways to solve problems involving it. However we will focus,for the moment, only on recurrence relations like the following

an = 3an−1

an = 2an−1 − 5n2an−2

an = 4an−1 + 2an−2 + 5an−3

These are called linear recurrence relations. The definition of linear is thatthey can be written in the following form (this is for second order):

an + b(n)an−1 + c(n)an−2 = h(n)

where b, c and h are explicit functions of n that make no reference to anyterms of the unknown sequence ak . If the function h(n) on the right sideis just 0, the recurrence relation is called homogeneous.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 9 / 18

There is a theory of linear recurrence relations that helps us build solutionsout of simpler parts.

For this discussion we will refer to an = f (n) as asolution if it just satisfies the recurrence equation, ignoring any initialcondition(s).

Theorem

If an = f (n) is a solutions of a homogeneous linear recurrence relation,then for any constant C so is an = Cf (n). If an = g(n) is also a solution,then so is an = f (n) + g(n).

For example, consider

an − 5an−1 + 6an−2 = 0

which is homogeneous and linear. Let us check that both an = 3n andan = 2n are solutions.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 10 / 18

There is a theory of linear recurrence relations that helps us build solutionsout of simpler parts. For this discussion we will refer to an = f (n) as asolution if it just satisfies the recurrence equation, ignoring any initialcondition(s).

Theorem

If an = f (n) is a solutions of a homogeneous linear recurrence relation,then for any constant C so is an = Cf (n). If an = g(n) is also a solution,then so is an = f (n) + g(n).

For example, consider

an − 5an−1 + 6an−2 = 0

which is homogeneous and linear. Let us check that both an = 3n andan = 2n are solutions.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 10 / 18

There is a theory of linear recurrence relations that helps us build solutionsout of simpler parts. For this discussion we will refer to an = f (n) as asolution if it just satisfies the recurrence equation, ignoring any initialcondition(s).

Theorem

If an = f (n) is a solutions of a homogeneous linear recurrence relation,then for any constant C so is an = Cf (n). If an = g(n) is also a solution,then so is an = f (n) + g(n).

For example, consider

an − 5an−1 + 6an−2 = 0

which is homogeneous and linear. Let us check that both an = 3n andan = 2n are solutions.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 10 / 18

There is a theory of linear recurrence relations that helps us build solutionsout of simpler parts. For this discussion we will refer to an = f (n) as asolution if it just satisfies the recurrence equation, ignoring any initialcondition(s).

Theorem

If an = f (n) is a solutions of a homogeneous linear recurrence relation,then for any constant C so is an = Cf (n). If an = g(n) is also a solution,then so is an = f (n) + g(n).

For example, consider

an − 5an−1 + 6an−2 = 0

which is homogeneous and linear.

Let us check that both an = 3n andan = 2n are solutions.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 10 / 18

There is a theory of linear recurrence relations that helps us build solutionsout of simpler parts. For this discussion we will refer to an = f (n) as asolution if it just satisfies the recurrence equation, ignoring any initialcondition(s).

Theorem

If an = f (n) is a solutions of a homogeneous linear recurrence relation,then for any constant C so is an = Cf (n). If an = g(n) is also a solution,then so is an = f (n) + g(n).

For example, consider

an − 5an−1 + 6an−2 = 0

which is homogeneous and linear. Let us check that both an = 3n andan = 2n are solutions.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 10 / 18

For the first, we simply put

an = 3n, an−1 = 3n−1, an−2 = 3n−2

into the recurrence relation to get

3n − 5 · 3n−1 + 6 · 3n−2 = 0

We can rearrange the left side:

(32 − 5 · 31 + 6)3n−2 = 0 or (9− 5 · 3 + 6)3n−2 = 0

and clearly the last one says 0 · 3n−2 = 0, which is always true. Similarcalculations with an = 2n lead to

(22 − 5 · 2 + 6)2n−2 = 0

which is also true.

With these solutions we can build new solutions: an = 2(3n) andan = −(2n) and an = 2(3n)− (2n). Note that if we add initial conditionsa0 = 1 and a1 = 4, then only the last of these satisfies them both.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 11 / 18

For the first, we simply put

an = 3n, an−1 = 3n−1, an−2 = 3n−2

into the recurrence relation to get

3n − 5 · 3n−1 + 6 · 3n−2 = 0

We can rearrange the left side:

(32 − 5 · 31 + 6)3n−2 = 0 or (9− 5 · 3 + 6)3n−2 = 0

and clearly the last one says 0 · 3n−2 = 0, which is always true.

Similarcalculations with an = 2n lead to

(22 − 5 · 2 + 6)2n−2 = 0

which is also true.

With these solutions we can build new solutions: an = 2(3n) andan = −(2n) and an = 2(3n)− (2n). Note that if we add initial conditionsa0 = 1 and a1 = 4, then only the last of these satisfies them both.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 11 / 18

For the first, we simply put

an = 3n, an−1 = 3n−1, an−2 = 3n−2

into the recurrence relation to get

3n − 5 · 3n−1 + 6 · 3n−2 = 0

We can rearrange the left side:

(32 − 5 · 31 + 6)3n−2 = 0 or (9− 5 · 3 + 6)3n−2 = 0

and clearly the last one says 0 · 3n−2 = 0, which is always true. Similarcalculations with an = 2n lead to

(22 − 5 · 2 + 6)2n−2 = 0

which is also true.

With these solutions we can build new solutions: an = 2(3n) andan = −(2n) and an = 2(3n)− (2n). Note that if we add initial conditionsa0 = 1 and a1 = 4, then only the last of these satisfies them both.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 11 / 18

For the first, we simply put

an = 3n, an−1 = 3n−1, an−2 = 3n−2

into the recurrence relation to get

3n − 5 · 3n−1 + 6 · 3n−2 = 0

We can rearrange the left side:

(32 − 5 · 31 + 6)3n−2 = 0 or (9− 5 · 3 + 6)3n−2 = 0

and clearly the last one says 0 · 3n−2 = 0, which is always true. Similarcalculations with an = 2n lead to

(22 − 5 · 2 + 6)2n−2 = 0

which is also true.

With these solutions we can build new solutions: an = 2(3n) andan = −(2n) and an = 2(3n)− (2n).

Note that if we add initial conditionsa0 = 1 and a1 = 4, then only the last of these satisfies them both.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 11 / 18

For the first, we simply put

an = 3n, an−1 = 3n−1, an−2 = 3n−2

into the recurrence relation to get

3n − 5 · 3n−1 + 6 · 3n−2 = 0

We can rearrange the left side:

(32 − 5 · 31 + 6)3n−2 = 0 or (9− 5 · 3 + 6)3n−2 = 0

and clearly the last one says 0 · 3n−2 = 0, which is always true. Similarcalculations with an = 2n lead to

(22 − 5 · 2 + 6)2n−2 = 0

which is also true.

With these solutions we can build new solutions: an = 2(3n) andan = −(2n) and an = 2(3n)− (2n). Note that if we add initial conditionsa0 = 1 and a1 = 4, then only the last of these satisfies them both.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 11 / 18

A further part of the theory of recurrence relations is the following

Theorem

For any homogeneous linear recurrence relation of order k there exist abasic set of solutions an = f1(n), an = f2(n),. . . ,an = fk(n)

such that everysolution has the form

an = C1f1(n) + C2f2(n) + · · ·+ Ck fk(n)

for some constants C1, C2,. . .Ck .

For our example an − 5an−1 + 6an−2 the basic solutions are an = 3n andan = 2n. Thus, all solutions look like an = C13n + C22n. This is called ageneral solution: It satisfies the recurrence relation for any choice of C1

and C2, but satisfies any given initial condition for only one choice.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 12 / 18

A further part of the theory of recurrence relations is the following

Theorem

For any homogeneous linear recurrence relation of order k there exist abasic set of solutions an = f1(n), an = f2(n),. . . ,an = fk(n) such that everysolution has the form

an = C1f1(n) + C2f2(n) + · · ·+ Ck fk(n)

for some constants C1, C2,. . .Ck .

For our example an − 5an−1 + 6an−2 the basic solutions are an = 3n andan = 2n. Thus, all solutions look like an = C13n + C22n. This is called ageneral solution: It satisfies the recurrence relation for any choice of C1

and C2, but satisfies any given initial condition for only one choice.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 12 / 18

A further part of the theory of recurrence relations is the following

Theorem

For any homogeneous linear recurrence relation of order k there exist abasic set of solutions an = f1(n), an = f2(n),. . . ,an = fk(n) such that everysolution has the form

an = C1f1(n) + C2f2(n) + · · ·+ Ck fk(n)

for some constants C1, C2,. . .Ck .

For our example an − 5an−1 + 6an−2 the basic solutions are an = 3n andan = 2n.

Thus, all solutions look like an = C13n + C22n. This is called ageneral solution: It satisfies the recurrence relation for any choice of C1

and C2, but satisfies any given initial condition for only one choice.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 12 / 18

A further part of the theory of recurrence relations is the following

Theorem

For any homogeneous linear recurrence relation of order k there exist abasic set of solutions an = f1(n), an = f2(n),. . . ,an = fk(n) such that everysolution has the form

an = C1f1(n) + C2f2(n) + · · ·+ Ck fk(n)

for some constants C1, C2,. . .Ck .

For our example an − 5an−1 + 6an−2 the basic solutions are an = 3n andan = 2n. Thus, all solutions look like an = C13n + C22n.

This is called ageneral solution: It satisfies the recurrence relation for any choice of C1

and C2, but satisfies any given initial condition for only one choice.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 12 / 18

A further part of the theory of recurrence relations is the following

Theorem

For any homogeneous linear recurrence relation of order k there exist abasic set of solutions an = f1(n), an = f2(n),. . . ,an = fk(n) such that everysolution has the form

an = C1f1(n) + C2f2(n) + · · ·+ Ck fk(n)

for some constants C1, C2,. . .Ck .

For our example an − 5an−1 + 6an−2 the basic solutions are an = 3n andan = 2n. Thus, all solutions look like an = C13n + C22n. This is called ageneral solution: It satisfies the recurrence relation for any choice of C1

and C2, but satisfies any given initial condition for only one choice.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 12 / 18

If the general solution is an = C13n + C22n and the initial conditions area0 = 1 and a1 = 4 then putting n = 0 and n = 1 into the solution gives us

a0 = 1 = C1 + C2

a1 = 4 = 3C1 + 2C2

Solving this for C1 and C2 gives C1 = 2, C2 = −1.

This gives us the general scheme for solving homogeneous linearrecurrence relations:

Find the basic set of solutions.

Build the general solution from them.

Solve for the constants using the initial conditions.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 13 / 18

If the general solution is an = C13n + C22n and the initial conditions area0 = 1 and a1 = 4 then putting n = 0 and n = 1 into the solution gives us

a0 = 1 = C1 + C2

a1 = 4 = 3C1 + 2C2

Solving this for C1 and C2 gives C1 = 2, C2 = −1.

This gives us the general scheme for solving homogeneous linearrecurrence relations:

Find the basic set of solutions.

Build the general solution from them.

Solve for the constants using the initial conditions.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 13 / 18

If the general solution is an = C13n + C22n and the initial conditions area0 = 1 and a1 = 4 then putting n = 0 and n = 1 into the solution gives us

a0 = 1 = C1 + C2

a1 = 4 = 3C1 + 2C2

Solving this for C1 and C2 gives C1 = 2, C2 = −1.

This gives us the general scheme for solving homogeneous linearrecurrence relations:

Find the basic set of solutions.

Build the general solution from them.

Solve for the constants using the initial conditions.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 13 / 18

If the general solution is an = C13n + C22n and the initial conditions area0 = 1 and a1 = 4 then putting n = 0 and n = 1 into the solution gives us

a0 = 1 = C1 + C2

a1 = 4 = 3C1 + 2C2

Solving this for C1 and C2 gives C1 = 2, C2 = −1.

This gives us the general scheme for solving homogeneous linearrecurrence relations:

Find the basic set of solutions.

Build the general solution from them.

Solve for the constants using the initial conditions.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 13 / 18

If the general solution is an = C13n + C22n and the initial conditions area0 = 1 and a1 = 4 then putting n = 0 and n = 1 into the solution gives us

a0 = 1 = C1 + C2

a1 = 4 = 3C1 + 2C2

Solving this for C1 and C2 gives C1 = 2, C2 = −1.

This gives us the general scheme for solving homogeneous linearrecurrence relations:

Find the basic set of solutions.

Build the general solution from them.

Solve for the constants using the initial conditions.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 13 / 18

Finding the basic solutions: We will do this completely only for secondorder equations with constant coefficients.

This means the recurrencerelation looks like an + ban−1 + can−2 = 0, with constants b and c .

For a first order equation: an − ban−1 = 0, the basic solution is an = bn

and the general solution is C1bn. The constant is determined by the initial

condition.

For higher order equations one might speculate that one or more of thebasic solutions has a similar structure. That is, we might suppose that onesolution is a geometric series an = rn for some r .

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 14 / 18

Finding the basic solutions: We will do this completely only for secondorder equations with constant coefficients. This means the recurrencerelation looks like an + ban−1 + can−2 = 0, with constants b and c .

For a first order equation: an − ban−1 = 0, the basic solution is an = bn

and the general solution is C1bn. The constant is determined by the initial

condition.

For higher order equations one might speculate that one or more of thebasic solutions has a similar structure. That is, we might suppose that onesolution is a geometric series an = rn for some r .

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 14 / 18

Finding the basic solutions: We will do this completely only for secondorder equations with constant coefficients. This means the recurrencerelation looks like an + ban−1 + can−2 = 0, with constants b and c .

For a first order equation: an − ban−1 = 0, the basic solution is an = bn

and the general solution is C1bn.

The constant is determined by the initialcondition.

For higher order equations one might speculate that one or more of thebasic solutions has a similar structure. That is, we might suppose that onesolution is a geometric series an = rn for some r .

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 14 / 18

Finding the basic solutions: We will do this completely only for secondorder equations with constant coefficients. This means the recurrencerelation looks like an + ban−1 + can−2 = 0, with constants b and c .

For a first order equation: an − ban−1 = 0, the basic solution is an = bn

and the general solution is C1bn. The constant is determined by the initial

condition.

For higher order equations one might speculate that one or more of thebasic solutions has a similar structure. That is, we might suppose that onesolution is a geometric series an = rn for some r .

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 14 / 18

Finding the basic solutions: We will do this completely only for secondorder equations with constant coefficients. This means the recurrencerelation looks like an + ban−1 + can−2 = 0, with constants b and c .

For a first order equation: an − ban−1 = 0, the basic solution is an = bn

and the general solution is C1bn. The constant is determined by the initial

condition.

For higher order equations one might speculate that one or more of thebasic solutions has a similar structure.

That is, we might suppose that onesolution is a geometric series an = rn for some r .

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 14 / 18

Finding the basic solutions: We will do this completely only for secondorder equations with constant coefficients. This means the recurrencerelation looks like an + ban−1 + can−2 = 0, with constants b and c .

For a first order equation: an − ban−1 = 0, the basic solution is an = bn

and the general solution is C1bn. The constant is determined by the initial

condition.

For higher order equations one might speculate that one or more of thebasic solutions has a similar structure. That is, we might suppose that onesolution is a geometric series an = rn for some r .

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 14 / 18

That can be checked: put an = rn in the equation (as usual alsoan−1 = rn−1 and an−2 = rn−2).

This gives

rn + brn−1 + crn−2 = 0 or (r2 + br + c)rn−2 = 0

Now if r = 0 the solution an = 0 gives us nothing to work with, so weassume r 6= 0. Then we can divide the last equation by rn−2 to get thecharactristic equation

r2 + br + c = 0

If an = rn is to be a solution then r must be a root of this equation:

r =−b ±

√b2 − 4c

2(1)

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 15 / 18

That can be checked: put an = rn in the equation (as usual alsoan−1 = rn−1 and an−2 = rn−2). This gives

rn + brn−1 + crn−2 = 0 or (r2 + br + c)rn−2 = 0

Now if r = 0 the solution an = 0 gives us nothing to work with, so weassume r 6= 0. Then we can divide the last equation by rn−2 to get thecharactristic equation

r2 + br + c = 0

If an = rn is to be a solution then r must be a root of this equation:

r =−b ±

√b2 − 4c

2(1)

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 15 / 18

That can be checked: put an = rn in the equation (as usual alsoan−1 = rn−1 and an−2 = rn−2). This gives

rn + brn−1 + crn−2 = 0 or (r2 + br + c)rn−2 = 0

Now if r = 0 the solution an = 0 gives us nothing to work with, so weassume r 6= 0.

Then we can divide the last equation by rn−2 to get thecharactristic equation

r2 + br + c = 0

If an = rn is to be a solution then r must be a root of this equation:

r =−b ±

√b2 − 4c

2(1)

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 15 / 18

That can be checked: put an = rn in the equation (as usual alsoan−1 = rn−1 and an−2 = rn−2). This gives

rn + brn−1 + crn−2 = 0 or (r2 + br + c)rn−2 = 0

Now if r = 0 the solution an = 0 gives us nothing to work with, so weassume r 6= 0. Then we can divide the last equation by rn−2 to get thecharactristic equation

r2 + br + c = 0

If an = rn is to be a solution then r must be a root of this equation:

r =−b ±

√b2 − 4c

2(1)

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 15 / 18

That can be checked: put an = rn in the equation (as usual alsoan−1 = rn−1 and an−2 = rn−2). This gives

rn + brn−1 + crn−2 = 0 or (r2 + br + c)rn−2 = 0

Now if r = 0 the solution an = 0 gives us nothing to work with, so weassume r 6= 0. Then we can divide the last equation by rn−2 to get thecharactristic equation

r2 + br + c = 0

If an = rn is to be a solution then r must be a root of this equation:

r =−b ±

√b2 − 4c

2(1)

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 15 / 18

Here’s an example:an − an−1 − 6an−1 = 0.

The above process gives us the characteristic equation

r2 − r − 6 = 0.

Which has roots r = 3 and r = −2. That means both an = 3n andan = (−2)n are solutions and the general solution is an = C13n + C2(−2)n.

[Note that (−2)n is not −2n. The first sequence is 1,−2, 4,−8, 16, . . .while the second is −1,−2,−4,−8,−16, . . . .]

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 16 / 18

Here’s an example:an − an−1 − 6an−1 = 0.

The above process gives us the characteristic equation

r2 − r − 6 = 0.

Which has roots r = 3 and r = −2.

That means both an = 3n andan = (−2)n are solutions and the general solution is an = C13n + C2(−2)n.

[Note that (−2)n is not −2n. The first sequence is 1,−2, 4,−8, 16, . . .while the second is −1,−2,−4,−8,−16, . . . .]

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 16 / 18

Here’s an example:an − an−1 − 6an−1 = 0.

The above process gives us the characteristic equation

r2 − r − 6 = 0.

Which has roots r = 3 and r = −2. That means both an = 3n andan = (−2)n are solutions and the general solution is an = C13n + C2(−2)n.

[Note that (−2)n is not −2n. The first sequence is 1,−2, 4,−8, 16, . . .while the second is −1,−2,−4,−8,−16, . . . .]

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 16 / 18

Here’s an example:an − an−1 − 6an−1 = 0.

The above process gives us the characteristic equation

r2 − r − 6 = 0.

Which has roots r = 3 and r = −2. That means both an = 3n andan = (−2)n are solutions and the general solution is an = C13n + C2(−2)n.

[Note that (−2)n is not −2n. The first sequence is 1,−2, 4,−8, 16, . . .while the second is −1,−2,−4,−8,−16, . . . .]

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 16 / 18

Continuing with the same example, let’s give it initial conditions:

an − an−1 − 6an−2 = 0, n ≥ 2

a0 = 0, a1 = 5

From the general solution an = C13n + C2(−2)n and the initial conditionswe get equations for C1 and C2:

C1 +C2 = 0

3C1−2C2 = 5

which gives C1 = 1 and C2 = −1 so that an = 3n − (−2)n is the solutionto the initial value problem.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 17 / 18

Continuing with the same example, let’s give it initial conditions:

an − an−1 − 6an−2 = 0, n ≥ 2

a0 = 0, a1 = 5

From the general solution an = C13n + C2(−2)n and the initial conditionswe get equations for C1 and C2:

C1 +C2 = 0

3C1−2C2 = 5

which gives C1 = 1 and C2 = −1 so that an = 3n − (−2)n is the solutionto the initial value problem.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 17 / 18

Continuing with the same example, let’s give it initial conditions:

an − an−1 − 6an−2 = 0, n ≥ 2

a0 = 0, a1 = 5

From the general solution an = C13n + C2(−2)n and the initial conditionswe get equations for C1 and C2:

C1 +C2 = 0

3C1−2C2 = 5

which gives C1 = 1 and C2 = −1 so that an = 3n − (−2)n is the solutionto the initial value problem.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 17 / 18

A second example:

an − 4an−2 = 0

a0 = 1, a1 = 1

Here we get r2 − 4 = 0 and roots 2 and −2. The general solution isan = C12n + C2(−2)n. From

C1 +C2 = 1

2C1−2C2 = 1

we get C1 = 3/4 and C2 = 1/4 so that an = (3/4)2n + (1/4)(−2)n.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 18 / 18

A second example:

an − 4an−2 = 0

a0 = 1, a1 = 1

Here we get r2 − 4 = 0 and roots 2 and −2.

The general solution isan = C12n + C2(−2)n. From

C1 +C2 = 1

2C1−2C2 = 1

we get C1 = 3/4 and C2 = 1/4 so that an = (3/4)2n + (1/4)(−2)n.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 18 / 18

A second example:

an − 4an−2 = 0

a0 = 1, a1 = 1

Here we get r2 − 4 = 0 and roots 2 and −2. The general solution isan = C12n + C2(−2)n.

From

C1 +C2 = 1

2C1−2C2 = 1

we get C1 = 3/4 and C2 = 1/4 so that an = (3/4)2n + (1/4)(−2)n.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 18 / 18

A second example:

an − 4an−2 = 0

a0 = 1, a1 = 1

Here we get r2 − 4 = 0 and roots 2 and −2. The general solution isan = C12n + C2(−2)n. From

C1 +C2 = 1

2C1−2C2 = 1

we get C1 = 3/4 and C2 = 1/4 so that an = (3/4)2n + (1/4)(−2)n.

Daniel H. Luecking Recurrence Relations Feb. 17, 2021 18 / 18

Recommended