Upload
others
View
6
Download
0
Embed Size (px)
Citation preview
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 anda0 = 1, a1 = 3.
We let an = crn and hence the characteristic equation is :
r2 − 4r + 4 = 0 in which both roots are r = 2.
Now since 2n, 2n are not independent then we should assumean = 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 areindependent )
Then we have an = c12n + c2n2n with a0 = 1, a1 = 3.
After all an = 2n + (1/2)n2n = 2n + n2n−1.
Arash Rafiey Recurrence Relations(continued)
Repeated Real Roots
Solve the recurrence relation an+2 = 4an+1 − 4an where n ≥ 0 anda0 = 1, a1 = 3.
We let an = crn and hence the characteristic equation is :
r2 − 4r + 4 = 0 in which both roots are r = 2.
Now since 2n, 2n are not independent then we should assumean = 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 areindependent )
Then we have an = c12n + c2n2n with a0 = 1, a1 = 3.
After all an = 2n + (1/2)n2n = 2n + n2n−1.
Arash Rafiey Recurrence Relations(continued)
Repeated Real Roots
Solve the recurrence relation an+2 = 4an+1 − 4an where n ≥ 0 anda0 = 1, a1 = 3.
We let an = crn and hence the characteristic equation is :
r2 − 4r + 4 = 0 in which both roots are r = 2.
Now since 2n, 2n are not independent then we should assumean = 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 areindependent )
Then we have an = c12n + c2n2n with a0 = 1, a1 = 3.
After all an = 2n + (1/2)n2n = 2n + n2n−1.
Arash Rafiey Recurrence Relations(continued)
Repeated Real Roots
Solve the recurrence relation an+2 = 4an+1 − 4an where n ≥ 0 anda0 = 1, a1 = 3.
We let an = crn and hence the characteristic equation is :
r2 − 4r + 4 = 0 in which both roots are r = 2.
Now since 2n, 2n are not independent then we should assumean = 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 areindependent )
Then we have an = c12n + c2n2n with a0 = 1, a1 = 3.
After all an = 2n + (1/2)n2n = 2n + n2n−1.
Arash Rafiey Recurrence Relations(continued)
Repeated Real Roots
Solve the recurrence relation an+2 = 4an+1 − 4an where n ≥ 0 anda0 = 1, a1 = 3.
We let an = crn and hence the characteristic equation is :
r2 − 4r + 4 = 0 in which both roots are r = 2.
Now since 2n, 2n are not independent then we should assumean = 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 areindependent )
Then we have an = c12n + c2n2n with a0 = 1, a1 = 3.
After all an = 2n + (1/2)n2n = 2n + n2n−1.
Arash Rafiey Recurrence Relations(continued)
Repeated Real Roots
Solve the recurrence relation an+2 = 4an+1 − 4an where n ≥ 0 anda0 = 1, a1 = 3.
We let an = crn and hence the characteristic equation is :
r2 − 4r + 4 = 0 in which both roots are r = 2.
Now since 2n, 2n are not independent then we should assumean = 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 areindependent )
Then we have an = c12n + c2n2n with a0 = 1, a1 = 3.
After all an = 2n + (1/2)n2n = 2n + n2n−1.
Arash Rafiey Recurrence Relations(continued)
Repeated Real Roots
Solve the recurrence relation an+2 = 4an+1 − 4an where n ≥ 0 anda0 = 1, a1 = 3.
We let an = crn and hence the characteristic equation is :
r2 − 4r + 4 = 0 in which both roots are r = 2.
Now since 2n, 2n are not independent then we should assumean = 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 areindependent )
Then we have an = c12n + c2n2n with a0 = 1, a1 = 3.
After all an = 2n + (1/2)n2n = 2n + n2n−1.
Arash Rafiey Recurrence Relations(continued)
Repeated Real Roots
Solve the recurrence relation an+2 = 4an+1 − 4an where n ≥ 0 anda0 = 1, a1 = 3.
We let an = crn and hence the characteristic equation is :
r2 − 4r + 4 = 0 in which both roots are r = 2.
Now since 2n, 2n are not independent then we should assumean = 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 areindependent )
Then we have an = c12n + c2n2n with a0 = 1, a1 = 3.
After all an = 2n + (1/2)n2n = 2n + n2n−1.
Arash Rafiey Recurrence Relations(continued)
Repeated Real Roots
Solve the recurrence relation an+2 = 4an+1 − 4an where n ≥ 0 anda0 = 1, a1 = 3.
We let an = crn and hence the characteristic equation is :
r2 − 4r + 4 = 0 in which both roots are r = 2.
Now since 2n, 2n are not independent then we should assumean = 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 areindependent )
Then we have an = c12n + c2n2n with a0 = 1, a1 = 3.
After all an = 2n + (1/2)n2n = 2n + n2n−1.
Arash Rafiey Recurrence Relations(continued)
Definition
In general suppose C0an + C1an−1 + C2an−2 + · · ·+ Ckan−k = 0where C ′
i s are constant and C0 6= 0 and Ck 6= 0 and r is thecharacteristic root with multiplicity 2 ≤ m ≤ k. Then the part ofthe general solution involving root r has the following form :
(A0 + A1n + A2n2 + · · ·+ Am−1n
m−1)rn
where Ai are arbitrary constant.
Arash Rafiey Recurrence Relations(continued)
Nonhomogeneous Recurrence Relation
Consider the recurrence relations :(1) an + C1an−1 = f (n), n ≥ 1.(2) an + C1an−1 + C2an−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 havea1 = 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)
Nonhomogeneous Recurrence Relation
Consider the recurrence relations :(1) an + C1an−1 = f (n), n ≥ 1.(2) an + C1an−1 + C2an−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 havea1 = 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)
Nonhomogeneous Recurrence Relation
Consider the recurrence relations :(1) an + C1an−1 = f (n), n ≥ 1.(2) an + C1an−1 + C2an−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 havea1 = 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)
Nonhomogeneous Recurrence Relation
Consider the recurrence relations :(1) an + C1an−1 = f (n), n ≥ 1.(2) an + C1an−1 + C2an−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 havea1 = 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)
Nonhomogeneous Recurrence Relation
Consider the recurrence relations :(1) an + C1an−1 = f (n), n ≥ 1.(2) an + C1an−1 + C2an−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 havea1 = 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.
an = a0 +∑n
i=1 f (i) = 7 + 3∑n
i=1 i2 = 7 + 12n(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)
Example :an − an−1 = 3n2 where n ≥ 1 and a0 = 7.
an = a0 +∑n
i=1 f (i) = 7 + 3∑n
i=1 i2 = 7 + 12n(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)
Example :an − an−1 = 3n2 where n ≥ 1 and a0 = 7.
an = a0 +∑n
i=1 f (i) = 7 + 3∑n
i=1 i2 = 7 + 12n(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)
Example :an − an−1 = 3n2 where n ≥ 1 and a0 = 7.
an = a0 +∑n
i=1 f (i) = 7 + 3∑n
i=1 i2 = 7 + 12n(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 + C1an−1 = krn
When rn is not a solution (C1 6= −r) for an + C1an−1 = 0 thenan = A(−C1)
n + B(rn) for some constants A,B.When rn is a solution for the recurrence, i.e. (−C1 = r) thenan = Arn + Bnrn for some constants A,B.
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 ofr − 3 = 0 and 3 6= 5 thereforean = A(3n) + B(7n)
a0 = 2 and a1 = 6 + 35 = 41 thereforean = (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 ofr − 3 = 0 and 3 = 3 thereforean = A(3n) + Bn(3n)
a0 = 2, a1 = 18 therefore an = (2 + 5n)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 ofr − 3 = 0 and 3 6= 5 thereforean = A(3n) + B(7n)
a0 = 2 and a1 = 6 + 35 = 41 thereforean = (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 ofr − 3 = 0 and 3 = 3 thereforean = A(3n) + Bn(3n)
a0 = 2, a1 = 18 therefore an = (2 + 5n)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 ofr − 3 = 0 and 3 6= 5 thereforean = A(3n) + B(7n)
a0 = 2 and a1 = 6 + 35 = 41 thereforean = (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 ofr − 3 = 0 and 3 = 3 thereforean = A(3n) + Bn(3n)
a0 = 2, a1 = 18 therefore an = (2 + 5n)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 ofr − 3 = 0 and 3 6= 5 thereforean = A(3n) + B(7n)
a0 = 2 and a1 = 6 + 35 = 41 thereforean = (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 ofr − 3 = 0 and 3 = 3 thereforean = A(3n) + Bn(3n)
a0 = 2, a1 = 18 therefore an = (2 + 5n)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 ofr − 3 = 0 and 3 6= 5 thereforean = A(3n) + B(7n)
a0 = 2 and a1 = 6 + 35 = 41 thereforean = (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 ofr − 3 = 0 and 3 = 3 thereforean = 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 + C1an−1 + C2an−2 = krn
With homogeneous relation (h) : an + C1an−1 + C2an−2 = 0. If
1 rn is not a solution for (h) then an = Arn + B(r1)n + C (r2)
n
2 rn is a solution for (h) and (h) has other solution rn1 , (r 6= r1)
then an = (A + Bn)rn + C (r1)n.
3 the characteristic equation r2 + C1r + C2 = 0 has r1 = r2 = rsolution then an = Arn + Bnrn + Cn2rn.
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 binarysequences 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 firstn− 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 theprevious symbols must be 0 (one such sequence).
Therefore an = an−1 + an−2 + 1 with a1 = 2 and a2 = 4.
an = ahn + ap
n where apn = A (constant) and (ah
n is the homogenouspart)
an = c1(1+
√5
2 )n + c2(1−
√5
2 )n + A.
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 binarysequences 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 firstn− 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 theprevious symbols must be 0 (one such sequence).
Therefore an = an−1 + an−2 + 1 with a1 = 2 and a2 = 4.
an = ahn + ap
n where apn = A (constant) and (ah
n is the homogenouspart)
an = c1(1+
√5
2 )n + c2(1−
√5
2 )n + A.
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 binarysequences 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 firstn− 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 theprevious symbols must be 0 (one such sequence).
Therefore an = an−1 + an−2 + 1 with a1 = 2 and a2 = 4.
an = ahn + ap
n where apn = A (constant) and (ah
n is the homogenouspart)
an = c1(1+
√5
2 )n + c2(1−
√5
2 )n + A.
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 binarysequences 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 firstn− 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 theprevious symbols must be 0 (one such sequence).
Therefore an = an−1 + an−2 + 1 with a1 = 2 and a2 = 4.
an = ahn + ap
n where apn = A (constant) and (ah
n is the homogenouspart)
an = c1(1+
√5
2 )n + c2(1−
√5
2 )n + A.
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 binarysequences 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 firstn− 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 theprevious symbols must be 0 (one such sequence).
Therefore an = an−1 + an−2 + 1 with a1 = 2 and a2 = 4.
an = ahn + ap
n where apn = A (constant) and (ah
n is the homogenouspart)
an = c1(1+
√5
2 )n + c2(1−
√5
2 )n + A.
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 binarysequences 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 firstn− 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 theprevious symbols must be 0 (one such sequence).
Therefore an = an−1 + an−2 + 1 with a1 = 2 and a2 = 4.
an = ahn + ap
n where apn = A (constant) and (ah
n is the homogenouspart)
an = c1(1+
√5
2 )n + c2(1−
√5
2 )n + A.
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 binarysequences 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 firstn− 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 theprevious symbols must be 0 (one such sequence).
Therefore an = an−1 + an−2 + 1 with a1 = 2 and a2 = 4.
an = ahn + ap
n where apn = A (constant) and (ah
n is the homogenouspart)
an = c1(1+
√5
2 )n + c2(1−
√5
2 )n + A.
Arash Rafiey Recurrence Relations(continued)
Problem 1. What is the number of binary sequences of length nwith no ”101” ?
Arash Rafiey Recurrence Relations(continued)