Você está na página 1de 14

MA142 Handout #1 Linear recurrence relations

Robert Harron
Wednesday, Nov. 18, 2009
This handout covers the material on solving linear recurrence relations. It starts o with an example that
goes through detailed calculations. It then explains how to extract a basic method from this example.
Subsequent examples are solved by applying a simple set of steps.
The rst part deals with recurrence relations that give rise to matrices that have distinct real eigenvalues.
The case of distinct complex eigenvalues is dealt with in section 3 (in some sense it is the same method,
but some simplications can be used). We dont have the machinery required to derive the method in the
case of eigenvalues with multiplicity greater than 1. Nonetheless, I have included a section that explains
how to solve such recurrence relations (section 4) (you are not required to know the material of that
section though).
1 A rst example: detailed calculations
Let
a
1
= 1, a
2
= 5 (1)
and for n 1
a
n+2
= 6a
n+1
8a
n
. (2)
Find a formula for a
n
. (You could think of this as saying: solve equation (2) for a
n
, given that a
1
= 1
and a
2
= 5.)
In case youre interested, the beginning of this sequence is 1, 5, 22, 92, 376, 1520, 6112, . . .
The rst idea behind solving this problem is to write the recurrence relation a
n+2
= 6a
n+1
8a
n
in
terms of matrix multiplication: nd
A =

such that

a
n+2
a
n+1

= A

a
n+1
a
n

.
The right-hand side is
A

a
n+1
a
n

a
n+1
+ a
n
a
n+1
+ a
n

so
A =

6 8
1 0

.
1
Then, we can write

a
n+2
a
n+1

6 8
1 0

a
n+1
a
n

6 8
1 0

a
n
a
n1

= =

6 8
1 0

a
2
a
1

so if we can nd a formula for A


n
, then we will have a formula for a
n+2
. This is where the second idea
comes in: the best way to take a power of a matrix is to diagonalize it. If we have
A = PDP
1
with
D =


1
0
0
2

,
then
A
n
= (PDP
1
)(PDP
1
) (PDP
1
) = PD
n
P
1
and
D
n
=


n
1
0
0
n
2

.
The characteristic polynomial of A is
ch
A
(x) = det

6 x 8
1 x

= x
2
6x + 8 (3)
whose roots are the eigenvalues

1
= 4 and
2
= 2.
You can nd that
v
1
=

4
1

is a eigenvector corresponding to
1
and
v
2
=

2
1

is an eigenvector corresponding to
2
. So
P =

4 2
1 1

and
P
1
=
1
det(P)

1 2
1 4

1
2
1

1
2
2

.
2
Therefore,

a
n+2
a
n+1

= A
n

a
2
a
1

(4)
= PD
n
P
1

a
2
a
1

(5)
=

4 2
1 1

4
n
0
0 2
n

1
2
1

1
2
2

5
1

(6)
=

4
n+1
2
n+1
4
n
2
n

1
2
1

1
2
2

5
1

(7)
=

4
n+1
2
n+1
4
n
2
n

3
2

1
2

(8)
=

3
2
4
n+1

1
2
2
n+1
3
2
4
n

1
2
2
n

. (9)
Taking the rst component, say, of this equality gives
a
n+2
=
3
2
4
n+1

1
2
2
n+1
or, equivalently,
a
n
=
3
2
4
n1

1
2
2
n1
. (10)
1.1 From the example to the method
By studying the above example, we can remove a lot of the work out of the method of solution. In this
section, Ill explain how we can, rstly, avoid having to nd the eigenvectors and P
1
. Then, Ill describe
how we can even avoid writing down the matrix A.
Looking at equation (6), we can see that only the entries of D
n
depend on n. So doing this multiplication,
whatever it is, will give something that looks like

a
n+2
a
n+1

a 4
n+1
+ b 2
n+1
c 4
n
+ d 2
n

for some constants a, b, c, d. Taking the rst component of this equality gives
a
n
= a 4
n1
+ b 2
n1
. (11)
We know this without having to know what P is. How do we gure out what a and b are (without
computing P)? Simply plug n = 1 and n = 2 into equation (11) and use (1):
n = 1 : 1 = a
1
= a 4
0
+ b 2
0
= a + b
n = 2 : 5 = a
2
= a 4 + b 2.
3
This gives us two linear equations for the two unknowns a and b. We can solve this using an augmented
matrix (of course, this is a rather simple system, so you could do this without matrices):

1 1 1
4 2 5

1 1 1
0 2 1

1 1 1
0 1
1
2

1 0
3
2
0 1
1
2

.
Thus,
a =
3
2
and b =
1
2
so
a
n
=
3
2
4
n1

1
2
2
n1
which agrees with the answer obtained above in (10).
So, we didnt need to nd v
1
, v
2
, P, P
1
, we just needed to know about the 4
n1
and the 2
n1
. What
are 4 and 2? They were the entries of D, i.e. the eigenvalues of A.
Now, how do we avoid having to nd A? We just saw that all we need from A are its eigenvalues, so
we just need the characteristic polynomial of A. Looking at equation (3) you may (or may not) notice
that its similar to the recurrence relation we started with (2). This is no coincidence. The recurrence
relation has the form
a
n+2
= pa
n+1
+ qa
n
. (12)
The matrix A for this recurrence relation is
A =

p q
1 0

whose characteristic polynomial is


ch
A
(x) = det

p x q
1 x

= x
2
px q.
Thus, the characteristic equation is
x
2
px q = 0.
This is equation (12) if you replace a
n+2
by x
2
, a
n+1
by x, and a
n
by 1. So, we dont need to nd A
or compute its characteristic polynomial because we can read o its characteristic polynomial from the
denition of the recurrence relation.
1.2 The method
Lets introduce a bit of terminology. The recurrence relation we used as an example in section 1 is referred
to as a linear recurrence relation of order 2 with initial conditions a
1
= 1 and a
2
= 5 (or a second
order linear recurrence relation with initial conditions). Second order refers to the fact that a
n+2
is
dened in relation to the two previous values a
n+1
and a
n
. Since every value is dened in relation to the
previous two, you need to start o by specifying two consecutive values (e.g. a
1
, a
2
) which are then called
initial conditions. You could give dierent initial conditions for the same recurrence relation and thus
4
obtain a dierent sequence (in example 1 below, we use the same recurrence relation as in the example in
section 1, but dierent initial conditions). A general k
th
order linear recurrence relation has the form
a
n+k
= p
1
a
n+k1
+ p
2
a
n+k2
+ + p
k
a
n
, where p
i
R.
For such a recurrence relation, an initial condition is specied by k consecutive values (e.g. a
1
, a
2
, . . . , a
k
).
Ill begin by outlining the method for solving second order linear recurrence relations (restricting to the
case where the corresponding eigenvalues are real and distinct), then Ill move on to higher order ones.
1.2.1 Order 2
Let
a
n+2
= p
1
a
n+1
+ p
2
a
n
(13)
be a second order linear recurrence relation.
Step 1: Find the fundamental solutions. (The fundamental solutions are the 4
n1
and 2
n1
in the
example we did above.)
The fundamental solutions are obtained by nding the solutions of the quadratic equation coming
from (13), i.e. in (13), replace a
n+2
by x
2
, a
n+1
by x, and a
n
by 1 to obtain
x
2
p
1
x p
2
= 0
and solve. Call the roots you get
1
and
2
(in this section, we are assuming these are distinct and
real). Then the fundamental solutions are

n1
1
and
n1
2
.
Step 2: The general solution of (13) is
a
n
= a
n1
1
+ b
n1
2
(14)
with a, b R.
Now suppose we have initial conditions
a
1
= r, a
2
= s.
then the solution to the recurrence relation (13) with initial conditions a
1
= r and a
2
= s is given by:
Step 3: Plug in n = 1 and n = 2 into equation (14) and solve for a and b:
a
1
= r = a + b
a
2
= s = a
1
+ b
2
5
which can be solved by row reduction of

1 1 r

1

2
s

.
Remark 1. Note that the system of equations giving a and b has a unique solution since
det

1 1

1

2

=
2

1
= 0
(since we are assuming
1
and
2
are distinct).
1.2.2 Higher order
Let
a
n+k
= p
1
a
n+k1
+ p
2
a
n+k2
+ + p
k
a
n
(15)
be a k
th
order linear recurrence relation.
Step 1: Find the fundamental solutions.
The fundamental solutions are obtained by nding the solutions of the equation coming from (15),
i.e. in (15), replace a
n+i
by x
i
to obtain
1
x
k
p
1
x
k1
p
2
x
k2
p
k
= 0
and solve. Call the roots you get
1
,
2
, . . . ,
k
(in this section, we are assuming these are distinct
and real). Then the fundamental solutions are

n1
1
,
n1
2
, . . . ,
n1
k
.
Step 2: The general solution of (15) is
a
n
= b
1

n1
1
+ b
2

n1
2
+ + b
k

n1
k
(16)
with b
i
R.
Now suppose we have initial conditions
a
1
= r
1
, a
2
= r
2
, . . . , a
k
= r
k
then the solution to the recurrence relation (15) with initial conditions a
i
= r
i
is given by:
1
Its not too hard to prove that the characteristic polynomial of the matrix A of interest is
ch
A
(x) = (1)
k

x
k
p
1
x
k1
p
2
x
k2
p
k

.
This is a standard fact in the theory of the rational canonical form.
6
Step 3: Plug in n = 1, n = 2, . . . , n = k into equation (16) and solve for the b
i
:
a
1
= r
1
= b
1
+ b
2
+ + b
k
a
2
= r
2
= b
1

1
+ b
2

2
+ + b
k

k
a
3
= r
3
= b
1

2
1
+ b
2

2
2
+ + b
k

2
k
.
.
.
a
k
= r
k
= b
1

k1
1
+ b
2

k1
2
+ + b
k

k1
k
which can be solved by row reduction of

1 1 . . . 1 r
1

1

2
. . .
k
r
2

2
1

2
2
. . .
2
k
r
3
.
.
.
.
.
.

k1
1

k1
2
. . .
k1
k
r
k

.
Remark 2. Note that the system of equations giving the b
i
has a unique solution since
2

1 1 . . . 1

1

2
. . .
k

2
1

2
2
. . .
2
k
.
.
.
.
.
.

k1
1

k1
2
. . .
k1
k

= (
2

1
)(
3

1
) . . . (
k

1
)(
3

2
)(
4

2
) . . . (
k

k1
) = 0
(since we are assuming the
i
are distinct).
2 Examples of applying the method
2.1 Example 1
Consider the recurrence relation
a
n+2
= 6a
n+1
8a
n
(17)
with initial conditions
a
1
= 1, a
2
= 4 (18)
Find a formula for a
n
. (Note that this is the same recurrence relation as the example in section 1, but
with dierent initial conditions).
Solution:
Step 1: Find the fundamental solutions.
2
This determinant is called the Vandermonde determinant.
7
Replacing a
n+i
with x
i
in equation (17), we get
x
2
6x + 8 = 0.
The solutions of this equation are given by the quadratic formula. We get

1
= 4 and
2
= 2.
The fundamental solutions of (17) are thus
4
n1
and 2
n1
.
Step 2: The general solution is
a4
n1
+ b2
n1
where a, b R.
Step 3: Plug in n = 1 and n = 2.
a
1
= 1 = a + b
a
2
= 4 = 4a + 2b.

1 1 1
4 2 4

1 1 1
0 2 0

1 1 1
0 1 0

1 0 1
0 1 0

so a = 1, b = 0.
The answer is
a
n
= 1 4
n1
+ 0 2
n1
= 4
n1
.
Remark 3. Because b ends up equaling zero here, the formula for a
n
is particularly simple. Note how
changing the initial condition can really change the formula for a
n
.
Question: So, I could give you the above recurrence relation with initial conditions and ask: What is
the 100th term? Now, you can answer 4
99
.
2.2 Example 2 Fibonnaci sequence
Consider the recurrence relation
a
n+2
= a
n+1
+ a
n
(19)
with initial conditions
a
1
= 1, a
2
= 1 (20)
Find a formula for a
n
.
Solution:
8
Step 1: Find the fundamental solutions.
Replacing a
n+i
with x
i
in equation (19), we get
x
2
x 1 = 0.
The solutions of this equation are given by the quadratic formula. We get

1
=
1 +

5
2
and
2
=
1

5
2
.
Let us introduce the common notation for these particular numbers
=
1 +

5
2
, so that 1 =
1

5
2
The fundamental solutions of (19) are thus

n1
and (1 )
n1
.
Step 2: The general solution is
a
n1
+ b(1 )
n1
where a, b R.
Step 3: Plug in n = 1 and n = 2.
a
1
= 1 = a + b
a
2
= 1 = a + b(1 ).

1 1 1
1 1

1 1 1
0 1 2 1

1 1 1
0 1
1
12

1 0 1
1
12
0 1
1
12

.
Note that
1 2 = 1 2
1 +

5
2
=

5
so
a = 1
1
1 2
= 1
1
1 2
=
1 2 (1 )

5
=

5
b =
1
1 2
=
1

5
The answer is
a
n
=

n1
+

(1 )
n1
=

n
(1 )
n

5
.
Remark 4. The sequence a
n
1, 1, 2, 3, 5, 8, 13, 21, . . .
in this example is called the Fibonacci sequence, named for Leonardo da Pisa a.k.a. Fibonacci, a math-
ematician of the middle ages who introduced the arabic numeral system we use today into western
9
civilization. In his 1202 book Liber Abaci, he used the Fibonacci sequence as a model for the population
growth of rabbits (a
n
is the number of pairs of rabbits after n months). According to wikipedia, the
Fibonacci sequence was well-known in ancient India (as early as 200 BC), and was used to count patterns
in a form of Sanskrit poetry.
The number
=
1 +

5
2
1.61803
is called the Golden ratio (or Golden mean, etc.). It has been studied since ancient Greece and is
considered to be an aesthetically pleasing ratio used in designing buildings, drawing spirals, etc.
Certain people might say that the fact that theres a relationship between the Fibonacci numbers and
the Golden ratio is cool. Others might not.
2.3 Example 3 Third order example
Consider the third order recurrence relation
a
n+3
= a
n+2
+ 4a
n+1
+ 4a
n
(21)
with initial conditions
a
1
= 1, a
2
= 6, a
3
= 8. (22)
Find a formula for a
n
.
Solution:
Step 1: Find the fundamental solutions.
Replacing a
n+i
with x
i
in equation (21), we get
x
3
+ x
2
4x 4 = 0.
The solutions of this equation can be obtained by the rational roots test. We get

1
= 2,
2
= 1,
3
= 2.
The fundamental solutions of (21) are thus
(2)
n1
, (1)
n1
, and 2
n1
.
Step 2: The general solution is
b
1
(2)
n1
+ b
2
(1)
n1
+ b
3
2
n1
where b
1
, b
2
, b
3
R.
10
Step 3: Plug in n = 1, n = 2, and n = 3
a
1
= 1 = b
1
+ b
2
+ b
3
a
2
= 6 = 2b
1
b
2
+ 2b
3
a
3
= 8 = 4b
1
+ b
2
+ 4b
3
.

1 1 1 1
2 1 2 6
4 1 4 8

1 1 1 1
0 1 4 4
0 3 0 12

1 1 1 1
0 1 0 4
0 0 4 8

1 0 0 1
0 1 0 4
0 0 1 2

so b
1
= 1, b
2
= 4, and b
3
= 2.
The answer is
a
n
= 1 (2)
n1
+ (4) (1)
n1
+ 2 2
n1
= (2)
n1
+ 4 (1)
n
+ 2
n
.
Question: So, I could give you the above recurrence relation with initial conditions and ask: What is
the 100th term? Now, you can answer
(2)
99
+ 4(1)
100
+ 2
100
= 2
99
(2 1) + 4 = 2
99
+ 4.
3 Complex eigenvalues
The solution in the case of distinct complex eigenvalues can be carried out the same as with real eigen-
values, but a shortcut can be taken. Ill illustrate this with an example.
3.1 Example 4
Consider the recurrence relation
a
n+2
= 2a
n+1
5a
n
(23)
with initial conditions
a
1
= 4, a
2
= 8 (24)
Find a formula for a
n
.
Solution:
11
Step 1: Find the fundamental solutions.
Replacing a
n+i
with x
i
in equation (23), we get
x
2
2x + 5 = 0.
The solutions of this equation are given by the quadratic formula. We get

1
= 1 + 2i and
2
= 1 2i.
The fundamental solutions of (23) are thus
(1 + 2i)
n1
and (1 2i)
n1
.
Step 2: The general solution is
a(1 + 2i)
n1
+ b(1 2i)
n1
where, now, a, b C.
Trick: If a = x + iy, then b = x iy (this is because a(1 + 2i)
n1
+ b(1 2i)
n1
must be a real
number, so a and b must be complex conjugates).
Step 3: Plug in n = 1 and n = 2.
a
1
= 4 = a + b = x + iy + x iy = 2x
so x = 2.
a
2
= 8 = a(1 + 2i) + b(1 2i)
= (2 + iy)(1 + 2i) + (2 iy)(1 2i)
= 2 + 4i + iy 2y + 2 4i iy 2y
= 4 4y
so y = 1.
The answer is
a
n
= (2 i)(1 + 2i)
n1
+ (2 + i)(1 2i)
n1
.
4 Repeated eigenvalues
To derive the method for solving linear recurrence relations that have eigenvalues with multiplicity > 1,
we would need the theory of the Jordan canonical form. This is a generalization of the theory of
diagonalization that allows you to nd a similar almost diagonal matrix (specically a Jordan block)
even for non-diagonalizable matrices (this requires nding generalized eigenvectors). Since we dont
have this knowledge, I gured Id just tell you how to solve the recurrence relations in case youre
interested.
12
Lets focus on the second order case. Suppose you have a second order linear recurrence relation, say
a
n+2
= 4a
n+1
4a
n
whose eigenvalues are the roots of
x
2
4x + 4 = (x 2)
2
i.e.

1
= 2 with multiplicity 2.
The problem you run into is that you need two fundamental solutions, but if your two eigenvalues
1
=
2
are the same, then

n1
1
=
n1
2
so you can only obtain one fundamental solution of that form. What you get out of the theory of the
Jordan canonical form is that the two fundamental solutions are
2
n1
and n2
n1
,
so the general solution is
a2
n1
+ bn2
n1
with a, b R. For example, suppose our initial conditions are
a
1
= 1 and a
2
= 10.
Plugging in n = 1 and n = 2 gives
a
1
= 1 = a + b
a
2
= 10 = 2a + 4b.
This can be solved by row reducing

1 1 1
2 4 10

1 1 1
0 2 8

1 1 1
0 1 4

1 0 3
0 1 4

.
So, the general term of the sequence is given by
a
n
= 3 2
n1
+ 4n2
n1
= 2
n1
(4n 3) .
For a k
th
order linear recurrence relation all of whose eigenvalues are the same with multiplicity k, you
still need k fundamental solutions. These are

n1
, n
n1
, n
2

n1
, . . . , n
k1

n1
.
When there are several eigenvalues
1
, . . . ,
q
with respective multiplicities m
1
, . . . , m
q
, the k fundamental
13
solutions are

n1
1
, n
n1
1
, . . . , n
m11

n1
1
,
n1
2
, n
n1
2
, . . . , n
m21

n1
2
,
n1
q
, . . . , n
mq1

n1
q
.
Remark 5. If you think this looks similar to how you solve linear dierential equations, youre not
wrong. The theory behind solving linear dierential equations is exactly the same.
14

Você também pode gostar