Chapter 4 For IT
Chapter 4 For IT
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
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⌉.
[Date] 2
Discrete Mathematics 2182
= 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
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.
[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)
[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
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.
[Date] 6
Discrete Mathematics 2182
[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:- 𝒆𝒂𝒊 = 𝒄𝒐𝒔𝜶 + 𝒊𝒔𝒊𝒏𝜶
[Date] 8
Discrete Mathematics 2182
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
[Date] 11
Discrete Mathematics 2182
[Date] 12
Discrete Mathematics 2182
1
⇒𝑞=6
1
Hence, 𝒂𝒏 (𝒑) = 𝒒𝒏𝟐 𝒓𝒏 = 6 𝑛2 3𝑛 is the particular solution.
[Date] 13
Discrete Mathematics 2182
[Date] 14
Discrete Mathematics 2182
[Date] 15
Discrete Mathematics 2182
[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. (𝜶 + 𝜷𝒏)𝟐𝒏 + 𝒏𝟐 𝟐𝒏 + . 𝟐𝒏 = (𝜶 + 𝜷𝒏 + 𝒏𝟐 + )𝟐𝒏 .
𝟔 𝟔
[Date] 17
Discrete Mathematics 2182
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).
∑∞ 𝑛
𝑛=1 𝑥 𝑓𝑛 = 𝐺(𝑥) − 𝑓0 = 𝐺(𝑥) − 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)
generating structure.
Using partial fraction on (4)
𝑥+1 𝐴 𝐵
(1−3𝑥)(1−𝑥)
= 1−𝑥 + 1−3𝑥
[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 )𝑥
−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
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
= 𝑓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
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
−2−2√5 5+√5
⇒ = 𝐵( )
4 2
[Date] 22
Discrete Mathematics 2182
1
⇒𝐵=−
√5
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
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
[Date] 23
Discrete Mathematics 2182
[Date] 24
Discrete Mathematics 2182
[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
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