Вы находитесь на странице: 1из 35

^ < >= « » e ∩ ∪ ^ < > = « » e ∩ ∪

^<>=«»e∩∪ ^<>=«»e∩∪
R=E«CU»RReEN∩C∪E^R<E>LA=AT«IO»N e ∩ ∪
5 ^ < >R
5^<>=«»e∩∪ ^<>=«»e
LEARNING OBJECTIVES
∑ Recurrence relation ∑ Generating functions

RECURRENCE RELATION

Introduction
Some of the counting problems cannot be solved by using the techniques discussed earlier, namely,
sum rule, product rule, permutations and combinations. They can be solved by finding relationships
between the terms of a sequence. The corresponding relationship is known as recurrence relation.
Recurrence relation An equation that expresses an in terms of one or more of the previous terms of
the sequence, namely a0, a1, a2, ..., an –1, for all integers n with n ≥ n0 where n0 is a non-negative integer,
is called a recurrence relation for the sequence {an} or a difference equation.
If the terms of a sequence satisfy the recurrence relation, then the sequence is called a solution of
the recurrence relation.

Example Let {a n} be a sequence that satisfies the recurrence relation an = an–1 + 3an–2 for
n = 2, 3, … and let a0 = 1 and a1 = 2. What are the values of a2 and a3?
Solution The given recurrence relation is an = an–1 + 3an–2, n = 2, 3, ...
a2 = a1 + 3a0 = 2 + 3 ¥ 1, since a0 = 1, a1 = 2
fi a2 = 5
and a3 = a2 + 3a1 = 5 + 3 ¥ 2 = 11.
Hence, a2 = 5 and a3 = 11.
Example Find the first five terms of the sequence defined by each of the following recurrence
relations and initial conditions:
(i) an = a2n–1, a1 = 2
(ii) an = nan–1 + n2 an–2, a0 = 1, a1 = 1
(iii) an = an–1 + an –3, a0 = 1, a1 = 2, a2 = 0

Solution (i) The given recurrence relation is an = a2 . n –1


Given that a1 = 2
a2 = a12 = 22 = 4
a3 = a22 = 42 = 16
a4 = a32 = 162 = 256
a5 = a42 = 2562 = 65,356
Hence, the first five terms of the sequence are 2, 4, 16, 256 and 65,356.
(ii) an = nan–1 + n2 an–2, a0 = 1, a1 = 1
a2 = 2a1 + 22 a0, = 2 ¥ 1 + 4 ¥ 1 = 6
a3 = 3a2 + 32 a1, = 3 ¥ 6 + 9 ¥ 1 = 27
a4 = 4a3 + 42 a2, = 4 × 27 + 16 × 6 = 204.
Thus, the first five terms of the sequence are 1, 1, 6, 27 and 204.
(iii) an = an–1 + an –3, a0 = 1, a1 = 2, a2 = 0
a3 = a2 + a0, = 0 + 1 = 1
a4 = a3 + a1, = 1 + 2 = 3.
Thus, the first five terms of the sequence are 1, 2, 0, 1 and 3.

Example Determine whether the sequence {a n} is a solution of the recurrence relation


an = an–1 + 2an –2 + 2n – 9, if
(i) an = – n + 2
(ii) an = 3 (–1)n + 2n – n + 2
Solution (i) The given recurrence relation is an = an–1 + 2an –2 + 2n – 9
an = – n + 2
\ an–1 = – (n – 1) + 2, an–2 = – (n – 2) + 2
R.H. S. of the recurrence relation = an–1 + 2an–2 + 2n – 9
= [– (n – 1) + 2] + 2 [– n (n – 2) + 2] + 2n – 9
= –n + 3 – 2n + 8 + 2n – 9
= –n + 2
= an = L.H.S.
\ an = – n + 2 is a solution of the recurrence relation.
(ii) an = 3 (–1) n + 2n – n + 2
R.H.S. = an–1 + 2an–2 + 2n – 9
= [3 (–1)n–1 + 2n–1– (n – 1)] + 2 [3 (–1) n–2 + 2n–2 – (n – 2) + 2] + 2n – 9
= 6 (–1) n–2 + 3 (–1) n–1 + 2 (2 n–2) + 2n–1 – 3n + 3 + 8 + 2n – 9

= 6( ) + 3
–1 n (–1)n 2n + 2 –n n +2
+ 2
(–1)2 (–1) 22 2

= 3. (–1)n + 2n – n + 2
= an = L.H.S.
\ an = 3 (–1) + 2n – n + 2 is a solution of the given recurrence relation.
n

Example Let a n = 2n + 5 (3n), for n = 0, 1, 2, .... .


(i) Find a0, a1, a2, a3 and a4.
(ii) Show that a2 = 5a1 – 6a0, a3 = 5a2 – 6a1 and a4 = 5a3 – 6a2.
(iii) Show that an = 5an–1 – 6an–2 for all integers n with n ≥ 2.
Solution (i) an = 2n + 5 (3n), for n = 0, 1, 2, .... . When n = 0,
a0 = 20 + 5 (30) = 6
a1 = 21 + 5 (31) = 17
a2 = 22 + 5 (32) = 49
a3 = 23 + 5 (33) = 143
a4 = 24 + 5 (34) = 421
(ii) 5a1 – 6a0 = 5 ¥ 17 – 6 ¥ 6 = 49 = a2.
fi a2 = 5a1 – 6a0
5a2 – 6a1 = 5 ¥ 49 – 6 ¥ 17 = 143 = a3.
fi a3 = 5a2 – 6a1
5a3 – 6a2 = 5 ¥ 143 – 6 ¥ 49 = 421 = a4.
fi a4 = 5a3 – 6a2
(iii) 5an–1 – 6an–2 = 5 [2n–1 + 5 ¥ 3n–1] – 6 [2n–2 + 5 ¥ 3n–2]
= 2n–2 (10 – 6) + 3n–2 (75 – 30)
= 2n–2 ¥ 4 + 3n–2 ¥ 45
= 2n–2 ¥ 22 + 3n–2 ¥ 32 ¥ 5
= 2n + 5(3n) = an
Thus, an = 5an–1 – 6an–2 for all integers n with n ≥ 2
Example By using an iterative approach, find the solutions to each of these recurrence rela-
tions with the given initial conditions:
(i) an = an–1 + 2, ; a0 = 3
(ii) an = an–1 + n, ; a0 = 1
(iii) an = an–1 + 2n + 3, ; a0 = 4
(iv) an = 3an–1 + 1, ; a0 = 1
Solution (i) an = an–1 + 2, a0 = 3
fi a1 = a0 + 2 = 3 + 2 = 3 + 1 ¥ 2
a2 = a1 + 2 = (3 + 2) + 2 = 3 + 2 ¥ 2
a3 = a2 + 2 = (3 + 2 ¥ 2) + 2 = 3 + 3 ¥ 2
a4 = a3 + 2 = (3 + 3 ¥ 2) + 2 = 3 + 4 ¥ 2
#
an = an–1 + 2 = 3 + (n – 1) + 2 = 3 + n (2)
fi an = 3 + 2n
This is the solution.
(ii) an = an–1 + n, a0 = 1
(1 + 1)
fi a1 = a0 + 1 = 1 + 1 = 2 = 1 + 1
2
(2 + 1)
a2 = a1 + 2 = 2 + 2 = 4 = 1 + 2
2
(3 + 1)
a3 = a2 + 3 = 4 + 3 = 7 = 1 + 3
2
(4 + 1)
a4 = a3 + 4 = 7 + 4 = 11 = 1 + 4
2
#
(n + 1)
a = a +n=1+n
n n–1
2
(n + 1) is a solution.
fi an = 1 + n
2
(iii) an = an–1 + 2n + 3, a0 = 4
a1 = a0 + 2 + 3 = 4 + 2 + 3 = 1 + 4 + 4
a2 = a1 + 4 + 3 = 4 + 8 + 4 = 22 + 2 ¥ 4 + 4
a3 = a2 + 6 + 3 = 4 + 8 + 4 + 6 + 3 = 32 + 3 ¥ 4 + 4
#
an = an–1 + 2n + 3 = n2 + n ´ 4 + 4
fi an = n2 + 4n + 4 is the solution.
(iv) an = 3an–1 + 1, a0 = 1
Ê 32 – 1ˆ
a1 = 3a0 + 1 = 3 ¥ 1 + 1 = 4 = Á
Ë 2 ˜¯
Ê 32+1 – 1ˆ
a2 = 3a1 + 1 = 3 ¥ 4 + 1 = 13 = Á
Ë 2 ˜¯
Ê 33+1 – 1ˆ
a3 = 3a2 + 1 = 3 ¥ 13 + 1 = Á
Ë 2 ˜¯
#

an = 3an–1 + 1 = Ê 3 – 1ˆ.
n+1

Ë 2 ˜¯
Á

Hence, a = Ê 3n+1 – 1ˆ is the solution.


n
ÁË 2 ˜¯

Example A person deposits Rs 1,000 in an account that yields 9% interest compounded yearly.
(i) Set up a recurrence relation for the amount in the account at the end of n years.
(ii) Find an explicit formula for the amount in the account at the end of n years.
(iii) How much money will the account contain after 100 years?
Solution (i) Let Sn denote the amount in the account after n years.
But, the amount in the account after n years
= the amount in the account after (n – 1) years + interest for the nth year
i.e., Sn = Sn–1 + (0.09) Sn–1, since the interest is 9% per year
i.e., Sn = (1.09)Sn–1
This is the required recurrence relation for the amount in the account at the end of n
years.
(ii) Explicit formula for Sn:
Now, S1 = (1.09)S0
S2 = (1.09) S1 = (1.09)2S0
S3 = (1.09) S2 = (1.09)3S0
#
Sn = (1.09)Sn–1 = (1.09)nS0
fi Sn = (1.09)nS0
i.e., Sn = (1.09)n ¥ 1,000, since S0 = Rs 1,000
Using mathematical induction, we can prove the validity of Eq. (10.1)
When n = 0, S0 = (1.09)0 ¥ 1,000
= 1,000
\ The result (i) is true for n = 0.
We assume that Sk = (1.09)k ¥ 1,000 is true.
We need to prove that Sk + 1 = (1.09)k + 1 ¥ 1,000 is true.
From the recurrence relation, we have
Sk + 1 =(1.09)Sk
= (1.09). (1.09)k ¥ 1,000 [by our assumption]
fi Sk + 1 = (1.09) k +1 ¥ 1,000
fi Sk + 1 is true.
Thus, by the principle of mathematical induction, Sn is true for all values of n.
\ The explicit formula is Sn = (1.09)n .(1,000)
(iii) When n = 100, we have
S100 = (1.09)100 ¥ 1,000
= Rs (1.09)100 ¥ 1,000
\ Money in the account after 100 years = Rs 1,000(1.09) 100.

Example Suppose the number of bacteria in a colony triples every hour.


(i) Set up a recurrence relation for the number of bacteria after n hours have elapsed.
(ii) If 100 bacteria are used to begin a new colony, how many bacteria will be there in the colony
in 10 hours?
Solution (i) Let an be the number of bacteria at the end of n hours.
\ an–1 is the number of bacteria at the end of (n – 1) hours.
Since the number of bacteria in a colony triples every hour, an = 3an–1.
This is true whenever n is a positive integer.
Hence, the recurrence relation for the number of bacteria after n hours is
an = 3an–1.
(ii) Let a0 = 100. Then
a1 = 3a0 = 3 ¥ 100
a2 = 3a1 = 32 ¥ 100
a3 = 3a2 = 33 ¥ 100
#
an = 3an–1 = 3n ¥ 100
fi an = 3n ¥ 100
We can prove the validity of Eq. (10.3) by using the induction principle.
When n = 0, a0= 30 ¥ 100 = 100. Therefore, a0 is trivially true.
We assume that ak = 3k ¥ 100 is true.
We need to prove that ak+1 = 3k+1 ¥ 100 is true.
Now, ak+1 = 3.ak [from the recurrence relation given in Eq. (10.2)]
= 3 ¥ 3k ¥ 100 [by our assumption]
= 3k+1 ¥ 100
fi ak+1 = 3k+1 ¥ 100
fi ak+1 is true.
Hence, by the principle of mathematical induction, an is true for every positive integer n.
Thus, the explicit formula is an= 3n ¥ 100.
When n = 10, we have
a10 = 310 ¥ 100
= 59,04,900
Therefore, the number of bacteria in the colony in 10 hours = 59,04,900.
Fibonacci sequence The sequence {1, 1, 2, 3, 5, 8, 13, .... .} is called Fibonacci sequence.
The recurrence relation for the Fibonacci sequence is
Fn = Fn–1 + Fn–2, n ≥ 2, F0 = 1, F1 = 1.
The conditions F0 = 1, F1 = 1 are called initial conditions or the basis.

Example Find the recurrence relation and basis for the sequence {1, 3, 32, 33, ...}.
Solution Let us denote the terms as follows:
a0 = 1, a1 = 3, a2 = 32, a3 = 33, ...
Therefore, the corresponding recurrence relation is an = 3an–1 and the basis or initial condition is a0 = 1.

EXERCISES
If the sequence {an} satisfies the recurrence Is the sequence {an}a solution of the recurrence
relation an = an–1 – an–2 for n = 2, 3, ... and relation an = 8an–1 – 16an–2 if
suppose a0 = 3, a1 = 5, then find a2 and a3. (a) an = 2n?
Find the first five terms of the following recur- (b) an = n (4n)?
rence relations with the given initial conditions: (c) a =n 2 (4n) + 3n(4n)?
(a) a = 6a , a = 2 2 n
n n–1 0
(d) an = n (4 )?
(b) an = an–1 + 3an–2, a0 = 1, a1 = 2.
(e) an = (– 4)n?
Determine whether the sequence {a n} is a
solution of the recurrence relation By using an iterative approach, find the
an = 2an–1 – an–2, for n = 2, 3, ..., if solution to each of the recurrence relations
with the given initial conditions:
(a) an = 3n (b) an = 2n (a) an = 3an–1, a0 = 2
(c) an = 5
(b) an = 2an–1, a0 = 1
Show that the sequence {a n} is a solution of
the recurrence relation an = –3an–1 + 4an–2 if (c) an = nan–1, a0 = 5
(a) an = 0 (b) an = 1 (d) an = 2nan–1, a0 = 1
(c) an = (– 4)n Suppose a person deposits Rs 10,000 in a sav-
ings account at a bank yielding 11% interest
per year, with the interest compounded annu- (a) Set up a recurrence relation for the
ally. How much money will be in the account number of vehicles produced in the first n
after 30 years? months by this factory.
A factory makes custom sports vehicles at an (b) How many vehicles are produced in the
increasing rate. In the first month only one first year?
vehicle is made, in the second month two (c) Find an explicit formula for the number of
vehicles are made an so on, with n vehicles vehicles produced in the first n months by
made in the nth month: this factory.

Solution of Linear Homogeneous Recurrence Relations


with Constant Coefficients
A recurrence relation of the form
an = c1an–1 + c2an–2 +...+ ck an–k
where c1, c2, …, ck are real numbers and ck π 0, is called a linear homogeneous recurrence relation of
degree k with constant coefficients.
Note The recurrence relation given in Eq. (10.4) is linear, since each a i has the power 1 and no
terms of the type a i a j occurred.
Note The degree of the recurrence relation is k, since a n is expressed in terms of the previous k
terms of the sequence, i.e., degree is the difference between the greatest and lowest subscripts of the
members of the sequence occurring in the recurrence relation.
Note The coefficients of the terms of the sequence are all constants. They are not functions of n.
Note If F (n) = 0, then the recurrence relation is said to be homogeneous; otherwise, it is said to
be non-homogeneous.
The recurrence relation given in Eq. (10.4) is homogeneous.

Example Provide some examples of linear homogeneous recurrence relation. Also, give their
degrees.
Solution (i) The recurrence relation Sn = (0.09)Sn–1 is a linear homogeneous recurrence relation of
degree 1.
(ii) The recurrence relation Fn = Fn – 1 + Fn – 2 is a linear homogeneous recurrence relation of
degree 2.
(iii) The recurrence relation an = an–4 is a linear homogeneous recurrence relation of degree 4.

Example Determine whether the following recurrence relations are linear homogeneous
recurrence relations with constant coefficients:
(i) an = 2an – 4 + a 2n – 3
(ii) Hn = 2Hn–1 + 2
(iii) Bn = nBn–1
Solution (i) The recurrence relation an = 2an–4 + a 2 n –3 is not linear.
(ii) The recurrence relation Hn = 2Hn–1 + 2 is not homogeneous.
(iii) The recurrence relation Bn = nBn–1 does not have constant coefficients.

Example Determine which of the following recurrence relations are linear homogeneous
recurrence relations with constant coefficients and also find their degrees:
(i) an = 3an–1 + 4a2n–2 + 5an –3
(ii) an = 2nan–1 + a n–2
(iii) an = a n–1 + a n–4
(iv) an = an–1 + 2
(v) an = a2n –1 + an–2
(vi) an = an–2
(vii) an = an–1 + n
Solution (i) This is a linear homogeneous recurrence relation with constant coefficients.
Degree = (n – 3) – n = 3.
(ii) This does not have constant coefficients.
(iii) This is a linear homogeneous recurrence relation with constant coefficients.
Degree = (n – 4) – n = 4.
(iv) This is not a homogeneous recurrence relation.
(v) This is not a linear recurrence relation.
(vi) This is a linear homogeneous recurrence relation with constant coefficients.
Degree = 2.
(vii) This is not a homogeneous recurrence relation.
Characteristic roots Consider the recurrence relation
an = c1an–1 + c2an–2 +...+ ck an–k
where c1, c2, …, ck are real numbers and ck π 0.
The characteristic equation of the recurrence relation given above is
rk – c1rk–1 – c2rk–2 – ◊◊◊ – ck–1 r – ck π 0
The solutions of the characteristic equation are called the characteristic roots.
Theorem Let c 1 and c2 be real numbers. Suppose r2 – c1r – c2 = 0 has two distinct roots r1 and
r2. Then the sequence {an} is a solution of the recurrence relation an = c1an–1 + c2an–2 if and
only if an = a1r1n + a2r2n for n = 0, 1, 2, …, where a1 and a2 are constants.
Proof Let r and r be two distinct roots of the characteristic equation r 2 – c r – c = 0.
1 2 1 2

Let a1, a2 be two constants such that an = a r1 n1 + a 2r n2.


We need to prove that {an} is a solution of the recurrence relation.
Since r1 and r2 are roots of r 2 – c1r – c2 = 0, we have
r12 – c1r1 – c2 = 0 fi r12 = c1r1 + c2
and r22 – c1r2 – c2 = 0 fi r22 = c1r2 + c2
Now, c1an–1 + c2an–2
= c1 [a1r1n–1 + a2 r2n –1] + c2 [a1r1n–2 + a2r2n–2]
= a1r1n–2(c1r1 + c2) + a2r2n–2 (c1r2 + c2)
= a1r1n–2r 2 + a r n–2 r 2 [from Eqs (10.6) and (10.7)]
1 2 2 2

= a1 r1 +
n
a 2r2n
= an [by our assumption]
\ The sequence {an} with an = a1 1r n + a2r2n is a solution of the recurrence relation.
Conversely, we assume that an = a1 r1 n + a2 r2 n is a solution of the recurrence relation
an = c1an –1 + c2an–2 for some constants a1, a2 and n = 0, 1, 2, ... .
We need to prove that every solution {an} of the recurrence relations has the form
an = a 1r1n + a 2r 2n for some constants a and1 a and 2 n = 0, 1, 2, ... .
Suppose {an} is a solution of the recurrence relation and the initial conditions a0 = c0 and a1 = c1
hold. We need to show that there are constants a1 and a2 so that the sequence {an} with
an = a 1r1n + a 2r 2n satisfies the initial conditions.
Now
a0 = c0 = a 1r 10 + a2r20 = a1 + a2
a1 = c1 = a1r1 + a2r2 [by our assumption]
i.e., c0 = a1 + a 2
and c1 = a1r1 + a 2r2
Solving this, we get
c1 – c0r2
a1 =
r1 – r2
c0r1 – c1
and a2 =
r1 – r2
The values of a1 and a2 are valid only if r1 π r2.
Therefore, for the above values of a1 and a2, the sequence {an} with an = a r n + a r n satisfies the
1 1 22
two initial conditions.
Since an = c1an–1 + c2an –2 with a0 = c0 and a1 = c1 uniquely determine the sequence,
an = a 1r1n + a 2r2n is a solution form.
Theorem Let c and c be real numbers with c π 0. Suppose r 2 – c r – c = 0 has only one root
1 2 2 1 2
r0. A sequence {an} is a solution of the recurrence relation an = c1an –1 + c2an –2 if and only if
a = a r n + a nr n, for n = 0, 1, 2, …, where a and a are constants.
n 1 0 2 0 1 2

Proof First, we show that if an = a r n + a nr n, then the sequence {a } is a solution of the recurrence
1 0 2 0 n
relation. Since r0 is a root of the characteristic equation r – 2c1r – c2 = 0
r0 is a solution of an = c1an–1 + c2an–2 [by Theorem 10.1]
Now we need to prove that an = nr n0 is also a solution of Eq. (10.8).
Since r0 is a root of r 2 – c1r – c2 = 0
and the degree of equation (10.9) is 2
r2 – c1r – c2 = (r – r0)2
= r2 – 2r0r + r 02
Equating the corresponding coefficients, we have
c1 = 2r0, c2 = –r 20
Now
c1an –1 + c2an–2 = c1 [(n – 1)r n–1
0 ] + c2 [(n – 2)r 0 ]
n–2

= 2r0 (n – 1)r0n–1 – r 02 (n – 2)r 0n–2


= r0n [2(n – 1) – (n – 2)]
= nr 0n
= an
\ nr0 is a solution.
n

Hence, by Theorem 10.7, an = a r1 0n + a2 nr0n is a solution of Eq. (10.8).


Conversely, we have to prove that every solution {an} of the recurrence relation an = c1an–1 + c2an–2 has
an = a 1r 0n + a2nr n0 for some constants a1 and a2 and for n = 0, 1, 2, ... .
Suppose that {an} is a solution of the recurrence relation and the initial conditions a0 = c0 and
a1 = c1 hold. We need to show that there are constants a1 and a2 so that the sequence {an} with
an = a r n + a nr n satisfies the initial conditions.
1 0 2 0
a0 = c0 = a1
a1 = c1 = a1r0+ a2r0
i.e., c1 – a1r0 = a2r0
i.e., a = È c1 – c0r0 ˘
2 Í ˙
Î r0 ˚
È c1 – c0r0 ˘
Therefore, when a =c , a = , the sequence {a } with a r n + a nr n satisfies the two
1 0 2 Í ˙ n 1 0 2 0
initial conditions. Î r0 ˚
Since the recurrence relation and these initial conditions uniquely determine the sequence,
an = a 1r0n + a 2 nr0n
Theorem Let c , c ,...., c be real numbers. Suppose the characteristic equation rk –c rk–1 –c rk–2 – ◊◊◊
1 2 k 1 2
– ck = 0 has k distinct roots r1, r2, ..., rk. Then a sequence {an} is a solution of the recurrence relation.
a = c a + c a + ◊◊◊ + c a if and only if a = a r n + a r n + ◊◊◊ + a r n for n = 0, 1, 2, ...
n 1 n–1 2 n–2 k n–k n 1 1 2 2 kk
where a1, a2 , ..., ak are constants.
Theorem Let c 1
, c2, ... ., ck be real numbers. Suppose the characteristic equation rk – c1rk–1 – c2r k –2 –
◊◊◊ – ck = 0 has t distinct roots r1, r2, ..., rt with multiplicities m1, m2, ... ., mt, respectively, so that mi ≥ 1 for
i = 1, 2, ..., t and m1 + m2 + ◊◊◊ + mt = k. Then the sequence {an} is a solution of the recurrence relation
an = c1an– 1 + c 2a n–2 + ◊◊◊ + c ka n–k if and only if
an = (a 1,0 + a 1,1n + ◊◊◊ + a 1, m1–1 nmt – 1 ) r1n + (a 2,0 + a 2,1 n + ◊◊◊ + a 2, m2–1 n m2–1)
r2n + ◊◊◊ + (a t,0 + a t,1 n + ◊◊◊ + a t,m –1 n
t
mt–1
) rtn,
for n = 0, 1, 2, ..., where ai,j are constants for 1 £ i £ t.
Note Consider the recurrence relation of the form a n = c1an–1 + c2an–2, n ≥ 2.
The characteristic equation is r 2 – c1r – c2 = 0
Let the roots of the characteristic equation be r1 and r2.
Case (i) If r and r are real and distinct, then the solution is a = a r n + a r n, where a and a are
1 2 n 1 1 2 2 1 2
arbitrary constants.
Case (ii) If r1 and r2 are real and equal, then the solution is an = (a1 + a 2n)rn where a 1 and a2 are
arbitrary constants.
Case (iii) If r1 and r2are complex numbers, then the solution is a =n r n (a cos
1
nq + a cos
2
nq, where
a1 and a2 are arbitrary constants.

Example Solve the recurrence relation


an = 5an–1 – 6an–2, for n ≥ 2, a0 = 1, a1 = 0.
Solution The given recurrence relation is an – 5an –1 + 6an –2 = 0.
The characteristic equation of the recurrence relation is r2 – 5r + 6 = 0.
\ r = 2, 3
Hence, the solution is an = c12n + c23n, where c1 and c2 are constants.
Initial conditions are a0 = 1, a1 = 0.
Now, a0 =1 fi c1 20 + c2 30 =1
fi c1 + c2 = 1
a0 = 0 fi c121 + c231 = 0
fi 2c1 + 3c2 = 0
Solving Eqs and we have, respectively,
fi c1 = 1 – c2
fi 2 (1 – c2) + 3c2 = 0
fi c2 = – 2
Also, c1 = 1 – (–2) = 3
\ c1 = 3 and c2 = –2
Hence, the unique solution is
an = 3 (2n) – 2 (3n) for n ≥ 2

Example Solve the recurrence relation


an = 8an–1 –16an –2 for n ≥ 2, a0 = 16, a 1 = 80.
Solution The given recurrence relation is
an – 8an –1 + 16an –2 = 0
The characteristic equation is
r2 – 8r + 16 = 0
fi (r – 4)2 = 0
fi r = 4, 4
Hence, the solution is
an = c14n + c2n4n, where c1 and c2 are arbitrary constants.
Initial conditions:
a0 = 16 fi c1.40 + c2.0 = 16
fi c1 = 16
Also, a0 = 80 fi c14 + c21 (41) = 80
fi 4c1 + 4c2 = 80
fi c1 + c2 = 20
fi c2 = 4, since c1 = 16
Hence, the unique solution is
an= 16 (4n) + 4n (4n ) = 4n +2 – n4 n +1
fi an = (4 – n)4 n + 1, n ≥ 2

Example Find the solution of the recurrence relation a n= 2an–1 + an–2 – 2an–3 for n = 3, 4, 5,
..., with a0 = 3, a1 = 6 and a2 = 0.
Solution The given recurrence relation is
an – 2an –1 – an –2 + 2an –3 = 0
The characteristic equation is
r3 – 2r2 – r + 2 = 0

1 1 –2 –1 2
0 1 –1 –2
1 –1 –2 0
fi (r – 1) (r2 – r – 2) = 0
fi (r – 1) (r + 1) (r – 2) = 0
fi r = 1, 2, –1
Hence, the solution
an = c11n + c22n + c3(–1)n, where c1, c2, c3 are arbitrary constants.
Initial conditions are a0 = 3 a1 = 6 and a2 = 0.
When a0 = 3, c1 + c2 + c3 = 3
When a1 = 6, c1 + c221 + c3(–1)1 = 6
fi c2 + 2c2 – c3 = 6
When a2 = 0, c1 + c222 + c3 (–1)2 = 0
fi c2 + 4c2 + c3 = 0
Adding Eqs (10.15) and (10.16) fi 2c1 + 3c2 = 9
Adding Eqs (10.16) and (10.17) fi 2c1 + 6c2 = 6
Subtracting Eq. (10.19) from Eq. (10.20) fi – 3c2 = 3
fi c2 = –1
Equation (10.18) fi 2c1 = 9 – 3c2
fi 2c1 = 9 + 3
fi c1 = 6
Equation (10.15) fi c3 = 3 – c1 – c2
=3–6+1
fi c3 = –2
\ The unique solution is an = 6 (1 n ) – 2n – 2 (–1)n.

Example Find an explicit formula for the Fibonacci numbers.


Solution The Fibonacci numbers are 0, 1, 1, 2, 3, 5, 8, 13, ... . The recurrence relation corresponding
to the Fibonacci sequence {Fn}, n ≥ 0, is
Fn = Fn–1 + Fn–2, n ≥ 2, with the initial conditions F0 = 0, F1 = 1.
The characteristic equation of the recurrence relation is r2 – r – 1 = 0.
1± 5
Solving it, we have r =
2
Hence, the solution of the recurrence relation is
n
Ê1 + 5 ˆ Ê1– 5 ˆ
n

Fn = c1 Á ˜ + c2 ÁË 2 ˜¯
Ë 2 ¯
where c1 and c2 are arbitrary constants.
Initial conditions are F0 = 0 and F1 = 1.
Now, F0 = 0 fi c1 + c2 = 0
And F = 1 fi c Ê 1 + 5 ˆ + c Ê1– 5 ˆ = 1
1 1Á ˜ 2Á ˜
Ë 2 ¯ Ë 2 ¯
Solving Eqs (10.21) and (10.22):
Equation (10.21) fi c1 = – c2.
\ Equation (10.22) fi c ÈÊ1 – 5 ˆ – Ê 1 + 5 ˆ˘ = 1
2 ÍÁ 2 ˜ Á 2 ˜˙
ÍÎË ¯ Ë ¯ ˙˚
fi c2 È – 5 ˘ = 1
Î ˚
–1
fi c2 =
5
Using this in Eq. (10.21), we get
1
1
c=
5
The solution is
n n
1 Ê1 + 5 ˆ 1 Ê1 – 5 ˆ
Fn = Á ˜ – Á ˜ ,n≥ 0
5 Ë 2 ¯ 5 Ë 2 ¯

Example The Lucas numbers satisfy the recurrence relation L n= L n–1 + L n–2 and the initial
conditions L0 = 2 and L1 = 1.
(i) Show that L n = Fn–1 + Fn–2 for n = 2, 3, ..., where Fn is the nth Fibonacci number.
(ii) Find an explicit formula for the Lucas numbers.
Solution (i) Let Sn be the statement
Ln = Fn–1 + Fn+1 for n = 2, 3, ... .
We shall prove this by using the principle of mathematical induction.
Basic step: S2 is shown to be true. That is, we need to prove
L2 = F1 + F3.
By the definition of Lucas number, we can write
L2 = L1 + L0
= 1 + 2, since L0 = 2, L1 = 1
=3
R.H.S. S2 = F1 + F3
= 1 + 2, since from the Fibonacci number 0 (F0) 1 (F1) 1 (F2) 2 (F3) 3 (F4) …
=3
fi L2 = F1 + F3
Hence, S2 is true.
Inductive step: We assume that Sk is true for every k £ n.
fi Lk = Fk –1 + Fk +1 is true for every k = n.
We need to prove that Sk +1 is true. That is, we need to prove
Lk + 1 = Fk + Fk + 2.
Now, by the definition of Lucas numbers
Lk+1 = Lk + Lk–1
= (Fk –1 + Fk +1) + (Fk –2 + Fk ) [by our assumption]
= (Fk –1 + Fk –2) + (Fk +1 + Fk )
= Fk + Fk +2 [by the definition of Fibonacci numbers]
i.e, Sk +1 is true.
Hence, by the principle of mathematical induction,
Sn is true for every n.
(ii) The given recurrence relation is
Ln – Ln–1 – Ln–2 = 0
The corresponding characteristic equation is
r2 – r – 1 = 0

1± 5
fi r=
2
1+ 5 1– 5
Let r1 = and r2 =
2 2
Therefore, the solution is
n
Ê 1+ 5ˆ n
Ê 1– 5 ˆ
Ln = c1 Á + c ˜
Ë 2 ˜¯

Ë 2 ¯
where c1 and c2 are constants.
Initial conditions are L0 = 2, L1 = 1.
Now, L0 = 2 fi c1 + c2 = 2
L = 1 fi c Ê 1 + 5 ˆ + c Ê 1– 5 ˆ = 1
1 1Á ˜ 2Á ˜
Ë 2 ¯ Ë 2 ¯
Solving Eqs (10.24) and (10.25), we get
a1 = 1 and a2 = 1
Hence, the unique solution is
n n
Ê1 + 5 ˆ Ê1– 5 ˆ
Ln = Á + ˜
Ë 2 ˜¯ ÁË 2 ¯

Example Solve the recurrence relation


an = 2an–1 – 2an–2, a0 = 1, a1 = 2.
Solution The given recurrence relation is an – 2an–1 + 2an–2 = 0.
Its characteristic equation is r2 – 2r + 2 = 0
2± 4–8
fi r=
2
=1±i
The modulus–amplitude form of
1 ± i = 2 Ê cos p ± sin pˆ
ËÁ 4 4 ˜¯
\ The general solution of the recurrence relation is
nÊ np npˆ
a = c cos ± c sin
2
n ( ) ÁË1
4 2 ˜
4 ¯
where c1 and c2 are constants.
Given that a0 = 1 and a1 = 2.
Now, a0 = 1 fi c1 ± 0 = 1
fi c1 = 1.
Also, a1 = 2 fi ( 2) ) Ê c cos p + sin
pˆ = 2
c
ÁË 1 ˜
4 ¯
2
4
È 1 1˘
fi 2 c +c =2
Í1 2 2 ˙
Î 2 ˚
fi c1 + c2 = 2
fi c2 = 1.
\ The required solution is
a= ( 2 ) Ê cos np + sin npˆ
n ÁË
˜
4 4 ¯
Solution of Non-homogeneous Recurrence Relation or Inhomogeneous
Recurrence Relation
A linear inhomogeneous or non-homogeneous recurrence relation with constant coefficients of degree
k is a recurrence relation of the form
an = c1an –1 + c2an –2 + ◊◊◊ + ckan – k + G (n), where c1, c2, ..., ck are real numbers and G (n) is a
function not identically zero depending only on n.
Algorithm for solving non-homogeneous finite-order linear recurrence relation To solve the
recurrence relation
an = c1an–1 + c2an–2 + ◊◊◊ + ckan–k = G (n)
or
S (k) = c1S (k – 1) + c2S (k – 2) + ◊◊◊ + cnS (k – n) = g (k),
we have to adopt the following procedure.
Step 1. We obtain the homogeneous solution.
First, we write the associated homogeneous recurrence relation, namely G (n) = 0
i.e., an + c1an –1 + c2an–2 + ◊◊◊ + cnan – k = 0
Then, we find its general solution, which is called the homogeneous solution.
Step 2. We obtain the particular solution.
There is no general procedure for finding the particular solution of a recurrence relation.
However, if G (n) has any one of the following forms
(i) polynomial in n
(ii) a constant
(iii) powers of constant
then we may guess the forms of the particular solution and exactly find out by the method of undeter-
mined coefficients.
Particular solution for given G(n) Table 10.2 shows the particular solution for given G (n).

Table Particular solution for given G (n)


S. No. G (n) Form of particular solution
(i) A constant, c A constant, d
(ii) A linear function c0 + c1n A linear function d0 + d1k
N d0 + d1k
(iii) n2 d0 + d1k + d2k2
(iv) An mth degree polynomial th
An m degree polynomial

c0 + c1n + c2n2+ ◊◊◊ + cmnm d0 + d1k + d2k2 + ◊◊◊ + dmkm


(v) rn, r ΠR drn

Step 3. We substitute the guess from Step 2 into the recurrence relation. If the guess is correct, then
we can determine the unknown coefficient of the guess. If we are not able to determine the
constants, then our guess is wrong and hence we go to Step 2.
Step 4. The general solution of the recurrence relation is the sum of the homogeneous and particu-
lar solutions.
Step 10. If no initial conditions are given, then Step 4 will give the solution.
If n initial conditions are given, then we get n equations with n unknowns. Solving the system, we
get a complete solution.

Example Solve the recurrence relation a n = 3an – 1+2n, a0 = 1


Solution The inhomogeneous recurrence relation is
an – 3an–1 = 2n
(i) The associated homogeneous equation is
an – 3an–1 = 0
Its characteristic equation is
r–3=0
fir = 3
\ The homogeneous solution is
an (H) = c1 3n
(ii) Since the R.H.S. of the recurrence relation is 2n and 2 is not the characteristic root, let the
particular solution of the recurrence relation be
an = d2n
Using this equation in the given recurrence relation, we get
d2n– 3d2n – 1 = 2n
3
fi d– d =1
2
fi 2d – 3d = 2
fi d = –2
\ an(P) = –2 (2)n = –2n + 1
Hence, the general solution is
an = an(H ) + a (P)
n
fi an = c13n – 2n + 1
Using the condition a0 = 1, we get
a0 = c130 –21 = 1
fi c1 – 2 = 1
fi c1 = 3
\ The required solution is an = 3 (3n) – 2n + 1
i.e., an = 3n + 1 –2 n + 1
Example Solve the recurrence relation a n= 2an–1 +2n, a0 = 2.
Solution The given recurrence relation is
an – 2an–1 = 2n
(i) The associated homogeneous equation is an – 2an–1 = 0.
The characteristic equation is
r–2=0
fir = 2
\ The homogeneous solution is an(H ) = c12n.
(ii) Since the R.H.S. of the recurrence relation is 2n and 2 is the characteristic root, let an =
dn2n be a particular solution of the recurrence relation.
Using this equation in the given recurrence relation, we get
dn2n – 2d (n – 1) 2n–1 =2n
fi dn2n – d (n – 1)2 n –1 = 2n
fi d [n – (n – 1)] = 1
fid = 1
( P)
a n = n2n
Hence, the general solution is
an = a(Hn) + a( P)N
fi an = c12n + n2n
Given that a0 = 2,
\ c120 + 0 = 2
fic = 2
Therefore, the required solution is
an 2 (2n) + n2n
fi an (2 + n) + n2n

Example Solve the recurrence relation a n– 2an – 1 + an – 2 = 2, with a0 = 25, a1 = 16.


Solution The given recurrence relation is
an – 2an –1 + an–2 = 2
(i) The associated homogeneous equation is an – 2an – 1 + an – 2 = 0
Its characteristic equation is r2 – 2r + 1= 0
fi (r – 1)2 = 0
fi r = 1, 1.
\ The homogeneous solution is
a(Hn ) = (c1 + c2n)1n
(ii) Since the R.H.S. of the recurrence relation is 2, a constant, we assume the particular solu-
tion of the recurrence to be
a(Hn ) = d, a constant.
Using this solution in the given recurrence relation, we get
d – 2d + d = 2
i.e., 0 = 2, which is impossible.
Thus, our assumption is wrong.
Now, we assume that a(n p) = nd
Using this solution in the given recurrence relation, we get
nd – 2 (n – 1) d + (n – 2) d = 2
fi nd – 2nd + nd + 2d – 2d = 2
fi 0 = 2, which is also impossible.
Thus, our assumption is wrong.
Now, we assume that a(H k
)
= n2d
Using this solution in the given recurrence relation, we get
n2d – 2 (n – 1)2 d + (n – 2)2 d = 2
fi n2d – 2 (n2 – 2n + 1) d + (n2 – 4n + 4) d = 2
fi n2 – 2n2d + 4nd – 2d + n2d – 4nd + 4d = 2
fid=1
\ a( np) = n2
Hence, the general solution is
an = a(Hn) + a( p)n
fi an = [c1 + c2n]1n + n2
Given a0 = 25 and a1 = 16.
Now, a0 = 25
fi [c1 + 0] + 0 = 25
fi c1 = 25
Also, a1 = 16
fi (c1 + c2) + 12 = 16
fi c1 + c2 + 1 = 16
fi c2 = 16 – 1 – 25
= –10
\ The required solution is
an = (25 – 10n) 1n +n2
fi an = n2 – 10n + 25

Example Solve the recurrence relation


ak – 7ak –1 + 10ak –2 = 6 + 8k, a0 = 1, a1 = 2

or solve
S (k) – 7S (k – 1) + 10S (k – 2) = 6 + 8k, S (0) = 1, S (1) = 2.
Solution The given recurrence relation is
ak – 7ak –1 + 10ak –2 = 6 + 8k
(i) The associated homogeneous equation is
ak – 7ak –1 + 10ak –2 = 0
Its characteristic equation is
r2 – 7r + 10 = 0
fi (r – 5) (r – 2) = 0
fi r = 2, 5
Therefore, the homogeneous solution is
k k
a (H) = c 2 + c 5
k 1 2

(ii) We need to find the particular solution,


let a k(P) = d0 + d1k, since the R.H.S. is a linear polynomial.
Using this solution in the given recurrence relation, we get
(d0 + d1k) – 7 [d0 + d1 (k – 1)] + 10 [d0 + d1 (k – 2)] = 6 + 8k
fi (d0 – 7d0 + 10d0) + d1 [k – 7 (k – 1) + 10 (k – 2)] = 6 + 8k
fi 4d0 + d1 [k – 7k + 7 + 10k – 20)]= 6 + 8k
fi (4d0 – 13d1) + 4d1k = 6 + 8k
Equating the corresponding coefficients on both sides, we get
4d0 – 13d1 = 6 and 4d1 = 8
494 Mathematical Foundation for Computer Science

Now, 4d1 = 8 fi d1 = 2
fi 4d0 = 6 + 13 (2)
fi d0 = 8
fi a(P)
k
= 8 + 2k
Thus, the general solution is ak = a (H ) = a (P)
k k

fi ak = c12 + c25 + 8 + 2k
k k

Given that, a0 = 1, a1 = 2
Now, a0 1 fi c1 + c2 + 8 = 1
fi c1 + c2 + 8 = – 7
Also, a1 = 2 fi c12 + c25 + 8 + 2 = 2a
fi 2c1 + 5c2 = – 8
Solving Eqs (10.35) and (10.36), we get
c1 = – 9 and c2 = 2
\ The required solution is
ak = – 9 (2k ) + 2 (5k ) + 8 + 2k

Example Solve the recurrence relation


an = 4an –1 – 4an –2 + (n + 1) 2n
Solution The given recurrence relation is
an = 4an – 1 – 4an – 2 + (n + 1)2n
(i) The associated homogeneous equation is
an – 4an –1 + 4an –2 = 0
Its characteristic equation is
r2 – 4r + 4 = 0
i.e., (r – 2)2 = 0
fi r = 2, 2
\ The homogeneous solution is
a(Hn ) = (c1 + c2n)2n
(ii) Since the R.H.S. of the recurrence relation is (n + 1)2n and 2, 2 is the characteristic root of
the equation (i.e., 2 is repeated twice), we assume the particular solution of the recurrence
relation to be
an(P) = (c1 + c2n)n22n
Using this solution in the given recurrence relation, we have
(c1 + c2n) n22n– 4 [c + c2 (n –1)] (n – 1)2 2n–1 + 4 [c1 + c2 (n – 2)] (n – 2)2 2n–2 = (n + 1)2n
fi 4 (c1 + c2n)n2– 8 (n – 1)2 [c1 + c2 (n – 1)] + 4 (n – 2)2 [c1 + c2 (n – 2)] = 4 (n + 1)
fi 4 (c1 + c2n)n2– 8 (n2 – 2n + 1) [c1 + c2 (n – 1)] + 4 (n2 – 4n + 4) [c1 + c2 (n – 2)]
= 4 (n + 1)10.38)
Putting, n = 0, we get
–8 (c1– c2) + 16 (c1 2c2) = 4
fi 8c1 – 24c2 = 4
1
fi c1 – 3c2 =
2
Equating the coefficients of n on both sides of Eq. (10.38), we get
16c1 – 16c2 – 8c2 – 16c1 + 32c2 + 16c2 = 4
fi 24c2 = 4

fi c2 = 1
6
Therefore, Eq. (10.39) gives
1 1
c = +
1
2 2
fi c1 = 1
Ê 1 ˆ
\ a (P) = 1 + n n22n
n ÁË 6 ˜¯
Ê 2 n3 ˆ n
=Á n + ˜ 2
Ë 6 ¯
Thus, the general solution of the recurrence relation is
an = a (nH ) + a(nP)
È n3 ˘
fi an = Íc1 + c2n + n2 + ˙ 2n
Î 6 ˚

Example Solve the recurrence relation a n= 4an – 1 – 4an – 2 + 3n + 2n, a0 = 1, a1 = 1.


Solution The given recurrence relation is
an – 4a1n0–.140–)4an –2 = 3n + 2 n
(i) The associated homogeneous equation is
an – 4an – 1 – 4an – 2 = 0
Its characteristic equation is r 2 – 4r + 4 = 0
fi (r – 2)2 = 0
fi r = 2, 2
Thus, the homogeneous solution is
a (Hn ) = (c1 + c2n)2n
(ii) R.H.S. = 3n + 2n
) )
Particular solution = a(P1 + a ( P2
n n

Since part of the R.H.S. is 3n, i.e., a linear polynomial,


)
let a (P1 = d + d n
n 0 1
Using this solution in the recurrence relation, we get
(d0 + d1n) – 4 {d0 + d1 (n – 1)} + 4 {d0 + d1 (n – 2)} = 3n
fi (d0 – 4d0 + 4d0) + d1 [n – 4(n – 1) + 4 (n – 2)] = 3n
fi (d0– 4d1) + d1n = 3n
Equating the coefficients of n on both sides, we get
d1 = 3
Equating the constant terms on both sides, we get
d0 – 4d1 = 0
fi d0 = 12
Therefore, particular solution corresponding to 3n is
an( p1 ) = 12 + 3n
Since part of the R.H.S. is 2n and 2 is the double root of the characteristic equation, let us
assume the particular solution to be a pn2 = dn22n
Using this solution in the given recurrence relation, we get
dn22n – 4d (n – 1)2 2n–1 + 4d (n – 2)2 2n–2 = 2n
fi 4dn2 – 8d (n – 1)2 + 4d (n – 2)2 = 4
fi dn2 – 2d (n – 1)2 + d (n – 2)2 = 1
fi dn2 – 2d (n2 – 2n + 1) + d (n2 – 4n + 4) = 1
Putting n = 0, we get
– 2d + 4d = 1
fi d = 1/2
Therefore, the particular solution corresponding to 2n is
( P2 ) 1
an = n22n
2
= n22n 1
Therefore, the particular solution is
(P1 ) ( P2 )
aPn = a n + a n

= 12 + 3n + n22n–1
Hence, the general solution is
an (c1 + c2n)2n + 12 + 3n + n22n – 1
Given that a0 = 1, a1 = 1
a0 = 1 fi c1 + 12 = 1
fi c1 = –11
Also, a1 = –1 fi (c1 + c2) 2 + 12 + 3 + 22 = 1
fi 2c1 + 2c2 = – 18
fi c1 + c2 = – 9
fi c2 = – 9 – (–11) = 2
fi c2 = 2
Thus, the required solution is
an = (2n – 11) 2n + 12 + 3n + n2 2n +1

Example For what values of constants A and B is a k = Ak + B a solution of the recurrence


relation ak = 2ak –1 + k + 10.
Solution The given recurrence relation is ak = 2ak – 1 + k + 10.
Now, ak = Ak + B is a solution of Eq. (10.44) if it satisfies the recurrence relation.
fi 2a k– 1 + k + 5 = 2 [A (k – 1) + B ] + k + 5
= (2A + 1) k + 2(B – A) + 5
= Ak + B, when A = ( 2A + 1) and 2(B – A ) + 5 = B
When A = –1 and B = –7, the above relation holds true
Thus, for A = –1 and B = –7, ak = Ak + B is one of the solutions.

EXERCISES
Determine which of these equations are linear Solve the recurrence relation a n = 6an –1 –
homogeneous recurrence relations with con- 11an –2 + 6an –3, a0 = 2, a1 = 5 and a2 = 110.
stant coefficients and find their degree. Solve a n + 3an – 1 + 3an – 2 + an – 3 = 0, a0 = 1, a1

ak -1 = – 2 and a2 = – 1.
(a) ak = a2k -1 (b) ak = k Solve a n – an – 1 – 6an – 2 = – 30, with a0 = 20
and a1 = – 5
(c) ak = ak–1 + ak–2 + k +3 Solve the recurrence relation a n – 3an – 1 –
(d) ak = 4 ak – 2 + 5ak – 4 + 9ak–7 4an – 2 = 4n.
Solve the recurrence relation a n = an-2 for Solve the recurrence relation a – 6a +
4 n+2 n+1
n ≥ 2, a0 = 1, a1= 0. 9an = 3(2n) + 7(3n), n ≥ 0. a0 = 1, a1 = 4.
Solve the recurrence relation a n = 7an–2 + 6an–3, Solve the recurrence relation a n = 4an – 1 – 3an – 2
a0 = 9, a1 = 10, a2 = 32. + 2n + n + 3, with a0 = 1, a1 = 4.
Find the solution to a n = 5an –2 – 4an – 4, with What is the general form of the solutions of a
a0 = 3, a1 = 2, a2 = 6 and a3 = 8. linear homogeneous recurrence relation if its
Solve the recurrence relation a n = 6an–1 –9an–2, characteristic equation has the roots 1, 1, 1, 1,
a0 = 1, a1 = 6. –2, –2, –2, 3, 3, – 4?
GENERATING FUNCTIONS

Introduction
Many counting problems can be solved by using generating functions. A generating function is a
powerful tool that can be used for solving recurrence relations by translating the terms of a sequence
of a recurrence relation into an equation involving generating function. The generating function of a
sequence a0, a1, a2, ... of real numbers is written as the series given below:
μ

G (z) = a0 + a1z + a2z2 + ◊◊◊ + anzn + ◊◊◊ =  an zn


n=0

Example Find the generating function for the sequence 2, 2, 2, 2, 2, 2.


Solution The generating function for the sequence 2, 2, 2, 2, 2, 2 is
G (z) = 2 + 2z + 2z2 + 2z3 + 2z4 + 2z5

Example Find the generating function for the sequence 1, 2, 3, 4, ... .


or
Find the generating function for the sequence {an}, with an = n + 1.
μ

Solution The generating function for the sequence 1, 2, 3, ... is G (z) = Â (n +1)zn
n= 0
= 1 + 2z + 3z2 + 4z3 + ...
1
= = (1 – z)–2
(1- z)2

Example Find the generating function for the sequence 1, 3, 32, 33, ... .
or
Find the generating function for the sequence {an}, with an = 3n.
Solution Its generating function is G(x) = 1 + 3z + 32z2 + 33z3 + ◊◊◊
μ

= Â 3n zn
n= 0

Note The generating function of a sequence a 0, a1, a2, ... is also denoted by a0, a1, a2,... .

Example Find the generating function for the sequence 5, 3,- 4, - 2, 0,1 .
Solution Its generating function is written as
G (z) = 5 + 3z – 4z2 – 2z3 + 0z4 + 1z5
= 5 + 3z – 4z2 – 2z3 + z5
Closed Form Expressions for Generating Functions
Closed form expression for a generating function is defined as an expression of the form
a + ar + ar2 + ....

Example Find the closed form expression of the generating function for the sequence 1, a, a2,
...
Solution The closed expression of the generating function of the given sequence may be written as
G (z) = 1 + az + a2z2 + a3z3 + ... .
= 1 + az + (az)2 + (az)3+ ... .
= (1 – az)–1
1
= , when |az| < 1
1 - az
1 1
fi G (z) = , when | z| < for a π 0.
1 - az a

Example Find the closed form expression of the generating function for the Fibonacci se-
quence defined by
Fn = Fn–1 + F n–2, n ³ 2, F0 = 0, F1 = 1
Solution The generating function of a Fibonacci sequence {Fn} is given by
F (z) = F0μ + F1z + F2 z2 + F3z3 + ◊◊◊

= Â Fnz
n

n =0

Given that Fn = Fn –1 + F n – 2, n ≥ 2
Multiplying both sides of Eq. (10.46) by zn and summing over all n ≥ 2, we get
• • •

 Fnzn =  Fn -1zn +  Fn - 2 zn
n≥ 0 n≥0 n≥0

fi  Fnz = z F z n -1 + z 2 F z n - 2
n

n≥2
 n -1  n- 2
n≥ 2 n≥2

fi F (z) – F0 – F1 z = z [F (z) – F0] + z 2 F (z)


fi F (z) – 0 – z = z [F (z) – 0] + z2 F(z), since F0 = 0, F1 = 1
fi [1 – z – z 2]F (z) = z
z
fi F (z) =
1- z z 2
This is the required closed form expression of the generating function.
The closed form expressions of the generating functions for some sequences are shown in Table 10.3.
Table Closed form expressions of generating functions
S. No. Sequence {ak} Generating function G(z)

ak 1
1.
1- az

2. bak b
1- az
3. bkak abz
(1- az)2

4. 1 1
1- z
5. k+1 1
(1- z)2
1
6. ez
k!
(–1)k+1 x 2 x3 x 4
7. log (1 + x) = x – + - +....
k 2 3 4
8. nCk (1 + x)n
k
9. nCka (1 + ax)n
1
10. (n + k – 1)Ck = (n + k – 1)C(n–1)
(1 – x )n

11. (– 1)k (n + k – 1)Ck = (– 1)k(n + k – 1)C(n–1) 1


(1 – x)n

Properties of Generating Functions


Consider the generating functions G (z) and F (z). Let {an} and {bn} be two sequences with n ≥ 0 . The
corresponding generating functions may be written as G (z) and F (z) such that
μ μ
G (z) =
 an z n
and F(z) = Â bn zn
n= 0 n= 0
(i) Uniqueness
G (z) = F (z) if and only if an = bn for all n.
(ii) The sum of two generating functions is a generating function.
Proof Property (ii) can be proved as follows:
• •
G(z) + F(z) =
 an zn +
 bn zn
n= 0 n= 0

= Â (an + bn )z n
n= 0

= Â cn zn where cn = an + bn
n= 0

= H (z)
Hence, the proof.
(iii) The scalar product of any generating function is a generating function, i.e., if l is any scalar,
then l G (z) is a generating function.
Proof We can prove property •
(iii) as given below.
l.G (z) = l
 n
anz
n=0

= Â (lan ) zn
=0
n•

where cn = l an
= Â cn z n
n= 0

= H (z)
Hence, the proof.
(iv) The product of two generating functions is again a generating function.
(v) If p ≥ 1, then z p G (z) is a generating function.
(vi) Differentiation:

Let G (z) = a0 + a1z + a2 + ... = Â an z n


z2
n= 0

G1(z) = a1 + 2a2z + 3a3 +... = Â nanzn-1
z2
n=0

G11(z) = Â n (n - 1) anz n-2
n= 0

#
Continuing in this way, we get

 n (n - 1) anz n-2 ◊◊◊ (n – k + 1) an z


n– k
G(k) (z) =
n=0

Solution of Recurrence Relation Using Generating Function


We can solve recurrence relations using generating functions as illustrated in the following examples:

Example Use generating functions to solve the recurrence relation a n = 3an –1 + 2, n ≥ 1 with
a0 = 1.

Solution Let the generating function of the sequence {an} be G (z) = Â an z n
n= 0
1 2
\ G (z) = +
1 - 3z 1 - z
Given recurrence relation is an = 3an –1 + 2.
Multiplying both sides of Eq. (10.48) by zn and summing over all n ≥ 1, we have

 an z n = 3  an-1 z n + 2  z n
n≥1 n≥1 n≥1

= 3 z  an-1 z n-1 + 2z  z n –1
n≥1 n≥1
fi G (z) – a0 = 3 zG (z) + 2z [1 + z + z2 + ◊◊◊]
2z
fi (1 – 3 z) G (z) = [since a0 = 1 and [1 + z + z2 + ◊◊◊] = (1 – z)–1]
(1 - z)
1+ z
fi (1 – 3z) G (z) =
1 -z
(1+ z)
fi G (z) =
(1 - z)(1 - 3z)
(1+ z) A B
Let = +
(1 - z)(1 - 3z) (1 - z) (1 - 3z)
Equating the numerators on both sides, we get
(1 + z) = A (1 – 3 z) + B (1 – z)
fi A = –1
and B = 2
2 1
\ G (z) = –
(1 - 3z) (1 - z)
Therefore, the required solution is an = 2 (3n) –1.
Example Use the method of generating function to solve the following recurrence relation:
an – 2an–1 – 3an–2 = 0, n ≥ 2 with a0 = 3 a1 = 1
Solution Let the generating function of the sequence {an} be G (z).

\ G (z) = Â an zn
n= 0

The given recurrence relation is an – 2an–1 – 3an– 2 = 0.


Multiplying both sides of Eq. (10.50) by zn and adding the sum over all n ≥ 2, we get

 an zn – 2  an-1zn –3  an-2 z n = 0
n≥2 n≥2 n≥2
fi  an z n – 2z  an-1zn-1 –3z 2  an-2 zn-2 = 0
n≥2 n≥2 n≥2

fi [G(z) – a0 – a1z] –2z [G(z) – a0] –3z2 G ( z) = 0


fi (1 – 2z – 3z2) G (z) – 3 – z – 2z (–3) = 0 [given that a0 = 3, a1 = 1]
fi (1 – 2z – 3z2) G (z) = 3 – 5z
(3 - 5z)
fi G(z) =
(1 - 2z - 3z2)
(3 - 5z)
=
(1 - 3z)(1 + 3z)
(3 - 5z) A B
Let = +
(1 - 3z)(1 + z) (1 - 3z) 1+ z
Equating the numerators on both sides, we get
3 – 5z = A (1 + z) + B (1 – 3z)
From this, we get A = 1 and B = 2
1 2
\ G(z) = +
1 + 3z 1+ z
= 1(3 ) + 2(–1)n
n

Thus, the required solution is an = 1 (3n) + 2 (– 1)n.

Example Use the method of generating function to solve the recurrence relation
an = 4an–1 – 4an–2 + 4n, n ≥ 2, given that a0 = 2 and a1 = 8.
Solution Let the generating function of {an} be G (z).

\ G(z) = Â an z n
n= 0
The given recurrence relation is an = 4 an –1 – 4an–2 + 4n
Multiplying both sides of Eq. (10.52) by zn and summing over all n ≥ 2, we have

 an zn = 4  an-1z n – 4  an-2 zn +  4n z n
n≥2 n≥2 n≥2 n≥2

= 4z  an-1zn-1 – 4z  n-2
n-2
fi  an z n 2 a z
n≥2
+ Â 4n z n
n≥2 n≥2 n≥2

fi [G (z) – a0 – a1z] – 4z [G(z) – a0] – 4z2 G(z) + Â(4z)n = 0


n=2

fi (G (z) – 4z + 4z2) G (z) = 2 + 8z + 8z + (1 – 4z) –1 –1– 4z


• 1
Â(4z)
[since a0 = 2, , a1 = 8 and n = ]
n=2
(1 - 4z)
1
fi (1 – 4z + 4z2) G (z) = + 1 – 4z
(1 - 4z)

1 + (1 - 4z)2
fi G(z) =
(1 - 4z)(1 - 2z)2
To split this, we use the partial fraction technique.
1 + (1 - 4z)2 A B C
Let = + +
(1 - 4z)(1 - 2z) 2 (1 - 4z) 1 - 2z (1 - 2z) 2
Equating the numerators on both sides, we get
1 + (1 – 4z)2 = A (1 – 2z)2 + B (1 – 4z) (1 – 2z) + C (1 – 4z)
Substituting z = ½, z = ¼ and z = 0, we get C = –2, A = 4 and B = 0.
4
\ G (z) = +0–
2
1 - 4z (1 - 2z) 2
= 4 (1 – 4z)–1 – 2 (1 – 2z)–2
= 4 [1 + 4z + (4z)2 +◊◊◊+ (4z)n +◊◊◊ – •
– 2 [1 + 2 (2 z) + 3 (2 z)2 + ◊◊◊ + (n + 1) (2n) n + ◊◊◊]
Thus, the required solution is
an = 4(4n) –2 (n +1)2n
fi an = 4n–1– (n +1)2 n+1

Example Use the method of generating function to solve the recurrence relation a n =
an –1 + 2 (n –1) with a0 = 3, n ≥ 1.
Solution Let the generating function for the sequence {an} be given by G (z),

\ G (z) = Â an zn
n= 0

The given recurrence relation is an = an –1 + 2n –2, n ≥ 1.


Multiplying both sides of Eq. (10.54) by zn and summing over all n ≥ 1, we get

 an zn =  an-1zn + Â(2n - 2) zn
n ≥1 n≥1 n≥1

fi  a nzn = z  + 2  nz n – 2  z n
n-1
an-1z
n≥1 n ≥1 n≥1 n≥1

fi [G (z) – a0] = zG (z) + 2 [z + 2z2 + 3z3 + ◊◊◊ + (n + 1) zn + 1+ ◊◊◊] –2[z + z2 + z3 + ◊◊◊]


fi (1 – z) G (z) = 3 + 2 z [1 + 2z + 3z2 + ◊◊◊ + (n + 1) zn + ◊◊◊ ] – 2 [(1 – z)–1 –1
2
= 3 + 2z (1 – z )–2 – +2
1- z
2z 2
=5+ –
(1- z)2 1- z
5 2 – 2z
fi G (z) = – (1 - z)3
(1 - z) (1 - z)2
G (z) = 5 [1 + z + z2 + ◊◊◊ + zn] – 2 [1 + 2z + 3z2 + ◊◊◊ +(n + 1) zn] + 2 z [1 ¥ 2 + 2 ¥ 3 ¥ z + 3 ¥ 4z2 + ◊◊◊ +
(n + 1 ) (n + 2 ) zn + ◊◊◊]
Therefore, the required solution is written as
an = 5(1n) –2(n + 1) + 2n (n +1)
= 5 – 2n – 2 +2n2 + 2n
= 2n2 + 3

Example Use the generating function to solve the recurrence relation a n = 4an –1 + 3n2
n
,n≥1
with a0 = 4.
Solution Let the generating function of the sequence {an} be G (z).

\ G (z) = Â an zn
n= 0

The given recurrence relation is


an = 4an –1 + 3n2n.
Multiplying both sides of Eq. (10.56) by zn and adding the sum over all n ≥ 1, we get

 anzn = 4  an-1zn + 3  n2n zn


n ≥1 n ≥1 n ≥1

fi  anzn = 4z  an-1zn-1 + 3  n(2z)n


n ≥1 n ≥1 n ≥1
μ

fi [G (z) – a0] = 4z G (z) + 3 Â n(2z)n


n =1

μ
fi (1 – 4z) G (z) – 4 = 3 (2z)
Â
n =1
n(2z)n-1 (since a0 = 4)

= 6 z (1 – 2z)–2
4 6z
fi G (z) = +
(1 - 4z) (1 - 4z)(1 - 2z)2
6z 4 B C
Let = + +
(1 - 4z)(1 - 2z) 2 (1 - 4z) (1 - 2z) (1 - 2z) 2
Equating the numerators on both sides, we get
6 z = A (1 – 2z)2 + B (1 – 4z) (1 – 2z) + C (1 – 4z).
Substituting z = ½, z = ¼ and z = 0 successively, we get
C = –3, A = 6 and B = –3
Eq. (10.56) becomes
10 3
G (z) = – – 3
(1 - 4z) (1 - 2z) (1 - 2z) 2
• • • •
n n n

fi  an zn = 10  (4z) – 3  (2z) – 3  (n + 1)(2z)


n= 0 n= 0 n= 0
n= 0

Equating the coefficients of zn on both sides, we get


an = 10 (4n) – 3 (2n) – (n + 1)2n
= 10(4n) – (3n + 6) 2n
This is the required solution.

2, n ≥ 0.
Example Use the generating function to solve the recurrence relation a n+2 – 4an = 9n

Solution Let the generating function of the sequence {an } be G (z).



\ G (z) = Â an zn
n= 0

The given recurrence relation is an+2 – 4an = 9n2


Multiplying both sides of Eq. (10.59) by zn and adding the sum over all n ≥ 0, we get
 an+2 zn – 4  a zn = 9  n2 znn
n≥ 0 n≥ 0 n≥ 0

fi 1 [G(z) – a0 – a1z] – 4 G(z) = 9 Â [n (n + 1) - n]zn


z2 n≥0
1
È 1 ˘ G (z) = [a + a z] + 9 [1(2z) + 2 (3z2) + ◊◊◊] –9 [z + 2z2 + 3z2 + ◊◊◊]
fi –4
ÍÎz 2 ˙˚ 0 1
z2
a a
= 0 + 1 + 18z (1 – z)–3 – 9z (1 – z)–2
z2 z
Ê a0 + a1z ˆ 18z3 9z3
fi G (z) = Á ˜+ –
Ë1- 4z 2 ¯ (1- z)3(1- 4z 2 ) (1- z)2(1- 4z 2 )
(a0 + a1z) (9 z3  9 z 4 )
= +
(1 + 2z)(1 - 2z) (1  z )3 (1  2 z ) (1  2 z )
Ê -17 ˆ Ê -1ˆ Ê 27ˆ

A B ÁË 3 ˜¯ 5 -6
ÁË12˜¯ Á ˜
+ Ë4 ¯
= + + + + +
1+ 2z 1- 2z 1- z (1- z) 2
(1- z)3 1+ 2z 1- 2z
(by splitting this according to the partial fraction technique)
k1 k 17 1 5 ¥1 – 6 1
= + 2 – ¥ +
1+ 2z 1- 2z 3 1- z (1- z) 2 (1- z)3
1 1
where k1 = A – and k2 = B –
2 12
• • • • • •
n n n 17 n n n

fi  an z = k1  (-2) z + k2  2n zn –  z + 5  (n + 1)z – 6  (n + 1) (n + 2)z


n= 0 n=0 n= 0
3 n= 0 n=0 n= 0
n
Equating the coefficients of z on both sides, we get
17
a = k (–2)n + k 2n – + 5 (n + 1) – 6 (n + 1) (n + 2)
n 1 2
3
This is the required solution.

EXERCISES
Find the closed form expression for the generat- Using the generating function, solve the
ing function of the following sequences: recurrence relation an = 3an–1 + 1, n ≥ 1, given
(a) an = 9 (5n), n ≥ 0 a0 = 1.
(b) an = 7 (–1)n Use the method of generating function to solve
the recurrence relation an +1 – 8an + 16an –1 = 4n,
Obtain partial fraction decompositions and
identify the sequence having the expression n ≥ 1, a0 = 1 and a1 = 8.
5+ 2z Use the generating function to solve the
1- 4z2 as a generating function. recurrence relation an = 5an –1 – 6an –2, with
initial conditions a0 = 6 and a1 = 30.
Use the generating function to solve the
recurrence relation an – 2an–1 – 3an–2 = 0, n ≥ 2, Use the method of generating function to
solve the recurrence relation ak = 4ak–1 – 4ak–2
with a0 = 3 and a1 = 1.
Using the generating function, solve the + k2, with a0 = 2 and a1 = 10.
difference equation a n+2 – 6an +1 + 5an = 0, Use the generating function to solve the
given y0 = 2 and y1 = 6. recurrence relation an +1 + 4a n + 4an –1 = n –1,
n ≥ 1, with a0 = 0 and a1 = 1.

Вам также может понравиться