Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
Linear Recurrence
Relations
Part I
Jorge Cobb
The University of Texas at Dallas
1
Solving recurrence relations
2
Setting up a recurrence relation is important –
it corresponds to modeling a problem
Solving it (providing a sequence that satisfies
the recurrence) is also needed
Sometimes, this can be done through
iteration/induction
For certain types of recurrence relations,
there are systematic methods for solving
them
Linear recurrence relations of degree k
an = c1an-1 + c2an-2 + ... + ckan-k with c1,c2,...,ck
real numbers and ck≠0
Linear:
3
The right-hand side is a sum of weighted previous
terms of the sequence – the weights do not
depend on the sequence (but not necessarily
constant, may be a function of n)
Linear homogeneous recurrence
relations of degree k with constant
coefficients
an = c1an-1 + c2an-2 + ... + ckan-k with c1,c2,...,ck real
numbers and ck≠0
Homogeneous:
Of degree k:
The recurrence goes back k terms, i.e., the earliest
previous term on the right hand side is an-k
Constant coefficients:
4
No terms appear on the right hand side that are not
multiples of a previous term
The multipliers of the previous terms are all constants, not
functions that depend on n
Classifying recurrences
5
Not linear
an=2an-1 + an-22
Not linear
an=an-1an-2
Yes, degree 2
an=an-1+an-2
an=1.05an-1
Yes, degree 1
an=nan-1
Coefficients are not constant
an=2an-1+1
Non-homogeneous
an=an-1+an-4
Yes, degree 4
Classification doesn’t depend on initial values
First degree linear homogeneous
recurrence relations with const. coef.
6
an = c1an-1
Recall the compound interest example
Through iterative expansion,
an = c1an-1 = c1(c1an-2) = c12an-2 = c12(c1an-3) =
c13an-3 = ... = c1na0
Approach for a general
solution
7
an = c1an-1 + c2an-2 + ... + ckan-k
Pretend that there is a solution of the form
an=rn for some constant r
rn = c1rn-1 + c2rn-2 + ... + ckrn-k
rk – c1rk-1 – c2rk-2 - ... – ck-1r – ck = 0
This is the characteristic equation of the
recurrence relation; the numbers r that satisfy
it are the characteristic roots of the
recurrence relation
Second degree linear homogeneous
recurrence relations
Assumptions
Recurrence relation: an = c1an-1 + c2an-2
Characteristic equation has two distinct roots r1, r2.
Theorem 1
{an} is a solution of the recurrence
if and only if
{an} is of the form an = b1r1n + b2r2n
for all n≥0, and for some constants b1, b2
8
Proving Theorem 1
We need to prove both directions:
9
If {an} is a solution, then it must be of the form
an= b1r1n + b2r2n
for some appropriately chosen constants
b1 and b2
If {an} is of the form
an= b1r1n + b2r2n
for all n≥0, then it must be a solution.
We prove the second one first (harder )
Proving Theorem 1, first part
Show an = b1r1n + b2r2n, n≥2, is a solution
an c1an 1 c2 an 2
c1 (b1r1n 1 b2 r2n 1 ) c2 (b1r1n 2 b2 r2n2 )
n2
1 1
br
n2
2 2
(c1r1 c2 ) b r
(c1r2 c2 )
Because r2 – c1r – c2 = 0 and r1 and r2 are roots,
c1r1 c2 r , c1r2 c2 r
2
1
Therefore,
an b1r1n2 r12 b2 r2n2 r22
b1r1n b2 r2n
10
2
2
Proving Theorem 1, first part
What about n=1 and n=0?
These are just the initial conditions of our solution
a1 b r b r b1r1 b2 r2
1
1 1
1
2 2
a0 b1r10 b2 r20 b1 b2
11
Proving Theorem 1, second part
Show that if {an} is a solution it must be of the form
an = b1r1n + b2r2n (we must find b1 and b2)
Note: a second-degree linear homogeneous
recurrence has a unique solution {an} if a0 and a1 are
specified
12
Because there is a single way to generate the terms an
from the two initial values
Therefore, if we show that there is a solution of the
form an = b1r1n + b2r2n, n ≥0, that satisfies the initial
values a0 and a1, this must be the solution that was
given to us, and we are done.
Proving Theorem 1, second part
We first show that there are b1 and b2 such that
b1r10 + b2r20 = a0 and b1r11 + b2r21 = a1
These simplify to
b 1 + b2 = a0
b1r1 + b2r2 = a1, (two linear equations, two unknowns)
b1 a0 b2
a1 a0 r1
(a0 b2 )r1 b2 r2 a1 ( r2 r1 )b2 a1 a0 r1 b2
r2 r1
a1 a0 r1 a0 r2 a0 r1 a1 a0 r1 a0 r2 a1
b1 a0 b2 a0
r2 r1
r2 r1
r2 r1
13
Proving Theorem 1, second part
14
Consider the sequence {a’n}, where
a’n = b1r1n + b2r2n, and a’0 = a0, a’1 = a1
From the first part of the theorem, we have shown that
a’n = b1r1n + b2r2n is a solution for any b1 and b2
We have shown (previous slide) that b1 and b2 can be
chosen so that the satisfy a’0 = a0, a’1 = a1
Thus, {a’n} is a solution, just like {an}, and with the same
initial conditions.
However, the initial conditions determine the rest of the
sequence.
Hence, {a’n} = {an} and {an} is in the desired form.
Notes about the proof
15
Our proof of the second part also serves as
the means to find the solution
It depended on r1 ≠ r2
The characteristic roots r1 and r2 may be
complex numbers (the proof and the solution
are still valid)
Example solution
an = an-1 + 2an-2, a0=2 and a1=7
Characteristic equation
r2 – r – 2 = 0
16
The quadratic formula for ax2+bx+c = 0,
b b2 4ac
x
2a
gives roots r1=(1-(3))/2=-1 and r2=(1+(3))/2 =
2
Example solution
Therefore,
a1 a0 r1 7 2 ( 1) 9
b2
3
r2 r1
2 ( 1)
3
a0 r2 a1 2 2 7 3
b1
1
r2 r1
2 ( 1)
3
an b1r1n b2 r2n 1 ( 1)n 3 2n 3 2n ( 1)n
17