Logic Lecture Slides

Download as pdf or txt
Download as pdf or txt
You are on page 1of 35

Logic and Discrete Mathematics

Section 6.7
Recurrence Relations and Their Solution

Slides version: January 2015


Definition

A recurrence relation for a sequence a0 , a1 , a2 , . . . is a formula


giving an in terms of one or more of the terms preceding it (i.e
in terms of a0 , a1 , a2 , . . . , an−1 ), for any n greater than some
initial integer k .

The values of the first few terms of the sequence needed to


start computing with the recurrence relation are called the initial
conditions.
The Fibonacci sequence

Let F0 = 1, F1 = 1, F2 = 2, F3 = 3, F4 = 5, etc.
The Fibonacci sequence

Let F0 = 1, F1 = 1, F2 = 2, F3 = 3, F4 = 5, etc.
We find that
Fn = Fn−1 + Fn−2
for all n ≥ 2.
The necessary initial conditions are F0 = 1, F1 = 1.
The Fibonacci sequence

Let F0 = 1, F1 = 1, F2 = 2, F3 = 3, F4 = 5, etc.
We find that
Fn = Fn−1 + Fn−2
for all n ≥ 2.
The necessary initial conditions are F0 = 1, F1 = 1.

This sequence is known as the Fibonacci sequence and


the terms of the sequence are known as Fibonacci numbers.
The Lucas Numbers

The sequence of Lucas numbers

2, 1, 3, 4, 7, 11, . . .

has the initial conditions L1 = 2 and L2 = 1


and the recursion Ln = Ln−1 + Ln−2 .
The Lucas Numbers

The sequence of Lucas numbers

2, 1, 3, 4, 7, 11, . . .

has the initial conditions L1 = 2 and L2 = 1


and the recursion Ln = Ln−1 + Ln−2 .

Note that this is the same recursion relation as for the


Fibonacci numbers.
The Catalan Numbers

The sequence of Catalan numbers is given recursively by

Cn+1 = C1 Cn + C2 Cn−1 + · · · + Ci Cn+1−i + · · · + Cn C1 ,

with C0 = C1 = 1.
The first eleven terms are

1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796

Cn can also be given non-recursively as follows:


 
(2n)! 1 2n
Cn+1 = = , n = 0, 1, 2, . . . .
(n + 1)!(n!) n+1 n
Significance of The Catalan Numbers (1)
The number of ways to cut an (n + 2)-sided polygon into
triangles by connecting its corners with n − 1 non-intersecting
straight line segments is equal to Cn .

Figure : Dividing the square.

Figure : Dividing the pentagon.


Significance of The Catalan Numbers (2)
The number of complete binary trees with n leaves is equal to
Cn−1 .
One leaf: Two leaves:

Three leaves:

Four leaves:

Figure : Complete binary trees with one, two, three and four leaves
Definitions
Definition
A recurrence relation of the form

an = c 1 (n)an−1 +c 2 (n)an−2 +c 3 (n)an−3 + · · · + c m (n)an−m +f (n)

where c1 , c2 , . . . , cm and f are functions of n, is called a linear


recurrence relation of order m.
Definitions
Definition
A recurrence relation of the form

an = c 1 (n)an−1 +c 2 (n)an−2 +c 3 (n)an−3 + · · · + c m (n)an−m +f (n)

where c1 , c2 , . . . , cm and f are functions of n, is called a linear


recurrence relation of order m.

• The relation is homogeneous if f (n) = 0 for all n


Definitions
Definition
A recurrence relation of the form

an = c 1 (n)an−1 +c 2 (n)an−2 +c 3 (n)an−3 + · · · + c m (n)an−m +f (n)

where c1 , c2 , . . . , cm and f are functions of n, is called a linear


recurrence relation of order m.

• The relation is homogeneous if f (n) = 0 for all n


• The relation has constant coefficients and is of order m
when the ci (n)’s are all constant and cm 6= 0.
Definitions
Definition
A recurrence relation of the form

an = c 1 (n)an−1 +c 2 (n)an−2 +c 3 (n)an−3 + · · · + c m (n)an−m +f (n)

where c1 , c2 , . . . , cm and f are functions of n, is called a linear


recurrence relation of order m.

• The relation is homogeneous if f (n) = 0 for all n


• The relation has constant coefficients and is of order m
when the ci (n)’s are all constant and cm 6= 0.
We consider recurrence relations that have the form

an = c1 an−1 + c2 an−2 + c3 an−3 + · · · + cm an−m , cm 6= 0.


Characteristic Equation and Roots

Definition

x m − c1 x m−1 − c2 x m−2 − · · · − cm = 0
is called the characteristic equation of the recurrence relation

an = c1 an−1 + c2 an−2 + c3 an−3 + · · · + cm an−m , cm 6= 0.


Characteristic Equation and Roots

Definition

x m − c1 x m−1 − c2 x m−2 − · · · − cm = 0
is called the characteristic equation of the recurrence relation

an = c1 an−1 + c2 an−2 + c3 an−3 + · · · + cm an−m , cm 6= 0.

• The characteristic equation has m (not necessarily distinct)


roots, r1 , r2 , r3 , . . . rm , referred to as characteristic roots.
Characteristic Equation and Roots

Definition

x m − c1 x m−1 − c2 x m−2 − · · · − cm = 0
is called the characteristic equation of the recurrence relation

an = c1 an−1 + c2 an−2 + c3 an−3 + · · · + cm an−m , cm 6= 0.

• The characteristic equation has m (not necessarily distinct)


roots, r1 , r2 , r3 , . . . rm , referred to as characteristic roots.
• These roots may be real or complex.
Characteristic Equation and Roots

Definition

x m − c1 x m−1 − c2 x m−2 − · · · − cm = 0
is called the characteristic equation of the recurrence relation

an = c1 an−1 + c2 an−2 + c3 an−3 + · · · + cm an−m , cm 6= 0.

• The characteristic equation has m (not necessarily distinct)


roots, r1 , r2 , r3 , . . . rm , referred to as characteristic roots.
• These roots may be real or complex.
• As cm 6= 0, they are all different from 0.
Theorem: Solutions

Theorem
The sequence an = r n is a solution of the recurrence

an = c1 an−1 + c2 an−2 + c3 an−3 + · · · + cm an−m , cm 6= 0.

if and only if r is a root of the characteristic equation

x m − c1 x m−1 − c2 x m−2 − · · · − cm = 0

Hence, for each characteristic root r , an = r n is a solution.


These are called fundamental solutions.
Operations on Solutions

Let (an ) and (bn ) be sequences.

Addition of the sequences: (an ) + (bn ) is the sequence


(an + bn ),
i.e.

(a1 , a2 , a3 , . . .) + (b1 , b2 , b3 , . . .) = (a1 + b1 , a2 + b2 , a3 + b3 , . . .).


Operations on Solutions

Let (an ) and (bn ) be sequences.

Addition of the sequences: (an ) + (bn ) is the sequence


(an + bn ),
i.e.

(a1 , a2 , a3 , . . .) + (b1 , b2 , b3 , . . .) = (a1 + b1 , a2 + b2 , a3 + b3 , . . .).

A constant multiple, k (an ), of a sequence (an ) is

k (an ) = (ka1 , ka2 , ka3 , . . .).


Theorem: Linear Combinations of Solutions

Theorem
If (an ) and (bn ) satisfy a homogeneous linear recurrence
relation with constant coefficients, then (an ) + (bn ) and k (an )
satisfy the same recurrence relation.
General Solution — Distinct Roots

Theorem
Let the roots r1 , r2 , r3 , . . . , rm of the characteristic equation be
distinct. Then an = k1 r1n + k2 r2n + k3 r3n + · · · km rmn is a general
solution of the homogeneous linear recurrence relation, i.e.
every solution can be expressed in this form for some choice of
constants k1 , k2 , k3 . . . , km .
I.e. the fundamental solutions of a recurrence relation form a
basis of the vector space of solutions of that relation.
Solution Procedure — Distinct Roots

1. Write down the characteristic equation for the relation.


Solution Procedure — Distinct Roots

1. Write down the characteristic equation for the relation.


2. Find the m roots of the characteristic equation. If the roots
are distinct we obtain m fundamental solutions.
Solution Procedure — Distinct Roots

1. Write down the characteristic equation for the relation.


2. Find the m roots of the characteristic equation. If the roots
are distinct we obtain m fundamental solutions.
3. Take an arbitrary linear combination of the fundamental
solutions to obtain a general solution.
Solution Procedure — Distinct Roots

1. Write down the characteristic equation for the relation.


2. Find the m roots of the characteristic equation. If the roots
are distinct we obtain m fundamental solutions.
3. Take an arbitrary linear combination of the fundamental
solutions to obtain a general solution.
4. Using the initial conditions, construct and solve a system of
equations to obtain the specific solution.
Examples: Distinct Roots

Solve the following recurrence relations:


1. an = 5an−1 − 6an−2 for n > 2, and with a1 = 2 and a2 = 10.
Examples: Distinct Roots

Solve the following recurrence relations:


1. an = 5an−1 − 6an−2 for n > 2, and with a1 = 2 and a2 = 10.
2. an = −an−1 + 12an−2 for n > 1, and with a0 = 1 and
a1 = 2.
Examples: Distinct Roots

Solve the following recurrence relations:


1. an = 5an−1 − 6an−2 for n > 2, and with a1 = 2 and a2 = 10.
2. an = −an−1 + 12an−2 for n > 1, and with a0 = 1 and
a1 = 2.
3. an = −4an−1 + 21an−2 for for n > 2, and with a1 = 2 and
a2 = 3.
Complex Roots

Theorem
If the roots of a characteristic equation of a homogeneous
linear recurrence relation of degree two are complex numbers
a + bi and a − bi (i.e. the roots are complex conjugates) then
the general solution of the recurrence relation is given by

an = ρn (k1 cos nθ + k2 sin nθ)


√ a
where ρ = a2 + b2 , cos θ = ρ and sin θ = bρ .
Complex Roots — Examples

Solve the following recurrence relation:



an = 2 2an−1 − 4an−2 for n > 1, with a0 = 1 and a1 = 2.
Multiplicity of Roots

A characteristic root r has multiplicity j if it appears as a root of


the characteristic equation
x m − c1 x m−1 − c2 x m−2 − · · · − cm = 0
exactly j times.
This is equivalent to (x − r )j being a divisor of the polynomial
x m − c1 x m−1 − c2 x m−2 − · · · − cm but (x − r )j+1 not being a
divisor.
Repeated Roots — Fundamental Solutions

If r is a characteristic root of multiplicity j, then


an = r n , an = nr n , an = n2 r n , . . . an = nj−1 r n are linearly
independent and can be taken as fundamental solutions.
Repeated Roots — Example

Solve the recurrence relation given by


an = 6an−1 − 9an−2 with a0 = 1 and a1 = 4.

You might also like