You are on page 1of 35

Recurrence Relations(continued)

Arash Rafiey

September 24, 2015

Arash Rafiey Recurrence Relations(continued)


Repeated Real Roots
Solve the recurrence relation an+2 = 4an+1 − 4an where n ≥ 0 and
a0 = 1, a1 = 3.

Arash Rafiey Recurrence Relations(continued)


Repeated Real Roots
Solve the recurrence relation an+2 = 4an+1 − 4an where n ≥ 0 and
a0 = 1, a1 = 3.
We let an = cr n and hence the characteristic equation is :
r 2 − 4r + 4 = 0 in which both roots are r = 2.

Arash Rafiey Recurrence Relations(continued)


Repeated Real Roots
Solve the recurrence relation an+2 = 4an+1 − 4an where n ≥ 0 and
a0 = 1, a1 = 3.
We let an = cr n and hence the characteristic equation is :
r 2 − 4r + 4 = 0 in which both roots are r = 2.
Now since 2n , 2n are not independent then we should assume
an = g (n)2n where g (n) is not a constant.

Arash Rafiey Recurrence Relations(continued)


Repeated Real Roots
Solve the recurrence relation an+2 = 4an+1 − 4an where n ≥ 0 and
a0 = 1, a1 = 3.
We let an = cr n and hence the characteristic equation is :
r 2 − 4r + 4 = 0 in which both roots are r = 2.
Now since 2n , 2n are not independent then we should assume
an = g (n)2n where g (n) is not a constant.
Thus we have g (n + 2)2n+2 = 4g (n + 1)2n+1 − 4g (n)2n and hence

Arash Rafiey Recurrence Relations(continued)


Repeated Real Roots
Solve the recurrence relation an+2 = 4an+1 − 4an where n ≥ 0 and
a0 = 1, a1 = 3.
We let an = cr n and hence the characteristic equation is :
r 2 − 4r + 4 = 0 in which both roots are r = 2.
Now since 2n , 2n are not independent then we should assume
an = g (n)2n where g (n) is not a constant.
Thus we have g (n + 2)2n+2 = 4g (n + 1)2n+1 − 4g (n)2n and hence
g (n + 2) = 2g (n + 1) − g (n).

Arash Rafiey Recurrence Relations(continued)


Repeated Real Roots
Solve the recurrence relation an+2 = 4an+1 − 4an where n ≥ 0 and
a0 = 1, a1 = 3.
We let an = cr n and hence the characteristic equation is :
r 2 − 4r + 4 = 0 in which both roots are r = 2.
Now since 2n , 2n are not independent then we should assume
an = g (n)2n where g (n) is not a constant.
Thus we have g (n + 2)2n+2 = 4g (n + 1)2n+1 − 4g (n)2n and hence
g (n + 2) = 2g (n + 1) − g (n).
It is clear g (n) = n holds for g (n).

Arash Rafiey Recurrence Relations(continued)


Repeated Real Roots
Solve the recurrence relation an+2 = 4an+1 − 4an where n ≥ 0 and
a0 = 1, a1 = 3.
We let an = cr n and hence the characteristic equation is :
r 2 − 4r + 4 = 0 in which both roots are r = 2.
Now since 2n , 2n are not independent then we should assume
an = g (n)2n where g (n) is not a constant.
Thus we have g (n + 2)2n+2 = 4g (n + 1)2n+1 − 4g (n)2n and hence
g (n + 2) = 2g (n + 1) − g (n).
It is clear g (n) = n holds for g (n).
So another solution would be n2n (note that n2n , 2n are
independent )

Arash Rafiey Recurrence Relations(continued)


Repeated Real Roots
Solve the recurrence relation an+2 = 4an+1 − 4an where n ≥ 0 and
a0 = 1, a1 = 3.
We let an = cr n and hence the characteristic equation is :
r 2 − 4r + 4 = 0 in which both roots are r = 2.
Now since 2n , 2n are not independent then we should assume
an = g (n)2n where g (n) is not a constant.
Thus we have g (n + 2)2n+2 = 4g (n + 1)2n+1 − 4g (n)2n and hence
g (n + 2) = 2g (n + 1) − g (n).
It is clear g (n) = n holds for g (n).
So another solution would be n2n (note that n2n , 2n are
independent )
Then we have an = c1 2n + c2 n2n with a0 = 1, a1 = 3.

Arash Rafiey Recurrence Relations(continued)


Repeated Real Roots
Solve the recurrence relation an+2 = 4an+1 − 4an where n ≥ 0 and
a0 = 1, a1 = 3.
We let an = cr n and hence the characteristic equation is :
r 2 − 4r + 4 = 0 in which both roots are r = 2.
Now since 2n , 2n are not independent then we should assume
an = g (n)2n where g (n) is not a constant.
Thus we have g (n + 2)2n+2 = 4g (n + 1)2n+1 − 4g (n)2n and hence
g (n + 2) = 2g (n + 1) − g (n).
It is clear g (n) = n holds for g (n).
So another solution would be n2n (note that n2n , 2n are
independent )
Then we have an = c1 2n + c2 n2n with a0 = 1, a1 = 3.
After all an = 2n + (1/2)n2n = 2n + n2n−1 .
Arash Rafiey Recurrence Relations(continued)
Definition
In general suppose C0 an + C1 an−1 + C2 an−2 + · · · + Ck an−k = 0
where Ci0 s are constant and C0 6= 0 and Ck 6= 0 and r is the
characteristic root with multiplicity 2 ≤ m ≤ k. Then the part of
the general solution involving root r has the following form :

(A0 + A1 n + A2 n2 + · · · + Am−1 nm−1 )r n


where Ai are arbitrary constant.

Arash Rafiey Recurrence Relations(continued)


Nonhomogeneous Recurrence Relation

Consider the recurrence relations :


(1) an + C1 an−1 = f (n), n ≥ 1.
(2) an + C1 an−1 + C2 an−2 = f (n), n ≥ 2.

Arash Rafiey Recurrence Relations(continued)


Nonhomogeneous Recurrence Relation

Consider the recurrence relations :


(1) an + C1 an−1 = f (n), n ≥ 1.
(2) an + C1 an−1 + C2 an−2 = f (n), n ≥ 2.
There is no general method for solving above recurrence relations.

Arash Rafiey Recurrence Relations(continued)


Nonhomogeneous Recurrence Relation

Consider the recurrence relations :


(1) an + C1 an−1 = f (n), n ≥ 1.
(2) an + C1 an−1 + C2 an−2 = f (n), n ≥ 2.
There is no general method for solving above recurrence relations.
But in some cases there is a way.
Suppose an − an−1 = f (n).

Arash Rafiey Recurrence Relations(continued)


Nonhomogeneous Recurrence Relation

Consider the recurrence relations :


(1) an + C1 an−1 = f (n), n ≥ 1.
(2) an + C1 an−1 + C2 an−2 = f (n), n ≥ 2.
There is no general method for solving above recurrence relations.
But in some cases there is a way.
Suppose an − an−1 = f (n).
Now by replacement we have
a1 = a0 + f (1)
a2 = a1 + f (2)
a3 = a2 + f (3)
.
.
an = an−1 + f (n)

Arash Rafiey Recurrence Relations(continued)


Nonhomogeneous Recurrence Relation

Consider the recurrence relations :


(1) an + C1 an−1 = f (n), n ≥ 1.
(2) an + C1 an−1 + C2 an−2 = f (n), n ≥ 2.
There is no general method for solving above recurrence relations.
But in some cases there is a way.
Suppose an − an−1 = f (n).
Now by replacement we have
a1 = a0 + f (1)
a2 = a1 + f (2)
a3 = a2 + f (3)
.
.
an = an−1 + f (n)
Therefore an = a0 + f (1) + f (2) + · · · + f (n).

Arash Rafiey Recurrence Relations(continued)


Example :
an − an−1 = 3n2 where n ≥ 1 and a0 = 7.

Arash Rafiey Recurrence Relations(continued)


Example :
an − an−1 = 3n2 where n ≥ 1 and a0 = 7.
Pn Pn
an = a0 + i=1 f (i) =7+3 i=1 i
2 = 7 + 12 n(n + 1)(2n + 1).

Arash Rafiey Recurrence Relations(continued)


Example :
an − an−1 = 3n2 where n ≥ 1 and a0 = 7.
Pn Pn
an = a0 + i=1 f (i) =7+3 i=1 i
2 = 7 + 12 n(n + 1)(2n + 1).

What about the following relation ?

an − 3an−1 = 5(7n ), where n ≥ 1 and a0 = 2.

Arash Rafiey Recurrence Relations(continued)


Example :
an − an−1 = 3n2 where n ≥ 1 and a0 = 7.
Pn Pn
an = a0 + i=1 f (i) =7+3 i=1 i
2 = 7 + 12 n(n + 1)(2n + 1).

What about the following relation ?

an − 3an−1 = 5(7n ), where n ≥ 1 and a0 = 2.

an − 3an−1 = 5(3n ), where n ≥ 1 and a0 = 2.

Arash Rafiey Recurrence Relations(continued)


Definition
Consider the nonhomogeneous first-order relation (k constant)

an + C1 an−1 = kr n

When r n is not a solution (C1 6= −r ) for an + C1 an−1 = 0 then


an = A(−C1 )n + B(r n ) for some constants A, B.
When r n is a solution for the recurrence, i.e. (−C1 = r ) then
an = Ar n + Bnr n for some constants A, B.

Arash Rafiey Recurrence Relations(continued)


Example :
an − 3an−1 = 5(7n ), where n ≥ 1 and a0 = 2.

Arash Rafiey Recurrence Relations(continued)


Example :
an − 3an−1 = 5(7n ), where n ≥ 1 and a0 = 2.

The root for associated with an − 3an−1 = 0 is the root of


r − 3 = 0 and 3 6= 5 therefore
an = A(3n ) + B(7n )

Arash Rafiey Recurrence Relations(continued)


Example :
an − 3an−1 = 5(7n ), where n ≥ 1 and a0 = 2.

The root for associated with an − 3an−1 = 0 is the root of


r − 3 = 0 and 3 6= 5 therefore
an = A(3n ) + B(7n )

a0 = 2 and a1 = 6 + 35 = 41 therefore
an = (5/4)(7n+1 ) − (1/4)(3n+1 ).

Arash Rafiey Recurrence Relations(continued)


Example :
an − 3an−1 = 5(7n ), where n ≥ 1 and a0 = 2.

The root for associated with an − 3an−1 = 0 is the root of


r − 3 = 0 and 3 6= 5 therefore
an = A(3n ) + B(7n )

a0 = 2 and a1 = 6 + 35 = 41 therefore
an = (5/4)(7n+1 ) − (1/4)(3n+1 ).

Example :
an − 3an−1 = 5(3n ), where n ≥ 1 and a0 = 2.
The root for associated with an − 3an−1 = 0 is the root of
r − 3 = 0 and 3 = 3 therefore
an = A(3n ) + Bn(3n )

Arash Rafiey Recurrence Relations(continued)


Example :
an − 3an−1 = 5(7n ), where n ≥ 1 and a0 = 2.

The root for associated with an − 3an−1 = 0 is the root of


r − 3 = 0 and 3 6= 5 therefore
an = A(3n ) + B(7n )

a0 = 2 and a1 = 6 + 35 = 41 therefore
an = (5/4)(7n+1 ) − (1/4)(3n+1 ).

Example :
an − 3an−1 = 5(3n ), where n ≥ 1 and a0 = 2.
The root for associated with an − 3an−1 = 0 is the root of
r − 3 = 0 and 3 = 3 therefore
an = A(3n ) + Bn(3n )

a0 = 2, a1 = 18 therefore an = (2 + 5n)3n .

Arash Rafiey Recurrence Relations(continued)


Definition
Consider the nonhomogeneous second-order relation (k constant)

an + C1 an−1 + C2 an−2 = kr n

With homogeneous relation (h) : an + C1 an−1 + C2 an−2 = 0. If


1 r n is not a solution for (h) then an = Ar n + B(r1 )n + C (r2 )n
2 r n is a solution for (h) and (h) has other solution r1n , (r 6= r1 )
then an = (A + Bn)r n + C (r1 )n .
3 the characteristic equation r 2 + C1 r + C2 = 0 has r1 = r2 = r
solution then an = Ar n + Bnr n + Cn2 r n .

Arash Rafiey Recurrence Relations(continued)


Example :
What is the number of binary sequences of length n with no ”100”
?

Arash Rafiey Recurrence Relations(continued)


Example :
What is the number of binary sequences of length n with no ”100”
?
Let an be the number of such sequences.

Arash Rafiey Recurrence Relations(continued)


Example :
What is the number of binary sequences of length n with no ”100”
?
Let an be the number of such sequences.
If the last symbol is 1 then the first n − 1 symbols is a binary
sequences of length n − 1 with no ”100”. Therefore we have an−1
of such sequences.

Arash Rafiey Recurrence Relations(continued)


Example :
What is the number of binary sequences of length n with no ”100”
?
Let an be the number of such sequences.
If the last symbol is 1 then the first n − 1 symbols is a binary
sequences of length n − 1 with no ”100”. Therefore we have an−1
of such sequences.
If the last symbol is 0 and the (n − 1)-th symbol is 1 then the first
n − 2 symbols is a binary sequences of length n − 2 with no ”100”.
Therefore we have an−2 of such sequences.

Arash Rafiey Recurrence Relations(continued)


Example :
What is the number of binary sequences of length n with no ”100”
?
Let an be the number of such sequences.
If the last symbol is 1 then the first n − 1 symbols is a binary
sequences of length n − 1 with no ”100”. Therefore we have an−1
of such sequences.
If the last symbol is 0 and the (n − 1)-th symbol is 1 then the first
n − 2 symbols is a binary sequences of length n − 2 with no ”100”.
Therefore we have an−2 of such sequences.
If the last symbol is 0 and the (n − 1)-th symbol is 0 then all the
previous symbols must be 0 (one such sequence).

Arash Rafiey Recurrence Relations(continued)


Example :
What is the number of binary sequences of length n with no ”100”
?
Let an be the number of such sequences.
If the last symbol is 1 then the first n − 1 symbols is a binary
sequences of length n − 1 with no ”100”. Therefore we have an−1
of such sequences.
If the last symbol is 0 and the (n − 1)-th symbol is 1 then the first
n − 2 symbols is a binary sequences of length n − 2 with no ”100”.
Therefore we have an−2 of such sequences.
If the last symbol is 0 and the (n − 1)-th symbol is 0 then all the
previous symbols must be 0 (one such sequence).
Therefore an = an−1 + an−2 + 1 with a1 = 2 and a2 = 4.

Arash Rafiey Recurrence Relations(continued)


Example :
What is the number of binary sequences of length n with no ”100”
?
Let an be the number of such sequences.
If the last symbol is 1 then the first n − 1 symbols is a binary
sequences of length n − 1 with no ”100”. Therefore we have an−1
of such sequences.
If the last symbol is 0 and the (n − 1)-th symbol is 1 then the first
n − 2 symbols is a binary sequences of length n − 2 with no ”100”.
Therefore we have an−2 of such sequences.
If the last symbol is 0 and the (n − 1)-th symbol is 0 then all the
previous symbols must be 0 (one such sequence).
Therefore an = an−1 + an−2 + 1 with a1 = 2 and a2 = 4.
an = anh + anp where anp = A (constant) and (anh is the homogenous
part) √ √
an = c1 ( 1+2 5 )n + c2 ( 1−2 5 )n + A.

Arash Rafiey Recurrence Relations(continued)


Problem 1. What is the number of binary sequences of length n
with no ”101” ?

Arash Rafiey Recurrence Relations(continued)

You might also like