Professional Documents
Culture Documents
03 Recursive Algorithm Complexity Part 2
03 Recursive Algorithm Complexity Part 2
Theorem
A nonhomogeneous linear recurrence form can be transformed into homogeneous
linear recurrence
a0tn + a1tn-1 + … + aktn-k = bnp(n)
where d is the degree of p(n)
Characteristic equation :
Example :
Solve the following recurrence
tn – 3tn-1 = 4n(2n + 1) for n > 1
t0 = 0
t1 = 12
Solution :
- Obtain the characteristic eq for the corresponding homogeneous eq :
tn – 3tn-1 = 0 → r1 – 3 = 0
- Obtain a term from the nonhomogeneous part of the recurrence
4n(2n1 + 1)
b d
the term is
(r + b)d+1 = (r – 4)1+1
7tn – 3tn-1 = 0
6tn – 5tn-1 + 8tn-2 = 0
8tn – 4tn-3 = 0
a0tn + a1tn-1 + … + aktn-k = 0
The characteristic equation for the homogeneous linear recurrence equation with
constant coefficients
a0tn + a1tn-1 + … + aktn-k = 0
is defined as
a0rk + a1rk-1 + … + akr0 = 0
5r2 + 7r + 6 = 0
We use an arrow to show that the order of the characteristic equation is k
(in this case is 2)’
Theorem
Let the homogeneous linear recurrence equation with constant coefficients
a0tn + a1tn-1 + … + aktn-k = 0
be given. If its characteristic equation
a0rk + a1rk-1 + … + akr0 = 0
has k distinct solutions r1, r2, . . . , rk, then the only solutions to the recurrence are
n n n
tn = c1r1 + c2r2 + … + ckrk
5. substitute the constant into the general solution to obtain the particular
solution
tn = c14n + c2(-1)n
tn = 4n - (-1)n
Theorem
Let r be a root of multiplicity m of the characteristic equation for a homogeneous
linear recurrence with constant coefficients. Then
tn = rn, tn = nrn. tn = n2rn, tn = n3rn, …, tn = nm-1rn
are all solution to the recurrence.
To be continued in part 2
References