You are on page 1of 27

CSM 166: Discrete Mathematics

for Computer Science


FINITE DIFFERENCE EQUATIONS - RECURRENCE RELATIONS

Isaac Afari Addo <addoisaacafari@gmail.com>


National Institute for Mathematical Science (NIMS) - Ghana
Department of Mathematics, KNUST
Kumasi-Ghana.

09/07/2021
Content

Introduction

Classification of Recurrence Relations

CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021
Introduction

Definition 1 (Recurrence relation)


A recurrence relation for a sequence a0 , a1 , , . . . is a
relation that defines an in terms of a0 , a1 , , . . . an−1 .

The formula relating an to earlier values in the


sequence is called the generating rule.

The assignment of a value to one of the a’s is


called an initial condition.

CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021
Introduction

Example 1
The Fibonacci Sequence 1, 1, 2, 3, 5, . . . is a
sequence in which every number after the first
two is the sum of the preceding two numbers.

The initial conditions are a0 = a1 = 1 and the


generating rule is

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

CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021
Solution to a Recurrence Relation
A solution to a recurrence relation is an explicit
formula for an in terms of n .

The fundamental method for finding the


solution of a sequence defined recursively is by
using iteration.

This involves starting with the initial values of


the sequence and then calculates successive
terms of the sequence until a pattern is observed.

An explicit formula for the sequence and then


uses mathematical induction to prove its validity.
CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021
Solution to a Recurrence Relation

Example 2
Find a solution for the recurrence relation
(
a0 = 1
an = an−1 + 2, n≥1

CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021
Solution to Example 2
Listing out some terms of the sequence:

a0 = 1
a1 = 1 + 2
a2 = 1 + 4
a3 = 1 + 6
a4 = 1 + 8
a1 = 1 + 10

A guessed formular is an = 2n + 1 , n ≥ 0 and thus


needs to be proven using mathematical
induction.
CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021
Solution to a Recurrence Relation

Example 3
Consider the arithmetic sequence

an = an−1 + d, n≥1

where a0 is the initial value. Find an explicit


formula for an .

CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021
Solution to Example 3
Listing out the first 4 terms of the sequence:

a1 = a0 + d
a2 = a0 + 2d
a3 = a0 + 3d
a4 = a0 + 4d
a5 = a0 + 5d

A guessed formular is an = a0 + nd and thus

needs to be proven using mathematical


induction.
CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021
Solution to a Recurrence Relation
Exercise A:
1. Consider the geometric sequence

an = ran−1 , n≥1

Where a0 is the initial value. Find an explicit


formula for an .
2. Find a solution to the recurrence relation
(
a0 = 0
an = an−1 + (n + 1), n≥1

CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021
Exercise B: A function yn is defined recursively
as follows:

y1 = 3

y2 = 7

yn = 3yn−1 − 2yn−2 forn ≥ 3

Find an explicit formula or solution for yn in


terms of n.

CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021
Classification of Recurrence
Relations
A recurrence relation is of first order if yn is
defined only in terms of yn−1 .

It is of second order if yn is defined in terms of


yn−1 and yn−2 , and so on.

A recurrence relation of the form


yn = a1 yn−1 + a2 yn−2 + · · · + ak yn−k is called a linear
homogenous recurrence relation of order k

If the ai are constants, then the above equation is


said to have constant coefficients.
CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021
Classification of Recurrence
Relations

Linear recurrence relations have the following


important properties:

1. multiplying any solution by a constant gives


another solution,

2. adding two or more solutions give another


solution.

CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021
First-Order Recurrence Relations

First-order recurrence relations are of the form:


(
yn = ayn−1
y0 = c

where a and c are constants.

CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021
First-order recurrence relations are solved by
iteration:

yn = ayn−1
= a(ayn−2 )
= a2 (ayn−3 )
= ......
= an−1 y1
= a n y0

Using the initial condition, we have yn = can ,


n ∈ Z+

CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021
Second-Order Recurrence
Relations
Second-order recurrence relations are of the
form:

y = ayn−1 + byn−2 for n ≥ 2
 n


y 0 = c1 (1)


y 0 = c0

Assuming a, b, c0 and c1 are constants and a trial


function yn = ct n to solve the relation above.

Using this assumption, yn−1 = ct n−1 and


yn−2 = ct n−2
CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021
Second-Order Recurrence
Relations

Subtituting these into the recurrence relation (2:

ct n = act n−1 + bct n−2

Dividing through by ct n−2 :

t 2 = at + b ⇒ t 2 − at − b = 0 (2)
(2) is called the auxiliary or characteristic

equation of the recurrence relation.

CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021
Roots of the Characteristic
Equation

The characteristic equation is a quadratic


equation whose roots may be:

I two distinct real roots t = t1 and t = t2

II repeated real roots t = t0

III two complex roots t = t1 and t2 = t1

CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021
Solution to the Recurrence
Relation

CASE I
Since yn = t1n and yn = t2n are solutions of the
linear recurrence relation then another solution
(the general solution) is

yn = At1n + Bt2n (3)

where A and B are arbitrary constants.

A and B are determined using the initial values


y0 = c0 and y1 = c1 .
CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021
Solution to the Recurrence
Relation
CASE II
Since t = t0 is the repeated root of the
characteristic equation, yn = t0n is a solution of
the recurrence relation as well as the linearly
independent solution yn = nt0n .

Thus a general solution:


yn = At n + Bnt n (4)
where A and B are arbitrary constants.

A and B are determined using the initial values


y0 = c0 and y1 = c1 .
CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021
Solution to the Recurrence
Relation I

CASE III
The complex roots of the auxiliary equation with
real coefficients occur in conjugate pair. i.e if
t1 = u + iv then t2 = u − iv with v 6= 0

By the general rule, the solution

yn = At1n + Bt2n
= A(u + iv)n + B(u − iv)n (5)

CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021
Solution to the Recurrence
Relation II
In polar form

u + iv = r(cos θ + i sin θ)
u + iv = r(cos θ − i sin θ)

And by DeMoivre’s Theorem

[ρ(cos θ ± i sin θ]n = ρ n (cos nθ ± i sin nθ)

Thus

yn = Aρ n (cos nθ + i sin nθ) + Bρ n (cos nθ − i sin nθ)


= (A + B)ρ 2 (cos nθ) + i(A − B)ρ 2 sin nθ
CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021
Solution to the Recurrence
Relation III

If we substitute A = B = 12 , then yn = ρ n cos nθ is a


particular solution.

Similarly taking A = − 12 i and B = 12 i, then


yn = ρ n sin nθ is also a particular solution.
Thus the general solution is

yn = Aρ n sin nθ + Bρ n cos nθ (6)


p
where ρ = u2 + v2 and θ = tan−1 21 .

CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021
Example 4
Solve the following

yn = 3yn−1 − 2yn−2 for n ≥ 2

iy2 = 7

y1 = 3


yn = 6yn−1 − 9yn−2 for n ≥ 1

ii y1 = 3

y0 = 5

iii yn + 2yn−1 + 2yn−2 = 0


Solution:

CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021
The Characteristic equation is t 2 − 6t + 2 = 0

CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021
Exercise C: Solve the following difference
equations:
1. yn+1 − ayn = 0, y0 = 1
2. yn = −3yn−1
3. yn+2 + 2yn = 0
4. yn − 2yn−1 + 2yn−2 = 0
5. yn + 4yn−1 + 8yn−2 = 0; y1 = −1
6. yn − 4yn−1 + 8yn−2 = 0; y2 = 1, y3 = −2
7. yn+2 + 2yn+1 + 4yn = 0

CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021
End of Lecture

Questions...???

Thanks

CSM 166: Discrete Mathematics for Computer Science Chapter 4: Difference Equation-Recurrence Relation, 09/07/2021

You might also like