0% found this document useful (0 votes)
124 views

Advanced Counting Methods

counting method
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)
124 views

Advanced Counting Methods

counting method
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/ 13

Chapter four

4 Advanced counting methods


4.1 Inclusion-exclusion principle
For a set 𝑋, |𝑋| denotes the number of elements of 𝑋: It is easy to see that for any two sets A
and B we have the following result known as the Inclusion -Exclusion Principle
|𝐴 ∪ 𝐵| = |𝐴| + |𝐵| − |𝐴 ∩ 𝐵|
Indeed, |𝐴| gives the number of elements in 𝐴 including those that are common to 𝐴 and 𝐵: The
same holds for |𝐵| Hence, |𝐴| + |𝐵| includes twice the number of common elements. Hence, to
get an accurate count of the elements of 𝐴 ∪ 𝐵, it is necessary to subtract |𝐴 ∩ 𝐵| from |𝐴| + |𝐵|
Note that if A and B are disjoint then |𝐴 ∩ 𝐵| = 0 and consequently
|𝐴 ∪ 𝐵| = |𝐴| + |𝐵|.
Example: A total of 35 programmers interviewed for a job; 25 knew FORTRAN, 28 knew
PASCAL, and 2 knew neither languages. How many knew both languages?
Solution. Let A be the group of programmers that knew FORTRAN, B those who knew
PASCAL. Then 𝐴 ∩ 𝐵 is the group of programmers who knew both languages. By the
Inclusion-Exclusion Principle we have
|𝐴 ∪ 𝐵| = |𝐴| + |𝐵| − |𝐴 ∩ 𝐵|
That is,
33 = 25 + 28 − |𝐴 ∩ 𝐵|
Solving for |𝐴 ∩ 𝐵| we get |𝐴 ∩ 𝐵| = 20
Theorem For any finite sets 𝐴, 𝑩, 𝑪 we have
|𝐴 ∪ 𝐵 ∪ 𝐶| = |𝐴| + |𝐵| + |𝐶| − |𝐴 ∩ 𝐵| − |𝐴 ∩ 𝐶| − |𝐵 ∩ 𝐶| + |𝐴 ∩ 𝐵 ∩ 𝐶|
That is, we “include” 𝑛(𝐴), 𝑛(𝐵), 𝑛(𝐶), we “exclude” 𝑛(𝐴 ∩ 𝐵), 𝑛(𝐴 ∩ 𝐶), 𝑛(𝐵 ∩ 𝐶), and
finally “include” n(A ∩ B ∩ C).
Example. Consider the sets 𝑆 = {1, 2, 3, 4}, 𝑇 = {1, 3, 5, 6, 7} and 𝑊 = {1, 4, 6, 8, 9}.
Suppose that we would like to count the number of elements of their union 𝑆 ∪ 𝑇 ∪ 𝑊. We
might do this in the following way:
(1) We add up the numbers of elements of S, T and W. Then we have the count
|𝑆| + |𝑇| + |𝑊| = 14.
Clearly we have over-counted. For example, the number 3 belongs to S as well as T, so we have
counted it twice instead of once.
(2) We compensate by subtracting from |𝑆| + |𝑇| + |𝑊| the number of those elements which
belong to more than one of the three sets S, T and W. Then we have the count
|𝑆| + |𝑇| + |𝑊| − |𝑆 ∩ 𝑇| − |𝑆 ∩ 𝑊| − |𝑇 ∩ 𝑊| = 8.
But now we have under-counted. For example, the number 1 belongs to all the three sets S, T and
W, so we have counted it 3 − 3 = 0 times instead of once.
(1) We therefore compensate again by adding to
|𝑆| + |𝑇| + |𝑊| − |𝑆 ∩ 𝑇| − |𝑆 ∩ 𝑊| − |𝑇 ∩ 𝑊|
The number of those elements which belong to all the three sets S, T and W. Then we have the
count
|𝑆| + |𝑇| + |𝑊| − |𝑆 ∩ 𝑇| − |𝑆 ∩ 𝑊| − |𝑇 ∩ 𝑊| + |𝑆 ∩ 𝑇 ∩ 𝑊| = 9,
which is the correct count, since clearly 𝑆 ∪ 𝑇 ∪ 𝑊 = {1, 2, 3, 4, 5, 6, 7, 8, 9}.
Example Find the number of mathematics students at a college taking at least one of the
languages French, German, and Russian, given the following data: 65 study French, 20 study
French and German, 45 study German, 25 study French and Russian, 8 study all three languages.
42 study Russian, 15 study German and Russian, We want to find 𝑛(𝐹 ∪ 𝐺 ∪ 𝑅) where 𝐹, 𝐺,
and 𝑅 denote the sets of students studying French, German, and Russian, respectively.
By the Inclusion–Exclusion Principle,
𝑛(𝐹 ∪ 𝐺 ∪ 𝑅) = 𝑛(𝐹 ) + 𝑛(𝐺) + 𝑛(𝑅) − 𝑛(𝐹 ∩ 𝐺) − 𝑛(𝐹 ∩ 𝑅) − 𝑛(𝐺 ∩ 𝑅) + 𝑛(𝐹 ∩ 𝐺 ∩ 𝑅)
= 65 + 45 + 42 − 20 − 25 − 15 + 8 = 100
Namely, 100 students study at least one of the three languages.
Suppose now that we have 𝑘 finite sets 𝑆1 , 𝑆2 , . . . , 𝑆𝑘 . We may suspect that
|𝑆1 ∪ 𝑆2 ∪. . .∪ 𝑆𝑘 | = ⏟
(|𝑆1 | + |𝑆2 |+. . . + |𝑆𝑘 |) − ⏟
(|𝑆1 ∩ 𝑆2 |+ . . . + |𝑆𝑘−1 ∩ 𝑆𝑘 |)
𝑜𝑛𝑒 𝑎𝑡 𝑎𝑡𝑖𝑚𝑒 (𝑘
1) 𝑡𝑒𝑟𝑚𝑠 𝑡𝑤𝑜 𝑎𝑡 𝑎𝑡𝑖𝑚𝑒 (𝑘
2) 𝑡𝑒𝑟𝑚𝑠

+ (|𝑆 (−1)𝑘+1 (|𝑆1 ∩ 𝑆2 ∩. . .∩ 𝑆𝑘 |) .


⏟ 1 ∩ 𝑆2 ∩ 𝑆3 | + . . . + |𝑆𝑘−2 ∩ 𝑆𝑘−1 ∩ 𝑆𝑘 |)−. . . + ⏟
𝑡ℎ𝑟𝑒𝑒 𝑎𝑡 𝑎𝑡𝑖𝑚𝑒 (𝑘
3) 𝑡𝑒𝑟𝑚𝑠 𝑘 𝑎𝑡 𝑎𝑡𝑖𝑚𝑒 (𝑘
𝑘) 𝑡𝑒𝑟𝑚𝑠

This is indeed true, and can be summarized as follows.


Principle of inclusion-exclusion Suppose that 𝑆1 , 𝑆2 , . . . , 𝑆𝑘 are non-empty finite sets. Then
𝑘 𝑘

| ⋃ 𝑆𝑗 | = ∑(−1)𝑗+1 ∑ |𝑆𝑖1 ∩ 𝑆𝑖2 ∩ … 𝑆𝑖𝑗 ]


𝑗=1 𝑗=1 1≤𝑖1 <...<𝑖𝑗 ≤𝑘

where the inner summation




1≤𝑖1 <...<𝑖𝑗 ≤𝑘

is a sum over all the


𝑘
⟨ ⟩
𝑗
distinct integer 𝑗 − 𝑡𝑢𝑝𝑙𝑒𝑠 (𝑖1 , . . . , 𝑖𝑗 ) satisfying 1 ≤ 𝑖1 <. . . < 𝑖𝑗 ≤ 𝑘.
Example: Suppose among 32 people who save paper or bottles (or both) for recycling, there are
30 who save paper and 14 who save bottles. Find the number m of people who: (a) save both; (b)
save only paper; (c) save only bottles. Let P and B denote the sets of people saving paper and
bottles, respectively. Then:
(a) 𝑚 = 𝑛(𝑃 ∩ 𝐵) = 𝑛(𝑃 ) + 𝑛(𝐵) − 𝑛(𝑃 ∪ 𝐵) = 30 + 14 − 32 = 12
(b) 𝑚 = 𝑛(𝑃 \𝐵) = 𝑛(𝑃 ) − 𝑛(𝑃 ∩ 𝐵) = 30 − 12 = 18
(c) 𝑚 = 𝑛(𝐵\𝑃) = 𝑛(𝐵) − 𝑛(𝑃 ∩ 𝐵) = 14 − 12 = 2
Example. Let 𝐴, 𝐵, 𝐶, 𝐷 denote, respectively, art, biology, chemistry, and drama courses. Find
the number N of students in a dormitory given the data:
12 take A, 5 take A and B, 4 take B and D, 2 take B,C,D,
20 take B, 7 take A and C, 3 take C and D, 3 take A, C, D,
20 take C, 4 take A and D, 3 take A, B,C, 2 take all four,
8 take D, 16 take B and C, 2 take A, B, D, 71 take none.
Let T be the number of students who take at least one course. By the Inclusion–Exclusion
Principle Theorem,
𝑇 = 𝑠1 − 𝑠2 + 𝑠3 − 𝑠4
𝑤ℎ𝑒𝑟𝑒: 𝑠1 = 12 + 20 + 20 + 8 = 60,
𝑠2 = 5 + 7 + 4 + 16 + 4 + 3 = 39,
𝑠2 = 3 + 2 + 2 + 3 = 10, 𝑠4 = 2.
Thus 𝑇 = 29, and 𝑁 = 71 + 𝑇 = 100.
Example. Let U be the set of positive integers not exceeding 1000. Then |U| = 1000. Find |S|
where S is the set of such integers which are not divisible by 3, 5, or 7.
Let A be the subset of integers which are divisible by 3, B which are divisible by 5, and C which
are divisible by 7. Then 𝑆 = 𝐴′ ∩ 𝐵′ ∩ 𝐶′ since each element of S is not divisible by 3, 5 or 7.
By integer division,
|𝐴| = 1000/3 = 33, |𝐵| = 1000/5 = 200, |𝐶| = 1000/7 = 142,
|𝐴 ∩ 𝐵| = 1000/15 = 66, |𝐴 ∩ 𝐶| = 1000/21 = 47, |𝐵 ∩ 𝐶| = 1000/35 = 28,
|𝐴 ∩ 𝐵 ∩ 𝐶| = 1000/105 = 9
Thus, by the Inclusion–Exclusion Principle Theorem,
|𝑆| = 1000 − (333 + 200 + 142) + (66 + 47 + 28) − 9 = 1000 − 675 + 141 − 9 = 457
Example. We wish to calculate the number of distinct natural numbers not exceeding 1000
Which are multiples of 10, 15, 35 or 55. Let
𝑆1 = {1 ≤ 𝑛 ≤ 1000: 𝑛 𝑖𝑠 𝑎 𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑒 𝑜𝑓 10}, 𝑆2 = {1 ≤ 𝑛 ≤ 1000: 𝑛 𝑖𝑠 𝑎 𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑒 𝑜𝑓 15},
𝑆3 = {1 ≤ 𝑛 ≤ 1000: 𝑛 𝑖𝑠 𝑎 𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑒 𝑜𝑓 35}, 𝑆4 = {1 ≤ 𝑛 ≤ 1000: 𝑛 𝑖𝑠 𝑎 𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑒 𝑜𝑓 55},
So that
1000 1000
|𝑆1 | = = 100, |𝑆2 | = = 66,
10 15
1000 1000
|𝑆3 | = = 28, |𝑆4 | = = 18.
35 55
Next,
𝑆1 ∩ 𝑆2 = {1 ≤ 𝑛 ≤ 1000: 𝑛 𝑖𝑠 𝑎 𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑒 𝑜𝑓 10 𝑎𝑛𝑑 15} = {1 ≤ 𝑛 ≤
1000: 𝑛 𝑖𝑠 𝑎 𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑒 𝑜𝑓 30}
S1 ∩ S3 = {1 ≤ n ≤ 1000: n is a multiple of 10 and 35} = {1 ≤ n ≤ 1000 : n is a multiple of 70},
S1 ∩ S4 = {1 ≤ n ≤ 1000: n is a multiple of 10 and 55} = {1 ≤ n ≤ 1000 : n is a multiple of 110},
S2 ∩ S3 = {1 ≤ n ≤ 1000: n is a multiple of 15 and 35} = {1 ≤ n ≤ 1000 : n is a multiple of 105},
S2 ∩ S4 = {1 ≤ n ≤ 1000: n is a multiple of 15 and 55} = {1 ≤ n ≤ 1000 : n is a multiple of 165},
S3 ∩ S4 = {1 ≤ n ≤ 1000: n is a multiple of 35 and 55} = {1 ≤ n ≤ 1000 : n is a multiple of 385},
so that
1000 1000
|𝑆1 ∩ 𝑆2| = = 33, |𝑆1 ∩ 𝑆3| = = 14,
30 70
1000 1000
|𝑆1 ∩ 𝑆4| = = 9, |𝑆2 ∩ 𝑆3| = = 9,
110 105
1000 1000
|𝑆2 ∩ 𝑆4| = = 6, |𝑆3 ∩ 𝑆4 = = 2.
165 385
Next,
𝑆1 ∩ 𝑆2 ∩ 𝑆3 = {1 ≤ 𝑛 ≤ 1000 ∶ 𝑛 𝑖𝑠 𝑎 𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑒 𝑜𝑓 10,15 𝑎𝑛𝑑 35}
= {1 ≤ 𝑛 ≤ 1000 ∶ 𝑛 𝑖𝑠 𝑎 𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑒 𝑜𝑓 210}
𝑆1 ∩ 𝑆2 ∩ 𝑆4 = {1 ≤ 𝑛 ≤ 1000 ∶ 𝑛 𝑖𝑠 𝑎 𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑒 𝑜𝑓 10, 15 𝑎𝑛𝑑 55}
= {1 ≤ 𝑛 ≤ 1000 ∶ 𝑛 𝑖𝑠 𝑎 𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑒 𝑜𝑓 330},
𝑆1 ∩ 𝑆3 ∩ 𝑆4 = {1 ≤ 𝑛 ≤ 1000 ∶ 𝑛 𝑖𝑠 𝑎 𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑒 𝑜𝑓 10, 35 𝑎𝑛𝑑 55}
= {1 ≤ 𝑛 ≤ 1000 ∶ 𝑛 𝑖𝑠 𝑎 𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑒 𝑜𝑓 770},
𝑆2 ∩ 𝑆3 ∩ 𝑆4 = {1 ≤ 𝑛 ≤ 1000 ∶ 𝑛 𝑖𝑠 𝑎 𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑒 𝑜𝑓 15, 35 𝑎𝑛𝑑 55}
= {1 ≤ 𝑛 ≤ 1000 ∶ 𝑛 𝑖𝑠 𝑎 𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑒 𝑜𝑓 1155},
so that
1000 1000
|𝑆1 ∩ 𝑆2 ∩ 𝑆3| = = 4, |𝑆1 ∩ 𝑆2 ∩ 𝑆4| = = 3,
210 330
1000 1000
|𝑆1 ∩ 𝑆3 ∩ 𝑆4| = = 1, |𝑆2 ∩ 𝑆3 ∩ 𝑆4| = = 0.
770 1155
Finally,
𝑆1 ∩ 𝑆2 ∩ 𝑆3 ∩ 𝑆4 = {1 ≤ 𝑛 ≤ 1000 ∶ 𝑛 𝑖𝑠 𝑎 𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑒 𝑜𝑓 10, 15, 35 𝑎𝑛𝑑 55}
= {1 ≤ 𝑛 ≤ 1000 ∶ 𝑛 𝑖𝑠 𝑎 𝑚𝑢𝑙𝑡𝑖𝑝𝑙𝑒 𝑜𝑓 2310},
It follows that
|𝑆1 ∪ 𝑆2 ∪ 𝑆3 ∪ 𝑆4|
= (|𝑆1| + |𝑆2| + |𝑆3| + |𝑆4|) − (|𝑆1 ∩ 𝑆2| + |𝑆1 ∩ 𝑆3| + |𝑆1 ∩ 𝑆4|
+ |𝑆2 ∩ 𝑆3| + |𝑆2 ∩ 𝑆4| + |𝑆3 ∩ 𝑆4|) + (|𝑆1 ∩ 𝑆2 ∩ 𝑆3| + |𝑆1 ∩ 𝑆2
∩ 𝑆4| + |𝑆1 ∩ 𝑆3 ∩ 𝑆4| + |𝑆2 ∩ 𝑆3 ∩ 𝑆4|) − (|𝑆1 ∩ 𝑆2 ∩ 𝑆3 ∩ 𝑆4|)
= (100 + 66 + 28 + 18) − (33 + 14 + 9 + 9 + 6 + 2) + (4 + 3 + 1 + 0) − (0) = 147.
Exercise. How many even numbers in the range of 100 to 999 have no repeated digit?
1.1. Recurrence relations
A recurrence relation is an equation which is defined in terms of itself

Definition. A recurrence relation for the sequence fang is an equation that expresses an in
terms of one or more of the previous terms 𝑎1 , 𝑎2 , 𝑎3 … 𝑎𝑛−1 , for all integers n with 𝑛 ≥ 0.
𝑎𝑛 = 𝐹(𝑎1 , 𝑎2 , 𝑎3 … 𝑎𝑛−1 , 𝑛)
Let 𝑎𝑛 = 𝑐1 𝑎𝑛−1 + 𝑐2 𝑎𝑛−2 + _ _ _ + 𝑐𝑘 𝑎𝑛−𝑘 + 𝑓(𝑛) be a linear non-homogeneous
recurrence.
If 𝑓(𝑛) = 0 it is linear and homogeneous
The following recurrence relations are linear non homogeneous recurrence relations.
i) 𝑎𝑛 = 𝑎𝑛−1 + 2𝑛
ii) 𝑎𝑛 = 𝑎𝑛−1 + 𝑎𝑛−2 + 𝑛2 + 𝑛 + 1
iii) 𝑎𝑛 = 𝑎𝑛−1 + 𝑎𝑛−4 + 𝑛!
iv) 𝑎𝑛 = 𝑎𝑛−6 + 𝑛2𝑛
Many natural functions are easily expressed as recurrences
𝑎𝑛 = 𝑎𝑛−1 + 1 𝑎1 = 1, 𝑎𝑛 = 𝑛 Polynomial
𝑎𝑛 = 2𝑎𝑛−1 , 𝑎1 = 1, 𝑎𝑛 = 2𝑛−1 Exponential
𝑎𝑛 = 𝑛𝑎𝑛−1 , 𝑎1 = 1, 𝑎𝑛 = 𝑛! Weird function
𝑎𝑛 = 𝑐1 𝑎𝑛−1 + 𝑐2 𝑎𝑛−2 + _ _ _ + 𝑐𝑘 𝑎𝑛−𝑘 where 𝑐1 , 𝑐2 , _ _ _ , 𝑐𝑘 are real numbers and 𝑐𝑘 ≠ 0.
Linear = previous terms appear with exponent 1 (not squares, cubes, etc),
Homogeneous = no term other than the multiples of 𝑎𝑖 ′𝑠, degree k= expressed in terms of
previous k terms constant coefficients = coefficients in front of the terms are constants,
instead of general functions. This recurrence relation plus k initial conditions uniquely
determines the sequence.
Example: Which of the following are linear homogeneous recurrence relations of degree k with
constant coefficients? If yes, determine k; if no, explain why not.
𝑃𝑛 = (1.11)𝑃𝑛−1 𝑎𝑛 = 𝑎𝑛−5
𝑓𝑛 = 𝑓𝑛−1 + 𝑓𝑛−2 𝑎𝑛 = 𝑎𝑛−1 + 𝑎2 𝑛−2
𝐻𝑛 = 2𝐻𝑛−1 + 1 𝐵𝑛 = 𝑛𝐵𝑛−1
Assume the sequence 𝑏𝑛 satisfies the recurrence. Another sequence 𝑎𝑛 satisfies the non
homogeneous recurrence if and only if ℎ𝑛 = 𝑎𝑛 – 𝑏𝑛 is also a sequence that satisfies
homogeneous recurrence.
1.2. Methods of solving recurrence relations
It is often easy to find a recurrence as the solution of a counting problem. Solving the recurrence
can be done for many special cases as we will see although it is somewhat of an art
Many sequences can be a solution for the same recurrence relation.
𝑎𝑛 = 2𝑎𝑛−1 − 𝑎𝑛−2 , 𝑓𝑜𝑟 𝑛 ≥ 2
The following sequences are solutions of this recurrence relation:
𝑎𝑛 = 3𝑛, 𝑓𝑜𝑟 𝑎𝑙𝑙 𝑛 ≥ 0

𝑎𝑛 = 5, 𝑓𝑜𝑟 𝑎𝑙𝑙 𝑛 ≥ 0.
The initial conditions for a sequence specify the terms before 𝑛0 (before the recurrence relation
takes effect). The recurrence relation together with the initial conditions uniquely determines the
sequence. For the example above, the initial conditions are 𝑎0 = 0, 𝑎1 = 3; and 𝑎0 = 5, 𝑎1 = 5
respectively.
Consider a homogeneous second-order recurrence relation with constant coefficients which has
the form
𝑎𝑛 = 𝑠𝑎𝑛−1 + 𝑡𝑎𝑛−2
where s and t are constants with 𝑡 ≠ 0.We associate the following quadratic polynomial with the
above recurrence relation:
∆(𝑥) = 𝑥 2 − 𝑠𝑥 − 𝑡
This polynomial ∆(𝑥)is called the characteristic polynomial of the recurrence relation, and the
roots of ∆(𝑥) are called its characteristic roots.
Theorem (1) Let 𝑐1 and 𝑐2 be real numbers. Suppose that 𝑟 2 + 𝑐1 𝑟 + 𝑐2 = 0 has two distinct
roots 𝑟1 and 𝑟2 . Then, the sequence fang is a solution of the recurrence relation 𝑎𝑛 = 𝑐1 𝑎𝑛−1 +
𝑐2 𝑎𝑛−2 if and only if 𝑎𝑛 = 𝑏1 𝑟 𝑛1 + 𝑏2 𝑟 𝑛 2 for 𝑛 = 0, 1, 2, …, where 𝑏1 and 𝑏2 are constants.
Example Consider the following homogeneous recurrence relation:
𝑎𝑛 = 2𝑎𝑛−1 + 3𝑎𝑛−2
The general solution is obtained by first finding its characteristic polynomial ∆(𝑥) and its roots
𝑟1 𝑎𝑛𝑑 𝑟2:
∆(𝑥) = 𝑥 2 − 2𝑥 − 3 = (𝑥 − 3)(𝑥 + 1); roots 𝑟1 = 3, 𝑟2 = −1
Since the roots are distinct, we can use Theorem 6.8 to obtain the general solution:
𝑎𝑛 = 𝑐1 3𝑛 + 𝑐2 (−1)𝑛
Thus any values for 𝑐1 and 𝑐2 will give a solution to the recurrence relation.
Suppose we are also given the initial conditions 𝑎0 = 1, 𝑎1 = 2.
Using the recurrence relation we can compute the next few terms of the sequence:
1, 2, 8, 28, 100, 356, 1268, 3516, . . .
The unique solution is obtained by finding c1 and c2 using the initial conditions. Specifically:
For n = 0 and 𝑎0 = 1, we get: 𝑐1 30 + 𝑐2 (−1)0 = 1 𝑜𝑟 𝑐1 + 𝑐2 = 1
For n = 1 and 𝑎1 = 2, we get: 𝑐1 31 + 𝑐2 (−1)1 = 2 𝑜𝑟 3𝑐1 − 𝑐2 = 2
3 1
Solving the system of the two equations in the unknowns 𝑐1 and 𝑐2 yields: 𝑐1 = 4 and 𝑐2 = 4
Thus the following is the unique solution of the given recurrence relation with the given initial
conditions 𝑎0 = 1, 𝑎 1 = 2:
3 𝑛 1 3𝑛+1 + (−1)𝑛
𝑎𝑛 = 3 + (−1)𝑛 =
4 4 4
Example Consider the celebrated Fibonacci sequence:
𝑎𝑛 = 𝑎𝑛−1 + 𝑎𝑛−2 , 𝑤𝑖𝑡ℎ 𝑎0 = 0, 𝑎1 = 1
The first 10 terms of the sequence follow:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, . . .
Sometimes the Fibonacci sequence is defined using the initial conditions 𝑎0 = 1, 𝑎 1 = 1 or the
initial conditions 𝑎1 = 1, 𝑎2 = 2. We use 𝑎0 = 0, 𝑎1 = 1 for computational convenience. (All
three initial conditions yield the same sequence after the pair of terms 1, 2.)
Observe that the Fibonacci sequence is a homogeneous linear second-order recurrence relation,
so it can be solved using Theorem 6.8. Its characteristic polynomial follows:
∆(𝑥) = 𝑥 2 − 𝑥 − 1
Using the quadratic formula, we obtain the roots:
1 + √5 1 − √5
𝑟1 = , 𝑟2 =
2 2
By theorem , we obtain the general solution:
𝑛 𝑛
1 + √5 1 − √5
𝑎𝑛 = 𝑐1 ( ) + 𝑐2 ( )
2 2
The initial conditions yield the following system of two linear equations in 𝑐1 and 𝑐2
For n = 0 and 𝑎0 = 0, we get: 0 = 𝑐1 + 𝑐2
1 +√5 1−√5
For n = 1 and 𝑎1 = 1, we get: 1 = 𝑐1 + 𝑐2
2 2

The solution of the system follows:


1 −1
𝑐1 = , 𝑐2 =
√5 √5
Accordingly, the following is the solution of the Fibonacci recurrence relation:
𝑛 𝑛
1 1 + √5 1 1 − √5
𝑎𝑛 = ( ) − ( )
√5 2 √5 2
Exercises:
1. Solve: 𝑎𝑛 = 𝑎𝑛−1 + 2𝑎𝑛−2 with 𝑎0 = 2 and 𝑎1 = 7 2
2. Find explicit formula for the Fibonacci Numbers.
Theorem 6.9: Suppose the characteristic polynomial ∆(𝑥) = 𝑥 2 − 𝑠𝑥 − 𝑡of the recurrence
relation
𝑎𝑛 = 𝑠𝑎𝑛−1 + 𝑡𝑎𝑛−2
has only one root 𝑟0 . Then the general solution of the recurrence relation follows, where 𝑐1 and
𝑐2 are arbitrary constants:
𝑎𝑛 = 𝑐1 r n 0 + 𝑐2 𝑛r n 0
The constants 𝑐1 and 𝑐2 may be uniquely computed using initial conditions.
Example Consider the following homogeneous recurrence relation:
𝑎𝑛 = 6𝑎𝑛−1 − 9𝑎𝑛−2
The characteristic polynomial ∆(𝑥) follows:
∆(𝑥) = 𝑥 2 − 6𝑥 + 9 = (𝑥 − 3)2
Thus ∆(𝑥) has only the one root 𝑟0 = 3. Now we use Theorem to obtain the following general
solution of the recurrence relation:
𝑎𝑛 = 𝑐1 3𝑛 + 𝑐2 𝑛3𝑛
Thus any values for 𝑐1 and 𝑐2 will give a solution to the recurrence relation.
Suppose we are also given the initial conditions 𝑎1 = 3, 𝑎2 = 27. Using the recurrence relation
we can compute the next few terms of the sequence:
3, 27, 135, 567, 2187, 8109, . . .
The unique solution is obtained by finding 𝑐1 and 𝑐2 using the initial conditions. Specifically:
For n = 1 and 𝑎1 = 3, we get: 3 = 3𝑐1 + 3𝑐2
For n = 2 and 𝑎2 = 27, we get: 27 = 9𝑐1 + 18𝑐2
Solving the system of the two equations in the unknowns 𝑐1 and 𝑐1 yields: 𝑐1 = −1 and 𝑐2 = 2
Thus the following is the unique solution of the recurrence relation with the given initial
conditions:
𝑎𝑛 = −3𝑛 + 2𝑛3𝑛 = 3𝑛 (2𝑛 − 1)
Consider now a general linear homogeneous 𝑘𝑡ℎ order recurrence relation with constant
coefficients which has the form
𝑘

𝑎𝑛 = 𝑐1 𝑎𝑛−1 + 𝑐2 𝑎𝑛−2 + 𝑐3 𝑎𝑛−3 + ・ ・ ・ + 𝑐𝑘 𝑎𝑛−𝑘 = ∑ 𝑐𝑖 𝑎𝑛−𝑖


𝑖=1
where 𝑐1 , 𝑐2 , 𝑐3 , ・ ・ ・, 𝑐𝑘 are constants with 𝑐𝑘 ≠ 0. The characteristic polynomial ∆(𝑥) of
the recurrence relation follows:
∆(𝑥) = 𝑥 𝑘 − 𝑐1 𝑥 𝑘−1 − 𝑐2 𝑥 𝑘−2 − 𝑐3 𝑥 𝑘−3 − ・ ・ ・ − 𝑐𝑘 1
The roots of ∆(𝑥) are called the characteristic roots of the recurrence relation.
Example What is the solution of the recurrence relation?
𝑎𝑛 = −𝑎𝑛−1 + 4𝑎𝑛−2 + 4𝑎𝑛−3
with 𝑎0 = 8, 𝑎1 = 6 and 𝑎2 = 26?
Solution: Since it is linear homogeneous recurrence, first find its characteristic equation
𝑟 3 + 𝑟 2 − 4𝑟 − 4 = 0 ⇒ (𝑟 + 1)(𝑟 + 2)(𝑟 − 2) = 0
𝑟1 = −1, 𝑟2 = −2 and 𝑟3 = 2
So, by theorem 𝑎𝑛 = 𝑐1 (−1)𝑛 + 𝑐2 (−2)𝑛 + 𝑐3 2𝑛 is a solution.
Now we should find 𝑐1, 𝑐2 and 𝑐3 using initial conditions.
𝑎0 = 𝑐1 + 𝑐2 + 𝑐3 = 8
𝑎0 = −𝑐1 − 2𝑐2 + 2𝑐3
𝑎0 = 𝑐1 + 4𝑐2 + 4𝑐3
So, 𝑐1 = 2, 𝑐2 = 1 and 𝑐3 = 5.
𝑎𝑛 = 2(−1)𝑛 + (−2)𝑛 + 3(2)𝑛 is a solution.
The following remarks are in order.
Remark 1: If p(n) and q(n) are solutions, then any linear combination
𝑐1 𝑝(𝑛) + 𝑐2 𝑞(𝑛)
of p(n) and q(n) is also a solution. This is not true if the recurrence relation is non homogeneous.
Remark 2: If r is a root of multiplicity m of the characteristic polynomial ∆(𝑥), then each of the
following
𝑟 𝑛 , 𝑛𝑟 𝑛 , 𝑛2 𝑟 𝑛 , . . . , 𝑛𝑚−1 𝑟 𝑛
is a solution of 1 Thus any linear combination
𝑐1 𝑟 𝑛 + 𝑐2 𝑛𝑟 𝑛 + 𝑐3 𝑛2 𝑟 𝑛 +. . . + 𝑐𝑚 𝑛𝑚−1 𝑟 𝑛 = (𝑐1 + 𝑐2 𝑛 + 𝑐3 𝑛2 +. . . + 𝑐𝑚 𝑛𝑚−1 )𝑟 𝑛
is also a solution.
Example Consider the following third-order homogeneous recurrence relation:
𝑎𝑛 = 11𝑎𝑛−1 − 39𝑎𝑛−2 + 45𝑎𝑛−3
The characteristic polynomial ∆(𝑥) of the recurrence relation follows:
∆(𝑥) = 𝑥 3 − 11𝑥 2 + 39𝑥 − 45 = (𝑥 − 3)2 (𝑥 − 5)
Thus ∆(𝑥) has two roots, 𝑟1 = 3 of multiplicity 2 and 𝑟2 = 5 of multiplicity 1. Thus, by the
above remarks, the following is the general solution of the recurrence relation:
𝑎𝑛 = 𝑐1 (3𝑛 ) + 𝑐2 𝑛(3𝑛 ) + 𝑐3 (5𝑛 ) = (𝑐1 + 𝑐2 𝑛)(3𝑛 ) + 𝑐3 (5𝑛 )
Thus any values for 𝑐1, 𝑐2 , 𝑐3 will give a solution to the recurrence relation.
Suppose we are also given the initial conditions 𝑎0 = 5, 𝑎1 = 11, 𝑎2 = 25. Using the
recurrence relation we can compute the next few terms of the sequence:
5, 11, 25, 71, 301, 1667, . . .
The unique solution is obtained by finding 𝑐1, 𝑐2 , 𝑐3 using the initial conditions. Specifically:
For n = 0 and 𝑎0 = 5, we get: 𝑐1 + 𝑐3 = 5
For n = 1 and 𝑎1 = 11, we get: 3𝑐1 + 3𝑐2 + 5𝑐3 = 11
For n = 2 and 𝑎2 = 25, we get: 9𝑐1 + 18𝑐2 + 25𝑐3 = 25
Solving the system of the three equations in the unknowns c1, c2, c3 yields:
𝑐1 = 4, 𝑐2 = −2, 𝑐3 = 1
Thus the following is the unique solution of the recurrence relation with the given initial
conditions:
𝑎𝑛 = (4 − 2𝑛)(3𝑛 ) + (5𝑛 )
Example: What is the solution of the recurrence relation
𝑎𝑛 = 8𝑎𝑛−2 − 16𝑎𝑛−4 , for 𝑛 ≥ 4,
with 𝑎0 = 1, 𝑎1 = 4, 𝑎2 = 28 and 𝑎3 = 32?
Solution: Find its characteristic equation
𝑟 4 − 8𝑟 2 + 16 = 0 ⇒ (𝑟 4 − 4)2 = (𝑟 − 2)2 (𝑟 + 2)2 = 0
𝑟1 = 2 𝑟2 = −2 (Their multiplicities are 2.) So, by theorem
𝑎𝑛 = (𝑐1 + 𝑐2 𝑛)(2)𝑛 + (𝑐3 + 𝑐4 𝑛)(−2)𝑛 is a solution.
Now we should find constants using initial conditions.
𝑎0 = 𝑐1 + 𝑐3 = 1
𝑎1 = 2𝑐1 + 2𝑐2 − 2𝑐3 − 2𝑐4 = 4
𝑎2 = 4𝑐1 + 8𝑐2 + 4𝑐3 + 8𝑐4 = 28
𝑎3 = 8𝑐1 + 24𝑐2 − 8𝑐3 − 24𝑐4 = 32
𝑆𝑜, 𝑐1 = 1, 𝑐2 = 2, 𝑐3 = 0 𝑎𝑛𝑑 𝑐4 = 1.
𝑎𝑛 = (1 + 2𝑛) 2𝑛 + 𝑛(−2)𝑛 is a solution.
Exercise: Find the solution to the recurrence relation
𝑎𝑛 = −3𝑎𝑛−1 ` − 3𝑎𝑛−2 − 𝑎𝑛−1 ;
with initial conditions 𝑎0 = 1, 𝑎1 = −2 and 𝑎𝑛 = −1.
Non homogeneous Recurrence Relations
We look not at linear non-homogeneous recurrence relation with constant coefficients, that is,
one of the form
𝑎𝑛 = 𝑐1 𝑎𝑛−1 + 𝑐2 𝑎𝑛−2 + _ _ _ + 𝑐𝑘 𝑎𝑛−𝑘 + 𝑓(𝑛)
where 𝑐1 , 𝑐2 , … , 𝑐𝑘 are real numbers and 𝑓(𝑛) is a function not identically zero depending only
on 𝑛. The recurrence relation
𝑎𝑛 = 𝑐1 𝑎𝑛−1 + 𝑐2 𝑎𝑛−2 + _ _ _ + 𝑐𝑘 𝑎𝑛−𝑘
is the associated homogeneous recurrence relation.

Theorem: If {𝑎𝑛 (𝑝) } is a particular solution for the non-homogeneous linear recurrence relation with
constant coefficients
𝑎𝑛 = 𝑐1 𝑎𝑛−1 + 𝑐2 𝑎𝑛−2 + _ _ _ + 𝑐𝑘 𝑎𝑛−𝑘 + 𝑓(𝑛) then every solution is of the form {𝑎𝑛 (𝑝) + 𝑎𝑛 (ℎ) },
where {𝑎𝑛 (ℎ) } is a solution of the associated homogeneous recurrence relation
𝑎𝑛 = 𝑐1 𝑎𝑛−1 + 𝑐2 𝑎𝑛−2 + _ _ _ + 𝑐𝑘 𝑎𝑛−𝑘

Example: What is the solution of the recurrence relation?


𝑎𝑛 = 𝑎𝑛−1 + 𝑎𝑛−2 + 3𝑛 + 1 𝑓𝑜𝑟 𝑛 ≥ 2,
with 𝑎0 = 2 and 𝑎1 = 3?
Solution: We are looking for 𝑎𝑛 that satisfies both recurrence and initial conditions.
𝑎𝑛 = 𝑏𝑛 + ℎ𝑛 where ℎ𝑛 is a solution for the associated homogeneous recurrence:
ℎ𝑛 = ℎ𝑛−1 + ℎ𝑛−2
𝑛 𝑛
1+√5 1−√5
we know ℎ𝑛 = 𝑐1 ( ) + 𝑐2 ( ) .
2 2

And since it is linear non-homogeneous recurrence, 𝑏𝑛 is similar to 𝑓(𝑛) guess:


𝑏𝑛 = 𝑐𝑛 + 𝑑
𝑏𝑛 = 𝑏𝑛−1 + 𝑏𝑛−2 + 3𝑛 + 1
𝑐𝑛 + 𝑑 = 𝑐(𝑛 − 1) + 𝑑 + 𝑐(𝑛 − 2) + 𝑑 + 3𝑛 + 1
𝑐𝑛 + 𝑑 = 𝑐𝑛 − 𝑐 + 𝑑 + 𝑐𝑛 − 2𝑐 + 𝑑 + 3𝑛 + 1
0 = (3 + 𝑐)𝑛 + (𝑑 − 3𝑐 + 1) ⇒ 𝑐 = −3 𝑑 = −10
So, 𝑏𝑛 = − 3𝑛 − 10. (𝑏𝑛 only satisfies the recurrence, it does not satisfy the initial conditions.)
𝑛 𝑛
1+√5 1−√5
𝑎𝑛 = 𝑏𝑛 + ℎ𝑛 = − 3𝑛 − 10 + 𝑐1 ( ) + 𝑐2 ( )
2 2
Now we should find constants using initial conditions.
𝑎0 = −10 + 𝑐1 + 𝑐2 = 2
1+√5 1−√5
𝑎1 = −13 + 𝑐1 + 𝑐2 ⇒ 𝑐1 = 6 + 2√5 𝑐2 = 6 − 2√5
2 2
𝑛 𝑛
1+√5 1−√5
So, 𝑎𝑛 = − 3𝑛 − 10 + (6 + 2√5 ) ( ) + (6 − 2√5 ) ( )
2 2

Example: What is the solution of the recurrence relation


𝑎𝑛 = 2𝑎𝑛−1 − 𝑎𝑛−2 + 2𝑛 𝑓𝑜𝑟 𝑛 ≥ 2,
with 𝑎0 = 1 and 𝑎1 = 2?
Solution: Since it is linear non-homogeneous recurrence, bn is similar to f(n)
Guess: 𝑏𝑛 = 𝑐2𝑛 + 𝑑
𝑏𝑛 = 2𝑏𝑛−1 − 𝑏𝑛−2 + 2𝑛
𝑐2𝑛 + 𝑑 = 2(𝑐2𝑛−1 + 𝑑) − (𝑐2𝑛−2 + 𝑑) + 2𝑛
𝑐2𝑛 + 𝑑 = 𝑐2𝑛 + 2 𝑑 − 𝑐2𝑛−2 − 𝑑 + 2𝑛
0 = (−4𝑐 + 4𝑐 − 𝑐 + 4)2𝑛−2 + (−𝑑 + 2𝑑 − 𝑑) ⇒ 𝑐 = 4, 𝑑 = 0
So 𝑏𝑛 = 4 2𝑛 + 0 = 𝑏𝑛 = 2𝑛+2 .
(𝑏𝑛 only satisfies the recurrence, it does not satisfy the initial conditions.) We are looking for 𝑎𝑛
that satisfies both recurrence and initial conditions.
𝑎𝑛 = 𝑏𝑛 + ℎ𝑛 where ℎ𝑛 is a solution for the associated homogeneous recurrence:
ℎ𝑛 = 2ℎ𝑛−1 − ℎ𝑛−2 .
Find its characteristic equation
𝑟 2 − 2𝑟 + 1 = 0 ⇒ (𝑟 − 1)2 = 0 ⇒ 𝑟1 = 1 (Its multiplicity is 2.)
So, by theorem ℎ𝑛 = (𝑐1 + 𝑐2 𝑛)(1)𝑛 = (𝑐1 + 𝑐2 𝑛) is a solution.
𝑎𝑛 = 𝑏𝑛 + ℎ𝑛
𝑎𝑛 = 2𝑛+2 + 𝑐1 + 𝑐2 𝑛 is a solution.
Now we should find constants using initial conditions.
𝑎0 = 4 + 𝑐1 = 1
𝑎1 = 8 + 𝑐1 + 𝑐2 = 2 ⇒ 𝑐1 = −3, 𝑐2 = −3
So 𝑎𝑛 = 2𝑛+2 − 3 − 3𝑛.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy