Math 359 Lecture Slide Recurrence Relations (1)
Math 359 Lecture Slide Recurrence Relations (1)
UNIVERSITY OF GHANA
COLLEGE OF BASIC AND APPLIED SCIENCES
SCHOOL OF PHYSICAL AND MATHEMATICAL SCIENCES
DEPARTMENT OF MATHEMATICS
December 4, 2023
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 1/48
Recurrence relations
Example 4.1
Find the first five terms of the sequence {an }∞
n=0 defined by each of the
following recurrence relations and initial conditions.
1 an = −an−1 + n − 1, a0 = 7
2 xn+2 + 5xn+1 + 6xn = 0, x0 = 1, x1 = −1
3 an = an−1 + an−3 , a0 = 1, a1 = 2, a2 = 0
ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 2/48
Recurrence relations
SOLUTION:
1 To obtain the other terms of the sequence, we notice that the
an = −an−1 + n − 1 holds for n ≥ 1. We have that
a0 = 7
a1 = −a0 + 0 = −7
a2 = −a1 + 1 = 8
a3 = −a2 + 2 = −6
a4 = −a3 + 3 = 9
ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 3/48
Recurrence relations
x0 = 1
x1 = −1
x2 = −(5x1 + 6x0 ) = −1
x3 = −(5x2 + 6x1 ) = 11
x4 = −(5x3 + 6x2 ) = −49
ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 4/48
Recurrence relations
a0 = 1
a1 = 2
a2 = 0
a3 = a2 + a0 = 1
a4 = a3 + a1 = 3,
ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 5/48
Recurrence relations
Example 4.2
Determine whether the sequence {an }∞n=0 is a solution of the recurrence
relation an = 8an−1 − 16an−2 given that
1 an = n4n
2 an = 1
SOLUTION:
1 Let the sequence {a }∞ n
n n=0 be given by an = n4 . This means that
an−1 = (n − 1)4 n−1 and an−2 = (n − 2)4 n−2 for n ≥ 2. We find that
8(n − 1)4n−1 − 16(n − 2)4n−2 = 4n−2 [8(n − 1) × 4 − 16(n − 2)]
= 16 × 4n−2 [2n − 2 − n + 2]
= n4n
= an ,
ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 6/48
Recurrence relations
8 − 16 = −8 ̸= 1 = an ,
ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 7/48
Linear recurrence relations
Definition 4.2 (Linear recurrence relation)
A recurrence relation of the form
Example 4.3
1 3
an = 3an−1 + 4an−2 is non-linear, since an−1 is raised to power 3, and
is of order 2.
2 an = 3n3 an−1 + nan−2 is linear and has order 2.
3 an = an−1 an−2 + n2 is non-linear, because of the product an−1 an−2 ,
and has order 2.
4 an = 6an−1 − 11an−2 + 6an−3 is linear and has order 3. ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 8/48
Linear recurrence relations
Example 4.4
1 an = an−1 an−2 + n2 is non-linear, non-homogeneous and has order 2.
2 an = 6an−1 − 11an−2 + 6an − 3 is linear, homogeneous and has order
3.
3 an = 5an−1 − 6an−2 + n is linear, non-homogeneous of order 2.
ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 9/48
Linear recurrence relations
Example 4.5
1 an = 5an−1 − 6an−2 + n is linear with constant coefficients and of
order 2.
2 an = 6an−1 − 11an−2 + 6an−3 is linear with constant coefficients and
of order 3.
ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 10/48
Linear recurrence relations
Definition 4.5
A linear recurrence relation of the form
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 11/48
Homogeneous recurrence relations
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 12/48
Homogeneous recurrence relations
Theorem 4.1
Let c1 , c2 ∈ R. Suppose that r 2 − c1 r − c2 = 0 has two distinct roots r1
and r2 . Then the sequence {an }∞ n=0 is a solution of the recurrence relation
an = c1 an−1 + c2 an−2 if and only if an = α1 r1n + α2 r2n for n = 0, 1, 2, . . .,
where α1 and α2 are constants.
r 2 − c1 r − c2 = 0 (4.8)
has two distinct roots r1 and r2 . Since r1 and r2 are roots of equation
(4.8), we have that r12 = c1 r1 + c2 and r22 = c1 r2 + c2 .
Now, suppose that the sequence {an }∞ n n
n=0 is given by an = α1 r1 + α2 r2 ,
where α1 and α2 are constants.
ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 13/48
Homogeneous recurrence relations
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 14/48
Homogeneous recurrence relations
Choose
A1 − A0 r2
α1 = , r1 ̸= r2 (4.9)
r1 − r2
and
A0 r1 − A1
α2 = , r1 ̸= r2 . (4.10)
r1 − r2
Consider the sequence {α1 r1n + α2 r2n }∞
n=0 . We observe that
A1 − A0 r2 A0 r1 − A1 A0 (r1 − r2 )
α1 r10 + α2 r20 = + = = A0 (4.11)
r1 − r2 r1 − r2 r1 − r2
and
A1 − A0 r2 A0 r1 − A1 A1 (r1 − r2 )
α1 r11 + α2 r21 = r1 + r2 = = A1 . (4.12)
r1 − r2 r1 − r2 r1 − r2
ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 15/48
Homogeneous recurrence relations
Example 4.6
A young pair of rabbits (one of each sex) is placed on an island. A pair of
rabbits does not breed until they are 2 months old. After they are 2
months old, each pair of rabbits produces another pair each month. Find a
recurrence relation for the number Fn of pairs of rabbits on the island after
n months, assuming that no rabbits ever die. Hence, find an explicit
formula for Fn .
[NB: The sequence {Fn }∞ n=0 is known as the Fibonacci sequence]
ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 16/48
Homogeneous recurrence relations
SOLUTION:
ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 17/48
Homogeneous recurrence relations
Let Fn be the number of pairs of rabbits after n months. In the beginning,
when n = 0, there was no pair of rabbits on the island, and so F0 = 0.
After the first one month, we get F1 = 1. Since this pair does not breed
during the second month, we see that F2 = 1. We observe that each
newborn pair comes from a pair at least 2 months old, which means that
the number of newborn pairs after n months is Fn−2 . So, we deduce that
where Fn−1 is the number pairs of rabbits on the island the previous
month.
The characteristic equation of the recurrence relation Fn = Fn−1 + Fn−2 is
r 2 − r − 1, which yields the characteristic roots
√ √
1+ 5 1− 5
r1 = and r2 = . (4.13)
2 2
ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 18/48
Homogeneous recurrence relations
Theorem 4.1 enables us to write
√ !n √ !n
1+ 5 1− 5
Fn = α1 + α2 , (4.14)
2 2
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 19/48
Homogeneous recurrence relations
Therefore, the Binet formula for the Fibonacci sequence {Fn }∞
n=0 is
" √ !n √ !n #
1 1+ 5 1− 5
Fn = √ − . (4.18)
5 2 2
Example 4.7
Solve the recurrence relation an = 3an−2 − 2an−1 , n ≥ 2 given that a0 = 1
and a1 = −3.
an = A(−3)n + B, (4.19)
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 20/48
Homogeneous recurrence relations
We employ the initial conditions to obtain the equations
A+B =1 (4.20)
and
− 3A + B = −3. (4.21)
We solve equations (4.20) and (4.21) simultaneously to get A = 1 and
B = 0. Hence we find that the solution {an }∞ n=0 to the given recurrence
relation and initial conditions has an = (−3)n .
Theorem 4.2
Let c1 , c2 ∈ R with c2 ̸= 0. Suppose that r 2 − c1 r − c2 = 0 has only one
real root r0 . A sequence {an }∞
n=0 is a solution of the recurrence relation
an = c1 an−1 + c2 an−2 if and only if an = α1 r0n + α2 nr0n , where α1 and α2
are constants determined by initial conditions a0 = A0 and a1 = A1 .
ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 21/48
Homogeneous recurrence relations
PROOF: Let c1 , c2 ∈ R with c2 ̸= 0. Suppose that r 2 − c1 r − c2 = 0 has
only one real root r0 .
Suppose that the sequence {an }∞ n n
n=0 is defined by an = α1 r0 + α2 nr0 ,
where α1 and α2 are constants. Then, for n ≥ 2, we find that
h i h
c1 an−1 + c2 an−2 = c1 α1 r0n−1 + α2 (n − 1)r0n−1 + c2 α1 r0n−2 + α2 (n − 2)r0n−
= α1 r0n−2 [c1 r0 + c2 ] + α2 r0n−2 [c1 (n − 1)r0 + c2 (n − 2)]
= α1 r0n−2 r02 + α2 r0n−2 [n(c1 r0 + c2 ) − (c1 r0 + 2c2 )]
= α1 r0n + α2 r0n−2 [nr02 − (c1 r0 + 2c2 )].
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 22/48
Homogeneous recurrence relations
It follows that
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 23/48
Homogeneous recurrence relations
and
Furthermore, we have seen that {α1 r0n + α2 nr0n }∞n=0 satisfies the
recurrence relation an = c1 an−1 + c2 an−2 , for n ≥ 2. The recurrence
relation and the initial conditions uniquely determine a sequence.
Therefore, an = α1 r0n + α2 nr0n .
ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 24/48
Homogeneous recurrence relations
Example 4.8
Solve the recurrence relation given by an = 2an−1 − an−2 , n ≥ 2 with
initial conditions a0 = 4 and a1 = 1.
4 = α1 and 1 = α1 + α2 , (4.27)
which imply that α1 = 4 and α2 = −3. Hence, the sequence {an }∞ n=0
where an = 4 − 3n is the solution to the given recurrence relation and
initial conditions. ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 25/48
Homogeneous recurrence relations
Example 4.9
Solve the recurrence relation an = 6an−1 − 9an−2 for n ≥ 2, with initial
conditions a0 = 1 and a1 = 6.
an = α1 3n + α2 n3n , (4.28)
α1 = 1 and α1 + α2 = 2, (4.29)
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 26/48
Non-homogeneous Recurrence Relations
ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 27/48
Non-homogeneous Recurrence Relations
Theorem 4.3
If {Pn }∞
n=0 is a particular solution of the non-homogeneous linear
recurrence relation with constant coefficients
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 28/48
Non-homogeneous Recurrence Relations
bn −Pn = c1 (bn−1 −Pn−1 )+c2 (bn−2 −Pn−2 )+· · ·+ck (bn−k −Pn−k ). (4.34)
bn = Pn + Hn for n = 0, 1, 2, . . . . (4.35)
ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 29/48
Non-homogeneous Recurrence Relations
Theorem 4.4
Suppose that {an }∞
n=0 satisfies the linear non-homogeneous recurrence
relation
an = c1 an−1 + c2 an−2 + · · · + ck an−k + F (n)
where c1 , c2 , . . . , ck ∈ R and
F (n) = ek nk + ek−1 nk−1 + · · · + e1 n + e0 s n ,
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 30/48
Non-homogeneous Recurrence Relations
ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 31/48
Non-homogeneous Recurrence Relations
Example 4.10
Find all solutions of the recurrence relation
an = 4an−1 − 4an−2 + (n + 1)2n .
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 32/48
Non-homogeneous Recurrence Relations
This leads us to
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 33/48
Non-homogeneous Recurrence Relations
Putting n = 2 in equation (4.40), we get
16(2A + B) = 8(A + B), (4.42)
1
which yields A = . Therefore, we obtain
6
1
an = (α1 + nα2 )2n + n2 n + 1 2n . (4.43)
6
Example 4.11
The plane is divided by n straight lines in such a way that every pair of
lines intersect but, but no three lines intersect. Obtain a linear recurrence
relation for the number of regions into which the plane is divided. Hence
find a formula for the number of regions into which n lines divide the plane.
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 34/48
Non-homogeneous Recurrence Relations
The nth line intersects the previous n − 1 lines at n − 1 points, adding n
new regions to the previously existing an−1 . Hence, we get
an = an−1 + n, a0 = 1. (4.44)
We find that solutions of an = an−1 are of the form Hn = C ∈ R. There is
a particular solution of the form Pn = n(An + B). Thus,
n(An + B) = (n − 1)[A(n − 1) + B] + n,
1
which produces A = B = . This implies that
2
n
an = C + (n + 1).
2
Using the initial condition a0 = 0, we obtain A = 1. Therefore, the
number an of regions into which n lines divide the plane, where the lines
intersect pairwise, but no three lines intersect is given by
1
an = [2 + n(n + 1)], n = 0, 1, 2, . . . .
2 ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 35/48
Non-homogeneous Recurrence Relations
Example 4.12
Find all solutions of the recurrence relation
an = 3an−1 − 2an−2 + 5.
An = 3A(n − 1) − 2A(n − 2) + 5,
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 36/48
Non-homogeneous Recurrence Relations
Example 4.13
Find all solutions of the recurrence relation
gn = 6gn−1 − 9gn−2 + n2 22 .
Pn = (an2 + bn + c)2n ,
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 37/48
Non-homogeneous Recurrence Relations
This implies that
h i
an2 + bn + c 2n = 6 a(n − 1)2 + b(n − 1) + c 2n−1
h i
− 9 a(n − 2)2 + b(n − 2) + c 2n−2 + n2 2n ,
(4.45)
which gives us
h i
4 an2 + bn + c = 12 a(n − 1)2 + b(n − 1) + c
h i
− 9 a(n − 2)2 + b(n − 2) + c + n2 2n .
(4.46)
Equating coefficients of n2 , we find that a = 4. We get b = 48 when we
equate coefficients of n. When we equate constant terms, we arrive at
c = 192. All solutions of the given recurrence relation are given by
gn = (A + Bn)3n + (4n2 + 48n + 192)2n , (4.47)
ug1.jpg
where A and B are constants.
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 38/48
Generating Functions
We have seen how to solve a recurrence relation and its initial conditions
by first finding the characteristic equation. Here, we solve a recurrence
relation and its initial conditions by finding an explicit formula for the
associated generating function. We shall work with the generating
functions displayed in Table 1.
ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 39/48
Generating Functions
G(x ) ak
n
(
1− x n+1 X 1, if k ≤ n
= = 1 + x + x2 + · · · + xn
1−x k=0 0, otherwise
∞
1 X
= xk = 1 + x + x2 + · · · 1
1−x k=0
∞
1 X
= ak x k = 1 + ax + a2 x 2 + · · · ak
1 − ax k=0
∞
1 X
= (k + 1)x k = 1 + 2x + 3x 2 + 4x 3 + · · · k +1
(1 − x )2 k=0
∞
(
1 X 1, if r |k
= x rk = 1 + x r + x 2r + x 3r + · · ·
1 − xr k=0 0, otherwise
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 40/48
Generating Functions
Example 4.14
Using generating functions solve the recurrence relation an = 3an−1 + 2n
for n ≥ 1 and initial condition a1 = 3.
ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 41/48
Generating Functions
Then, we get
∞
X
G(x ) = a0 + an x n
n=1
∞
1 X
= + (3an−1 + 2n)x n
3 n=1
∞ ∞
1 X X
= + 3x an−1 x n−1 + 2x (n − 1 + 1)x n−1 .
3 n−1=0 n−1=0
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 42/48
Generating Functions
It follows that
1 2x
G(x ) = +
3(1 − 3x ) (1 − x )2 (1 − 3x )
1 3 1 1
= + − −
3(1 − 3x ) 2(1 − 3x ) 2(1 − x ) (1 − x )2
11 1 1
= − −
6(1 − 3x ) 2(1 − x ) (1 − x )2
∞ ∞ ∞
11 X 1X X
= 3n x n − xn − (n + 1)x n
6 n=0 2 n=0 n=0
∞
11 3
X
= 3n − n − x n.
n=0
6 2
The solution {an }∞
of the recurrence relation an = 3an−1 + 2n, n ≥ 1
n=1
and initial condition a1 = 3 is given by
11 3
an = 3 n − n − .
6 2 ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 43/48
Generating Functions
Example 4.15
Find an explicit formula for ak given that
ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 44/48
Generating Functions
It follows that
∞
X
G(x ) = a0 + a1 x + ak x k
k=2
∞
X
= 1 + 4x + (ak−1 + 6ak−2 )x k
k=2
∞
X ∞
X
= 1 + 4x − x + x ak−1 x k−1 + 6x 2 ak−2 x k−2
k−1=0 k−2=0
∞
X ∞
X
= 1 + 3x + x ak x k + 6x 2 ak x k
k=0 k=0
2
= 1 + 3x + xG(x ) + 6x G(x ).
ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 45/48
Generating Functions
ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 46/48
Generating Functions
ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 47/48
END
OF
RECURRENCE RELATIONS
ug1.jpg
Benedict Vasco NORMENYO, PhD MATH 359: DISCRETE MATHEMATICS December 4, 2023 48/48