You are on page 1of 18

Recurrence relation

Ayele B

23/02/11

Ayele B Recurrence relation


1 Recurrence formula and Types of recurrence relation.
2 Elementary solution techniques (Homogeneous and
Non-homogeneous) Using
1 Using characterstics equaion.
2 Generating function.

Ayele B Recurrence relation


2.1 Recurrence formula and Type

Definition: A recurrence relation for the sequence {an } is an


equation that expresses an in-terms of one or more of the previous
terms of the sequence a0 , a1 , a2 , ..., an−1 ∀n ∈ Z with n ≥ n0 where
n0 ∈ Z +
A sequence is the solution of the recurrence relation if its terms
satisfy the recurrence relation.

Example:Let {an } be a sequence that satisfy the recurrence


relation an = an−1 − an−2 for n = 2, 3, 4, ... and suppose that
a0 = 3 and a1 = 5. what are the values of a2 and a3 ?

Ayele B Recurrence relation


2

Modeling with recurrence relations

Example: Suppose a person deposits 10, 000 birr in a saving


account at a bank yielding 7 present per year with interest
compounded annually how much will be in the account after 10
years?
Example: A young pair of rabbits (one of each sex) is placed on
an island. A pair of rabbits does not bread until they are 2 months
old. After they are 2 months old each pair of rabbits produces
another pair each month. Find the recurrence relation for the
number of pair of rabbits on the island after n-months. Assuming
that no rabbits ever die.
Example: A computer system considers a string of decimal digits
a valid codeword if it contains an even number of 0 as digits. Find
the formula for a valid n-digit codwords?

Ayele B Recurrence relation


Example: Find a recurrence relation for Cn the number of ways to
parenthesize the product of n + 1 numbers x0 , x1 , x2 , ..., xn to
specify the order of multiplication.
Example: (The Tower of Hanoi) A puzzel consists of 3 pegs
mounted on a board together with disks of different size. Initially
these disks are plased on the 1st peg in order of size, with the
lagest in the bottom. The rule of the puzzle allow disks to be
moved one at a time from one peg to another as long as a disk is
never placed on the top of the smaller disk the goal of the puzzle is
to have all the disks on the 2nd peg in order of size with the largest
in the bottom. Find the recurrence relation for the sequence {Hn }.
Hn = 2Hn−1 + 1 or 2n − 1

Ayele B Recurrence relation


Ayele B Recurrence relation
3
Defination: A linear k-order recurrence relation with constant
coefficients is a recurrence relation of the form
an = c1 an−1 + c2 an−2 + ... + ck an−k + f (n) with C1 , C2 , C3 , ..., Ck
are constants where Ck 6= 0 and f (n) is a function of n.
Note:
Linear:-there are no power or product of aj0 s
Constant coefficient:-C1 , C2 , C3 , ..., Ck doesn’t depends on n.
if f (n) = 0 the recurrence relation is homogeneous otherwise
non-homogeneous
Example:
recurrence relation Order Homoginity Linearity Coefficient

an = 5an−1 − 4an−2 + n2
an = 2an−1 an−2 + n
an = an−1 + 2(an−2 )2
an = nan−1
an = 2an−1 + 5an−2 − 6an−3
Ayele B Recurrence relation
2.2 Elementary solution techniques
A sequence: is the solution of the recurrence relation if its terms
satisfy the recurrence relation
Example:Determine whether the sequence {an } is a solution of the
recurrence relation an = 2an−1 − an−2 for n = 2, 3, 4, ...∀n ∈ Z +
a an = 3n
b an = 2n
c an = 5
1. Using Characterstics equation
A. Solutions of Linear homogeneous recurrence relation with
constant coefficient
we are looking solution of the form an = r n
Linear homogeneous recurrence relation with constant coefficient is
given by
an = c1 an−1 + c2 an−2 + ... + ck an−k .......(1)
= r n = C1 r n−1 + C2 r n−2 + ... + Ck r n−k (divide both sides by r n−k )
r k − C1 r k−1 − C2 r k−2 − ... − Ck−1 r − Ck = 0.......(2)
Ayele B Recurrence relation
5

equation (2) is called the Characteristics equation of the


recurrence relation in equation (1).
the solution of the characteristics equation is called
Characteristics root of the recurrence relation
Theorem : Let C1 ,C2 ,..., Ck be real numbers, suppose that the
characteristics equation r k − C1 r k−1 − C2 r k−2 − ... − Ck = 0 has
t-distinct roots r1 ,r2 ,...,rt with multiplicity m1 + m2 + ... + mt = k.
Then the sequence {an } is a solution of the recurrence relation
an = C1 an−1 + C2 an−2 + ... + Ck an−k if and only if
an = (α1,0 + α1,1 n + ... + α1,m1 −1 nm1 −1 )r1n +
(α2,0 + α2,1 n + ... + α2,m2 −1 nm2 −1 )r2n +
...
(αt,0 + αt,1 n + ... + αt,mt −1 nmt −1 )rtn for n = 0, 1, 2, ... where αi.j
are constants for 1 ≤ i ≤ t and 0 ≤ j ≤ mi − 1
Example:suppose the characteristics roots of the recurrence
relation are 2, 2, 2, 5, 5, 9 what is the form of the general solution
Ayele B Recurrence relation
6

Example:What is the solutions of the recurrence relation


a an = −2an−1 with initial condition a0 = 3
b an = an−1 + 2an−2 with Initial Condition a0 = 2, a1 = 7
c an = 6an−1 − 9an−2 with the initial condition a0 = 1 and a1 = 6
d an + 2an−1 + 2an−2 = 0
Example:Find the closed form of an = −3an−1 − 3an−2 − an−3 with
the initial condition a0 = 1,a1 = −2 and a2 = 1
Exercise:Find the closed form of
a an = 2an−1 + 3an−2 with initial conditions a0 = 1, a1 = 3
b an = 11an−1 − 39an−2 + 45an−3 with initial conditions
a0 = 1, a1 = 3, a2 = 5
c an + an−1 + an−2 = 0 with initial conditions a0 = 1, a1 = 4

Ayele B Recurrence relation


7

B. Solutions of non-homogeneous recurrence relation


Definition:A linear non-homogeneous recurrence relation with
constant coefficients is of the form
an = C1 an−1 + C2 an−2 + ... + Ck an−k + f (n), where
f (n) 6= 0.........(1) with C1 ,C2 ,..., Ck be real numbers
an = C1 an−1 + C2 an−2 + ... + Ck an−k is the associated
homogeneous recurrence relation of equation (1)
Example:
Non-homogeneous RR Associated homogeneous RR
an = an−1 + 2n an = an−1
2
an = an−1 − 2an−2 + n + n + 1 an = an−1 − 2an−2
an = an−1 + n! an = an−1

Ayele B Recurrence relation


8

Theorem 5: Suppose that {an } satisfies the linear


non-homogeneous recurrence relation
an = C1 an−1 + C2 an−2 + ... + Ck an−k + f (n) and
f (n) = (br nr + br −1 nr −1 + ... + b1 n + b0 )s n where b0 ,b1 ,...,br and
s∈R
when s is not the root of the characteristics equation of the
associated homogeneous recurrence relation then the
particular solution is (pr nr + pr −1 nr −1 + ... + p1 n + p0 )s n
when s is the root of the characteristics equation of the
associated homogeneous recurrence relation with multiplicity
m, then the particular solution is
nm (pr nr + pr −1 nr −1 + ... + p1 n + p0 )s n

Ayele B Recurrence relation


9

Example: What is the particular solution form for


an = 6an−1 − 9an−2 + f (n)
a f (n) = 3n
b f (n) = n3n
c f (n) = n2 2n
d f (n) = (n2 + 1)3n

(p)
Theorem 6: If {an } is a particular solution of the
non-homogeneous linear recurrence relation with constant
coefficients
an = C1 an−1 + C2 an−2 + ... + Ck an−k + f (n) then the solution of
(h) (p) (p) (h)
the form {an + an } where an -the particular solution and an -
solutions of the associated homogeneous recurrence relation.

Ayele B Recurrence relation


10

Example:Find the solutions of the recurrence relation


a an = 3an−1 + 2n with a1 = 3
b an = 5an−1 − 6an−2 + 7n

Example:Let an be the sum of the first n-positive integers, so that


an = nk=1 which is the same as an = an−1 + n
P

Exercise: find the solution of


a an = 2an−1 + 2n with initial condition a0 = 2
b an = 6an−1 − 12an−2 − 8an−3 + n(−2)n

Ayele B Recurrence relation


11

B. Using Generation function


Definition: Let S = {a0 , a1 , a2 , ...} be an infinite sequence of real
numbers, thenP the generating function G (x) of S is the power
series G (x) = ∞ k
k=0 ak x .
Example:
S = {1, 1, 1, ...} → ∞ k 1
P
k=0 x = 1−x
S = {0, 1, 2, ...} → ∞ kx k
P
P3 k=0
S = {1, 1, 1} → k=0 x k = 1 + x + x 2
generating function F (x) = ∞ k
P
For two P k=0 ak x and
∞ k
G (x) = k=0 bk x
The sum is F (x) + G (x) = ∞ (a + bk )x k
P
P∞k=0 Pkk
The product F (x).G (x) = k=0 ( j=0 aj bk−j x k )x k

Ayele B Recurrence relation


12
For solving Recurrence relation: We use the following
generatingPfunction
if G (x) = ∞ Pa∞k x
k=0
k

then xG (x)P= k=0 ak x k+1P= ∞ k


P
k=1 ak−1 x and
2 ∞ k+2 ∞ k
x G (x) = k=0 ak x = k=2 ak−2 x
Example: Solve the following recurrence relation using Generating
function
1 an = an−1 + n with initial condition a0 = 0
2 an − 6an−1 + 9an−2 = 0 with initial condition a0 = 1 and
a1 = 9
Exercise: Solve the following recurrence relation using Generating
function
1 an = 3an−2 + 1 with initial condition a0 = a1 = 1
2 an − 3an−1 = n2 with initial condition a0 = 1
3 fn = fn−1 + fn−2 with initial condition f0 = 1 and f1 = 1
Ayele B Recurrence relation
13

The rational zeros theorem: If p(x) is a polynomial with integer


coefficents and if pq is a zero of p(x)(i.ep( pq ) = 0) then p - is a
factor of the constant term of p(x) and q - is a factor of the
leading coefficent of p(x)
Example: 2x 4 + x 3 − 19x 2 − 9x + 9
Solution:
1. Factor the constant term p = ±1, ±3, ±9
2. Factor the leadding coefficent q = ±1, ±2
3. qp = ± 11 , ± 21 , ± 31 , ± 23 , ± 91 , ± 29
Synthetic division of polynomial:
Step1: Arrange the coefficent (if the term is missed then use 0 as
coefficent.
Step2: Bring the leading coefficent(first number) straight down.

Ayele B Recurrence relation


14

Step3: Multiply the number a from (x − a) in the division box with


the number you brought down and put the result in the next
column.
Step4: Add the two numbers together and wright the result in the
box of the row.
Step5: Repeat step 3 and 4 until you reach the end of the problem.
Example: Use synthetic division to divide 2x 3 − 5x 2 + 3x + 7 by
x − 2?
2 2 -5 3 7
4 -2 2
2 -1 1 9

9
2x 2 − x + 1 + x−2

Ayele B Recurrence relation

You might also like