0% found this document useful (0 votes)
10 views26 pages

Chapter 4 For IT

Chapter 4 of the Discrete Mathematics document covers advanced counting methods, focusing on the Inclusion-Exclusion Principle, which provides a way to count the number of elements in the union of sets while avoiding overcounting. It includes definitions and examples of the floor and ceiling functions, as well as applications of the Inclusion-Exclusion principle to solve problems involving divisibility. Additionally, it introduces recurrence relations as a method for expressing sequences in terms of previous terms.

Uploaded by

keliman190
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views26 pages

Chapter 4 For IT

Chapter 4 of the Discrete Mathematics document covers advanced counting methods, focusing on the Inclusion-Exclusion Principle, which provides a way to count the number of elements in the union of sets while avoiding overcounting. It includes definitions and examples of the floor and ceiling functions, as well as applications of the Inclusion-Exclusion principle to solve problems involving divisibility. Additionally, it introduces recurrence relations as a method for expressing sequences in terms of previous terms.

Uploaded by

keliman190
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Discrete Mathematics 2182

Chapter 4: Advanced Counting Methods (8 hrs.)

4.1 Inclusion-Exclusion Principle (Subtraction rule)

Definition
When two tasks can be done at the same time we cannot use the sum rule to count the number
of ways to do one of the two tasks. Adding the number of ways to do each task leads to an over
counted, since the ways to do both tasks are counted twice. To correctly count the number of
ways to do one of the two tasks we add the number do each of the two tasks and subtracts the
number of ways to do both tasks. These technique is called principle of inclusive-exclusive.
 Let A and B be two finite sets, then
𝑛(𝐴 ∪ 𝐵) = 𝑛(𝐴) + 𝑛(𝐵) − 𝑛(𝐴 ∩ 𝐵)
 Let A, B, and C be three finite sets then
𝑛(𝐴 ∪ 𝐵 ∪ 𝐶) = 𝑛(𝐴) + 𝑛(𝐵) + 𝑛(𝐶) − 𝑛(𝐴 ∩ 𝐵) − 𝑛(𝐴 ∩ 𝐶) − 𝑛(𝐵 ∩ 𝑐) + 𝑛(𝐴 ∩ 𝐵 ∩ 𝐶)
 Let A, B, C, and D be four finite sets then
𝑛(𝐴 ∪ 𝐵 ∪ 𝐶 ∪ 𝐷) = 𝑛(𝐴) + 𝑛(𝐵) + 𝑛(𝐶) + 𝑛(𝐷) − [𝑛(𝐴 ∩ 𝐵) + 𝑛(𝐴 ∩ 𝐶) +
𝑛(𝐴 ∩ 𝐷) + 𝑛(𝐵 ∩ 𝐶) + 𝑛(𝐵 ∩ 𝐷) + 𝑛(𝐶 ∩ 𝐷)] + [𝑛(𝐴 ∩ 𝐵 ∩ 𝐶) +
𝑛(𝐴 ∩ 𝐵 ∩ 𝐷) + 𝑛(𝐴 ∩ 𝐶 ∩ 𝐷) + 𝑛(𝐵 ∩ 𝐶 ∩ 𝐷)] − 𝑛(𝐴 ∩ 𝐵 ∩ 𝐶 ∩ 𝐷)
Example
1. Let us consider a class in which 20 students study Algebra, 25 students study Probability
and 8 students study both. If asked how many of the students study either Algebra or
Probability?
Solution
Let 𝐴 represent the student’s study of algebra,
Let 𝑃 represent the student’s study of probability
Let 𝐴 ∪ 𝑃 represent the student’s study either algebra or probability.
Let 𝐴 ∩ 𝑃 represent the student’s study both algebra and probability. Then
𝑛(𝐴 ∪ 𝑃) = 𝑛(𝐴) + 𝑛(𝑃) − 𝑛(𝐴 ∩ 𝑃) = 20 + 25 − 8 = 37
Exercise
1. There are 2000 freshman students in your university of there 400are taking a course in
mathematics,500 are taking in a course of computer science and 300 are taking both course,
then how many are taking a course in either mathematics or computer science?
Ans. 𝟔𝟎𝟎
Definition (floor function)

The floor function assigns to the real number 𝑥 the largest integer that is less than or equal to
𝑥. The value of the floor function at 𝑥 is denoted by [𝐱] or ⌊𝐱⌋.

[Date] 1
Discrete Mathematics 2182

Example: What is the values of?


a. ⌊𝟏. 𝟏⌋ ans. 1 d. ⌊𝟑. 𝟒⌋ans. 3
b. ⌊𝟎. 𝟏⌋ ans. 0 e. ⌊𝟒. 𝟗⌋ans.4
c. ⌊𝟐⌋ ans. 2 f. ⌊√𝟐⌋ Ans. 1
Definition (ceiling function)

The ceiling function assigns to the real number 𝑥 the smallest integer that is greater than or
equal to 𝑥. The value of the ceiling function at 𝑥 is denoted by ⌈x⌉.

Example: What is the values of?


a. ⌈1.1⌉ ans. 2 d. ⌈3.4⌉ans. 4
b. ⌈0.1⌉ans. 1 e. ⌈4.9⌉ans.5
c. ⌈2⌉ans. 2 f. ⌈√2⌉ Ans. 2
Exercise: Evaluate the following numerical values.
𝟏 𝟏 𝟏 𝟏
a. ⌈⌊𝟐⌋⌉ ans. 0 d. ⌈⌊𝟐⌋ + ⌈𝟐 ˥ + 𝟐 ˥ ans. 2
𝟑 𝟏 𝟑
b. ⌊⌈𝟐⌉⌋ans .2 e. ⌊𝟐 + ⌈𝟐⌉˩ ans. 2
𝟓
c. ⌊⌈⌊𝟐⌋⌉˩ ans 2
Applications of Inclusive-Exclusive counting principles
1. Find the number of positive integers ≤ 300 and
a. Divisible by 2 or 3.
b. not divisible by 7 or 8
Solution
a. let 𝐴 = {𝑥 ∈ 𝑁: 𝑥 ≤ 300 𝑎𝑛𝑑 𝑑𝑖𝑣𝑖𝑠𝑖𝑏𝑙𝑒 𝑏𝑦 2}
𝐵 = {𝑥 ∈ 𝑁: 𝑥 ≤ 300 𝑎𝑛𝑑 𝑑𝑖𝑣𝑖𝑠𝑖𝑏𝑙𝑒 𝑏𝑦 3}
Then, 𝐴 ∩ 𝐵 consists of positive integers ≤ 300 that are divisible by 2 and 3. That is, divisible
by 6.
Thus, 𝐴 = {2,4,6, … ,300}
𝐵 = {3,6,9, … ,300} And 𝐴 ∩ 𝐵 = {12,18,24, … , 300}
Clearly we can use the floor function
300
𝑛(𝐴) = ⌊ ⌋ = 150
2
300
𝑛(𝐵) = ⌊ ⌋ = 100
3
300
𝑛(𝐴 ∩ 𝐵) = ⌊2×3⌋ = 50

[Date] 2
Discrete Mathematics 2182

By the principle of inclusion-exclusion, we have that


n(A ∪ B) = n(A) + n(B) − n(A ∩ B)
300 300 300
=⌊ ⌋+⌊ ⌋−⌊ ⌋
2 3 6

= 150 + 100 − 50 = 200


Thus, there are 𝟐𝟎𝟎 positive integer’s ≤ 300 and divisible by 2 or 3.
b. let 𝐴 = {𝑥 ∈ 𝑁: 𝑥 ≤ 300 𝑎𝑛𝑑 𝑑𝑖𝑣𝑖𝑠𝑖𝑏𝑙𝑒 𝑏𝑦 7}
𝐵 = {𝑥 ∈ 𝑁: 𝑥 ≤ 300 𝑎𝑛𝑑 𝑑𝑖𝑣𝑖𝑠𝑖𝑏𝑙𝑒 𝑏𝑦 8}
We need to find n(AUB)′ = n(A′ ∩ B′ )
𝑛(𝐴 ∪ 𝐵)′ = 𝑛(𝐴′ ∩ 𝐵 ′ ) = 𝑈 − 𝑛(𝐴 ∪ 𝐵), where U be the universal set.
= 𝑈 −[ n(A) + n(B) − n(A ∩ B)]
= 𝑈 − 𝑛(𝐴) − 𝑛(𝐵) + 𝑛(𝐴 ∩ 𝐵)
300 300 300
= 300 − ⌊
7
⌋ − ⌊ 8 ⌋ + ⌊ 56 ⌋

= 300 − 42 − 37 + 5 = 226
Thus, there are 𝟐𝟐𝟔 positive integer’s ≤ 300 and not divisible by 7 or 8.
2. Find the number of positive integers ≤ 300 and
a. Divisible by at least one of 3, 5, 7?
b. . Divisible by 3 and by 5 but not by 7?
c. Divisible by 5 but by neither 3 nor 7?
Solution
a. let 𝐴 = {𝑥 ∈ 𝑁: 𝑥 ≤ 300 𝑎𝑛𝑑 𝑑𝑖𝑣𝑖𝑠𝑖𝑏𝑙𝑒 𝑏𝑦 3}
𝐵 = {𝑥 ∈ 𝑁: 𝑥 ≤ 300 𝑎𝑛𝑑 𝑑𝑖𝑣𝑖𝑠𝑖𝑏𝑙𝑒 𝑏𝑦 5}
𝐶 = {𝑥 ∈ 𝑁: 𝑥 ≤ 300 𝑎𝑛𝑑 𝑑𝑖𝑣𝑖𝑠𝑖𝑏𝑙𝑒 𝑏𝑦 7}
We are asked to find that 𝑛(𝐴 ∪ 𝐵 ∪ 𝐶) =?
By the principle of inclusion-exclusion, we have that
𝑛(𝐴 ∪ 𝐵 ∪ 𝐶) = 𝑛(𝐴) + 𝑛(𝐵) + 𝑛(𝐶) − 𝑛(𝐴 ∩ 𝐵) − 𝑛(𝐴 ∩ 𝐶) − 𝑛(𝐵 ∩ 𝑐) + 𝑛(𝐴 ∩ 𝐵 ∩ 𝐶)
Clearly we can use the floor function
300 300
𝑛(𝐴) = ⌊ ⌋ = 𝟏𝟎𝟎 𝑛(𝐴 ∩ 𝐶) = ⌊ ⌋ = 𝟏𝟒
3 3×7
300 300
𝑛(𝐵) = ⌊ ⌋ = 𝟔𝟎 𝑛(𝐵 ∩ 𝐶) = ⌊ ⌋=𝟖
5 5×7
300 300
𝑛(𝐶) = ⌊ ⌋ = 𝟒𝟐 𝑛(𝐴 ∩ 𝐵 ∩ 𝐶) = ⌊ ⌋=𝟐
7 3×5×7
300
𝑛(𝐴 ∩ 𝐵) = ⌊3×5⌋ = 𝟐𝟎

[Date] 3
Discrete Mathematics 2182

Therefore,
𝑛(𝐴 ∪ 𝐵 ∪ 𝐶) = 𝑛(𝐴) + 𝑛(𝐵) + 𝑛(𝐶) − 𝑛(𝐴 ∩ 𝐵) − 𝑛(𝐴 ∩ 𝐶) − 𝑛(𝐵 ∩ 𝑐) + 𝑛(𝐴 ∩ 𝐵 ∩ 𝐶)
= 100 + 60 + 42 − 20 − 14 − 8 + 2
= 162
b. it is enough to find
n(A ∩ B)\C)
By the definition of set-minus,
n(A ∩ B)\C = n(A ∩ B) − n(A ∩ B ∪ C)
= 20 − 2 = 18
c. we are asked to find
𝑛(𝐵)\𝑛(𝐴 ∪ 𝐶) = 𝑛(𝐵) − 𝑛(𝐵 ∩ (𝐴 ∪ 𝐶))
By distributing B over the intersection, we get
𝑛(𝐵 ∩ (𝐴 ∪ 𝐶)) = 𝑛(𝐵 ∩ 𝐴) ∪ 𝑛(𝐵 ∩ 𝐶)
= 𝑛(𝐵 ∩ 𝐴) + 𝑛(𝐵 ∩ 𝐶) − 𝑛((𝐵 ∩ 𝐴) ∩ (𝐵 ∩ 𝐶))
= 𝑛(𝐵 ∩ 𝐴) + 𝑛(𝐵 ∩ 𝐶) − 𝑛(𝐴 ∩ 𝐵 ∩ 𝐶)
= 20 + 8 − 2 = 26
So, the answer is 𝑛(𝐵) − 26 = 60 − 26 = 34
Exercise
1. Find the number of positive integer ≤ 2076 and divisible by
a. 3 or 4 c. 2,3or 5 but not 30
b. 3 or 4 but not 12 d. 3, 4 or 5 but not 60
2. Find the number of positive integers ≤ 1976 and divisible by
a. 2 or 3 c. 2,3or 5
b. 3 or 5 d. 3, 5 or 7
3. Find the number of integers between 1 and 500 which are divisible by 2 and 3 but not
divisible by 3 and 7.
4.2 Recurrence Relations

Definition: A recurrence relation for a sequence {𝑎𝑛 }∞


𝑛=0 is an equation that expresses 𝑎𝑛 in

terms of one or more preceding terms 𝑎0 , 𝑎1 , … , 𝑎𝑛−2 , 𝑎𝑛−1 . Moreover, the sequence is called
the solution to the recurrence relation if it satisfies the recurrence relation.

The following are examples of recurrence relations:


𝒂𝒏 = 𝟐𝒂𝒏−𝟏 + 𝟏, 𝒏≥𝟏 (𝟏)
𝒂𝒏 = 𝟓𝒂𝒏−𝟏 − 𝟔𝒂𝒏−𝟐 , 𝒏≥𝟐 (𝟐)
For (1) we would need one initial value to find a particular or single an . For example, if a0 = 1,
then a1 = 3 and a2 = 7.

[Date] 4
Discrete Mathematics 2182

For (2) we would need two initial values to find a particular or single an . For example, if a0 =
1 and a1 = 5 then a3 = 19 and a3 = 65.
Example
1. let {𝑎𝑛 }∞
𝑛=0 be a sequence with a recurrence relation 𝑎𝑛 = 2𝑎𝑛−1 + 3𝑎𝑛−2 where 𝑎0 = 1
and 𝑎1 = 3, then find 𝑎5 and 𝑎8 , (𝑛 ≥ 2)
Solution
𝑎2 = 2𝑎1 + 3𝑎0 = 2(3) + 3(1) = 6 + 3 = 9
𝑎3 = 2𝑎2 + 3𝑎1 = 2(9) + 3(3) = 18 + 9 = 27
𝑎4 = 2𝑎3 + 3𝑎2 = 2(27) + 3(9) = 54 + 27 = 81
𝑎5 = 2𝑎4 + 3𝑎3 = 2(81) + 3(27) = 162 + 81 = 243
𝑎6 = 2𝑎5 + 3𝑎4 = 2(243) + 3(81) = 486 + 243 = 729
𝑎7 = 2𝑎6 + 3𝑎5 = 2(729) + 3(243) = 1,458 + 729 = 2,187
𝑎8 = 2𝑎7 + 3𝑎6 = 2(2,187) + 3(729) = 4,374 + 2,187 = 6,561
2. Verify that the solution of the recurrence relation
a. 𝒂𝒏 = 𝟐𝒂𝒏−𝟏 + 𝟏, 𝒏 ≥ 𝟐 with 𝑎0 = 0 is 𝑎𝑛 = 2𝑛 − 1
b. 𝒂𝒏 = 𝟐𝒂𝒏−𝟏 − 𝒂𝒏−𝟐 , 𝒏 ≥ 𝟐 is 𝑎𝑛 = 3𝑛
c. 𝒂𝒏 = 𝟐𝒂𝒏−𝟏 − 𝒂𝒏−𝟐 , 𝒏 ≥ 𝟐 is not 𝑎𝑛 = 2𝑛
Solution
a. We have to do two things
I. Check that the given formula gives the correct initial value
II. Check that the given formula solves the recurrence relation.
Putting n = 0 in an = 2n − 1 gives a0 = 1 − 1 as required.
To do (II) we evaluate 2an−1 + 1 using the given formula and show that it is equal to 𝑎𝑛
Now 𝑎𝑛−1 = 2𝑛−1 − 1 so
2an−1 + 1 = 2(2𝑛−1 − 1) + 1 = 2𝑛 − 1
Hence, 𝑎𝑛 = 2𝑛 − 1is a solution for the given recurrence relation.
b. 𝑎𝑛−1 = 3(𝑛 − 1) and 𝑎𝑛−2 = 3(𝑛 − 2)
So, 2𝑎𝑛−1 − 𝑎𝑛−2 = 2(3(𝑛 − 1) − 3(𝑛 − 2)
= 2(3𝑛 − 3) − 3𝑛 + 6
= 6𝑛 − 6 − 3𝑛 + 6 = 3𝑛
Hence, 𝑎𝑛 = 3𝑛 is a solution for the given recurrence relation.
c. 𝑎𝑛−1 = 2𝑛−1 and 𝑎𝑛−2 = 2𝑛−2
So, 2𝑎𝑛−1 − 𝑎𝑛−2 = 2(2𝑛−1 ) − 2𝑛−2
= 2𝑛 − 2𝑛 . 2−2
1 3
= 2𝑛 (1 − 4) = 2𝑛 (4)

Hence, 𝑎𝑛 = 2𝑛 is not a solution for the given recurrence relation.

[Date] 5
Discrete Mathematics 2182

Exercise
1. Let 𝑎𝑛 = 2𝑎𝑛−1 + 𝑎𝑛−2 with 𝑎0 = 1 and 𝑎1 = 1, then find 𝑎2 , 𝑎3 , 𝑎4 , and 𝑎5
2. Verify that the solution of the recurrence relation
a. 𝑎𝑛 = 3𝑎𝑛−1 + 1, with 𝑎0 = 4 is 𝑎𝑛 = 4(3)𝑛
b. 𝑎𝑛 = 5𝑎𝑛−1 − 12, with 𝑎0 = 13 is 𝑎𝑛 = 10(5)𝑛 + 3
c. 𝑎𝑛 = 2𝑎𝑛−1 − 1 with 𝑎1 = 3 is 𝑎𝑛 = 2𝑛 + 1
3. A sequence is defined by the recurrence relation 𝑎𝑛+1 = 3𝑎𝑛 + 1 with 𝑎0 = 10, then
find 𝑎1 + 𝑎2 + 𝑎3 ?
4. For the sequence defined by 𝑎𝑛+1 = 3𝑎𝑛 − 2, 𝑎0 = 7 , then what is the value of
𝑎2 − 𝑎1 ?
4.3 Methods of Solving Recurrence Relations

Definition (Linear recurrence relation with constant coefficient (LRRWCC))


 A recurrence relation of the form:
𝑎0 𝑓0 + 𝑎1 𝑓1 + 𝑎2 𝑓2 + 𝑎3 𝑓3 + ⋯ + 𝑎𝑘 𝑓𝑘 = 𝑓(𝑛) (1)
Where 𝑎𝑖′ 𝑠 (𝑖 = 0,1,2, … , 𝑛) and 𝑎𝑘 ≠ 0 are constant is called LRRWCC.

Example
1. 2𝑓𝑛 − 3𝑓𝑛−1 + 4𝑓𝑛−2 = 𝑓(𝑛) ↔ 𝐿𝑅𝑅𝑊𝐶𝐶 of degree 2.
2. 2𝑓𝑛 − 3(𝑓𝑛−1 )2 + 5𝑓𝑛−3 + 8𝑓𝑛−4 = 𝑓(𝑛) ↔ 𝑛𝑜𝑛 𝐿𝑅𝑅𝑊𝐶𝐶 of degree 4
3. 4𝑓𝑛 − 8𝑓𝑛−3 + 10𝑓𝑛−5 + 3𝑓𝑛−7 = 𝑓(𝑛) ↔ 𝐿𝑅𝑅𝑊𝐶𝐶 of degree 7.

 In (1) if𝑓(𝑛) = 0, then we have 𝑎0 𝑓0 + 𝑎1 𝑓1 + 𝑎2 𝑓2 + 𝑎3 𝑓3 + ⋯ + 𝑎𝑘 𝑓𝑘 = 0 is called


homogeneous LRRWCC (HLRRWCC).
 In (1) if𝑓(𝑛) ≠ 0, then 𝑎0 𝑓0 + 𝑎1 𝑓1 + 𝑎2 𝑓2 + 𝑎3 𝑓3 + ⋯ + 𝑎𝑘 𝑓𝑘 = 𝑓(𝑛) called non
homogeneous LRRWCC (NHLRRWCC).
Example
a. 2𝑓𝑛 − 3𝑓𝑛−1 + 4𝑓𝑛−2 = 0 ↔ 𝐻𝐿𝑅𝑅𝑊𝐶𝐶 of degree 2
b. 3𝑓𝑛 − 3𝑓𝑛−2 + 4𝑓𝑛−3 = 4 ↔ 𝑁𝐻𝐿𝑅𝑅𝑊𝐶𝐶 of degree 3
c. 𝑓𝑛 − 3𝑓𝑛−1 + 4𝑓𝑛−2 = 2𝑛 ↔ 𝑁𝐻𝐿𝑅𝑅𝑊𝐶𝐶

Methods of solving RRWCC


 By using the following methods we can solve the given RRWCC:
 Method of characteristics polynomial (use to solve HLRRWCC).
 Method of undetermined coefficients(use to solve NHLRRWCC)
 Method of Generating function
 Method of symbolic differentiation

[Date] 6
Discrete Mathematics 2182

4.3.1 Solution of HLRRWCC


The basic approach for solving LHRR’s is to look for the solutions of the form an = r n , where
r is constant. Note that an = r n is the solution of the recurrence relation
𝑎𝑛 + 𝑐1 𝑎𝑛−1 + 𝑐2 𝑎𝑛−2 + ⋯ + 𝑐𝑘 𝑎𝑛−𝑘 = 0 (2)
If and only if
𝑟 𝑛 + 𝑐1 𝑟 𝑛−1 + 𝑐2 𝑟 𝑛−2 + ⋯ + 𝑐𝑘 𝑟 𝑛−𝑘 = 0
When both side of the equation is divided by 𝑟 𝑛−𝑘 we obtain the equation
𝑟 𝑘 + 𝑐1 𝑟 𝑘−1 + 𝑐2 𝑟 𝑘−2 + ⋯ + 𝑐𝑘−1 𝑟 + 𝑐𝑘 = 0 (3)
Which is called the characteristics (Axillary) equations of the recurrence relation (2). The
solutions of the characteristic equation (3) are called characteristic roots of the recurrence
relation (2).
Example: find characteristics (Axillary) equations of the recurrence relation of
a. 𝑎𝑛 − 𝑐1 𝑎𝑛−1 − 𝑐2 𝑎𝑛−2 = 0 ans. 𝑟 2 − 𝑐1 𝑟 − 𝑐2 = 0
b. 𝑎𝑛 − 3𝑎𝑛−2 + 4𝑎𝑛−3 = 0 ans. 𝑟 3 − 3𝑟 + 4 = 0
c. 𝑎𝑛 − 3𝑎𝑛−1 + 4𝑎𝑛−2 + 8𝑎𝑛−5 = 0 ans. 𝑟 5 − 3𝑟 4 + 4𝑟 3 + 8 = 0

 All the possible solutions or general solution to the LHRRWCC of degree 1


𝑎𝑛 + 𝑐1 𝑎𝑛−1 = 0 is given by 𝒂𝒏 = 𝜶(−𝒄)𝒏 where 𝛼 is constant and to be determine.

Example: Find the solution of the recurrence relation


a. 𝑎𝑛 − 5𝑎𝑛−1 = 0 with initial condition 𝑎0 = 7
b. 𝑎𝑛 − 2𝑎𝑛−1 = 0 with initial condition 𝑎0 = 3
Solution
a. The general solution is given by 𝒂𝒏 = 𝜶(−𝒄)𝒏 . Since 𝑎0 = 7
⇒ 𝑎0 = 𝛼(5)0 = 7
⇒𝛼=7
Hence the solution is 𝒂𝒏 = 𝟕(𝟓)𝒏
b. The general solution is given by𝒂𝒏 = 𝜶(−𝒄)𝒏 . Since 𝑎0 = 3
⇒ 𝑎0 = 𝛼(2)0 = 3
⇒𝛼=3
Hence the solution is 𝒂𝒏 = 𝟑(𝟐)𝒏

[Date] 7
Discrete Mathematics 2182
 All the possible solutions or general solution to the LHRRWCC of degree 2
𝑎𝑛 + 𝑐1 𝑎𝑛−1 + 𝑐2 𝑎𝑛−2 = 0 For 𝑛 ≥ 2 With characteristics equation𝒓𝟐 + 𝒄𝟏 𝒓 + 𝒄𝟐 =
𝟎, then if the characteristic equation has:
1. Two distinct roots 𝐫𝟏 and 𝐫𝟐 , then the general solution of the given recurrence relation
if and only if is given by
𝒂𝒏 = 𝜶(𝒓𝟏 )𝒏 + 𝜷(𝒓𝟐 )𝒏 Where 𝜶 & 𝜷 are constants and to be determine.
2. Only one root (Double Real Root): i.e., 𝒓𝟏 = 𝒓𝟐 = 𝒓, then the general solution of the
given recurrence relation if and only if is given by
𝒂𝒏 = 𝜶(𝒓)𝒏 + 𝜷𝒏(𝒓)𝒏 Where 𝜶 & 𝜷 are constants and to be determine.
3. Complex Roots: if 𝒓𝟏 = 𝒓𝒆𝜶𝒊 and 𝒓𝟐 = 𝒓𝒆−𝜶𝒊, then the general solution of the given
recurrence relation if and only if is given by
𝒂𝒏 = 𝒌𝟏 𝒓𝒏 𝒄𝒐𝒔(𝜶𝒏) + 𝒊𝒌𝟐 𝒓𝒏 𝒔𝒊𝒏(𝜶𝒏) Where 𝒌𝟏 = 𝜶𝟏 + 𝜶𝟐 & 𝒌𝟐 = (𝜶𝟏 +
𝜶𝟐)𝒊 are constants and to be determine.
Note:- 𝒆𝒂𝒊 = 𝒄𝒐𝒔𝜶 + 𝒊𝒔𝒊𝒏𝜶

Example: Find the solution of


a. 𝑎𝑛 − 𝑎𝑛−1 − 2𝑎𝑛−2 = 0 for 𝑛 ≥ 2
b. 𝑎𝑛 = −7𝑎𝑛−1 − 12𝑎𝑛−2 for 𝑛 ≥ 2 with 𝑎0 = 0 and 𝑎1 = 5
c. 𝑎𝑛 = 7𝑎𝑛−1 − 10𝑎𝑛−2 for 𝑛 ≥ 2 with 𝑎0 = 2 and 𝑎1 = 3
9
d. 𝑎𝑛 − 3𝑎𝑛−1 + 4 𝑎𝑛−2 for 𝑛 ≥ 2 with 𝑎0 = 1 and 𝑎1 = 10
e. 𝑎𝑛 = 2𝑎𝑛−1 + 𝑎𝑛−2 − 2𝑎𝑛−3 𝑓𝑜𝑟 𝑛 ≥ 3 𝑤𝑖𝑡ℎ 𝑎0 = 1, 𝑎1 = 2 𝑎𝑛𝑑 𝑎2 = 0
Solution:
a. Step1:- find the characteristics equation of the given recurrence relation. i.e.,
r 2 − r − 2 = 0 is the characteristics equation.
Step2: find the roots of the characteristics equation using quadratic formula (factorization).
r2 − r − 2 = 0
⇒ (𝐫 + 𝟏)(𝐫 − 𝟐) = 𝟎
So, 𝑟 = −1 and 𝑟 = 2
Thus, the characteristic equation has two distinct roots r = −1 andr = 2.
Step3: find the general solution.
Hence, the general solution is
𝑎𝑛 = 𝛼(𝑟1 )𝑛 + 𝛽(𝑟2 )𝑛 Where 𝛼 & 𝛽 constant to be are determine.
⇒ 𝒂𝒏 = 𝜶(−𝟏)𝒏 + 𝜷(𝟐)𝒏 Which is the solution of the given recurrence relation.
b. Step1:- find the characteristics equation of the given recurrence relation. i.e.,
r 2 + 7 r + 12 = 0 is the characteristics equation.
Step2: find the roots of the characteristics equation using quadratic formula (factorization).
r 2 + 7r + 1 2 = 0
⇒ (𝐫 + 𝟑)(𝐫 + 𝟒) = 𝟎
So, 𝑟 = −3 and 𝑟 = −4
Thus, the characteristic equation has two distinct roots r = −3 andr = −4.

[Date] 8
Discrete Mathematics 2182

Step3: find the general solution.


Hence, the general solution is
𝑎𝑛 = 𝛼(𝑟1 )𝑛 + 𝛽(𝑟2 )𝑛 Where 𝛼 & 𝛽 constant to be are determine.
⇒ 𝒂𝒏 = 𝜶(−𝟑)𝒏 + 𝜷(−𝟒)𝒏 Which is the solution of the given recurrence relation.
Step4: putting the given initial condition in the general solution and solve the constants.
Putting 𝑛 = 0 and 𝑛 = 1 in 𝒂𝒏 = 𝜶(−𝟑)𝒏 + 𝜷(−𝟒)𝒏 and using the initial conditions gives
𝑎0 = 𝛼 + 𝛽 = 0
𝛼+𝛽 =0 (1)
𝑎1 = 𝛼(−3) + 𝛽(−4) = 5
−3𝛼 − 4𝛽 = 5 (2)
Solving equation (1) and (2), we obtain
𝛼 = 5 and 𝛽 = −5
Hence, 𝒂𝒏 = 𝟓(−𝟑)𝒏 − 𝟓(−𝟒)𝒏 = 𝟓[(−𝟑)𝒏 − (−𝟒)𝒏 ] is the desired solution.
c. Step1:- find the characteristics equation of the given recurrence relation. i.e.,
r 2 − 7 r + 10 = 0 is the characteristics equation.
Step2: find the roots of the characteristics equation using quadratic formula (factorization).
r 2 − 7r + 1 0 = 0
⇒ (𝐫 − 𝟐)(𝐫 − 𝟓) = 𝟎
So, 𝑟 = 2 and 𝑟 = 5
Thus, the characteristic equation has two distinct roots r = 2 andr = 5.
Step3: find the general solution.
Hence, the general solution is
𝑎𝑛 = 𝛼(𝑟1 )𝑛 + 𝛽(𝑟2 )𝑛 Where 𝛼 & 𝛽 constant to be are determine.
⇒ 𝒂𝒏 = 𝜶(𝟐)𝒏 + 𝜷(𝟓)𝒏 Which is the solution of the given recurrence relation.
Step4: putting the given initial condition in the general solution and solve the constants.
Putting 𝑛 = 0 and 𝑛 = 1 in 𝒂𝒏 = 𝜶(𝟐)𝒏 + 𝜷(𝟓)𝒏 and using the initial conditions gives
𝑎0 = 𝛼 + 𝛽 = 2
𝛼+𝛽 =2 (1)
𝑎1 = 𝛼(2) + 𝛽(5) = 3
2𝛼 + 5𝛽 = 3 (2)
Solving equation (1) and (2), we obtain
7 1
𝛼 = 3 and 𝛽 = − 3
𝟕 𝟏 𝟏
Hence, 𝒂𝒏 = 𝟑 (𝟐)𝒏 − 𝟑 (𝟓)𝒏 = 𝟑 [𝟕(𝟐)𝒏 − (𝟓)𝒏 ] is the solution.

d. Step1:- find the characteristics equation of the given recurrence relation. i.e.,
9
r 2 − 3r + 4 = 0.
Step2: find the roots of the characteristics equation using quadratic formula (factorization).
9
r2 − 3 r + 4 = 0
↔ 4r 2 − 12r + 9 = 0

[Date] 9
Discrete Mathematics 2182

⇒ (𝟐𝒓 − 𝟑)𝟐 = 𝟎
3
So, 𝑟 = 2 with multiplicity 2.
3
Thus, the characteristic equation has double root is .
2
Step3: find the general solution.
Hence, the general solution is
𝑎𝑛 = 𝛼(𝑟)𝑛 + 𝛽𝑛(𝑟)𝑛 Where 𝛼 & 𝛽 constant to be are determine.
𝟑 𝟑
⇒ 𝒂𝒏 = 𝜶(𝟐)𝒏 + 𝛃𝐧(𝟐)𝐧
Step4: putting the given initial condition in the general solution and solve the constants.
𝟑 𝟑
Putting 𝑛 = 0 and 𝑛 = 1 in 𝒂𝒏 = 𝜶(𝟐)𝒏 + 𝜷𝒏(𝟐)𝒏 and using the initial conditions gives
𝑎0 = 𝛼 = 1
𝛼=1 (1)
3 3
𝑎1 = 𝛼 (2) + 𝛽 (2) = 10
3 3
𝛼 + 2 𝛽 = 10 (2)
2
Substituting equation (1) in to (2), we obtain
17
𝛽= 3
𝟑 𝒏 𝟏𝟕 𝟑 𝟏𝟕 𝟑
Hence, 𝒂𝒏 = (𝟐) + 𝒏(𝟐)𝒏 = [𝟏 + 𝒏](𝟐)𝒏 is the solution.
𝟑 𝟑
e. Step1:- find the characteristics equation of the given recurrence relation.
The characteristic equation of this recurrence relation is
𝑟 3 − 2𝑟 2 − 𝑟 + 2 = 0
Step2: find the roots of the characteristics equation using quadratic formula (factorization).
The three roots are𝟏, −𝟏, 𝟐.
Step3: find the general solution.
Hence, the general solution is given by
𝑎𝑛 = 𝑐1 𝑟1 𝑛 + 𝑐2 𝑟2 𝑛 + 𝑐3 𝑟3 𝑛
= 𝑐1 (−1)𝑛 + 𝑐2 (1)𝑛 + 𝑐3 (2)𝑛
Step4: putting the given initial condition in the general solution and solve the constants
Putting 𝑛 = 0, 𝑛 = 1 and 𝑛 = 2 in 𝑎𝑛 = 𝑐1 (−1)𝑛 + 𝑐2 (1)𝑛 + 𝑐3 (2)𝑛 and using the initial
conditions gives
𝑐1 + 𝑐2 + 𝑐3 = 1 (∗)
−𝑐1 + 𝑐2 + 2𝑐3 = 2 (∗∗)
𝑐1 + 𝑐2 + 4𝑐3 = 0 (∗∗∗)
From (*), (**) and (***), we obtain
−2 −1
𝑐1 = 2, 𝑐2 = , 𝑐3 =
3 3
−2 −1
Thus, 𝑎𝑛 = 𝑐1 (−1) + 𝑐2 (1) + 𝑐3 (2)𝑛 = 2(−1)𝑛
𝑛 𝑛
(1)𝑛 (2)𝑛 is the solution of the given
3 3
recurrence relation.

[Date] 10
Discrete Mathematics 2182

Exercise: Find the solution of the following recurrence relation


a. 𝑎𝑛 = 6𝑎𝑛−1 − 9𝑎𝑛−2 with 𝑎0 = 1 and 𝑎1 = 6
b. 𝑎𝑛 − 6𝑎𝑛−1 − 7𝑎𝑛−2 for 𝑛 ≥ 5 with 𝑎3 = 344 and 𝑎4 = 2400
c. 𝑎𝑛 = 2𝑎𝑛−1 + 3𝑎𝑛−2 for 𝑛 ≥ 2 with 𝑎0 = 2 and 𝑎1 = 4
d. 𝑎𝑛 = 4𝑎𝑛−1 + 21𝑎𝑛−2 for 𝑛 ≥ 2 with 𝑎0 = 3 and 𝑎1 = 7
e. 𝑎𝑛 + 8𝑎𝑛−1 + 12𝑎𝑛−2 for 𝑛 ≥ 2 with 𝑎0 = −2 and 𝑎1 = 6
f. 𝑎𝑛 − 8𝑎𝑛−1 + 12𝑎𝑛−2 for 𝑛 ≥ 2 with 𝑎0 = 3 and 𝑎1 = −1
Solution
a. 𝑎𝑛 = 3𝑛 (1 + 𝑛)
1
b. 𝑎𝑛 = 7𝑛 + (−1)𝑛+1 e. 𝑎𝑛 = − 2 [(−6)𝑛 + 3(−2)𝑛 ]
c. 𝑎𝑛 = (−1)𝑛 + (3)𝑛 1
3 f. 𝑎𝑛 = 4 [19(2)𝑛 − 7(6)𝑛 ]
d. 𝑎𝑛 = 2 [(−3)𝑛 + (7)𝑛 ]

4.3.2 Solution of NLHRRWCC


 A recurrence relation of the form:
𝑎0 𝑓0 + 𝑎1 𝑓1 + 𝑎2 𝑓2 + 𝑎3 𝑓3 + ⋯ + 𝑎𝑘 𝑓𝑘 + 𝑓(𝑛) = 0 (4)
Where 𝑎𝑖′ 𝑠 (𝑖 = 0,1,2, … , 𝑛) , 𝑓𝑛 ≠ 0 and 𝑎𝑘 ≠ 0 are constant is called NLHRRWCC.
 The solution of NLHRRWCC is the sum of two parts:
Homogeneous part denoted by 𝑓𝑛 (ℎ) and particular solution denoted by𝑓𝑛 (𝑝) .
 The general solution of eqn.(4) is written as
𝐺𝑒𝑛𝑒𝑟𝑎𝑙 𝑠𝑜𝑙𝑢𝑡𝑖𝑜𝑛 = 𝑓𝑛 (ℎ) + 𝑓𝑛 (𝑝)
Rules of solving NLHRRWCC
1. When 𝑓𝑛 is the form of
𝑐0 + 𝑐1 𝑛 + 𝑐2 𝑛2 + ⋯ + 𝑐𝑚−1 𝑛𝑚−1 + 𝑐𝑚 𝑛𝑚 , then the corresponding particular solution will be 𝑑0 +
𝑑1 𝑛 + 𝑑2 𝑛2 + ⋯ + 𝑑𝑚−1 𝑛𝑚−1 + 𝑑𝑛𝑚 .
2. When 𝑓𝑛 is the form of
(𝑐0 + 𝑐1 𝑛 + 𝑐2 𝑛2 + ⋯ + 𝑐𝑚−1 𝑛𝑚−1 + 𝑐𝑚 𝑛𝑚 )𝑎𝑛 , then the corresponding particular solution will be (
𝑑0 + 𝑑1 𝑛 + 𝑑2 𝑛2 + ⋯ + 𝑑𝑚−1 𝑛𝑚−1 + 𝑑𝑛𝑚 )𝑎𝑛 .
3. Suppose {𝑓𝑛 } satisfies the LHRRWCC 𝑎0 𝑓0 + 𝑎1 𝑓1 + 𝑎2 𝑓2 + 𝑎3 𝑓3 + ⋯ + 𝑎𝑘 𝑓𝑘 + 𝑓(𝑛) where
𝑎0 , 𝑎1 , 𝑎2 , … , 𝑎𝑘 are constants and 𝑓𝑛 can be written as (𝑏𝑡 𝑛𝑡 + 𝑏𝑡−1 𝑛𝑡−1 + ⋯ + 𝑏1 𝑛 + 𝑏0 )𝑠 𝑛 , where
𝑏0 , 𝑏1 , … , 𝑏𝑡 are constant numbers and 𝑠 is a real number, then
a. When 𝑠 is not a root of a charactersics equation of LH part, then the particular solution is (𝑝𝑡 𝑛𝑡 +
𝑝𝑡−1 𝑛𝑡−1 + ⋯ + 𝑝1 𝑛 + 𝑝0 )𝑠 𝑛 .
b. When 𝑠 is a root of a characteristics equation of LH part, then the particular solution and its
multiplicity 𝑚 is given by 𝑛𝑚 (𝑝𝑡 𝑛𝑡 + 𝑝𝑡−1 𝑛𝑡−1 + ⋯ + 𝑝1 𝑛 + 𝑝0 )𝑠 𝑛 .

[Date] 11
Discrete Mathematics 2182

Example: solve the following NLHRRWCC


a. 𝑎𝑛 = 6𝑎𝑛−1 − 9𝑎𝑛−2 + 𝑓(𝑛) where
i. 𝑓(𝑛) = 3𝑛 ii. 𝑓(𝑛) = 𝑛3𝑛 iii. 𝑓(𝑛) = 𝑛2 3𝑛
b. 𝑎𝑛 = 3𝑎𝑛−1 + 2𝑛 with 𝑎0 = 3
c. 𝑎𝑛 = 3𝑎𝑛−1 + 10𝑎𝑛−2 + 7. 5𝑛 with 𝑎0 = 4, 𝑎1 = 3
d. 𝑎𝑛 + 5𝑎𝑛−1 + 6𝑎𝑛−2 = 3𝑛2 − 2𝑛 + 1
e. 𝑎𝑛 − 7𝑎𝑛−1 + 10𝑎𝑛−2 = 8𝑛 + 6
f. 𝑎𝑛 − 10𝑎𝑛−1 + 25𝑎𝑛−2 = (𝑛2 + 𝑛 − 1)5𝑛 , 𝑓𝑜𝑟 𝑛 ≥ 2
g. 𝑎𝑛 = 𝑎𝑛−1 + 𝑎𝑛−2 + 5𝑛 − 6, 𝑓𝑜𝑟 𝑛 ≥ 2
Solution
a. The given recurrence relation is of the form 𝒂𝒏 − 𝟔𝒂𝒏−𝟏 + 𝟗𝒂𝒏−𝟐 = 𝒇(𝒏) ,
i. Where f(n) = 3n .
First isolate the homogeneous recurrence relation and find its general solution.i.e,
The associated homogeneous recurrence relation to the given recurrence relation is 𝒂𝒏 −
𝟔𝒂𝒏−𝟏 + 𝟗𝒂𝒏−𝟐 = 𝟎 and its characteristics equation is 𝑟 2 − 6𝑟 + 9 = 0.
Thus, ⇒ (𝑟 − 3)2 = 0
⇒ 𝑟 = 3 With multiplicity 2.
Hence 𝒂𝒏 (𝒉) = 𝜶𝟑𝒏 + 𝜷𝒏𝟑𝒏 = 𝟑𝒏 (𝜶 + 𝜷𝒏)
Next find the particular solution
𝑓(𝑛) = 𝑛3𝑛 , And r = 3 is the root of the characteristic equation with multiplicity 2. Thus we
choose particular solution 𝒂𝒏 (𝒑) = 𝒒𝒏𝟐 𝒓𝒏 , where 𝑞 is a constant.
Then, we have to find 𝑞 by substituting 𝒂𝒏 (𝒑) in to the given recurrence relation, that is
𝒂𝒏 (𝒑) − 6𝒂𝒏−𝟏 (𝒑) + 𝟗𝒂𝒏−𝟐 (𝒑) = 𝟑𝒏
Observe that
𝑎𝑛 (𝑝) = 𝑞𝑛2 3𝑛 , 𝑎𝑛−1 (𝑝) = 𝑞(𝑛 − 1)2 3𝑛−1 and𝑎𝑛−2 (𝑝) = 𝑞(𝑛 − 2)2 3𝑛−2.
Thus,
[𝑞𝑛2 3𝑛 − 6(𝑞(𝑛 − 1)2 3𝑛−1 ) + 9(𝑞(𝑛 − 2)2 3𝑛−2 ) = 3𝑛
⇒ 𝑞𝑛2 3𝑛 − 6𝑞(𝑛2 − 2𝑛 + 1)3𝑛−1 + 9𝑞(𝑛2 − 4𝑛 + 4)3𝑛−2 = 3𝑛
⇒ 𝑞𝑛2 3𝑛 − 6𝑞𝑛2 3𝑛−1 + 12𝑞𝑛3𝑛−1 + 6𝑞3𝑛−1 + 9𝑞𝑛2 3𝑛−2 − 36𝑞𝑛3𝑛−2 + 36𝑞3𝑛−2 = 3𝑛
⇒ 𝑞𝑛2 3𝑛 − 2𝑞𝑛2 3𝑛 + 4𝑞𝑛3𝑛 + 2𝑞3𝑛 + 𝑞𝑛2 3𝑛 − 4𝑞𝑛3𝑛 + 4𝑞3𝑛 = 3𝑛
⇒ 2𝑞3𝑛 + 4𝑞3𝑛 = 3𝑛
⇒ 6𝑞3𝑛 = 3𝑛

[Date] 12
Discrete Mathematics 2182

1
⇒𝑞=6
1
Hence, 𝒂𝒏 (𝒑) = 𝒒𝒏𝟐 𝒓𝒏 = 6 𝑛2 3𝑛 is the particular solution.

Therefore, the general solution is 𝒂𝒏 (𝒉) + 𝒂𝒏 (𝒑)


1
⇒ 3𝑛 (𝛼 + 𝛽𝑛) + 6 𝑛2 3𝑛 Which is the general solution of the given NHLRRWCC.

ii. where f(n) = n3n


The given recurrence relation is of the form 𝒂𝒏 − 𝟔𝒂𝒏−𝟏 + 𝟗𝒂𝒏−𝟐 = 𝒇(𝒏) , where f(n) =
n3n .The associated homogeneous recurrence relation to the given recurrence relation is 𝒂𝒏 −
𝟔𝒂𝒏−𝟏 + 𝟗𝒂𝒏−𝟐 = 𝟎 and its characteristics equation is 𝑟 2 − 6𝑟 + 9 = 0.
Thus, ⇒ (𝑟 − 3)2 = 0
⇒ 𝑟 = 3 With multiplicity 2.
Hence 𝒂𝒏 (𝒉) = 𝜶𝟑𝒏 + 𝜷𝒏𝟑𝒏 = 𝟑𝒏 (𝜶 + 𝜷𝒏)
Next find the particular solution
𝑓(𝑛) = 𝑛3𝑛 , And r = 3 is the root of the characteristic equation with multiplicity 2. Thus we
choose particular solution 𝒂𝒏 (𝒑) = 𝒏𝟐 (𝒒𝟎 + 𝒒𝟏 𝒏)𝒓𝒏 , where 𝑞0 𝑎𝑛𝑑 𝑞1 are constants.
Then, we have to find 𝑞0 𝑎𝑛𝑑 𝑞1 by substituting 𝒂𝒏 (𝒑) in to the given recurrence relation, that is
𝒂𝒏 (𝒑) − 6𝒂𝒏−𝟏 (𝒑) + 𝟗𝒂𝒏−𝟐 (𝒑) = 𝟑𝒏
Observe that
𝒂𝒏 (𝒑) = 𝒏𝟐 (𝑞0 + 𝑞1 𝑛)𝟑𝒏 , 𝒂𝒏−𝟏 (𝒑) = (𝒏 − 𝟏)𝟐 (𝑞0 + 𝑞1 (𝑛 − 1))𝟑𝒏−𝟏 and
𝒂𝒏−𝟐 (𝒑) = (𝒏 − 𝟐)𝟐 (𝑞0 + 𝑞1 (𝑛 − 2)𝟑𝒏−𝟐.
After some calculation we obtain
1 1
𝑞1 = 6 𝑎𝑛𝑑 𝑞0 = 2
1 1
Hence, 𝒂𝒏 (𝒑) = 𝒏𝟐 (𝑞0 + 𝑞1 𝑛)𝒓𝒏 = 𝑛2 (2 + 6 𝑛)3𝑛 is the particular solution.

Therefore, the general solution is 𝒂𝒏 (𝒉) + 𝒂𝒏 (𝒑)


𝟏 𝟏
⇒ 𝟑𝒏 (𝜶 + 𝜷𝒏) + 𝒏𝟐 (𝟐 + 𝟔 𝒏)𝟑𝒏 Which is the general solution of the given NHLRRWCC.

iii. Exercise (hint 𝒂𝒏 (𝒑) = 𝒏𝟐 (𝑞0 + 𝑞1 𝑛 + 𝑞2 𝑛2 )𝟑𝒏 )

[Date] 13
Discrete Mathematics 2182

b. The characteristics equation is


r−3=0↔r=3
Thus, the homogeneous part solution is
𝒂𝒏 (𝒉) = 𝜶(𝟑)𝒏
Using initial condition a0 = 3, then 𝒂𝟎 (𝒉) = 𝜶(𝟑)𝟎 = 𝟑 ↔ 𝜶 = 𝟑
Thus, 𝒂𝒏 (𝒉) = 𝟑(𝟑)𝒏
Next, find particular solution. f(n) = 2n and r = 3 is the root of the characteristic equation with
multiplicity 1. So we choose the particular solution to the given nonhomogeneous recurrence
relation to be
𝑎𝑛 (𝑝) = 𝑞1 𝑛 + 𝑞0 , where 𝑞1 and 𝑞0 are constants to be determined by substituting 𝑎𝑛 (𝑝) in to
the given recurrence relation.
Thus, 𝑎𝑛 (𝑝) − 3𝑎𝑛−1 (𝑝) = 𝑓(𝑛)
Observe that
𝒂𝒏 (𝒑) = 𝑞1 𝑛 + 𝑞0 , and
𝒂𝒏−𝟏 (𝒑) = 𝑞1 (𝑛 − 1) + 𝑞0
Thus,
𝑞1 𝑛 + 𝑞0 − 𝟑(𝑞1 (𝑛 − 1) + 𝑞0 ) = 2𝑛
Which implies
𝟏
(𝟒𝒒𝟏 )𝒏 = 𝟐𝒏 ⇔ 𝒒𝟏 =
𝟐
𝟑
𝟑𝒒𝟏 − 𝟐𝒒𝟎 = 𝟎 ⇔ 𝒒𝟎 = 𝟒
1 3
Hence, 𝒂𝒏 (𝒑) = 𝑞1 𝑛 + 𝑞0 = 2 𝑛 + 4 is the particular solution.

Therefore, the general solution is 𝒂𝒏 (𝒉) + 𝒂𝒏 (𝒑)


1 3
⇒ 𝟑(𝟑)𝒏 + 2 𝑛 + 4 Which is the general solution of the given NHLRRWCC.

c. The characteristic equation is


r 2 − 3r − 10 = 0 ⇔ (r + 2)(r − 5) = 0.
We have roots r1 = −2 and r2 = 5
Thus, homogeneous part solution is
𝒂𝒏 (𝒉) = 𝜶(−𝟐)𝒏 + 𝜷(𝟓)𝒏
Next, find particular solution. 𝒇(𝒏) = 𝟕. 𝟓𝒏 , and 𝒓 = 𝟓 is the root of the characteristic equation
with multiplicity 1. Thus we choose particular solution

[Date] 14
Discrete Mathematics 2182

𝒂𝒏 (𝒑) = 𝒒𝒏(𝟓𝒏 ) , where 𝑞 is a constant. Then, we have to find 𝑞 by substituting 𝒂𝒏 (𝒑) in to


the given recurrence relation, that is
𝒂𝒏 (𝒑) − 3𝒂𝒏−𝟏 (𝒑) − 𝟏𝟎𝒂𝒏−𝟐 (𝒑) = 𝟕. 𝟓𝒏
Observe that
𝑎𝑛 (𝑝) = 𝑞𝑛5𝑛 , 𝑎𝑛−1 (𝑝) = 𝑞(𝑛 − 1)5𝑛−1 and𝑎𝑛−2 (𝑝) = 𝑞(𝑛 − 2)5𝑛−2 .
Thus,
[𝑞𝑛5𝑛 − 3(𝑞(𝑛 − 1)5𝑛−1 ) + 9(𝑞(𝑛 − 2)5𝑛−2 ) = 7.5𝑛
⇒ 𝑞𝑛5𝑛 − 3𝑞(𝑛 − 1)5𝑛−1 + 9𝑞(𝑛 − 2)5𝑛−2 = 7.5𝑛
⇒ 𝑞𝑛5𝑛 − 3𝑞𝑛5𝑛−1 + 3𝑞5𝑛−1 + 9𝑞𝑛5𝑛−2 − 18𝑞5𝑛−2 = 7.5𝑛
3 3 9 18
⇒ 𝑞𝑛5𝑛 − 5 𝑞𝑛5𝑛 + 5 𝑞5𝑛 + 25 𝑞𝑛5𝑛 − 25 𝑞5𝑛 = 7.5𝑛
3 3 9 18
⇒ 𝑞𝑛5𝑛 − 5 𝑞𝑛5𝑛 + 5 𝑞5𝑛 + 25 𝑞𝑛5𝑛 − 25 𝑞5𝑛 = 7.5𝑛
3 −175
⇒ − 25 𝑞5𝑛 = 7.5𝑛 ⇔ 𝑞 = 3
−𝟏𝟕𝟓
Hence, 𝒂𝒏 (𝒑) = 𝒒𝒏𝒓𝒏 = 𝒏5𝑛 is the particular solution.
𝟑

Therefore, the general solution is 𝒂𝒏 (𝒉) + 𝒂𝒏 (𝒑)


−175
⇒ 𝛼(−2)𝑛 + 𝛽(5)𝑛 + 𝑛5𝑛 Which is the general solution of the given NHLRRWCC.
3

d. The characteristic equation is


r 2 + 5r + 6 = 0 ⇔ (r + 2)(r + 3) = 0.
We have roots r1 = −3 and r2 = −2
Thus, homogeneous part solution is
𝒂𝒏 (𝒉) = 𝜶(−𝟑)𝒏 + 𝜷(−𝟐)𝒏
Next, find particular solution. 𝒇(𝒏) = 3𝑛2 − 2𝑛 + 1 So we choose the particular solution to the
given nonhomogeneous recurrence relation to be
𝑎𝑛 (𝑝) = 𝑞2 𝑛2 + 𝑞1 𝑛 + 𝑞0
where 𝑞2 , 𝑞1 and 𝑞0 are constants to be determined by substituting 𝑎𝑛 (𝑝) in to the given
recurrence relation.
Thus, 𝑎𝑛 (𝑝) + 5𝑎𝑛−1 (𝑝) + 6𝑎𝑛−2 (𝑝) = 𝑓(𝑛)
Observe that
𝒂𝒏 (𝒑) = 𝑞2 𝑛2 + 𝑞1 𝑛 + 𝑞0 ,
𝒂𝒏−𝟏 (𝒑) = 𝑞2 (𝑛 − 1)2 + 𝑞1 (𝑛 − 1) + 𝑞0 and

[Date] 15
Discrete Mathematics 2182

𝒂𝒏−𝟐 (𝒑) = 𝑞2 (𝑛 − 2)2 + 𝑞1 (𝑛 − 2) + 𝑞0 .


Thus,
[𝑞2 𝑛2 + 𝑞1 𝑛 + 𝑞0 + 𝟓(𝑞2 (𝑛 − 1)2 + 𝑞1 (𝑛 − 1) + 𝑞0 ) + 𝟔(𝑞2 (𝑛 − 2)2 + 𝑞1 (𝑛 − 2) + 𝑞0 ) =
3𝑛2 − 2𝑛 + 1
Which implies
𝟏
(𝟏𝟐𝒒𝟐 )𝒏𝟐 = 𝟑𝒏𝟐 ⇔ 𝒒𝟐 =
𝟒
𝟏𝟑
(−𝟑𝟒𝒒𝟐 + 𝟑𝒒𝟏 )𝒏 = −𝟐𝒏 ⇔ 𝒒𝟏 =
𝟔
𝟐𝟑
𝟐𝟗𝒒𝟐 − 𝟐𝒒𝟏 + 𝟑𝒒𝟎 = 𝟏 ⇔ 𝒒𝟎 = − 𝟑𝟔
1 13 23
Hence, 𝒂𝒏 (𝒑) = 𝑞2 𝑛2 + 𝑞1 𝑛 + 𝑞0 = 4 (𝑛2 ) + 𝑛 − 36 is the particular solution.
6
Therefore, the general solution is 𝒂𝒏 (𝒉) + 𝒂𝒏 (𝒑)
1 13 23
⇒ 𝜶(−𝟑)𝒏 + 𝜷(−𝟐)𝒏 + 4 (𝑛2 ) + 6
𝑛 − 36 Which is the general solution of the given
NHLRRWCC.
e. The characteristic equation is
r 2 − 7r + 10 = 0 ⇔ (r − 2)(r − 5) = 0.
We have roots r1 = 2 and r2 = 5
Thus, homogeneous part solution is
𝒂𝒏 (𝒉) = 𝜶(𝟐)𝒏 + 𝜷(𝟓)𝒏
Next, find particular solution. 𝒇(𝒏) = 8𝑛 + 6 So we choose the particular solution to the given
nonhomogeneous recurrence relation to be
𝑎𝑛 (𝑝) = 𝑞1 𝑛 + 𝑞0 , where 𝑞1 and 𝑞0 are constants to be determined by substituting 𝑎𝑛 (𝑝) in to
the given recurrence relation.
Thus, 𝑎𝑛 (𝑝) − 7𝑎𝑛−1 (𝑝) + 10𝑎𝑛−2 (𝑝) = 𝑓(𝑛)
Observe that
𝒂𝒏 (𝒑) = 𝑞1 𝑛 + 𝑞0 ,
𝒂𝒏−𝟏 (𝒑) = 𝑞1 (𝑛 − 1) + 𝑞0 and
𝒂𝒏−𝟐 (𝒑) = 𝑞1 (𝑛 − 2) + 𝑞0 .
Thus,
𝑞1 𝑛 + 𝑞0 − 𝟕(𝑞1 (𝑛 − 1) + 𝑞0 ) + 𝟏𝟎(𝑞1 (𝑛 − 2) + 𝑞0 ) = 8𝑛 + 6
Which implies
(𝟒𝒒𝟏 )𝒏 = 𝟖𝒏 ⇔ 𝒒𝟏 = 𝟐
−𝟏𝟑𝒒𝟏 + 𝟒𝒒𝟎 = 𝟔 ⇔ 𝒒𝟎 = 𝟖
Hence, 𝒂𝒏 (𝒑) = 𝑞1 𝑛 + 𝑞0 = 2𝑛 + 8 is the particular solution.
Therefore, the general solution is 𝒂𝒏 (𝒉) + 𝒂𝒏 (𝒑)
⇒ 𝜶(𝟐)𝒏 + 𝜷(𝟓)𝒏 + 2𝑛 + 8 Which is the general solution of the given NHLRRWCC.
f. The characteristic equation is

[Date] 16
Discrete Mathematics 2182

r 2 − 10r + 25 = 0 ⇔ (r − 5)2 = 0.
We have roots r1 = r2 = 5
Thus, homogeneous part solution is
𝒂𝒏 (𝒉) = 𝜶(𝟓)𝒏 + 𝜷𝒏(𝟓)𝒏
Next, find particular solution. 𝒇(𝒏) = (𝒏𝟐 + 𝑛 − 1)5𝑛 , and 𝑟 = 5 is the root of the
characteristic equation and the multiplicity of 5 is 2, so we choose the particular solution to the
given nonhomogeneous recurrence relation to be
𝒂𝒏 (𝒑) = 𝒏𝟐 (𝑞2 𝑛2 + 𝑞1 𝑛 + 𝑞0 )5𝑛 , where 𝑞2 , 𝑞1 and 𝑞0 are constants to be determined by
substituting 𝒂𝒏 (𝒑) in to the given recurrence relation.
Observe that
Observe that
𝒂𝒏 (𝒑) = 𝒏𝟐 (𝑞2 𝑛2 + 𝑞1 𝑛 + 𝑞0 )5𝑛 ,
𝒂𝒏−𝟏 (𝒑) = (𝑛 − 1)2 (𝑞2 (𝑛 − 1)2 + 𝑞1 (𝑛 − 1) + 𝑞0 )5𝑛−1 and
𝒂𝒏−𝟐 (𝒑) = (𝒏 − 𝟐)𝟐 (𝑞2 (𝑛 − 2)2 + 𝑞1 (𝑛 − 2) + 𝑞0 )5𝑛−2.
Thus,
𝒂𝒏 (𝒑) − 𝟏𝟎 𝒂𝒏−𝟏 (𝒑) + 𝟐𝟓 𝒂𝒏−𝟐 (𝒑) = (𝒏𝟐 + 𝑛 − 1)5𝑛
⇒ 𝒏𝟐 (𝑞2 𝑛2 + 𝑞1 𝑛 + 𝑞0 )5𝑛 − 10(𝑛 − 1)2 (𝑞2 (𝑛 − 1)2 + 𝑞1 (𝑛 − 1) + 𝑞0 )5𝑛−1
+ 25(𝒏 − 𝟐)𝟐 (𝑞2 (𝑛 − 2)2 + 𝑞1 (𝑛 − 2) + 𝑞0 )5𝑛−2 = (𝒏𝟐 + 𝑛 − 1)5𝑛
The rest of the steps of the solution are left as an exercise.
Exercise
1. Find all solutions of the recurrence relation
a. 𝑎𝑛 = 4𝑎𝑛−1 − 4𝑎𝑛−2 + (𝑛 + 1)2𝑛 .
𝒏𝟑 𝒏𝟑
Ans. (𝜶 + 𝜷𝒏)𝟐𝒏 + 𝒏𝟐 𝟐𝒏 + . 𝟐𝒏 = (𝜶 + 𝜷𝒏 + 𝒏𝟐 + )𝟐𝒏 .
𝟔 𝟔

b. 𝑎𝑛 = 2𝑎𝑛−1 − 𝑎𝑛−2 + 2𝑎𝑛−3 + 3𝑛 + 2 , 𝑤ℎ𝑒𝑟𝑒 𝑎0 = 𝑎1 = 𝑎2 = 1

Ans. 𝑨 ∗ 𝟐𝒏 + 𝑩𝒊𝟐 + 𝑪. (𝒊)𝒏 + 𝑫 ∗ 𝟑𝒏 + 𝑬 = − +.

[Date] 17
Discrete Mathematics 2182

4.3.3 Solution of Recurrence Relation using Generating Function


Remark: - To solve the given recurrence relation by using recurrence relation, first transform
the given recurrence relation in generating function form.
 How to transform the given recurrence relation in generating function form.
 Use the following procedure to transform the given recurrence relation in generating
function form.
 First apply the generating function form 𝐺(𝑥) = ∑∞ 𝑛
𝑛=0 𝑓𝑛 𝑥 to each term of the given RR.

 Evaluate each term using step 1 and simplify.


 Write into generating function form.
 Finally the coefficients of 𝑥 𝑛 is the required solution.

Example: solve
a. 𝑓𝑛 = 3𝑓𝑛−1 , 𝑛 = 1,2,3, . . 𝑤𝑖𝑡ℎ 𝑓0 = 2
b. 𝑓𝑛 = 3𝑓𝑛−1 + 2, 𝑛 ≥ 1, 𝑓0 = 1
c. 𝑓𝑛+2 − 4𝑓𝑛+1 + 3𝑓𝑛 = 0 𝑓𝑜𝑟 𝑛 ≥ 0 𝑤𝑖𝑡ℎ 𝑓0 = 2, 𝑓1 = 4
d. 𝑓𝑛 = 𝑓𝑛−1 + 𝑓𝑛−2 𝑓𝑜𝑟 𝑛 ≥ 2 𝑤𝑖𝑡ℎ 𝑓0 = 0, 𝑓1 = 1
Solution
a. First the given recurrence relation into generating function. That is multiply the given
equation by 𝑥 𝑛 `and then added. For 𝑛 ≥ 1
⇒ 𝑥 𝑛 𝑓𝑛 = 3𝑥 𝑛 𝑓𝑛−1
⇒ ∑∞ 𝑛 ∞ 𝑛
𝑛=1 𝑥 𝑓𝑛 = 3 ∑𝑛=1 𝑥 𝑓𝑛−1

∑∞ 𝑛 2 3 𝑘
𝑛=1 𝑥 𝑓𝑛 = 𝑥𝑓1 + 𝑥 𝑓2 + 𝑥 𝑓3 + ⋯ + 𝑥 𝑓𝑘 𝑓𝑜𝑟 𝑘 ≤ 𝑛
But the original 𝐺(𝑥) = ∑∞ 𝑛 2 3 𝑘
𝑛=0 𝑥 𝑓𝑛 = 𝑓0 + 𝑥𝑓1 + 𝑥 𝑓2 + 𝑥 𝑓3 + ⋯ + 𝑥 𝑓𝑘+⋯

∑∞ 𝑛
𝑛=1 𝑥 𝑓𝑛 = 𝐺(𝑥) − 𝑓0 = 𝐺(𝑥) − 2 (1)
3 ∑∞ 𝑛 2 3
𝑛=1 𝑥 𝑓𝑛−1 = 3(𝑥𝑓0 + 𝑥 𝑓1 + 𝑥 𝑓2 + ⋯ + 𝑥
𝑘+1
𝑓𝑘 + ⋯ )
= 3𝑥(𝑓0 + 𝑥𝑓1 + 𝑥 2 𝑓2 + ⋯ + 𝑥 𝑘 𝑓𝑘 + ⋯ )
= 3𝑥𝐺(𝑥) (2)
By equation (1) and (2), we have
⇒ 𝐺(𝑥) − 2 = 3𝑥𝐺(𝑥)
⇒ 𝐺(𝑥) − 3𝑥𝐺(𝑥) = 2
⇒ 𝐺(𝑥)[1 − 3𝑥] = 2

[Date] 18
Discrete Mathematics 2182

2
⇒ 𝐺(𝑥) = 1−3𝑥 , it is generating structure.
1
𝐺(𝑥) = 2 ∑∞ 𝑛 ∞ 𝑛 ∞ 𝑛 𝑛
𝑛=0(3𝑥) = ∑𝑛=0 2. (3𝑥) = ∑𝑛=0 2. (3 )𝑥 , (|𝑥| < 3).

The solution is the coefficient of 𝑥 𝑛 after 𝐺(𝑥) is evaluated.


Therefor, 𝑓𝑛 = 2. 3𝑛 is a solution.
b. First multiply the given equation by 𝑥 𝑛 `and then added. For 𝑛 ≥ 1
⇒ 𝑥 𝑛 𝑓𝑛 = 3𝑥 𝑛 𝑓𝑛−1 + 2𝑥 𝑛
⇒ ∑∞ 𝑛 ∞ 𝑛 ∞
𝑛=1 𝑥 𝑓𝑛 = 3 ∑𝑛=1 𝑥 𝑓𝑛−1 + ∑𝑛=1 2𝑥
𝑛

Second write each term in terms of 𝐺(𝑥)


∑∞ 𝑛 2 3 𝑘
𝑛=1 𝑥 𝑓𝑛 = 𝑥𝑓1 + 𝑥 𝑓2 + 𝑥 𝑓3 + ⋯ + 𝑥 𝑓𝑘 𝑓𝑜𝑟 𝑘 ≤ 𝑛
But the original 𝐺(𝑥) = ∑∞ 𝑛 2 3 𝑘
𝑛=0 𝑥 𝑓𝑛 = 𝑓0 + 𝑥𝑓1 + 𝑥 𝑓2 + 𝑥 𝑓3 + ⋯ + 𝑥 𝑓𝑘+⋯

∑∞ 𝑛
𝑛=1 𝑥 𝑓𝑛 = 𝐺(𝑥) − 𝑓0 = 𝐺(𝑥) − 1 (1)

3 ∑ 𝑥 𝑛 𝑓𝑛−1 = 3(𝑥𝑓0 + 𝑥 2 𝑓1 + 𝑥 3 𝑓2 + ⋯ + 𝑥 𝑘+1 𝑓𝑘 + ⋯ )


𝑛=1

= 3𝑥(𝑓0 + 𝑥𝑓1 + 𝑥 2 𝑓2 + ⋯ + 𝑥 𝑘 𝑓𝑘 + ⋯ )
= 3𝑥𝐺(𝑥) (2)

∑ 2𝑥 𝑛 = 2𝑥 + 2𝑥 2 + 2𝑥 3 + 2𝑥 4 + ⋯ + 2𝑥 𝑘 + ⋯
𝑛=1

= 2(𝑥 + 𝑥 2 + 𝑥 3 + 𝑥 4 + ⋯ + 𝑥 𝑘 + ⋯ )
2𝑥
= 1−𝑥 , 𝑓𝑜𝑟 |𝑥| < 1 (3)

From eqn. (1), (2), and (3), we get


2𝑥
𝐺(𝑥) − 1 = 3𝑥𝐺(𝑥) + 1−𝑥
2𝑥
⇒ 𝐺(𝑥) − 3𝑥𝐺(𝑥) = 1 + 1−𝑥
𝑥+1
⇒ 𝐺(𝑥)[1 − 3𝑥] = 1−𝑥
𝑥+1
⇒ 𝐺(𝑥) = (1−3𝑥)(1−𝑥) (4) , it is

generating structure.
Using partial fraction on (4)
𝑥+1 𝐴 𝐵
(1−3𝑥)(1−𝑥)
= 1−𝑥 + 1−3𝑥

⇒ 𝐴(1 − 3𝑥) + 𝐵(1 − 𝑥) = 𝑥 + 1

[Date] 19
Discrete Mathematics 2182

⇒𝐴+𝐵 =1 (∗)
⇒ (−3𝐴 − 𝐵)𝑥 = 𝑥 (∗∗)
From (*) and (**), we obtain 𝐴 = −1 𝑎𝑛𝑑 𝐵 = 2
Now, eqn. (4), can be written as
−1 2
𝐺(𝑥) = 1−𝑥 + 1−3𝑥
1 1
= −1 (1−𝑥) + 2(1−3𝑥)

= −(∑∞ 𝑛 ∞
𝑛=0 𝑥 ) + 2 ∑𝑛=0(3𝑥)
𝑛

= ∑∞ 𝑛 𝑛
𝑛=0(−1 + 2.3 )𝑥

Therefore, 𝑓𝑛 = −1 + 2. 3𝑛 is the solution.


c. First multiply the given equation by 𝑥 𝑛 `and then added. For 𝑛 ≥ 0
⇒ 𝑥 𝑛 𝑓𝑛+2 − 4𝑥 𝑛 𝑓𝑛+1 + 3𝑥 𝑛 𝑓𝑛
⇒ ∑∞ 𝑛 ∞ 𝑛 ∞ 𝑛
𝑛=0 𝑥 𝑓𝑛+2 − 4 ∑𝑛=0 𝑥 𝑓𝑛+1 + 3 ∑𝑛=0 𝑥 𝑓𝑛

Second write each term in terms of 𝐺(𝑥)


∑∞ 𝑛 2
𝑛=0 𝑥 𝑓𝑛+2 = 𝑓2 + 𝑥𝑓3 + 𝑥 𝑓4 + ⋯ + 𝑥
𝑘−2
𝑓𝑘 𝑓𝑜𝑟 𝑘 ≤ 𝑛
1
= 𝑥 2 (𝑥 2 𝑓2 + 𝑥 3 𝑓3 + ⋯ + 𝑥 𝑘 𝑓𝑘+⋯ )
1
= (𝐺(𝑥) − 𝑓0 − 𝑥𝑓1 ) (1)
𝑥2

−4 ∑∞ 𝑛 2
𝑛=0 𝑥 𝑓𝑛+1 = −4(𝑓1 + 𝑥𝑓2 + 𝑥 𝑓3 + ⋯ + 𝑥
𝑘−1
𝑓𝑘 + ⋯ )
4
= − 𝑥 (𝑥𝑓1 + 𝑥 2 𝑓2 + 𝑥 3 𝑓3 + ⋯ + 𝑥 𝑘 𝑓𝑘 + ⋯ )
4
= − 𝑥 (𝐺(𝑥) − 𝑓0 ) (2)

∑∞ 𝑛 2 3 4 𝑘
𝑛=0 3𝑥 𝑓𝑛 = 3𝑓0 + 3𝑥𝑓1 + 3𝑥 𝑓2 + 3𝑥 𝑓3 + 3𝑥 𝑓4 + ⋯ + 3𝑥 𝑓𝑘 + ⋯

= 3(𝑓0 + 𝑥𝑓1 + 𝑥 2 𝑓2 + 𝑥 3 𝑓3 + 𝑥 4 𝑓4 + ⋯ + 𝑥 𝑘 𝑓𝑘 + ⋯ )
= 3𝐺(𝑥) (3)
From eqn. (1), (2), and (3), we get
1 4
(𝐺(𝑥) − 2 − 4𝑥) − (𝐺(𝑥) − 2) + 3𝐺(𝑥) = 0
𝑥2 𝑥
𝐺(𝑥) 2 4 4𝐺(𝑥) 8
⇒ − 𝑥2 − 𝑥 − + 𝑥 + 3𝐺(𝑥) = 0
𝑥2 𝑥
𝐺(𝑥) 4𝐺(𝑥) 2 4
⇒ − + 3𝐺(𝑥) = −𝑥
𝑥2 𝑥 𝑥2
𝐺(𝑥)−4𝑥𝐺(𝑥)+3𝑥 2 𝐺(𝑥) 2−4𝑥
⇒ =
𝑥2 𝑥2

[Date] 20
Discrete Mathematics 2182

⇒ 𝐺(𝑥)[1 − 4𝑥 + 3𝑥 2 ] = 2 − 4𝑥
2−4𝑥 2−4𝑥
⇒ 𝐺(𝑥) = 1−4𝑥+3𝑥 2 = (3𝑥−1)(𝑥−1) (4)

It is generating structure.
Using partial fraction on (4)
2−4𝑥 𝐴 𝐵
= 3𝑥−1 + 𝑥−1
(3𝑥−1)(𝑥−1)

⇒ 𝐴(𝑥 + 1) + 𝐵(3𝑥 − 1) = 2 − 4𝑥
⇒𝐴−𝐵 =2 (∗)
⇒ (𝐴 + 3𝐵)𝑥 = −4𝑥 (∗∗)
1 3
From (*) and (**), we obtain 𝐴 = 2 𝑎𝑛𝑑 𝐵 = − 2

Now, eqn. (4), can be written as


1 3
𝐺(𝑥) = 2(3𝑥−1) − 2(𝑥−1)
1 1 3 1
= − 2 (1−3𝑥) + 2 2(1−𝑥)
1 3
= − 2 (∑∞ 𝑛 ∞
𝑛=0(3𝑥) ) + 2 ∑𝑛=0(𝑥)
𝑛

3 1
= ∑∞ 𝑛 𝑛
𝑛=0(2 − 2 . 3 )𝑥

3 1
Therefore, 𝑓𝑛 = 2 − 2 . 3𝑛 is the solution.

d. Note that the generating function for the Fibonacci sequence is given by

𝐺(𝑥) = ∑ 𝑓𝑛 𝑥 𝑛
𝑛=0

We now algebraically manipulate this series to take advantage of the Fibonacci


recurrence.
𝐺(𝑥) = ∑∞
𝑛=0 𝑓𝑛 𝑥
𝑛

= 𝑓0 + 𝑓1 𝑥 + ∑∞
𝑛=2 𝑓𝑛 𝑥
𝑛

= 𝑓0 + 𝑓1 𝑥 + ∑∞
𝑛=2(𝑓𝑛−1 + 𝑓𝑛−2 )𝑥
𝑛

= 𝑓0 + 𝑓1 𝑥 + ∑∞ 𝑛 ∞
𝑛=2 𝑓𝑛−1 𝑥 + ∑𝑛=2 𝑓𝑛−2 𝑥
𝑛

= 𝑓0 + 𝑓1 𝑥 − 𝑓0 𝑥 + 𝑥 ∑∞
𝑛=2 𝑓𝑛−1 𝑥
𝑛−1
+ 𝑥 2 ∑∞
𝑛=2 𝑓𝑛−2 𝑥
𝑛−2

We now re-index the first summation using the change of variables 𝑖 = 𝑛 − 1 and
the second summation using the change of variables 𝑗 = 𝑛 − 2. Thus,
𝐺(𝑥) = 𝑓0 + 𝑓1 𝑥 − 𝑓0 𝑥 + 𝑥 ∑∞ 𝑖 2 ∞
𝑖=0 𝑓𝑖 𝑥 + 𝑥 ∑𝑗=0 𝑓𝑗 𝑥
𝑗

[Date] 21
Discrete Mathematics 2182

Since the variable used in the summation is irrelevant, we have that


𝐺(𝑥) = 𝑓0 + 𝑓1 𝑥 − 𝑓0 𝑥 + 𝑥𝐺(𝑥) + 𝑥 2 𝐺(𝑥)
This gives an algebraic equation that we can solve for 𝐺(𝑥):
𝐺(𝑥) − 𝑥𝐺(𝑥) − 𝑥 2 𝐺(𝑥) = 𝑓0 + 𝑓1 𝑥 − 𝑓0 𝑥
⇒ 𝐺(𝑥)[1 − 𝑥 − 𝑥 2 ] = 𝑓0 + 𝑓1 𝑥 − 𝑓0 𝑥
𝑓0 +𝑓1 𝑥−𝑓0 𝑥
⇒ 𝐺(𝑥) = 1−𝑥−𝑥 2

Substituting the initial values, 𝑓0 = 0 and𝑓1 = 1, yields:


𝑥
𝐺(𝑥) = 1−𝑥−𝑥 2

Using partial fraction decomposition, we have


𝑥 𝐴 𝐵
𝐺(𝑥) = 1−𝑥−𝑥 2 = 1−𝑎𝑥 + 1−𝑏𝑥

To properly find the partial fraction decomposition, we must solve for 𝐴, 𝐵, 𝑎, and
𝑏. Note that.
1 − 𝑥 − 𝑥 2 = (1 − 𝑎𝑥)(1 − 𝑏𝑥) = 1 − (𝑎 + 𝑏)𝑥 + 𝑎𝑏𝑥 2
⇒ 𝑎 + 𝑏 = 1 𝑎𝑛𝑑 𝑎𝑏 = −1
1
⇒ 𝑏 = −𝑎
1
⇒𝑎− =1
𝑎
2
⇒𝑎 −𝑎−1=0
Using the Quadratic Formula yields
1±√5
𝑎= 2

Taking 𝑎 to be the “positive” solution, we can then back substitute to find 𝑏


1+√5 1−√5
𝑏 =1−𝑎 =1−( )=
2 2
To find A and B, we note that
𝑥 𝐴 𝐵
= 1−𝑎𝑥 + 1−𝑏𝑥
1−𝑥−𝑥 2

⇒ 𝑥 = 𝐴(1 − 𝑏𝑥) + 𝐵(1 − 𝑎𝑥)


Letting x = 1/b, yields:
2 2 1+√5 2
𝑥 = 1−√5 ⇒ 1−√5 = 𝐵 (1 − ( ) (1−√5))
2

−2−2√5 5+√5
⇒ = 𝐵( )
4 2

[Date] 22
Discrete Mathematics 2182

1
⇒𝐵=−
√5

Similarly, substituting 𝑥 = 1/𝑎 will yield 𝐴:


2 2 1−√5 2
𝑥 = 1+√5 ⇒ 1+√5 = 𝐴 (1 − ( ) (1+√5))
2

2 5−√5
⇒ 2 = 𝐴( )
2
1+√5

1
⇒𝐴=
√5

Thus the generating function associated with the Fibonacci sequence can be rewritten
as

𝑥 1 1 1
𝐺(𝑥) = = ( − )
1−𝑥−𝑥 2 √5 1−(
1+√5
)𝑥 1−(
1−√5
)𝑥
2 2

This in turn can be rewritten in terms of geometric series as follows:


1 1+√5 𝑛 1−√5 𝑛 𝑛
𝐺(𝑥) = (∑∞
𝑛=0( ) 𝑥 𝑛 − ∑∞
𝑛=0( ) 𝑥 )
√5 2 2

1 1+√5 𝑛 1−√5 𝑛 𝑛
= ∑∞
𝑛=0 (( ) −( ) 𝑥 )
√5 2 2

However, by definition
1 1+√5 𝑛 1−√5 𝑛 𝑛
𝐺(𝑥) = ∑∞ 𝑛
𝑛=0 𝑓𝑛 𝑥 = ∑∞
𝑛=0 (( ) −( ) 𝑥 )
√5 2 2
𝑛
Comparing the coefficients on 𝑥 on each side of the equation yields
1 1+√5 𝑛 1−√5 𝑛
𝑓𝑛 = [( ) −( ) ].
√5 2 2

Exercise: Solve the following with and without generating functions.


a. 𝑎𝑛 = 6𝑎𝑛−1 − 9𝑎𝑛−2 + 2. 3𝑛 𝑤𝑖𝑡ℎ 𝐼𝐶 𝑎0 = 1, 𝑎1 = 0
b. 𝑎𝑛 = 2𝑛𝑎𝑛−1 + 𝑛! 2𝑛 𝑤𝑖𝑡ℎ 𝐼𝐶 𝑎1 = 1
c. 𝑎𝑛 = 2𝑎𝑛−1 − 𝑎𝑛−2 𝑤𝑖𝑡ℎ 𝐼𝐶 𝑎0 = 1, 𝑎1 = 3
d. 𝑎𝑛+1 = 3𝑎𝑛 𝑤𝑖𝑡ℎ 𝐼𝐶 𝑎0 = 2 𝑓𝑜𝑟 𝑛 ≥ 0. Ans. 𝑎𝑛 = 2. 3𝑛
2+4𝑛
e. 𝑎𝑛+2 = 5𝑎𝑛+1 − 4𝑎𝑛 𝑤𝑖𝑡ℎ 𝐼𝐶 𝑎0 = 1, 𝑎1 = 2 𝑓𝑜𝑟 𝑛 ≥ 0. Ans. 𝑎𝑛 = 3

f. 𝑎𝑛+2 = 𝑎𝑛+1 + 𝑎𝑛 𝑤𝑖𝑡ℎ 𝐼𝐶 𝑎0 = 𝑎1 = 1 𝑓𝑜𝑟 𝑛 ≥ 0.

[Date] 23
Discrete Mathematics 2182

4.3.4 The Method of Symbolic Differentiation


The basic idea of this method is to manipulate the non-homogeneous recurrence to obtain a
homogeneous recurrence.

Example: Use symbolic differentiation solve 𝑇𝑛 = 3𝑇𝑛−1 + 2, 𝑤ℎ𝑒𝑟𝑒, 𝑇0 = 0


Solution: We rewrite the recursion as 𝑇𝑛 − 3𝑇𝑛−1 = 2. Since this relation holds true for all 𝑛 ≥
1, it is also true that 𝑇𝑛+1 − 3𝑇𝑛 = 2 (this is the symbolic differentiation).
From this it follows that:
𝑇𝑛 − 3𝑇𝑛−1 = 2 = 𝑇𝑛+1 − 3𝑇𝑛
⇒ 𝑇𝑛+1 − 4𝑇𝑛 + 3𝑇𝑛−1 = 2
We now have a homogeneous linear recurrence with constant coefficients. So, it can be solved
with the method described in the previous section. Note that the new recurrence can be rewritten
as 𝑇𝑛+2 − 4𝑇𝑛+1 + 3𝑇𝑛 = 0. The associated characteristic polynomial associated with this
recurrence is
r 2 − 4r + 3 = (r − 1)(r − 3)
Thus the characteristic roots of this polynomial are 𝑟1 = 1 and 𝑟2 = 3. Hence, all
possible solutions to the recurrence are of the form
𝑇𝑛 = 𝐴 + 𝐵 ∗ 3𝑛 (∗)
To find the coefficients, we must find another value of the sequence. Substituting 𝑛 = 0 and
𝑛 = 1 into Eq. (*) yields
𝑛 = 0 ⇒ 𝑇0 = 𝐴 + 𝐵 = 1;
𝑛 = 1 ⇒ 𝑇1 = 𝐴 + 3𝐵 = 5.
we now solve the above system.
𝐴 = 1 − 𝐵 ⇒ 1 − 𝐵 + 3𝐵 = 5
⇒ 2𝐵 = 4 ⇒ 𝐵 = 2 ⇒ 𝐴 = −1.
Thus,𝑇𝑛 = −1 + 2 ∗ 3𝑛 = 2 ∗ 3𝑛 − 1 , which is the desired solution.

 We can also use this method to solve other non-homogeneous recurrences.

Example: solve the recurrence relation


𝑇𝑛 = 7𝑇𝑛−1 − 12𝑇𝑛−2 + 𝑛2 , 𝑤ℎ𝑒𝑟𝑒 𝑇0 = 𝑇1 = 1
Solution: Begin by rewriting the recurrence as
𝑇𝑛 − 7𝑇𝑛−1 + 12𝑇𝑛−2 = 𝑛2 (∗∗)
Symbolically differentiating Eq. (**) yields

[Date] 24
Discrete Mathematics 2182

𝑇𝑛+1 − 7𝑇𝑛 + 12𝑇𝑛−1 = (𝑛 + 1)2 = 𝑛2 + 2𝑛 + 1


⇒ Tn+1 − 7Tn + 12Tn−1 − 2𝑛 − 1 = 𝑛2
Equating this with Eq. (**) gives the equation
Tn+1 − 7Tn + 12Tn−1 − 2𝑛 − 1 = 𝑇𝑛 − 7𝑇𝑛−1 + 12𝑇𝑛−2
⇒ Tn+1 − 8Tn + 19Tn−1 − 12𝑇𝑛−2 = 2𝑛 + 1 (∗∗∗)
Unfortunately, this equation is not homogeneous. Hence, we symbolically differentiate again to
obtain
Tn+2 − 8Tn+1 + 19Tn − 12𝑇𝑛−1 = 2(𝑛 + 1) + 1
⇒ Tn+2 − 8Tn+1 + 19Tn − 12𝑇𝑛−1 − 2 = 2𝑛 + 1
Equating this with Eq. (***) yields
Tn+2 − 8Tn+1 + 19Tn − 12𝑇𝑛−1 − 2 = Tn+1 − 8Tn + 19Tn−1 − 12𝑇𝑛−2
⇒ Tn+2 − 9Tn+1 + 27Tn − 31𝑇𝑛−1 + 12𝑇𝑛−2 = −2 (∗∗∗∗)
Symbolically differentiating Eq. (****), yields
Tn+3 − 9Tn+2 + 27Tn+1 − 31𝑇𝑛 + 12𝑇𝑛−1 = −2
Equating this with Eq. (****) yields
Tn+3 − 9Tn+2 + 27Tn+1 − 31𝑇𝑛 + 12𝑇𝑛−1 = Tn+2 − 9Tn+1 + 27Tn − 31𝑇𝑛−1 + 12𝑇𝑛−2
⇒ Tn+3 − 10Tn+2 + 36Tn+1 − 58𝑇𝑛 + 43𝑇𝑛−1 − 12𝑇𝑛−2 = 0
Hence, we now have a homogenous linear recurrence with constant coefficients. This recurrence
can be rewritten as
Tn+5 − 10Tn+4 + 36Tn+3 − 58𝑇𝑛+2 + 43𝑇𝑛+1 − 12𝑇𝑛 = 0.
The associated characteristic polynomial is
𝑟 5 − 10𝑟 4 + 36𝑟 3 − 58𝑟 2 + 43𝑟 − 12.
Using a combination of the Rational Root Theorem and long division (or a computer algebra
system), we find that the characteristic roots of the polynomial are 𝑟1 = 𝑟2 = 𝑟3 = 1, 𝑟4 = 3 ,
and 𝑟5 = 4. Hence, all possible solutions to the recurrence are of the form
𝑇𝑛 = 𝐴 + 𝐵𝑛 + 𝐶𝑛2 + 𝐷 ∗ 3𝑛 + 𝐸 ∗ 4𝑛 (∆)
To determine these coefficients, we must determine an additional three values of the sequence. In
particular,
𝑇2 = 7𝑇1 − 12𝑇0 + 22 = 7 − 12 + 7 + 4 = −1
𝑇3 = 7(−1) − 12(1) + 32 = −7 − 12 + 9 = −10
𝑇4 = 7(−10) − 12(−1) + 42 = −7 + 12 + 16 = −42
Substituting the values 𝑛 = 0, 1, 2, 3, 4 into Eq. ∆ yields the system
𝑛 = 0 ⇒ 𝑇0 = 𝐴 + 𝐷 + 𝐸 = 1;

[Date] 25
Discrete Mathematics 2182

𝑛 = 1 ⇒ 𝑇1 = 𝐴 + 𝐵 + 𝐶 + 3𝐷 + 4𝐸 = 1;
𝑛 = 2 ⇒ 𝑇2 = 𝐴 + 2𝐵 + 4𝐶 + 9𝐷 + 16𝐸 = −1;
𝑛 = 3 ⇒ 𝑇3 = 𝐴 + 3𝐵 + 9𝐶 + 27𝐷 + 64𝐸 = −10;
𝑛 = 4 ⇒ 𝑇4 = 𝐴 + 4𝐵 + 16𝐶 + 81𝐷 + 256𝐸 = −42.
Using a computer algebra system, we find the coefficients to be
83 17 1 −1 −1
𝐴= ,𝐵 = ,𝐶 = ,𝐷 = 𝑎𝑛𝑑 𝐸 =
54 18 6 2 27
Hence, the closed form of the recurrence is
83 17𝑛 𝑛2 3𝑛 4𝑛
𝑇𝑛 = 54 + + − − 27 .
18 6 2

Exercise: solve by using method of symbolic differentiation, find a closed form for the recurrence
43 25 23
1. Tn = 9Tn−1 − 14Tn−2 + 5n , where T0 = T1 = 1. Ans. Tn = 15 ∗ 2n − ∗ 5n + 10 ∗ 7n
6

2. Tn = 9Tn−1 − 18Tn−2 + 4n − 3n . Ans. Tn = A + Bn + C ∗ 3n + D ∗ 5n


3. Tn = 9Tn−1 − 18Tn−2 + 4n − 3n . Ans. Tn = A + Bn + C ∗ 3n + D ∗ 5n

4. Tn = 97 − 18Tn−2 + sin( 2 ). Ans. Tn = A ∗ in + B ∗ (−i)n + C ∗ 7n

5. Tn = 4Tn−1 + 6, where T0 = 1.
6. Tn = 3Tn−1 + n2 + n + 1, where T0 = 1.
7. Tn = 5Tn−1 + 4n , where T0 = 1.
8. Tn = 7Tn−1 + 5n − n2 , where T0 = 1.
9. Tn = 2Tn−1 + 2n , where T0 = 1.
10. Tn = 8Tn−1 + sin(nπ), where T0 = 1.
11. Tn = 7Tn−1 − 12Tn−2 + 5n2 − 3n + 7, where T0 = T1 = 1.
12. Tn = 10Tn−1 − 33Tn−2 + 36Tn−3 + 4n − n2 + 2n + 1, where T0 = T1 = T2 = 1.
13. Tn = Tn−1 + Tn−2 + cos(nπ) , where T0 = T1 = 1.
14. Tn = 8Tn−1 − 16Tn−2 + 4n2 , where T0 = T1 = 1.
15. Tn = 8Tn−1 − 20Tn−2 + 32Tn−3 − 64Tn−4 + (−1)n + 4n + n2 − sin(nπ),
where T0 = T1 = T2 = T3 = 1.

[Date] 26

You might also like