You are on page 1of 28

Discrete Mathematics with Applications

MATH236

Dr. Hung P. Tong-Viet

School of Mathematics, Statistics and Computer Science


University of KwaZulu-Natal
Pietermaritzburg Campus

Semester 1, 2013

Tong-Viet (UKZN) MATH236 Semester 1, 2013 1 / 28


Table of contents

1 Solving linear recurrence relations

Tong-Viet (UKZN) MATH236 Semester 1, 2013 2 / 28


Solving linear recurrence relations

Introduction

Definition
A linear homogeneous recurrence relation of degree k with constant
coefficients is a recurrence relation of the form

an = c1 an−1 + c2 an−2 + · · · ck an−k ,

where c1 , c2 , · · · , ck are real numbers, and ck 6= 0.

Tong-Viet (UKZN) MATH236 Semester 1, 2013 3 / 28


Solving linear recurrence relations

Introduction

The recurrence relation in the definition is linear because the


right-hand side is a sum of previous terms of the sequence each
multiplied by a constant.
The recurrence relation is homogeneous because no terms occur that
are not multiples of the aj s
The coefficients of the terms of the sequence are all constants, rather
than functions that depend on n.
The degree is k because an is expressed in terms of the previous k
terms of the sequence
By the principle of mathematical induction, the recurrence relation in
the definition is uniquely determined by this recurrence relation and
the k initial conditions a0 = C0 , a1 = C1 , · · · , ak−1 = Ck−1 .

Tong-Viet (UKZN) MATH236 Semester 1, 2013 4 / 28


Solving linear recurrence relations

Examples of linear homogeneous recurrence relations

The recurrence relation Pn = 1.11Pn−1 is a linear homogeneous


recurrence relation of degree one.
The recurrence relation fn = fn−1 + fn−2 is a linear homogeneous
recurrence relation of degree five
2
The recurrence relation an = an−1 + an−2 is not linear
The recurrence relation Hn = 2Hn−1 + 1 is not homogeneous
The recurrence relation Bn = nBn−1 is not linear homogeneous as it
does not have constant coefficients.

Tong-Viet (UKZN) MATH236 Semester 1, 2013 5 / 28


Solving linear recurrence relations

Soving Linear Homogeneous recurrence relations with


constant coefficients

Linear homogeneous recurrence relations are studied for two reasons


First, they often occur in doodling of problems
Second, they can be systematically solved.

Tong-Viet (UKZN) MATH236 Semester 1, 2013 6 / 28


Solving linear recurrence relations

Soving Linear Homogeneous recurrence relations

The basic approach for solving linear homogeneous recurrence


relations is to look for solutions of the form an = r n , where r is a
constant
Notice that an is a solution of the recurrence relation
an = c1 an−1 + c2 an−2 + · · · ck an−k if and only if

r n = c1 r n−1 + c2 r n−2 + · · · + ck r n−k

Dividing both sides by r n−k , and the right-hand side is subtracted


from the left, we obtain

r k − c1 r k−1 − c2 r k−2 − · · · − ck = 0.

Tong-Viet (UKZN) MATH236 Semester 1, 2013 7 / 28


Solving linear recurrence relations

Soving Linear Homogeneous recurrence relations

The sequence {an } with an = r n is a solution if and only if r is a


solution of this last equation.
We call this the characteristic equation of the recurrence relation.
The solutions of this equation are called the characteristic roots of
the recurrence relation.
As we will see that characteristic roots can be used to give an explicit
formula for all the solutions of the recurrence relation
We will consider the linear homogeneous recurrence relations of
degree two.

Tong-Viet (UKZN) MATH236 Semester 1, 2013 8 / 28


Solving linear recurrence relations

Soving Linear Homogeneous recurrence relations

Theorem (Theorem 1)
Let c1 and c2 be real numbers. Suppose that r 2 − c1 r − c2 = 0 has two
distinct roots r1 and r2 . Then the sequence {an } is a solution of the
recurrence relation an = c1 an−1 + c2 an−2 if and only if an = α1 r1n + α2 r2n
for n = 0, 1, · · · , where α1 and α2 are constants.

Tong-Viet (UKZN) MATH236 Semester 1, 2013 9 / 28


Solving linear recurrence relations

Example
Example
What is the solution of the recurrence relation an = an−1 + 2an−2 with
a0 = 2 and a1 = 7.

Proof.
The characteristic equation of the recurrence relation is r 2 − r − 2 = 0
Its roots are r1 = 2 and r2 = −1
Hence the sequence {an } is a solution to the recurrence relation if
and only if an = α1 2n + α2 (−1)n for some constants α1 and α2 .
From the initial conditions, it follows that a0 = 2 = α1 + α2 and
a1 = 7 = α1 · 2 + α2 · (−1)
Solving these equations, we have α1 = 3 and α2 = −1
So the solution is an = 3 · 2n − (−1)n .

Tong-Viet (UKZN) MATH236 Semester 1, 2013 10 / 28


Solving linear recurrence relations

Proof of Theorem 1

Assume first that if an = α1 r1n + α2 r2n , then the sequence {an } is a


solution of the recurrence relation
Because r1 and r2 are roots of r 2 − c1 r − c2 = 0, it follows that
r12 = c1 r1 + c2 and r22 = c1 r2 + c2 .
From these equations, we see that

c1 an−1 + c2 an−2 = c1 (α1 r1n−1 + α2 r2n−1 ) + c2 (α1 r1n−2 + α2 r2n−2 )


= α1 r1n−2 (c1 r1 + c2 ) + α2 r2n−2 (c1 r2 + c2 )
= α1 r1n−2 r12 + c2 r2n−2 r22
= α1 r1n + α2 r2n
= an .

This shows that {an } with an = α1 r1n + α2 r2n is a solution of the


recurrence relation.

Tong-Viet (UKZN) MATH236 Semester 1, 2013 11 / 28


Solving linear recurrence relations

Proof of Theorem 1

We now need to show that every solution {an } of the recurrence


relation an = c1 an−1 + c2 an−2 must have an = α1 r1n + α2 r2n for
n = 0, 1, · · · , for some constants α1 and α2
Suppose that {an } is a solution of the recurrence relation, and the
initial conditions a0 = C0 and a1 = C1 hold
We show that there exist constants α1 , α2 such that the sequence
{an } with an = α1 r1n + α2 r2n satisfies these same initial conditions.
This requires that a0 = C − 0 = α1 + α2 and a1 = C1 = α1 r1 + α2 r2
We have α2 = C0 − α1 and C1 = α1 r1 + (C0 − α1 )r2
C1 −C0 r2
This shows that α1 = r1 −r2 and

C1 − C0 r 2 C0 r 1 − C1
α2 = C0 − α1 = C0 − =
r1 − r2 r1 − r2

Tong-Viet (UKZN) MATH236 Semester 1, 2013 12 / 28


Solving linear recurrence relations

Proof of Theorem 1

The expressions for αi , i = 1, 2, depend on the fact that r1 6= r2 .


Hence, with these values for αi , i = 1, 2, the sequence {an } with
α1 r1n + α2 r2n satisfies the two initial conditions
We know that {an } and {α1 r1n + α2 r2n } are both solutions of the
recurrence relation an = c1 an−1 + c2 an−2 and both satisfy the initial
conditions when n = 0 and n = 1.
Because there is a unique solution of a linear homogeneous recurrence
relation of degree two wight wo initial conditions, it follows that the
two solutions are the same.
So a solution of the linear homogeneous recurrence relation with
constant coefficients of degree two must be of the form
an = α1 r1n + α2 r2n where α1 and α2 are constant.

Tong-Viet (UKZN) MATH236 Semester 1, 2013 13 / 28


Solving linear recurrence relations

Example

Example
Find the explicit formula for the Fibonacci sequence

Proof.
Recall the the sequence of Fibonacci numbers satisfies the recurrence
relation fn = fn−1 + fn−2 with initial conditions f0 = 0 and f1 = 1.
The roots √
of the characteristic equation
√ r 2 − r − 1 = 0 are
r1 = (1 + 5)/2 and r2 = (1 − 5)/2
Theorem, the Fibonacci numbers are given by
√ √
fn = α1 (1 + 5)/2)n + α2 (1 − 5)/2)n ,

for some constants α1 and α2 .

Tong-Viet (UKZN) MATH236 Semester 1, 2013 14 / 28


Solving linear recurrence relations

Example

Proof.
We have f0 = α1 √+ α2 = 0 and √
f1 = 1 = α1 (1 + 5)/2) + α2 (1 − 5)/2)
√ √
Solving these equations, we have α1 = 1/ 5 and α2 = −1/ 5
So the Fibonacci numbers are given by
√ √
1 1+ 5 n 1 1+ 5 n
fn = √ ( ) −√ ( )
5 2 5 2

Tong-Viet (UKZN) MATH236 Semester 1, 2013 15 / 28


Solving linear recurrence relations

Solving linear homogeneous recurrence relation

Theorem (Theorem 2)
Let c1 and c2 be real numbers with c2 6= 0. Suppose that
r 2 − c1 r − c2 = 0 has only one root r0 . A sequence {an } is a solution of
the recurrence relation an = c1 an−1 + c2 an−2 if and only if
an = α1 r0n + α2 nr0n for n = 0, 1, · · · , where αi , i = 1, 2 are constants.

Tong-Viet (UKZN) MATH236 Semester 1, 2013 16 / 28


Solving linear recurrence relations

Example

Example
What is the solution of the recurrence relation

an = 6an−1 − 9an−2

with initial conditions a0 = 1 and a1 = 6?

Tong-Viet (UKZN) MATH236 Semester 1, 2013 17 / 28


Solving linear recurrence relations

Example
Proof.
The only root of r 2 − 6r + 9 = 0 is r0 = 3.
Hence, the solution to this recurrence relation is

an = α1 3n + α2 · n · 3n

for some constants α1 and α2 .


Using the initial conditions, we have a0 = 1 = α1 and
a1 = 6 = 3α1 + 3α2
Solving these equations, we have α1 = α2 = 1.
The solutions to this recurrence relation and the initial conditions is

an = 3n + n · 3n

Tong-Viet (UKZN) MATH236 Semester 1, 2013 18 / 28


Solving linear recurrence relations

Linear non-homogeneous recurrence relations

A recurrence relation of the form

an = c1 an−1 + c2 an−2 + · · · + ck an−k + F (n)

where c1 , c2 , · · · , ck are real numbers and F (n) is a function not


identically zero depending only on n is called the linear
non-homogeneous recurrence relation with constant coefficients
The recurrence relation an = c1 an−1 + c2 an−2 + · · · + ck an−k is called
the associated homogeneous recurrence relation.
This recurrence relation plays an important role in the solution of the
non-homogeneous recurrence relation.

Tong-Viet (UKZN) MATH236 Semester 1, 2013 19 / 28


Solving linear recurrence relations

Linear non-homogeneous recurrence relations

Theorem (Theorem 3)
(p)
If {an } is a particular solution of the nonhomogeneous linear recurrence
relation with constant coefficients

an = c1 an−1 + c2 an−2 + · · · + ck an−k + F (n),


(p) (h) (h)
then every solution is of the form {an + an }, where {an } is a solution
of the associated homogeneous recurrence relation

an = c1 an−1 + c2 an−2 + · · · + ck an−k

Tong-Viet (UKZN) MATH236 Semester 1, 2013 20 / 28


Solving linear recurrence relations

Linear non-homogeneous recurrence relations

Proof.
(p)
Because {an } is a particular solution of the nonhomogeneous linear
recurrence relation, we know that
(p) (p) (p) (p)
an = c1 an−1 + c2 an−2 + · · · + ck an−k + F (n).

Suppose that {bn } is a second solution of the non homogeneous


recurrence relation, so that

bn = c1 bn−1 + c2 bn−2 + · · · + ck bn−k + F (n).

Tong-Viet (UKZN) MATH236 Semester 1, 2013 21 / 28


Solving linear recurrence relations

Linear non-homogeneous recurrence relations

Proof.
Subtracting the first of these two equations from the second shows
that
(p) (p) (p) (p)
bn − an = c1 (bn−1 − an−1 ) + c2 (bn−2 − an−2 ) + · · · + ck (bn−k − an−k ).

(p)
It follows that {bn − an } is a solution of the associated
(h)
homogeneous linear recurrence, say, {an }.
(p) (h)
Thus bn = an + an .

Tong-Viet (UKZN) MATH236 Semester 1, 2013 22 / 28


Solving linear recurrence relations

Example

Example
Find all solutions of the recurrence relation an = 3an−1 + 2n with a1 = 3.

The associated linear homogeneous equation is an = 3an−1 .


(h)
So its solutions are an = α · 3n for some constant α
We now find a particular solution.
As F (n) = 2n is a polynomial in n of degree one, a reasonable trial
solution is a linear function in n, say pn = cn + d for some constants
c and d
Suppose pn = cn + d is a solution. Then an = 3an−1 + 2n becomes
cn + d = 3(c(n − 1) + d) + 2n.
Simply and combine like terms, we have (2 + 2c)n + (2d − 3c) = 0.

Tong-Viet (UKZN) MATH236 Semester 1, 2013 23 / 28


Solving linear recurrence relations

Example

It follows that cn + d is a solution if and only if 2 + 2c = 0 and


2d − 3c = 0
So c = −1 and d = −3/2
(p)
Consequently, an = −n − 3/2 is a particular solution
By Theorem 3, all solutions are of the form

(p) (h) 3
an = an + an = −n − + α · 3n
2
where α is a constant
To find a solution with a1 = 3, let n = 1 in the formula we obtained
for the general solution
We find that 3 = −1 − 3/2 + 3α

Tong-Viet (UKZN) MATH236 Semester 1, 2013 24 / 28


Solving linear recurrence relations

Example

11
So α = 6 and
the solution is
3
an = −n − + α · 3n .
2

Tong-Viet (UKZN) MATH236 Semester 1, 2013 25 / 28


Solving linear recurrence relations

Example

Example
Find all solutions of the recurrence relation an = 5an−1 − 6an−2 + 7n .

The associated linear homogeneous equation is an = 5an−1 − 6an−2 .


(h)
So its solutions are an = α1 · 3n + α2 · 2n for some constant α1 , α2
We now find a particular solution.
(p)
As F (n) = 7n , a reasonable trial solution is an = C · 7n , where C is
a constant
Substituting into the recurrence relation, we have C = 49/20
So all solutions are

an = α1 · 3n + α2 · 2n + (49/20)7n .

Tong-Viet (UKZN) MATH236 Semester 1, 2013 26 / 28


Solving linear recurrence relations

Finding particular solutions

Theorem
Suppose that {an } satisfies the linear nonhomogeneous recurrence relation

an = c1 an−1 + c2 an−2 + · · · + ck an−k + F (n)

where c1 , c2 , · · · , ck are real numbers, and

F (n) = (bt nt + bt−1 nt−1 + · · · + b1 n + b0 )s n ,

where b0 , b1 , · · · , bt and s are real numbers. Then

Tong-Viet (UKZN) MATH236 Semester 1, 2013 27 / 28


Solving linear recurrence relations

Finding particular solutions

Theorem (Cont.)
1 If s is not a root of the characteristic equation of the associated linear
homogeneous recurrence relation, then there is a particular solution of
the form
(pt nt + pt−1 nt−1 + · · · + p1 n + p0 )s n
2 If s is a root of the characteristic equation of the associated linear
homogeneous recurrence relation and its multiplicity is m, then there
is a particular solution of the form

nm (pt nt + pt−1 nt−1 + · · · + p1 n + p0 )s n

Tong-Viet (UKZN) MATH236 Semester 1, 2013 28 / 28

You might also like