Recurrence relations

A recurrence relation for the sequence a_{0} , a_{1} ,
is an equation that relates an to certain
of its predecessors a_{0},a_{1}, …, a_{n-1 }.

e.g. Fibonacci sequence :

f_{n} = f_{n-1 }+ f_{n-2
}for n ³
3

with initial condition : f_{1 }= 1 , f_{2} = 2

Example 1 : Tower of Hanoi :

The Tower of Hanoi is a puzzle consisting of three pegs mounted on a board and n disks of various sizes with holes in their centers. It is assumed that if a disk is on a peg, only a disk of smaller diameter can be placed on top of the first disk. Given all the disks stacked on one peg , the problem is to transfer the disks to another peg by moving one disk at a time.

Let C_{n} be the number of disk movements needed to solve the n-disk
Tower of Hanoi problem, then

C_{n} = 2 C _{n-1} + 1
for n > 1 with initial condition :
C_{1 }= 1

Example 2: Ackermann's Function :

A(m,0) = A(m-1,1) m = 1,2,…….

A(m,n) = A(m-1 , A(m,n-1) ) m = 1,2,……. and n = 1,2,……

With the initial conditions :

A(0,n ) = n + 1 , n = 0, 1, …….

Ackermann's function is a fast growing function.

Solving Recurrence relations

- Iteration method :
- find the roots for the resulting characteristic equation :
- then the general solution to the recurrence relation eq.1 is of the form

To solve a recurrence relation involving a_{0} , a_{1 }….
by iteration , one uses the recurrence relation to replace the nth a_{n} in terms of
certain of its

predecessors a _{n-1}, … a_{0}. Then successively use the recurrence
relation to replace each of a _{n-1}, … by certain of their predecessors. Continue in
this fashion until an explicit formula is obtained.

Example 5.2.1

Solve a_{n }= a _{n-1} + 3 subject to the initial
condition a_{1} = 2.

a_{n }= a _{n-1} + 3 = a _{n-2} + 3 + 3 = a_{n }
= a _{n-3} + 3 + 3 + 3 = a _{n-3} + 3*3

= ………

= a _{n-(n-1)} + 3*(n-1) = 2 + 3*(n-1) = 3*n -1

Example 5.2.4 :

Solve c_{n} = 2 c _{n-1} + 1
with initial condition c_{1} = 1 .

c_{n} = 2 c _{n-1} + 1 = 2 *(2 c _{n-2} + 1) + 1
= 2 ^{2 } c _{n-2} + 2 + 1

= 2 ^{2 } (2 c _{n-3} + 1) + 2 + 1 = 2 ^{3 } c _{n-3} +
2 ^{2} + 2 + 1

= ……. = 2 ^{k }c _{n-k} + 2 ^{k-1} + ….. + 2 + 1

= 2 ^{n-1}c _{n-(n-1)} + 2 ^{n-2} + …. + 2 + 1

= 2 ^{n-1 } + 2 ^{n-2} + …. + 2 + 1 = 2 ^{n} - 1

Definition :

A linear homogeneous recurrence relation of order k with constant coefficients is a recurrence relation of the form :

a_{n} = c_{1}a _{n-1} + c_{2} a _{n-2}
+ …. + c_{k} a _{n-k} with c_{k}
¹
0 --- eq.1

A linear homogeneous recurrence relation of order k with constant coefficients, together with the k initial conditions

a_{0} = C_{0} , a_{1} = C_{1}, ….., a _{k-1} = C
_{k-1}

uniquely defines a sequence a_{0}, a_{1}, …….

To solve :

1. substitute each a_{k} by t^{k} into the recurrence relation :

a_{n} = c_{1}a
_{n-1} + c_{2} a _{n-2} + …. + c_{k} a _{n-k}

t^{n} = c_{1}t ^{n-1} + c_{2} t ^{n-2} + …. + c_{k} t ^{n-k}

(t^{k} - c_{1}t ^{k-1} - c_{2} t ^{k-2}
-…. - c_{k} )t ^{n-k }
= 0 **eq. 2**

r_{1 }, r_{2 }, ….. , r_{k } are the *k* distinct non-trivial roots

a_{n} = b_{1}(r_{1})^{n} + b_{2}(r_{
2})^{n} + … + b_{k}(r_{k})^{n}

where b_{j} can be determined by solving the k linear equations derived from the k
initial conditions:

a_{0} = C_{0} è
C_{0} = b_{1}(r_{1})^{0} + b_{2}(r_{2})^{0
} + … + b_{k}(r_{k})^{0 }= b_{1} + b_{2}+ … + b_{
k}

a_{1} = C_{1} è
C_{1 }= b_{1}(r_{1})^{1} + b_{2}(r_{2})^{
1} + … + b_{k}(r_{k})^{1} = b_{1}r_{1}+ b_{2
}r_{2} + … + b_{k}r_{k}

… … … ….

a _{k-1} = C _{k-1 è
} C_{k-1 }= b_{1}(r_{1})^{k-1} + b_{2}(r_{2
})^{k-1} + … + b_{k}(r_{k})^{k-1}

Special cases : when k = 2 , eq.2 reduces to a quadratic equation :

t^{2} - c_{1}t - c_{2} = 0

and always can be solved using the quadratic formula :

r = ( c_{1} ±
( (c_{1})^{2} - 4 c_{2}) ^{1/2} )/2

Then

a_{n} = A(r_{1})^{n} + B(r_{2})^{n}
if r_{1} ¹
r_{2}

and a_{n} = A(r)^{n} + Bn(r)^{n}
if r_{1} = r_{2} = r