Desecerte Mathematics and Combinatorics A
Desecerte Mathematics and Combinatorics A
What is combinatorics?
Perhaps the fastest –growing area of modern mathematics is
combinatorics.
Combinatorics is concerned with arrangements of the objects of a
set into patterns satisfying specified rules.
In the modern world, people in almost every area of activity find it
necessary to solve problems of a combinatorial nature. Today its
influence continues to expand. Part of the reason for the tremendous
growth of combinatorics has been the major impact that computers have
had and continue to have in our society. Because of their increasing
speed, computers have been able to solve large-scale problems that
previously would not have been possible. But computers do not function
independently. They need to be programmed. The bases for these
programs often are combinatorial algorithms for the solutions of
problems. Analysis of these algorithms for efficiency with regard to
running time and storage requirements requires more combinatorial
thinking.
Another reason for the continued growth of combinatorics is its
applications to disciplines that previously had little serious contact with
mathematics. Thus, we find that the ideas and techniques of
combinatorics are being used not only in the tradition area of
mathematical application, namely the physical sciences, but also in
social sciences, the biological sciences, information theory, and so on.
There are three basic problems of combinatorics. They are the
existence problem, the counting problems, and the optimization problem.
1
The existence problem deals with the question: Is there at least one
arrangement of a particular kind? The counting problem asks: how many
arrangements are there? The optimization problem is concerned with
choosing, among all possible arrangements, that witch is best according
to some criterion.
Thus, in general, combinatorics is concerned with the existence,
enumeration (counting), and optimization of discrete structures. In this
module, discrete generally means finite, although some discrete
structures are infinite.
Objectives:
On completion of the course, successful students will be able to:
apply principles of counting to solve counting problems,
Know basic concepts about elementary probability, generating
function and recurrence relation.
use generating function and recurrence relation to solve counting
Problems
construct graphs with given degree patterns,
apply graph theory to solve network oriented problems
Contents
Chapter 1: Counting Principles
1.1 Introduction
1.2 Elementary counting principle
1.2.1 The sum rule principle
1.2.2 The product rule principle
1.3 Indirect counting principle
1.4 Permutations and Combinations
2
1.4.1 Enumeration of permutation and combination
1.4.1.1 Enumeration of permutation and combination
without repetition
1.4.1.2 Enumeration of permutation and combination
with repetition
1.5. The principle of inclusion-exclusion principle
1.5.1 Application of inclusion- exclusion principle
1.5.1.2 The number of integral solution
1.5.1.3 The sieve Eratosthenes
1.5.1.4 The derangements
1.6. The pigeon hole principle
1.6.1. The pigeonhole principle: simple form
1.6.2. The pigeonhole principle: averaging form
1.6.3. The pigeonhole principle: strong form
1.7. The binomial and multinomial theorems
1.7.1. Some combinatorial identities involving binomial
coefficients
1.7.2. Binomial theorem
1.7.3. Multinomial theorem
Chapter 2: Elementary probability theory
2.1. Introduction
2.2. Sample space and events
2.3. Probability of an event
2.3.1 Definitions of probability
2.4. Conditional probability
2.4.1. Multiplication of probability
2.5. Independent events
3
2.6. Bernoulli trials and the binomial distribution
2.7. Random variables and expectation
2.7.1 Random variables
2.7.2. Expected values
2.7.3. Independent random variables
2.7.3. Variance
Chapter 3: Generating function and recurrence relation
3.1. Introductions
3.2. Generating function of a sequence
3.2.1. Generating function model
3.2.2. Useful facts about power series
3.2.3. Solving counting problems using generating functions
3.2.4. The shifting properties of generating functions
3.3. Recurrence relations
3.3.1 Some properties of Fibonacci number
3.3.2 Solving recurrence relation
3.3.2.1. Solving recurrence relation using substitution method
3.3.2.2. Solving homogenous recurrence relation using
generating functions
3.3.2.3. Solving homogenous recurrence relation using
characteristic roots
3.3.2.4. Solving inhomogeneous recurrence relations
using generating functions
3.3.2.5. Solving inhomogeneous recurrence relations
Chapter 4: Elements of Graph Theory
4.1. Definition and Type of Graphs
4.2. Matrix Representation of Graphs
4
4.3. Isomorphism of Graphs
4.4. Path and Connectivity of Graphs
4.5. Eulerian and Hamilton Graphs
4.7. Graph Coloring
4.8. Trees
Chapter 5: Directed Graphs
5.1. Definition and Examples of Directed graphs
5.2. Matrix Representation of Directed graphs
5.3. Isomorphism of direct graphs
5.4. Paths and Connectivity of Diagraphs
Chapter 6: Labeled and Weighted Graph
6.1. Definition and Examples of Labeled and Weighted graphs
6.2. Shortest path Problems
6.3 Spanning Trees
5
Chapter One: Counting principles
1.1. Introduction
In this chapter we will explore the basic counting principles and
their application in solving counting problems.
Objective:
After these lessons the students will be able to:
State different type of counting principles
Solve different counting problems using these principles
1.2. Elementary counting principles
In this section we will present two elementary but basic counting
principles. Then we will show how they can be used to solve many
different counting problems. The two basic counting principles are:
1. the sum rule principle and
2. the product rule principle.
After this lesson the students will be able to
State the sum rule principle in terms of events and sets.
State the product rule principle in terms of events and sets.
Solve counting problems by applying the elementary counting
principles.
1.2.1 The sum rule principle
This principle states that:
If E1, E2, …, and En are mutually exclusive events (no two of the events
can happen at the same time) and if E1 can happen in t1 ways, E2 can
happen in t2 ways,…, and En can happen in tn ways , then E1 or E2 or…or
En can happen in t1+t2+…+tn ways.
6
Example: 1.2.1.1
How many ways can we get a sum of 4 or a sum of 8 when two
distinguishable dice are rolled?
Solution:
Let E1 and E2 be events of getting a sum of 4 and a sum of 8,
respectively. Then, since the outcomes (1, 3), (2, 2) and (3, 1) are the
only ones whose sum is 4, E1 can happen in 3 ways. Likewise, we obtain
a sum of 8 from the outcomes (2,6),(3,5),(4,4),(5,3) and (6,2).
Thus E2 can happen in 5 ways.
Hence by the sum rule principle, E1 or E2 can happen in 3+5 =8ways.
Hence there are 8 outcomes whose sum is 4 or 8, when two
distinguishable dice are rolled.
The sum rule can also be formulated in terms of choices as follow:
If an object can be selected from a reservoir in t1 ways and an object can
be select from a separate reservoir in t2 ways, then the selection of one
object from either one reservoir or the other can be made in t1+t2 ways.
Example1.2.1.2
A student can choose a computer project from one of three lists. The
three lists contain 23, 15 and 19 possible projects respectively. How
many possible projects are there to choose from?
Solution:
Let E1, E2 and E3 be events of choosing a computer project from the 1st,
2nd and 3rd lists, respectively. Since the 1st list, the 2nd list and the 3rd list
consists of 23,15 and 19 possible projects, respectively, the events E1,E2
and E3 can happen in 23,15 and 19 ways, respectively.
Hence E1 or E2 or E3 can happen in 23+15+19 =57 ways. Thus there are
57 possible projects to choose from.
7
Remark: The sum rule can be re-stated in terms of sets as follows:
If A1, A2,… ,Am are pair wise disjoint sets ,then the number of elements
in the union of these sets is the sum of the number of elements in them.
n n
i.e. if X Ai and Ai A j , then X Ai
i 1 i 1
Activity: 1.1
1. In how many ways can we draw
a) a heart or a spade
b) an ace or a king
c) a numbered card or a king from an ordinary deck of playing
cards.
2. How many ways can we get an even sum when two
distinguishable dice are rolled?
1.2.2. Product Rule Principle
If events E1, E2,…, En can happen in t1, t2,…,tn ways respectively.
Then the sequence of events E1 first, followed by E2,… and followed
by En can happen in (t1).(t2)…(tn)ways.
Example: 1.2.2.1
8
At one time, a local telephone number was given by a sequence of two
English letters followed by five digits.
How many different telephone numbers were there?
Solution:
Let E1 and E2 be events of choosing a letter and let E3, E4 and E5 be
events of choosing a digit. Since there are 26 choices for each of the
two letters and 10 choices from each of the five digits, hence, by the
product rule principle, this sequence of events can happen in
26.26.10.10.10.10.10. Thus there are a total of (26)2 x (10)5 possible
telephone numbers.
Activity 1.2
1. If five distinguishable dice are rolled, how many possible
out comes are there?
2. How many three digit numbers can be formed using the
digits 1, 2, 3, 4, 5, 6, 7, 8, &9?
3. How many three digit numbers can be formed using the
digits 1, 3, 4,5,6,8 & 9, if no repetition is allowed?
4. How many possible telephone numbers are there when
there are seven digits, the first two of which between 2
and 9 inclusive, the third digit between 1 and 9inclusive,
and each of the remaining may be between 0 and 9
inclusive?
Remark: In terms of choices , the product rule principle, is stated as: if
a first object can be chosen in t1 ways, a 2nd in t2 ways ,…,and an nth
object can be chosen in tn ways, then a choice of a 1st ,2nd ,…,and an nth
object can be made in (t1).(t2)...(tn) ways.
Example: 1.2.2.3
9
How many different bit strings are there of length seven?
Solution:
Since each bit is either zero (0) or one (1), each of the seven bits can be
chosen in two ways, .There fore, the product rule shows that there are a
total of 2.2.2.2.2.2.2=27=128 different bit strings of length seven.
Example: 1.2.2.4
Find the number of ways a man, woman, and girl can be selected from
5men, 6, women, 2 boys, and 4 girls.
Solution:
Let E1, E2, E3, E4 and E5 be events of choosing a man, woman, boy, and
girl, respectively. Since there are 5 men, 6 women, 2 boys, and 4 girls,
the events E1, E2, E3, E4 and E5 can happen in 5, 6, 2, and 4, respectively.
Hence by the product rule principle these sequences of events can
happen in 5.6.2.4 ways. Hence there are 5.8.2.4=240 number of ways of
selecting a man, woman, and girl.
The product rule principle can also be restated in terms of sets in the
following way. If A1, A2,…Am are finite sets, then the numbers of
elements in the Cartesian product of these sets is the product of the
m
number of elements in each set, i.e. A1 X A2 X ... X Am Ai .
i 1
10
m
m
Hence, A1 X A2 X ... X Am Ai .
i 1
Theorem: 1.2.2.5
If a1 , a2 ,..., an are the distinct elements of set A and b1 , b2 ,..., bm are the m
This implies the set AXB is the union of pair wise disjoint sets ai XB
for for i 1,2,..., n. Hence By the sum rule principle in terms of sets, we
have
n
AXB ai XB
i 1
n B n.m Since B m
Remark: Frequently the solution of combinatorial problems call for the
application of both the sum rule principle and the product rule principle,
perhaps even a repeated and intermixed application of both principles.
Example1.2.2.6
11
How many different license plates can be formed that involves 1or2
English Letters followed by 4 digits?
Solution:
Let E1 and E2 be events of forming plates using 1 letter followed by 4
digits and 2 letters followed by 4 digits respectively.
We can form plates with 1 letter followed by 4 digits in 26 x 104 ways,
plates with 2 letters followed by 4 digits in 262 x 104 ways. These
separate events are mutually exclusive so we can apply the sum rule to
conclude that there are 26 x 104 +262 x 104 = (26+262) x 104 plates with 1
or 2 followed by 4 digits.
Note: The words “and” & “or” indicate whether the sum rule or the
product rule is appropriate .The word “and” suggests the product rule ,
the word “or” suggests the sum rule .
Activity 1.2.2.7
1. How many different plates can be formed using 1 or 2 letters
followed by 3 or 4 digits?
2. How many 2-digits or 3-digits numbers can be formed using the
digits 1, 3, 4,5,6,8 & 9 if no repetition is allowed?
3. A new born child can be given 1, 2, or 3 names. In how many can
a child be named if we choose from 10 names (and no name can
be repeated)?
12
In this section we will introduce still another basic counting tool, known
as the indirect counting principle. It is some times beneficial to solve
some combinatorial problems by counting indirectly, that is, by counting
the complement of a set.
Objectives: After this lesson students will be able to:
State the indirect counting principle in terms of sets.
Apply this principle to solve different counting problems.
The indirect counting principle states that:
If A be a finite set and U be the largest set containing A and the set
A' x U : x A is the complement of A in U .
This principle follows from the sum rule principle, since U A A'
that A U A' .
Note that the set U consists of all the objects under discussion is called
universal set. Applying this principle makes sense only if it is easier to
count the number of elements in U and in A' x U : x A than to
count the number of objects in A .
Example: 1.3.1
Computer passed words are to consist of a string of 4 symbols taken
from the digits 0, 1, 2,…, 9. How many computer passed words have a
repeated symbol?
Solution:
13
Let U be the set of all computer passwords.
Let A be the set of computer passwords with repeated symbol.
Taking the complement of A in U we get the set A' of computer
passwords with no repeated symbol. Now applying the product rule
principle we get U 10.10.10.10. 10 4 10000 and A' 10.9.8.7 5040 .
Hence by the indirect counting principle we have
A U A' 10000 5040 4960 . Hence there are 4960 computer
Activity: 1.4
14
1. How many positive integers less than or equal to 1000 are not
divisible by 6?
2. How many non-negative integers less than 104 that contain the digit 2?
3. In how many ways can 10 people be seated in a row so that a certain
pair of them is not next to each other?
15
Apply the formula of r-combination with unlimited repetition to
the number of nonnegative integral solution of an equation.
Definition: 1.4.1
Let r be a positive integer. A permutation of n objects taken r at a time
(also called r-permutation of n objects) is an ordered arrangement of r
of the objects.
A combination of n objects taken r at a time (also called
r-combination of n objects) is an unordered selection of r of the
objects.
In other words, by an r-permutation of a set S of n elements is an
ordered arrangement of r of the n elements and by an r-combination of a
set S of n elements is an unordered selection of r of the n objects of S.
Example1.4.2
Let S a, b, c, d . Then list
i. the 2-permutation of S
ii. the 3-combination of S
Solution:
The 2-permutations of S are:
ab, ac, ad , bc, bd , cd , ba, ca, da, cb, db and dc .
And the 3-combinations of S are: {a, b, c},{a, b, d},{a, c, d} and {b, c, d}
Note: We remind you that r-combinations with out repetition are just
subsets of the set S consisting r of the n objects of S.
Some remarks will help clarify these definitions. Note that we are
simply defining the terms r-permutation and r-combinations here and
have not mentioned any thing about the rules governing the selection of
the r-objects. On one extreme, objects could be chosen where all
16
repetition is forbidden, or on the other extreme , each object may be
chosen up to r times , or then again there may be some rule of selection
between these extremes ; for instance , the rule that would allow a given
object to be repeated up to a certain specified numbers of times.
We will use expression like {3.a,2.b,2.c} to indicate that we have 3
objects a, b, c where selections are constrained by the conditions that
a can be selected at most three times, b can be selected at most twice,
and c can be chosen up to five times. The numbers 3, 2, and 5 in this
example will be called repetition numbers.
Example: 1.4.3
Find the 3-combinations and the 3- permutations of the set
{3.a,2.b,2.c}
Solution:
The 3-combinations of {3.a,2.b,2.c} are:
aaa, aab, aac, abb, abc, ccc, ccb, cca, and cbb .
ccb, cbc, bcc, cca, cac, acc, cbb, bcb , bbc and bbc
In order to include the case where there is no limit on the number of
times an object can be repeated in a selection we use the symbol „ ’ as a
repetition number to mean that an object can occur an infinite number of
times. If the repetition numbers are all , the selections of r objects are
called r-combinations with unlimited repetition and arrangements of the
r objects are called r-permutations with unlimited repetition.
17
If the repetition numbers are all 1, the selections of r objects are
called r-combinations with out repetition and arrangements of the r
objects are called r-permutations with out repetition.
If the repetition numbers are different from 1 and the selections of r
objects are called r-combinations with constrained repetition and
arrangements of the r objects are called r-permutations with constrained
repetition.
Example1.4.4:
Find the 2-combinations and the 2- Permutations of the set
.a, .b, .c, .d .
Solution:
The 2-combinations of the set .a, .b, .c, .d are:
aa, ab, ac, ad , bb, bc, bd , cc, cd , dd and, the 2-permutations with unlimited
repetitions are: aa, ab, ba, ac, ca, ad , da, bb, bc, cb, bd , db, cc, cd , dc, dd .
Since in 2-combinations, 2 is the limit on the number of objects to be
chosen.
Activity: 1.5
1. List all 5-combinations of
.a, .b, .c, .d , where b is chosen an even number of times .
2. List all the 3-permutations of .a, .b, .c, .d .
3. List all 3-combinations and 4-combinations of
a) a, b, c, d , e
b) .a, .b,1.c,1.d .
18
1.4.1 Enumeration of combinations and permutations
Now we will present general formulas for enumerating
combinations and permutations (i.e.the number of r-permutations and r-
combinations of n distinct objects). At this time, we only list formulas
for combination and permutations without repetition and with unlimited
repetitions. We will wait until later to use generating functions to give
general techniques for enumerating combinations where other rules
govern the selections.
1.4.1.1Enumeration of combinations and permutations
without repetition
First let us drive a formula to find the number of r-permutation and r-
combination with out repetition.
Theorem: 1.4.1.1 (Enumerating r-permutation with out repetition)
Let P(n, r ) denote the number of r-permutations of a set S consisting of n
n!
elements. Then P(n, r ) n(n 1)...(n r 1)
(n r )!
Proof:
Let E1, E2,…, Er be events filling the first, second,….., and the rth
positions of an r-permutations. Since there are n distinct, objects,E1 can
happen in n ways, E2 can happen in n 1 ways (since no repetitions are
allowed and there are n 1 objects left to choose from ) and following
in the same way E3 can happen in n 2 ways …,and finally Er can
happen in n-(r-1) = n-r+1ways. Thus by applying the product rule
principle, we conclude that P(n, r ) n(n 1).(n 2)....(n r 1) .
19
Now for a non negative integer n, let us define n! (read as n factorial)
by n! n(n 1)(n 2)...2.1 (the product of all integers from 1 to n), with
the convention 0! 1
Thus from the definition of factorials, it follows that
n!
P(n, r ) = . (Verify it)
(n r )!
For n ≥ 0, we define P(n,0) to be 1, and this agrees with the formula
where r = 0.
n!
The number of permutations of n elements is given by P(n, n) n!
0!
Example: 1.4.1.1.2
1. The number of 4-letter “words” that can be formed by using each of
the letters a, b, c, d ,e at most once is given by
5! 5!
P(5,4) 5! 120 , and the number of 5-letter words is
(5 4)! 1!
5! 5!
given by P(5,5) 5! 120
(5 5)! 0!
20
there are 3!.8! 93,600 different ways of arrangements in which the 3
men stand next to each other.
Activity: 1.6
1. What is the numbers of ways to order the 26 letters of the alphabet
so that no two of the vowels a, e, i, o, and u occur consecutively?
2. In how many ways can the letters of the English alphabet be
arranged so that there are exactly 5 letters between the
letters a and b ?
3. How many seven-digit numbers with out repetitions of digits are
there such that the digits are all non-zero and 5 and 6 do not
appear consecutively in either order?
The permutations that we have been considering for the objects are
being arranged in a line are called linear permutations.
If we arrange objects in a circle, then the number of permutations
decreases. Such permutations are called circular permutations.
Theorem: 1.4.1.1.4
The number of circular r-permutations of a set of n elements is given
p(n, r ) n!
by .In particular, the number of circular
r r (n r )!
permutation of n element is (n 1)!
Proof:
Here, in the circular permutations the r objects are not assigned to a
particular place but are only arranged relative to one another. In this
case the set of linear r-permutations can be partitioned in to parts in
such a way that two linear r-permutations correspond to the same
21
circular r-permutations if and only if they in the same part. In other
words, two circular permutations can be regarded as the same if one
is brought to other by a rotation (or, circular shift) ,for example in the
3-permutation of the a, b, c, d set the arrangements abc, bca, cab are
considered as the same arrangement in a circular arrangements. Thus,
the number of circular r-permutations equals the number of parts
which is obtained by dividing the number of linear r-permutations by
the number of elements of in each part. Since each part contains
r linear r-linear permutations, the numbers circular r-permutations of
parts is given by
p(n, r ) n!
,
r r (n r )!
And the number of circular n-permutations of n elements is
p(n, n) n! n! n!
. (n 1)! . Thus, n objects arrange
n n(n n)! n.0! n
22
Solution:
To solve this problem, let the 10 people be, P1 , P2 ,..., P10 where, P1 and P2
are the two who do not wish to sit together. Consider seating
arrangements for 9 people X , P3 , P4 ,..., P10 at a round table. There are
(9 1)! 8! such arrangements. If we replace X by either P1 , P2 or by P2 , P1
23
P(n, r ) n!
C (n, r ) , but P(n, r )
r! (n r )!
n!
Hence, C (n, r )
(n r )!.r!
This completes the proof.
Example: 1.4.1.1.9
In how many ways can a committee of 5 chosen from 9 people?
Solution:
Each committee is essentially a 5-combination of 9 people. Thus we can
choose a committee of 5 in C (9, 5) =126 ways.
Example: 1.4.1.1.10
There are 21 consonants and 5 vowels in the English alphabet. Consider
only 8-letter words with 3 different vowels and 5 different consonants.
How many such words can be formed?
Solution:
To solve this problem, there are three tasks to be performed. The first
task choosing the 3 vowels and this can be done in C (5,3) ways, and
the second task is choosing the 5 consonants and this can be done in
C (21,5) ways, and the third task is arranging the 8 letters and this task
24
Note: if S is a set with n elements, C (n, r) is the number of subsets of S
with exactly r elements.
Activity: 1.8
1. In how many ways can a committee of 5 teachers and 4 students be
chosen from 9 teachers and 15 students?
2. In how many ways can a team of 5 chosen from 10 players so as to
a) include both the strongest and the weakest?
b) include both the strongest but exclude the weakest?
c) exclude both the strongest and the weakest?
3. A collection of 100 light bulbs contain 8 defective ones. In how
many ways can the sample of 10 bulbs be selected so that either the
sample contains 6 good ones and 4 defective ones or 5 good ones and
5 defective ones?
4. How many bit strings of length 10 have at least three ones?
5. how many 9-letters words can be formed that contain 3, 4, or 5
vowels,
a) Allowing repetition of letters?
b) Not allowing repetition?
25
Theorem: 1.4.1.2.1 (enumerating r-permutations with unlimited
repetitions)
Let U (n, r) denote the number of r- permutations of n objects with
unlimited repetitions. Then U (n, r ) n
r
Proof:
Since repetitions are allowed each of the r positions can be filled in n
ways. Hence by the product rule
U (n, r ) n.n.....n (r factors )
nr
This completes the proof.
Example: 1.4.1.2.2
Find the number 3-permutition of the set .a, .b, .c, .d
Solution:
The number 3-permutition of the set .a, .b, .c, .d is equal to the
number of 3- permutation of 4 objects with unlimited repetition,
hence this is equal to U (4,3) 43 64
Example: 1.4.1.2.3.
There are 25 true or false questions on an examination. How many
different ways can a student do the examinations if it is forbidden to
leave the answer blank?
Solution:
This problem is the same as finding the number of 25-permutations of
the set S {.T , .F} . Hence by the theorem 1.4.1.2.1 there are
U (2,25) 225 different ways can a student do the examination.
26
Activity: 1.9
1. A multiple- choice questions test contains 10 questions. There are four
possible answers for each question.
a) How many ways can a student answer the questions on the test
if every question is answered?
b) How many ways can a student answer the questions on the test
if the student can leave answers blank?
3. How many binary sequences are there of length 15?
4. What is the number of ternary numerals with at most 4 digits?
5. How many strings of length n can be formed from the English
alphabet?
Theorem: 1.4.1.2.5(enumerating r-combinations with unlimited
repetitions)
Let V (n, r) denote the number of r-combinations of n objects with
(n 1 r )!
unlimited repetitions. Then V (n, r ) C (n 1 r , r ) .
r!(n 1)!
Proof:
Let the n distinct objects are: a1 , a2 ,..., an so that the selections is
27
= the number of binary numbers with n-1 one‟s and
r zero‟s.
= C (n 1 r , r )
This completes the proof.
Remark: the number of r-combinations of S {.a1, .a2 ,..., an} is the
=316,251.
d) The number of ways of placing 10 similar balls in 6 numbered
boxes is C (6-1+10, 10) =C (15, 10) =3,003.
e) The number of binary numbers with ten 1‟s and five zeros is C
(10+5, 5) =C (15, 5) =3,003, since n-1=10 and r=5.
Example: 1.4.1.2.7
How many different out comes are possible from tossing 10 similar
coins?
Solution:
28
This problem is the same as placing 10 similar balls in to 2 numbered
boxes labeled ” heads” and “tails”. There fore, there are
C (2-1+10, 10) =C (11, 10) =11posiblities.
Example: 1.4.1.2.8
How many different outcomes are possible from tossing 10 similar
dice?
Solution:
This problem is the same as placing 10 similar balls in to 6 numbered
boxes. Therefore there are C (6-1+10, 10) =C (15, 10) =3,003posiblities.
Example: 1.4.1.2.9
What is the number of non-negative integral solutions to the equation
x1 x2 x3 x4 20 in which x1 3, x2 1, x3 0, x4 5
Solution:
Here we introduce the new variables
y1 x1 3, y2 x2 1, y3 x3 , y4 x4 5
( x1 x2 x3 x4 ) (3 1 0 5)
20 9
11
Hence the number of non-integral solutions of the equation
x1 x2 x3 x4 20 in which x1 3, x2 1, x3 0, x4 5 is equal to the
29
1. Prove that
i) The number of integral solutions of x1 x2 ... xn r
where each xi 0 is equal to C(r-1, n-1).
the inequality x1 x2 x3 x4 x5 4
3 find the number of integral solution to x1 x2 x3 x4 50 where
x1 4, x2 7, x3 14, x4 10
Proof:
30
We are given that there are t distinct objects with repetitions
q1, q2 ,...., qt , respectively , for a total of
n q1 q2 .... qt objects.
We can think of it in this way. There are n places, and we want to put
exactly one of the objects of S in each of the places. We first decide
which places are to be occupied by the a1 ‟s. since there are q1 a1 ‟s in S;
ways. We next find that there are C (n- q1 q2 , q3 ) ways to choose the
places for the a3 ‟s. We continue like this, and applying the product rule
of principle, we have
P(n : q1 , q2 ,..., qt ) C (n, q1 ).C (n q1 , q2 ).C (n q1 q2 , q3 )
....C (n q1 q2 ... qt 1, qt )
n! (n q1 )! (n q1 q 2 )!
. .
q1!(n q1 )! q 2 !(n q1 q 2 )! q3 !(n q1 q 2 q3 )!
(n q1 q 2 ... qt 1 )!
....
qt !(n q1 q 2 ... qt )!
n!
q1!.q 2 !...qt !
This proves the result.
Note: P(n : q1 , q2 ,..., qt ) is the same as the number of ways to distribute n
31
The number of permutations of the letters in the word MISSIPPI is equal
to the number of 11-permutition of the set {1.M ,4.I ,4.S ,2.P} . Hence this
11!
is equal to P(11 : 1,4,4,2) .
1!4!4!2!
Example: 1.4.1.2.13
A store has 25 flags to hang along the front of the store to celebrate a
special occasion. If there are 10 red flags, 5 white flags, 4 yellow flags,
and 6 blue flags, how many distinguishable ways can the flags be
displayed?
Solution:
The problem is the same as finding the 25-permutition of the set
{10.R,5.W ,4.Y ,6.B} where R, W, Y and B represent the red, white, yellow,
32
In this section we drive and apply an important counting formula
called the inclusions-exclusions principle. Recall that the sum rule
principle gives a simple formula for counting the number of objects in a
union of sets, provided that the sets do not overlap . The inclusions-
exclusions principle gives a formula in which the sets are free to overlap
with out restrictions. First we state and prove the inclusion-exclusion
principle for two sets and three states and finally we sate the general
statement of the principle of inclusion-exclusion with out proof.
Objectives:
After this lesson the students will be able to:
State inclusion- exclusion principle for two sets and three sets.
State the general statement of the inclusion- exclusion
principles.
Solve counting problems using this principle.
Define derangements of the set {1, 2,…, n}.
Use inclusion- exclusion principle to find the number of
integral solutions of a given equation.
Apply the principle of inclusion-exclusion principle to find the
number of derangements.
Apply principle of inclusion-exclusion principle to find the
number of prime numbers not exceeding a specified positive
integer.
33
Result 1.5.1 (The inclusions-exclusions principle for two sets)
The statement of Inclusions-exclusions principle for two sets states that
if A and B are finite subsets of some universe set U,
then A B A B A B .
Proof : Consider the following Venn diagram given bellow
Since in counting the elements of A and the elements of
B we have counted the elements of A B twice .But it is clear that
A B A B by (1)
A2 A3 A1 A2 A3
34
Proof: Consider the following Venn diagram given bellow
Since in counting the elements of A1 , A2 and A3 we have counted the
elements of A1 A2 A3 three times.
But it is clear that A1 A2 A3 is the union of the seven disjoint sets
namely A'1 A2 A3 , A1 A' 2 A3 , A1 A2 A'3 , A'1 A' 2 A3 , A'1 A2 A'3
A1 A' 2 A'3 and A1 A2 A3 so by the sum rule principle,
Thus since these are disjoint unions we can use the sum rule principle to
compute
A1 A1 A' 2 A'3 A1 A' 2 A3 A1 A2 A'3 A1 A2 A3
A1 A' 2 A3 A1 A2 A3 A'1 A2 A3
A1 A2 A3 A1 A2 A3 A1 A2 A'3 A1 A2 A3
35
A1 A' 2 A3 A1 A2 A3 A'1 A2 A3
A1 A' 2 A3 A1 A2 A3 A1 A3 , and
A1 A2 A3 A1 A2 A3 A1 A2 A1 A3 A2 A3 A1 A2 A3
compute to compute F R .
Thus F R F R F R
=200+50 -20
=230
Activity: 1.12
1. if there are 200 faculty members that speak French , 50 that speak
Russian , 100 that speak Spanish , 20 that speak French and Russian ,
36
60 that speak French and Spanish 35 that speak Russian and
Spanish, while only 10 speak French , Russian , and Spanish ,how
many speak either French or Russian or Spanish?
2. An advertising agency has 1,000 clients. Suppose that T is the set of
clients that use television advertising, R is the set of clients that use
radio advertising, and N is the set of clients who use newspaper
advertising. Suppose that T 415, R 350, N 280 , 100 clients use
all 3 types of advertising, 175 use television and radio, 180 use radio
and newspaper, and 165 use television and newspaper.
a) Find T R N ' .
b) How many clients use radio and news paper advertising but
not television?
c) How many clients use television but do not use radio
advertising and do not use news paper advertising?
d) Find T 'R'N '
A A
i , j ,k
i j Ak
...
1n1 A1 A2 .... An
37
where, the second summations is taken over all 2-combinatons {1,2} of
the integers {1,2,…,n}, the third summations is taken over all 3-
combinations {i, j, k} of {1,2,…,n}, and so on .
for n = 4 there are C(4,1)+C(4,2)+ C(4,3)+C(4,4)=4+6+4+1=15 terms
and the theorem for n=4 states that
A1 A2 A3 A4 A1 A2 A3 A4 A1 A2 A1 A3
A1 A4 A2 A3 A2 A4 A3 A4
A1 A2 A3 A1 A2 A4 A1 A3 A4
A2 A3 A4 A1 A2 A3 A4
... 1 A1 A2 .... An
n
Proof:
A1 ' A2 '... An ' ( A1 A2 .... An )'
U A1 A2 ... An
n
U [ Ai Ai A j Ai A j Ak
i 1 i, j i , j ,k
... 1
n 1
A1 A2 .... An ]
n
U Ai Ai A j Ai A j Ak
i 1 i, j i , j ,k
38
... (1) 1
n 1
A1 A2 .... An
n
U Ai Ai A j Ai A j Ak
i 1 i, j i , j ,k
... 1 A1 A2 .... An
n
U A1 A2 A3 A1 A2 A1 A3
A2 A3 A1 A2 A3
39
100 (200 166 125) (33 25 41) 8
600
Activity: 1.13
Find the number of integers between 1 and 100 inclusive that are not
divisible by 2 and 3.
Let us give some more examples which use the principle of inclusion-
exclusion principle
Example: 1.5.9
In how many ways can the letters {5.a, 4b, 3.c} be arranged so that all
the letters of the same kind are not in a single block?
Solution:
Let U be the set of all permutations of these letters.
12!
Hence, U
5!4!3!
And let A1 be the arrangements of the letters where the 5 a‟s are in a
8!
single block, A1 ,
1!4!3!
A2 be the arrangements where the 4b‟s are in a single block,
9!
A2 ,
5!1!3!
and A3 the arrangements where the 3 c‟s are in one block. Then
10!
A3 ,
5!4!1!
A1 A2 is the set of arrangements of the letters where 5 a‟s and 4b‟s are
5!
in a single block. Hence A1 A2 ,
1!1!3!
40
A1 A3 is the set of arrangements of the letters where 5 a‟s and 3 c‟s
5!
are in a single block. Hence A1 A3 , A2 A3 is the set of
1!4!1!
arrangements of the letters where 4 b‟s and 3 c‟s are in a single block.
5!
Hence A2 A3 , and moreover A1 A2 A3 is the set of
5!1!1!
arrangements of the letters where 5 a‟s, 4 b‟s and 3 c‟s are in a single
3!
block thus, A1 A2 A3 ,
1!1!1!
Thus
A'1 A' 2 A'3 U A1 A2 A3 A! A2 A1 A3 A2 A3
A1 A2 A3
12! 8! 9! 10! 5! 5!
=
5!4!3! 1!4!3! 5!1!3! 5!4!1! 1!1!3! 1!4!1!
Activity: 1.14. In how many ways can the letters {4.a, 3b, 2.c} be
arranged so that all the letters of the same kind are not in a single block?
41
The principle of the inclusion-exclusion principle can be used
n
together with the formula C (n 1 r ( ri ), n 1) to find the number of
i 1
Solution:
Let U be the set of solutions ( x1 , x2 , x3 ) of the equation x1 x2 x3 20
where x1 2, x2 4, x3 2 . Thus
U C (3 1 20 (2 4 (2)),3 1) C (18,2)
42
Now A1 A2 is a set of solutions of equation (1) where
x1 2, x2 8, x3 2 therefore,
A1 A2 C (3 1 20 (6 8 2),3 1) C (10,2)
A1 A3 C (3 1 20 (6 4 10),3 1) C (2,2)
U A1 A2 A3
U A1 A2 A3 A1 A2 A1 A3
A2 A3 A1 A2 A3
Activity: 1.14
1. How many integral solution are there of x1 x2 x3 11
where 0 x1 3, 0 x2 4, 0 x3 6 ?
2. How many integral solution are there of x1 x2 x3 20 ,
where 1 x1 6, 1 x2 7, 1 x3 8 and 1 x4 9 ?
43
1.5.1.3The sieve Eratosthenes
A method developed by the Greek mathematician Eratosthenes who
lived in Alexandria in the third century B.C. gives a way of listing all
primes between 1 and n. his procedure is the following: remove all
multiples of 2 other than 2. Keep the first remaining integers exceeding
2, namely, the prime 3. Remove all the multiples of 3 except 3. Keep the
first remaining integers exceeding 3, namely, the prime 5. Remove all
the multiples of 5 except 5, and so on. The retained all numbers are the
primes. This method is called the “the sieve of Eratosthenes.”
The principle of inclusion-exclusion can be used to find the numbers
of primes not exceeding a specified positive integer. Recall that a
composite integer is divisible by a prime not exceeding its square root.
Example: 1.5.1.3.1
Find the numbers of primes not exceeding 100.
Solution:
First note that composite integer not exceeding 100 must have a prime
factor not exceeding 10. Because the only primes less than 10 are 2, 3, 5,
and 7, the primes not exceeding 100 are those 4 primes and those
positive integers greater than 1 and not exceeding 100 that are divisible
by none of 2, 3, 5, or 7.
To apply the principle of inclusion-exclusion let U {x Z : 1 x 100} .
Let A1 , A2 , A3 , and A4 be the set of elements of U divisible by 2, 3, 5, and
7, respectively. We wish to compute A'1 A' 2 A'3 A' 4 .
We know that
A'1 A' 2 A'3 A' 4 U A1 A2 A3 A4 A! A2 A1 A3
A1 A4 A2 A3 A2 A4 A3 A4
44
A1 A2 A3 A1 A2 A4 A1 A3 A4
A2 A3 A4 A1 A2 A3 A4
1.5.1.4 Derangements
The principle of inclusion-exclusion will be used to count the
permutation of n objects that leave no objects in their original position.
Consider the following examples:
1. At a party, 10 gentlemen check their hats. In how many ways can
their hats be returned so that no gentleman gets the hat which he
arrived?
2. In how many ways can the letters M, A, D, I, S, O, N be written
down so that the “word” spelled disagree completely with the
spelling of the word MADISON in the sense that no letters occupies
the same position as it does in the word MADISON?
Each of these questions is an instance of the following general problem.
45
We are given a set X with n elements in which each element has a
specified location, and we are asked to find the number of permutation
of the set X in which no element is in its specified location. In the first
question, the set X is the set of 10 hats, and the specified location of a
hat is (the head of) the gentleman to which it belongs. In the second
question X = {M, A, D, I, S, O, N}, and the location of a letter is that
specified by the word MADISON.
Since the actual nature of the objects is irreverent, we may take X to be
the set {1, 2, 3, …, n} in which the location of each of the integers is
that specified by its natural position in the sequence 1, 2, 3, …, n
Among the permutations of {1, 2, 3…, n} there are some, called
derangements, in which none of the n integers appears in its natural
position.
Definition: 1.5.1.4.1
A derangement of {1, 2, 3…, n} is a permutation i1i2 ...in of the set
{1, 2, 3…, n} such that i1 1, i2 2..., in n .
For example, the permutation 2 1 4 5 3 is a derangement of the set
{1, 2, 3, 4, 5} since 2 1, 1 2, 4 3, 5 4, 3 6
Let Dn the number of derangements of {1, 2, 3, …, n}. As illustrations
we note there are no derangements for n=1.
The only derangements for n=2 is 2 1.
For n=3 there are two derangements, namely 2 3 1 and 3 1 2.
The derangements for n=4 are as follows:
2143 3142 4123
2341 3412 4312
2 4 13 3421 4321
46
Thus, we have D1 =0, D2 1 D3 2 and D4 9
Theorem: 1.5.1.4.2
The number of derangements of a set with n elements is
1 1 1 1
Dn n!(1 .... (1) n ) , for n 1
1! 2! 3! n!
Proof:
To prove this theorem we apply the principle of inclusion-exclusion
Let U be the set of all permutations of {1, 2, 3…, n} then U n!
For each i , let Ai be the set of permutations of the form b1b2 b3 ...bn of {1,
2, 3… n} such that bi i .
Then the set of derangements is precisely the set A1 ' A2 '... An ' .
Thus, Dn A1 ' A2 '... An ' .
The permutations in A1 are all of the form 1b2 b3 ... bn where b2 b3 ... bn is a
permutation of {2, 3…, n}.
Thus A1 (n 1)! , and more generally we have Ai (n 1)!. The
permutations in A1 A2 are of the form 1 2 b3 b4 ... bn where b3 b4 ... bn is a
permutations of {3, 4…, n}.
Therefore, A1 A2 (n 2)! and more generally we have
47
Since there are C (n, k) k-combinations of {1, 2, 3,…, n}, applying the
inclusions-exclusions principle we have
Dn A'1 A' 2 ... A' n
U A1 A2 ... An
n
U Ai Ai A j Ai A j Ak ...
i 1 i, j i , j ,k
n! n! n! n!
n! .... (1) n )
1! 2! 3! n!
1 1 1 1
n!(1 .... (1) n )
1! 2! 3! n!
1 1 1 1
Thus, Dn n!(1 .... (1) n )
1! 2! 3! n!
This proves the result.
1 1 1 1 1
In particular, D5 5!(1 ) =44
1! 2! 3! 4! 5!
Example: 1.15
Let n books be distributed to n students. Suppose that the books are
returned and distributed to students again later on. In how many ways
can the books be distributed so that no student will get the same book
twice?
Solutions:
48
The first time the books are distributed n! ways, the second time Dn ways.
Hence by product rule principle the total number of ways is given by
1 1 1 1
n!.Dn (n!) 2 [1 .... (1) n ] .
1! 2! 3! n!
Activity: 1.5
1. How many ways can the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 are
arranged so that no even digit is in its original position?
2. Find D3 .
3. At a party there are n men and n women. In how many ways can
the n women choose partners for the first dance? How many ways
are there for the second dance if every one has to change partners?
4. prove that Dn nDn1 (1) n for n 2.
that do not have 1 in the first place, nor 4 in the forth place, nor 7
in the seventh place.
49
Objectives:
After this lesson the students will be able to:
State the pigeonhole principle in different form.
Apply this principle to solve a variety of interesting problems.
Prove some results using pigeonhole principle.
1.6.1 The pigeonhole principle: simple form
The simplest form of the pigeonhole states that: If you put n+1
pigeons are put into n pigeonholes, then there is at least one pigeonhole
which contains two or more pigeons.
Proof:
Let n+1 pigeons are put into n pigeonholes.
Claim: there exists at least one pigeon hole which contains two or
more pigeons.
Suppose not i.e. each pigeonholes are contains at most 1 pigeon. This
implies that the n pigeonholes contain at most n pigeons. But this
contradicts the hypothesis. Hence, this proves the claim.
This principle can be applied to many problems where we want to
show that a given situations can occur.
Example: 1.6.1.1
1. Among any group of 367 people, there must be at least two with
the same birthday, because there are only 366possible birthdays.
2. In any group 27 English words, there must be at least two that
begin with the same letter, since there are 26 letters in the English
alphabet.
50
3. How many students must be in a class to guarantee that at least
two students receive the same score on the final exam, if the exam
is graded on a scale from 0 to 100 points?
Solution:
There are 101 possible scores on the final. The pigeonhole principle
shows that among any 101+1=102 students there must be at least 2
students with the same score.
The simplest form of pigeonhole is generalized as follows:
If k.n+1 pigeons are put into n pigeonholes then there exists at least
one pigeonhole which contains k 1 or more pigeons. This is called
generalized simple form Pigeonhole principle.
Example: 1.6.1.2
Find the minimum number of students in a class to be sure that three
of them are born in the same month.
Solution:
Here the n=12 months are the pigeonholes and k 1 3 , or k=2.
Hence, by the generalized simple form pigeonhole principle, among
any k.n 1 =2(12) +1=25 students (pigeons), there of them are born
in the same month.
Example:
During a month with 30 days a base ball team plays at least 1 game a
day, but no more than 45 games. Show that there must be a period of
some number of consecutive days during which the team must play
exactly 14 games.
Solution:
51
Let a i be the number of games played at the end of the ith day. Since
at least 1 game is played each day, at most 45 games, we
have 1 a1 a2 ... a30 45 . Also adding 14 to each of these
inequalities gives a1 14 a2 14 ... a30 14 30 45 59
Now consider the following numbers:
a1 , a2 ,..., a30 , a1 14, a2 14,..., a30 14 . These are 60 numbers, each
52
Proof:
Let n is the number of pigeonholes and mi is the number of pigeons in
(The proof is similar for some mi A .) Let us assume the contrary, that
Example: 1.6.2.1
In a group of 61 people, show that at least 6 people were born in the
same month.
Solution:
Here the problem is the same as distributing 61pigeons among 12
pigeonholes. Hence by the second versions of the averaging form
53
pigeonhole principle there are at least 5.08 6 people who were
61
12
born in the same month.
Example: 1.6.2.2
Prove the generalized simple form of the pigeonhole principle using the
averaging form of the pigeonhole principle.
Solution:
Recall that the generalized form of the pigeonhole principle states that
“if k.n 1 pigeons are put into n pigeonholes then there exists at least one
pigeonhole which contains k 1 pigeons”. Let A is the average number
of pigeons per hole, then by second version of the averaging form of the
pigeonhole principle, there exists at least one pigeonhole which contains
k .n 1 1
A k k 1 . Hence this completes the proof.
n n
54
Activity: 1.17
1. If 401 letters were delivered to 50 apartments, then show that
some apartment received at most 8 letters.
2. If x1 , x2 , x3 ,...., x8 are the 8 distinct integers, then show that there is
some pair of some integers with the same remainder when divided
by 7.
1.6.3 Pigeonhole principle: strong form
Theorem: 1.6.3.1
Let m1, m2,…,mk be positive integers. If m1+m2+…+mn –n+1 objects are
put into n boxes , then either the first box contains at least m1 objects , or
the second box contains at least m2 objects , …, or the nth box contains at
least m n objects.
Proof:
Let m1+m2+…+mn –n+1 objects are put into n boxes.
Claim: for some i= 1, 2, … ,n the ith box contains at least mi objects.
Suppose the contrary, i.e. for all i the ith box contains at most mi -1 balls
i.e. the first box contains at most m1-1 objects , the second box contains
at most m2 -1 objects ,…, and the nth box contains at most
mi -1 objects. This implies all the n boxes contain at most m1 -1+m2 -
1+…+mn -1= m1+ m2+…+ mn- n objects. Which contradicts the
hypothesis m1+m2+…+mn –n+1 objects are put into n boxes. Hence this
proves the strong form of the pigeonhole principle is valid, i.e., the ith
box contains at least mi objects for some i=1, 2, …, n.
Note:
The simple forms of the pigeonhole principle is obtained from the strong
form by taking m1=m2=…=mn=2. That is, if m1+m2+…, mn –n+1=2n-
55
n+1=n+1 pigeons are put on n pigeon holes there exists one pigeonhole
which contains at least mi 2 pigeons.
Example: 1.6.3.2
If 41 balls are chosen from a collection of red , white , blue, green, and
yellow colored balls, show that there are at least 12 red balls, 15 white
balls, 4 blue balls,10green balls , or 4 yellow balls chosen.
Solution:
Let x1, x2, x3, x4, x5 represent, respectively, the number of red, white,
green, and yellow balls chosen. Thus, x1+x2+x3+x4+x5=41.
Claim: x1 12 x2 15, x3 4, x4 10, or x5 4.
Suppose, on the contrary, that is x1 11 x2 14, x3 3, x4 9, and x5 3.
Then
41=x1+x2+x3+x4+x5 11+14+3+9+3=40. Thus, we have arrived at the
contradiction 41 40 , hence the claim.
Alternative method
Let m1 =12, m2=15, m3=4, m4=10 and m5=4.
Since,
m1+ m2+ m3+ m4+…+ m5 – 5+1=12+15+4+10+4 - 5+1=41.
Then by strong form of the pigeonhole principle, there are at least 12 red
balls, 15 white balls, 4 blue balls,10green balls , or 4 yellow balls
chosen.
Example: 1.6.3.3
A basket of fruit is being arranged out of apples, bananas, and oranges.
What is the smallest number of piece of fruit that should be put in the
basket in order to guarantee that either there are at least 8 apples or at
least 6 bananas or at least 9 oranges?
56
Solution:
By a strong form of the pigeonhole principle, 8+6+9-3+1=21 pieces of
fruit, no matter how selected, will guarantee a basket of fruit with the
desired properties.
Activity: 1.18
Suppose that every student in mathematics class of 25 students is a
freshman, a sophomore, or a junior.
a) Show that there are at least 9 freshman, at least 9 sophomore, or at
least 9 juniors in the class.
b) Show that there are at least 3 freshman, at least 19 sophomore, or at
least 5 juniors in the class.
The symbol C (n.r ) has two meanings: the combinatorial and the
factorial. In other words, C (n.r ) represents the number of ways of
choosing r objects from n distinct objects (the combinatorial meaning)
n!
and, as well, C (n.r ) equals (the factorial or algebraic meaning).
r!(n r )!
There fore as a general rule, all the theorems and identities about
57
factorials and binomial coefficients can be viewed as two kinds of
statements for which two kinds of proof can be given – a combinatorial
proof and an algebraic proof.
Objectives:
After these lessons the students will be able to:
Prove some basic identities involving binomial coefficients using
combinatorial proof and algebraic proof.
Prove the binomial theorem and multinomial theorem.
Use these theorems to expand and to determine the coefficient of
the terms of an expression.
1.7.1 Some basic combinatorial identities involving binomial
coefficients
1. Representation of binomial coefficients by factorials.
For every pair of integer n and r where 0 r n ,
n!
C (n, r ) This identity was proved in theorem 1.4.1.1.8
r!(n r )!
chapter one.
2. Symmetry property
C (n, r ) C (n, n r )
Proof:
Using combinatorial proof:
When we choose r objects from n objects there are n-r objects left.
These n-r objects can be considered as an (n-r)-combination.
Hence to every r-combinations automatically there is an associated (n-r)-
combination and conversely. In other words there are precisely the same
number of r-combinations as (n-r)-combinations. Hence,
C (n, r ) C (n, n r ) .
58
Using algebraic proof:
n!
We know that C (n, r ) ,
r!(n r )!
n!
and C (n, n r )
(n (n r ))!(n r )!
n!
r!(n r )!
= C (n, r ) , which completes the proof.
3. Newton’s identity:
For integers, 0 k r n , C(n, r ) C(r, k ) C(n, k ) C(n k , r k ) .
Proof:
Using combinatorial proof
The left-hand side counts the number of ways of selecting two
sets: first a set A of r objects and then from A, a set B of k objects.
For example, we may be counting the number of ways to select a
committee of r people and then select a subset of k leaders from this
committee. On the other hand, the right hand side counts the number
of ways we could select the group of k leaders from the n people first,
and then select the remaining r - k people for the committee from the
remaining n – k people. And these two ways of counting are the
same, hence C(n, r ) C(r, k ) C(n, k ) C(n k , r k )
Using algebraic proof
Let us start from the right hand side of the equation, thus
n! (n k )!
C (n, k ) C (n k , r k ) .
k!(n k )! (r k )!(n k (r k ))!
59
n! (n k )!
.
k!(n k )! (r k )!(n r )!
n! 1
.
k! (r k )!(n r )!
n! 1
.
(n r )! (r k )!
1 r! r!
n!
. . ,since 1
(n r )! (r k )! r! r!
n! r!
.
(n r )!r! (r k )!
60
Sir Isaac Newton (1646-1727) discovered the importance of this
identity: it shows how to compute C (n, r 1) from C (n, r ) . That is by ii)
n
above C (n, r 1) C (n, r )
r 1
4. Pascal’s Identity
For all integers n and r with 1 r n 1 ,
C (n, r ) C (n 1, r ) C(n 1, r 1)
Proof:
Using algebraic proof
n!
We know that C (n, r ) and
r!(n r )!
(n 1)! (n 1)!
C (n 1, r ) C (n 1, r 1)
(n r 1)!r! (n r )!(r 1)!
(n r )(n 1)! r (n 1)!
(n r )!r!
(n r r )(n 1)!
(n r )!r!
n(n 1)!
(n r )!r!
n!
(n r )!r!
C (n, r )
61
In A we put all those r-combinations which do not contain y . In B
we put all the r-combinations which contain y .
62
By using the relation C (n, r ) C (n 1, r ) + C (n 1, r 1) and the initial
C (n,0) 1 and C (n, n) 1 , ( n 0) , we can build successive rows in the
n=0 1
n=1 1 1
n=2 1 2 1
n=3 1 3 3 1
n=4 1 4 6 4 1
n=5 1 5 10 10 5 1.
Figure Pascal‟s triangle
Pascal‟s identity shows that when two adjacent binomial
coefficients in this triangle are added, the binomial coefficient in the
next row between these coefficients is produced.
The binomial coefficients enjoy many other identities besides
Pascal‟s identity.
63
5. Diagonal summation
C(n,0) C(n 1,1) C(n 2,2) .... C(n r, r ) C(n r 1, r )
Proof:
Let us give a combinatorial proof by counting the numbers of ways to
distribute r similar balls into n+2 numbered boxes. This can be done
in C (n 2 1 r, r ) C (n r 1, r ) ways. But the balls may also be
distributed as follows: for each 0 k r , distribute k in the first n+ 1
box, and then the remainder in the last box. This can be done in
r r
k 0
C (n k , k ) ways. Hence, k 0
C (n k , k ) C (n r 1, r ) . This
r
That is k 0
C (n k , k ) C (n r 1, r ) . This completes the proof.
5. Row Summation.
n
Let n be a positive integers. Then,, C (n, r ) 2 .
n
r 0
Proof:
Let S be a set with n elements. Let X is a set of all subsets of S.
64
X 2 n . The set X consists of subsets of S with zero elements,
6. Column Summation
C(r, r ) C(r 1, r ) .... C(n, r ) C(n 1, r 1)
65
remaining n r k into a (r 2) box. Hence the number of
th
C (n 1,2)
n(n 1)
2
Example: 1.7.1.1
Evaluate the sum 12 2 2 32 .... n 2 .
Solution:
Here we observe that k 2 k (k 1) k 2C(k ,2) C(k ,1) for k 1,2,3,..., n
Hence 12 2 2 32 .... n 2 [2C(1,2) C(1,1)] [2C(2,2) C(2,1)]
[2C(3,2) C(3,1)] .... [2C(n,2) C(n,1)]
66
2C (n 1,2 1) C (n 1,1 1) by column summation identity
2C (n 1,3) C (n 1,2)
n(n 1)(2n 1)
(verify it)
6
Activity: 1.19
1. a) Show that k 3 k (k 1)(k 2) 3k 2 2k C(k ,1) 6C(k ,2) 6C(k ,3) .
b) Evaluate 13 23 33 .... n 3 .
c) Using the fact that k 4 k (k 1)(k 2)(k 3) 6k 2 11k 2 6k , derive
a formula for k 4 like (a) in terms of binomial coefficients.
2. Use the binomial identities to evaluate the sum
1.2.3 2.3.4 ... (n 2)(n 1)(n).
67
done in C(n, n r ) C(n, r ) ways. Therefore, the coefficient of the
term x nr y r is C(n, n r ) C(n, r ) . This proves the theorem.
Second proof :( using algebraic proof)
The proof is by induction on n. It‟s more cumbersome and helps one
appreciate the combinatorial viewpoint given in the first proof.
If n 1, the formula becomes
1
( x y)1 = C (1, r ) x1r y r C (1,0) x y C (1,1) x y x y , and this is clearly true.
1 0 0 1
r 0
We now assume that the formula is true for a positive integer n, that
n
is, ( x y) n = C (n, r ) x nr y r and we want prove that it is true when n is
r 0
replaced by n 1 . We write ( x y)
n 1
( x y) ( x y) n , and by the
inductive hypothesis this becomes
n
( x y) n1 ( x y) C (n, r ) x
r 0
nr
yr
C (n, r ) x
n
x ( C (n, r ) x nr nr
y ) y(
r
yr )
r 0 r 0
n n
= C (n, r ) x n1r y r + C (n, r ) x nr
y r 1
r 0 r 0
n n 1
= C (n,0) x n1 C (n, r ) x n1r y r + C (n, r ) x nr
y r 1 C (n, n) y n1
r 1 r 0
C (n, r ) x nr y r 1
r 0
C (n, k 1) x
k 1
n 1 k
y k . Now the letter of the dummy
C (n, r 1) x
r 1
n 1 r
y r and
68
n
( x y) n1 x n1 C (n, r ) x n1r y r +
n
r 1
C (n, r 1) x
r 1
n 1 r
y r y n 1
n
x n 1 C (n, r ) C (n, r 1)x n1r y r + y
n 1
r 1
n
x n 1
C (n 1, r ) x n 1r y r y n1 (Since by Pascal‟s identity
r 1
C (n, r ) C(n, r 1) C (n 1, r ) )
Since C(n,0) C(n, n) 1, we may write this last equation and obtain
n 1
( x y) n1 C (n 1, r ) x
r 0
n 1 r
yr
Hence the formula is true for n 1 and the binomial theorem holds by
mathematical induction.
Example: 1.7.2.2
Expand ( x y) 8 .
Solution:
( x y) 8 C (8,0) x 8 C (8,1) x 7 y C (8,2) x 6 y 2 C (8,3) x 5 y 3 C (8,4) x 4 y 4
x 8 8x 7 y 28x 6 y 2 56 x 5 y 3 70 x 4 y 4
56 x 3 y 5 28x 2 y 8 8xy 7 y 8
Corollary: 1.7.2.3
n
Let n be a positive integer. Then for all x, (1 x) n = C (n, r ) x
r 0
r
Proof:
By the binomial theorem we have
n n
(1 x) n = C (n, r )(1)
r 0
nr
xr = C (n, r ) x
r 0
r
. This completes the proof.
69
Activity: 1.20
1. Expand (2a 5b) 8 .
2. Find the coefficient of x 3 y 7 in (2 x 9 y)10
n
3. Prove (1 x) n C (n, r )(1) r x r
r 0
The terms that appear in the preceding sum are all the terms of the
q q q
form x1 1 .x2 2 .xt 3 ,where q1 , q2 , q3 are non-negative integers
70
with q1 q2 q3 3 . The coefficient of x1 q .x2 q .x3 q in this expression
1 2 3
3!
equals P(3 : q1 , q2 , q3 ) . More generally, we have the following
q1!.q 2 !.q3 !
multinomial theorem:
Theorem1.7.3.1 (The Multinomial Theorem)
Let n be a positive integer. Then for all x1 , x2 ,..., xt we have
71
Activity: 1.21
1. Find the coefficient of x13 x22 x32 x53 in ( x1 x2 x3 x4 x5 )10
2. Determine the coefficient of x 5 y10 z 5 w5 in ( x 7 y 3z w) 25 .
3. Determine the number of terms in the expansion ( x 7 y 3z w) 25 .
72
Chapter 2:
Elementary probability theory
2.1 Introduction
The probability theory is a mathematical modeling of the
phenomena of chance or randomness. Such phenomena are
characterized by the fact that their future behavior is not predictable
in a deterministic fashion.
The theory of probability originated from the game of chance and
gambling. The study of probability dates back to the 17th century and
the work of two mathematicians Blaise Pascal (1623-1662) and Pierre
de Fermat (1601-1665).
Objectives:
After these lessons the students will be able to:
define probability and some terminologies on probability
find the probability of an event
proves theorems on probability
define conditional probability and independent events
explain Bernoulli trials and the binomial distribution
define random variables and expectations
Sample Space and events
In our every day life we very often deal with the situations whose out
come can not forecast. We call such situations random experiments.
Random experiment
Random experiment is an experiment which can be repeated any number
of times under the same conditions, but does not give unique results i.e.
for each trial the result will not be known in advance.
73
Example: 2.2.1
If we toss a coin it is impossible to forecast whether the head will come
up or tail. Thus tossing a coin is a random experiment.
Sample space
The set S of all possible outcomes of a given random experiment is
called a sample space. Every element of the sample space S is called a
sample point.
Example: 2.2.2
When a coin is tossed, there are two sample points Head (H) and Tail
(T). Then the sample space is S= {H, T} and S 2 .
Example: 2.2.3
An urn contains 4 balls of different colors. The colors are red, yellow,
black and white. Two balls are simultaneously taken out of the urn.
describe the sample space of this experiment.
Solution:
The sample space is S= {RY, RB, RW, YB, YW, BW} where R, Y, B
and W stand for red, yellow, black and white colors respectively.
Activity: 2.1
1. A coin is tossed twice. If the second throw results in tail a die is
thrown. Describe the sample space for this experiment.
2. A random experiment has m outcomes a1, a2,…, am and another has n
out comes b1, b2,... ,bn. Describe the sample space when both the
experiment carried out .
Events
Any subset of sample space S is called an event.
74
Note:
The entire sample space S and the empty set are events since they
are subsets of S. is sometimes is called the impossible event.
Since an event is a set, we can combine events to form new events
using the various set operations.
i) A B is the event that occurs if and only if A occurs or B occurs
(or both).
ii) A B is the event that occurs if and only if A occurs and B
occurs.
iii) A' , the complement of A, is the event that occurs if and only if A
does not occur.
Two events A and B are called mutually exclusive if they are disjoint,
i.e., if A B . In other words, A and B are mutually exclusive if and
only if the can not occur simultaneously.
Example 2.2.4
1. When we toss a coin, either head or tail can be up, but both can
not be up at a time, hence the outcome of getting a head (H) and
tail (T) are mutually exclusive events.
2. When we throw a die the outcome of getting 1, 2, 3,…, 6 are
mutually exclusive events.
The probability of an event
In this section, we will restrict our selves to experiment that have finitely
many, equally likely outcomes.
75
2.3.1 Definitions of probability
Example: 2.3.1
If at least one child in a family of three children is a boy, what is the
probability that all three are boys?
Solution:
The sample space is S= {BBB, BBG, BGB, GBB, GGB, GBG, BGG}
where B represents a boy and G represents a girl.
Hence S 7 and since E is the event that all the three are boys, E 1 .
E 1
There fore P( E ) P( BBB ) .
S 7
Activity: 2.2
In tossing 3 coins at a time, find the probability of getting
a) at most one head
b) at least one head
c) exactly 2 heads.
Statistical or empirical definitions of probability
m
If in n trials, an event E happen m times, then P( E ) lim
n
( ) i.e. the
n
limit of the number of times E occurs divided by the number of times
the experiment is performed.
76
Axiomatic definitions of probability
Let S be a sample space. Let be the collections of all subsets of S.
Then the functions P : [0,1] is called a probability functions if
i) P( E) 0 for all E
ii) P(S)=1
iii) P( Ei ) P( Ei ) whenever, E1 , E 2 ,… are disjoint events which is
i 1 i 1
Theorems on probabilities
Theorem 2.3.3
Prove the probability of an impossible event is zero, i.e. P( ) 0
Proof:
Impossible event contains no sample point. The sample space S and
the impossible event are mutually exclusive events.
Thus, S S
P(S ) P(S )
Theorem: 2.3.4
The probability of the complement event A' of A is P( A' ) 1 P( A)
Proof
Clearly A and A' are disjoint events. Thus P( A A' ) P( A) P( A' )
Now A A' S P( A A' ) P(S )
P( A) P( A' ) 1 since, P(S ) 1
P( A' ) 1 P( A)
77
Activity: 2.3
1. Prove that for any two events A and B
i) P( A' B) P( B) ( A B)
ii) If B A , then
a) P( A B' ) P( A) ( B)
b) P( B) P( A)
iii) P( A B) P( A) & P( A B) P( B)
2.3.6 Additions theorem of probability
If A and B are any two events, then P( A B) P( A) P( B) P( A B)
Proof:
Consider the following Venn diagram given bellow
Clearly A and A' B are disjoint sets and their unions is A B
Now A B A ( A' B)
P( A' B) P( B) P( A B) ….(1)
78
2.4 Conditional Probability
Definition: 2.4.1
If A and B be events in a sample space S with P( B) 0 . The
conditional probability of A given B denoted by P( A \ B) and
P( A B)
defined as P( A \ B) , in other words, it is the probability of
P( B)
Example: 2.4.3
A box contains 4 bad and 6 good tubes. Two are drawn out from the
box at a time. One is tested and found to be good. What is the
probability that the other one is also good?
Solution:
Let A be the event that one tube is good and B be the event that the
other tube is good.
79
C (6,2) 1
Now P( A B) P(both tubes are good ) and P( A) 6 10 3 5
C (10,2) 3
P( A B) 1 3 5
thus, P( B \ A)
P( A) 35 9
Activity: 2.4
1. An unbiased coin is tossed twice. If A is the event: both head or
tail have occurred and B is the event: at most one tail is observed,
find P(A) , P(B) , P( A \ B) and P( B \ A) .
2. If P( A) 1 3 , P( B) 3 4 , P( A B) 11 12 , then find P( A \ B) and
P( B \ A) .
P( A B)
This implies P( A B) P( B) . P( A \ B) and P( B \ A) , with
P( A)
P( A) 0 gives P( A B) P( A) . P( B \ A)
80
P( A1 A2 , ... , An ) P( A1 ) . P( A2 \ A1 ) . P( A3 \ A1 A2 ).....P( An \ A1 A2 .... An )
Example: 2.4.5
An urn contains ten balls of which 3 are black and 7 white. The
following game is played. At each trial a ball is selected at random its
color noted, and it is replaced along with two additional balls of the
same color. What is the probability that a white ball is selected in each of
the first three trials?
Solution:
Let Ai denote the event that a white ball is selected on the ith trials.
P( A1 A2 A3 ) P( A1 ) . P( A2 \ A1 ) . P( A3 \ A1 A2 )
0.4125
Activity: 2.5
A lot contains 12 items of which 4 are defective. Three items are drawn
at random from the lot one after the other. Find the probability that all
the three are no defective.
81
Events A and B are said to be independent if and only
if P( A B) P( B) . P( A) ; otherwise they are dependent.
Example: 2.5.2
The events A and B are independent with P( A) 0.5 and P( B) 0.8 .
Find the probability that neither of the event occurs.
Solution:
Since A and B are independent events we have
P( A B) P( A) . P( B) 0.4
1 [ P( A) P( B) P( A B)]
82
Example: 2.5.3
Let P( A B) 5 6 , P( A B) 1 3 , P( B' ) 1 2 . Are events A and B are
independent? Explain.
Solution:
First let us find P( A ) and P( B) . Now P( B) 1 P( B' ) 1 1 2 1 2 and
P( A ) P( A B) P( A B) P( B)
5 6 1 3 1 2
2 3
Now P( A ) . P( B) 2 3.1 2 1 3 P( A B)
Hence
P( A B) P( A) . P( B) , thus A and B are independent events.
Activity: 2.6
1. consider the following events for a family with children:
A {children of both sexes}, B {at most one boy}
83
contributions to probability theory. In general, a possible outcome of a
Bernoulli trial is called a success or a failure. If p is the probability of a
success and q is the probability of a failure, it follows that p q 1 . A
binomial experiment consists of a fixed number of Bernoulli trials.
The notation B(n, p) will be used to denote a binomial experiment with
n trials and probability p of successes.
Frequently, we are interested in the number of successes in a
binomial experiment with and not in the order in which they occur.
The following theorem is applies.
Theorem: 2.6.1
The probability of exactly k success in a binomial experiment
B(n, p) is given by P(k ) P( k successes) C(n, k ) p k q nk
Proof:
The sample space of the n repeated trials consists of all
n-tuples (t1 , t 2 ,..., t n ) , where t i S (for success) or t i F (for failure)
for i 1, 2, ... , n . Since the n trials are independent, the probability of
each outcome of n trials consisting of k success and n k failures.
Now let A be the event of exactly k successes. Then A consists
of all n-tuples of which k components are S and n k components
are F . The number of such n-tuples in the event is equal to the
numbers of ways that k letters S can be distributed among the n
components of an n-tuple; hence A consists of C (n, k ) sample points.
k nk
The probability of each point in A is p q ;
k nk
Hence, P( A) P( k successes) C (n, k ) p q .
In particular, the probability of no successes is
84
P(0) C (n,0) p 0 q n q n . Thus the probability of one or more
successes is 1 q n
Example: 2.6.2
A fair coin is tossed three times; call heads a success. This is a
binomial experiment with n 6 and p q 1 2 . Now
a) The probability that exactly two heads occurs (i.e., k 2 ) is
P(2) C (6,2)(1 2) 2 (1 2) 4 15 64
C (6,5)(1 2) 6 (1 2) 0
15 64 6 64 1 64
11 64
Example: 2.6.3
What is the probability that exactly eight 0 bits are generated when 10
bits are generated with the probability that a 0 bit generated is 0.9, the
probability that a 1 bit generated is 0.1, and the bits are generated
independently?
Solution:
By the above theorem, the probability that exactly eight 0 bits are
generated is P(8) C(10,8)(0.9) 8 (0.1) 2 0.1937102445.
Remark:
The function P(k ) P( k successes) C (n, k ) p k q nk for k 0,1, 2, ..., n for
a binomial experiment B(n, p) is called the binomial distribution since
85
it corresponds to the successive terms of the binomial expansion:
( p q) n p n C (n,1) p n1q C (n,2) p n2 q 2 ... q n
n
C (n, k ) p k q n k
k 0
n
And note that C (n, k ) p k q nk ( p q) n 1 , that is, the sum of the
k 0
86
2.7.1 Random variables
Definition: 2.7.1.1
A random variable X is a function from the sample space of an
experiment to the set of real numbers. That is, a random variable is a rule
that assigns a numerical value to each outcome in a sample space S.
Remark:
Note that a random variable is a function. It is not a variable.
Example: 2.7.1.2
Suppose that a coin is tossed three times. Let X (t ) be the number of
heads that appear when t is the outcome. Then the random variable
X (t ) takes on the following values:
X ( HHH ) 3
X (TTT ) 0
Activity: 2.8
1. Let X be the sum of the numbers that appears when a pair of dices
is rolled. What are the values of this random variable for the 36
possible outcomes (i, j ) , where i and j are the
numbers that appear on the first die and the second die,
respectively, when these two dice are rolled.
87
2.7.2 Expected values
Many questions can be formulated in terms of the value we expect a
random variable to take, or more precisely, the average value of a
random variable when an experiment is performed a large number of
times. Questions of this kind include: how many heads are expected
to appear when a coin is tossed 100 times? To study such questions
we introduce the concept of the expected value of a random variable.
Definition: 2.7.2.1
The expected value (or expectation) of the random variable X (t ) on
the sample space S is equal to E ( X ) P(t ).X (t ) .
tS
Note that when the sample space S has n elements S {x1 , x2 , ... , xn } ,
E ( X ) i 1 P( xi ). X ( xi )
n
Remark:
We are concerned only with random variable with finite expected
values here.
Example: 2.7.2.2
A fair coin is tossed three times. Let S be the sample space of the
eight possible outcomes, let X be the random variable that assigns to
an outcome the number of heads in this outcome. What is the
expected value of X ?
Solution:
In example 2.7.1.2 above we listed the values of X for the eight
possible out comes when a coin is tossed three times. Since the coin
is fair and the events are independent, the probability of each
outcome is 1 8 .
Consequently,
88
E (X ) 1 8[ X ( HHH ) X (HHT ) X (HTH ) X (THH ) X (TTH )
1 8[3 2 2 2 1 1 1 0]
12 8 3 2
Activity: 2.9
1. What is the expected value of the sum of the numbers of that
appear when a pair of fair dice is rolled?
2. What is the expected value of the numbers of successes when n
Bernoulli trials are performed, where P is the probability of
successes on each trial?
Theorem: 2.7.2.4
If X and Y are random variables on a space S and a and b are real
numbers, then a) E( X Y ) E( X ) E(Y )
b) E(aX b) aE( X ) b
Furthermore, if X i , i 1, 2, ..., n are random variables on S , then
E ( X 1 X 2 .... X n ) E ( X 1 ) E ( X 2 ) ... E ( X n ) .
Proof:
a) the first result follows directly from the definition of expected
value, since
E ( X Y ) P(t ).[ X (t ) Y (t )]
tS
E ( X ) E (Y )
89
P(t ).(aX (t ) b)
tS
aP(t ). X (t ) bP(t )
tS
a P(t ). X (t ) b P(t )
tS tS
aE ( X ) b , since, P(t ) 1 .
tS
The above theorem can be useful for computing expected values, since
many random variables are sums of simpler random variables.
Example: 2.7.2.5
Using the above theorem, find the expected values of the sum of the
numbers that appear when a pair of dice is rolled.
Solution:
Let X 1 and X 2 be the random variables with X 1 (i, j) i and X 2 (i, j ) j so
that X 1 is the number appearing on the first die and X 2 is the number
appearing on the second die. Now we see that
6
E ( X 1 ) P(t ). X 1 (t )
t 1
90
P(1).X 1 (t ) P(2).X 1 (2) P(3).X 1 (3) P(4). X 1 (4)
21 6 7 2
91
Solution:
Let S {1, 2, 3, 4, 5, 6} , and let i S and j S . Since there are 36 possible
outcomes when the pair of dice is rolled and each is equally likely, we
have P[ X 1 (t ) i and X 2 (t ) j ] 1 36 .
Furthermore, P[ X 1 (t ) i] 1 6 and P[ X 2 (t ) 1 6] , since the probability that
i appears on the first die and the probability that j appears on the second
Example: 2.7.3.8
Show that the random variables X 1 and X X 1 X 2 , where X 1 and X 2 are
defined in Example2.7.3.5 are not independent.
Solution:
Note that P[ X 1 (t ) 1 and X (t ) 12] 0 , since X 1 (t ) 1 means the number
of appearing on the first die is 1, which implies that the sum of the
numbers on the two dice equal 12. On the other hand,
P[ X 1 (t ) 1] 1 6 and P[ X (t ) 12] 1 36 .
92
Proof:
From the definition of expected value and since X and Y are independent
random variables, it follows that
E ( X .Y ) P(t ).[( X .Y )(t )]
tS
r1X ( S ), r2 Y ( S )
r1r2 .P[ X (t ) r1 and Y (t ) r2 ]
r1X ( S ), r2 Y ( S )
r1r2 .P[ X (t ) r1 ].P[Y (t ) r2 ]
( r .P[ X (t ) r ]) . ( r .P[Y (t ) r ] )
1
r1X ( S )
1
r2 Y ( S )
2 2
E ( X ).E (Y ) .
of X , denoted (X ) , is defined to be V (X ) .
93
The following theorem provides a useful simple expression for the
variance of a random variable.
Theorem: 2.7.4.2
If X is a random variable on a sample space S , then
V ( X ) E ( X 2 ) [ E ( X )]2
Proof:
Note that V ( X ) [ X (t ) E ( X )]2 P(t )
tS
[ X 2 (t ) 2E ( X ) X (t )] E 2 ( X )]P(t )
tS
E( X 2 ) 2E ( X ) E( X ) E 2 ( X )
E ( X 2 ) [ E ( X )]2 .
Example: 2.7.4.3
What is the variance of the random variable X with X (t ) 1 if a Bernoulli
trial is a success and X (t ) 0 if it is failure, where P is the probability of
success?
Solution:
Since X takes only the values 0 and 1, it follows that
X 2 (t ) X (t ). Hence,
V ( X ) E ( X 2 ) [ E ( X )]2 p p 2 p(1 p) pq .
Activity: 2.11
What is the variance of the random variable X ((i, j )) 2i , where i is the
number appearing on the first die and j is the number appearing on the
second die, when two dice are rolled?
94
Another useful fact about variance is that the variance of the sum of
two independent random variables is the sum of their variances. This
result is useful for computing the variance of the result of n independent
Bernoulli trials.
Theorem: 2.7.4.4
If X and Y are two independent random variables on a sample space S ,
then V ( X Y ) V ( X ) V (Y ) .
Proof:
From the Theorem: 2.74.2, we have, V ( X Y ) E(( X Y ) 2 ) [ E( X Y )]2 .
It follows that
V ( X Y ) E (( X 2 XY Y 2 ) [ E ( X ) E (Y )]2
E ( X 2 ) 2E ( XY ) E (Y 2 ) E 2 ( X ) 2E ( X ) E (Y ) E 2 (Y )
V ( X ) V (Y ) .
Example: 2.7.4.5
What is the variance of the number of successes when n independent
Bernoulli trials are performed, where p is the probability of success on
each trial?
Solution:
Let X i be the random variables with X i ((t1 , t 2 ,..., t n )) 1 if t i is a successes
and X i ((t1 , t 2 ,..., t n )) 0 if t i a failure is. Let X X 1 X 2 .... X n .Then
X counts the number of successes in the n trials. From theorem 2.7.4.4
95
we have that V ( X i ) pq for i 1, 2. 3, ...n . It follows that V ( X ) npq .
Activity: 2.12
Find the variance and standard deviation of the random variable
X whose value when two dice are rolled is X ((i, j )) i j , where i is the
96
Chapter 3
Generating Functions of a sequence and a Recurrence
relation
3.1 Introduction:
Many counting problems cannot be solved easily using the method
discussed so far. Thus in this chapter we will see other methods of
solving counting problems. These are generating function and recurrence
relation.
Many counting problems solved using a formal power series, called
generating functions, where the coefficients of power of x represent
terms of the sequence we are interested in and by finding relationship,
called recurrence relation, between the terms of the sequence.
After this chapter the students will be able to:
Objectives:
solve counting problems using generating function and
recurrence relation
solve recurrence relations using different methods
3.2 Generating Functions of a Sequence
In this section we discuss the method of generating functions to
solve counting problem, such as the number of ways to select or
distribute objects, subject to a variety of constraints.
The objects of interest in this section are sequences of a real numbers.
97
Objectives
After these lessons the students will be able to:
Define generating functions of a sequence of a real numbers
find a generating functions of a sequence involving counting
problems
solve counting problems using generating functions
explain about the shifting properties of a generating functions.
Definition: 3.2.1
A sequence of real numbers (a0 , a1 , a2 ..., ar ,...) is function whose
domain is the set of nonnegative integers and whose range is the set of
real numbers. In other word, it is a function f : N {0) R
98
Definition: 3.2.3
Let A {ar }r 0 be a sequence of real numbers. The generating
functions of the sequence A {ar }r 0 is defined to be the formal
power series
A( x) a0 a1 x a2 x 2 ...... an x n .... r 0 ar x r
Example: 3.2.4
1. A( x) r 0 2 r x r is a generating functions for the sequence
A {2 r }r 0 (1,2,4,8,...)
Definition: 3.2.5
Let A( x) r 0 ar x r , B( x) s 0 bs x s be two formal power series.
ii) A( x) B( x) n 0
(an bn ) x n
n
That is Pn a0 bn a1bn1 a2 bn2 ... an1b1 an b0 ai bni .
i 0
Example: 3.2.6
Let A( x) a0 a3 x 3 a4 x 4 a8 x 8 and B( x) b0 b4 x 4 b5 x 5 b8 x 8 . Find
the coefficient of a) x 8 , b) x 5 in A( x).B( x).
99
Solution:
The coefficient of x 8 in A( x).B( x) is found by considering the powers
x 0
, x 3 , x 4 , x 8 from the first factor and the powers x 0 , x 4 , x 5 , x 8 in the
second factor such that their sum is 8.
Hence the coefficient of x 8 is
P8 a b
i j 8
i j , where, i 0,3,4, or 8 , and j 0,4,5, or 8 .
Thus P8 a0 b8 a3b5 a4 b4 a8b0 , because (0,8), (3,5), (4,4), (8,0) are the
only pairs of exponents of A( x) and B( x) whose sum is 8 .
Like wise the coefficient of x 5 in the product is
P5 a b
i j 5
i j where i 0,3,4, or 8 and j 0,4,5, or 8
100
e1 e2 5 , namely (0,5) with this restrictions on e1 and e2 . Hence the
coefficient of x 5 is (1 x 3 x 4 x 8 ) .(1 x 4 x 5 x 8 ) is 1 .
Now we have observed that: the coefficient of x r in the product
A( x).B( x) (1 x 3 x 4 x 8 ) .(1 x 4 x 5 x 8 ) is the number of integral
101
an equation e1 e2 ... en r with constraints on each ei , then
we can build a generating function A1 ( x) . A2 ( x) ... An ( x) whose
coefficients of x r is the answer to the problem. Having sated this
model let us give some examples how to construct a generating
function of a given sequence involving counting problem.
Example: 3.2.1.1
1. Find a generating function for the sequence (a0 , a1 , a2 ..., ar ,... )
2 e4 6 , e5 is odd , and 1 e5 9 .
Solution:
Now clearly, A1 ( x) A2 ( x) 1 x x 2 x 3 ,
A3 ( x) A4 ( x) x 2 x 3 x 4 x 5 x 6 , and
model ,
A( x) A1 ( x) . A2 ( x) A3 ( x) A4 ( x) . A5 ( x)
(1 x x 2 x 3 ) 2 . ( x 2 x 3 x 4 x 5 x 6 ) 2 . ( x x 3 x 5 x 7 x 9 )
102
Solution:
Now let Ai ( x) 1 x x 2 ... for each i 1,2,3....., n . Thus, the
generating function we want
is A( x) A1 ( x) . A2 ( x) ....An ( x) (1 x x 2 ...) n .
But we recall ar C (n 1 r, r )
n
Thus A( x) C (n 1 r , r ) x r is another expression for this same
r 0
n
generating function, thus (1 x x 2 ...) n C (n 1 r , r ) x r .
r 0
The solution of this equation involves three 3‟s and seven 0‟s.
10!
Hence there are C (10,3) such integral solutions.
3!.7!
103
each ei 0,3,8 . Clearly the solution of this equation involves
10!
three 3‟s, two 8‟s, and five 0‟s. Hence there are 2520
3!.2!.5!
such solutions. Hence, by generating function model the
coefficient of x 25 in the expressions
10!
(1 x 3 x 8 )10 is 2520.
3!.2!.5!
Activity: 3.1
1. Find a generating function for the sequence (a0 , a1 , a2 ..., ar ,... )
where ar the number of nonnegative integral solutions to
e1 e2 ... en r where 0 ei 1 for each i 1,2,3....., n .
104
not be concerned with questions of convergence in our
discussions.
We will state now some important facts about infinite series
used when working with generating functions.
1
1. The function A( x) is a generating function of the
1 x
sequence 1, 1, 1, 1,…,
1
1 x x 2 .... .... r 0 x r for x 1
since A( x)
1 x
1
2. The function A( x) generates the sequence 1, -1, 1, -1,…,
1 x
1
3. The function B( x) is the generating function of the
1 ax
= ( 1 x x 2 .... ....) 2 r 0 (r 1) x r
105
n
D( x)
1
1
(1 x) n 1 x
= (1 x x 2 .... ....) n C (n 1 r , r ) x r generates the sequence
r 0
n
C (n, r ) a r
(1 ax) n C (n, r )a
r 0
r
x r
1 x n 1 n
1 if r n
1 x
x r
= 1 x x 2 .... x n
r 0 0 otherwise
1
1 x
x
r 0
r
1 x x 2 .... 1
1 (1) r
1 x
(1) r x r
r 0
1 x x 2 x 3 ....
1 ar
1 ax
a
r 0
r
x r 1 xa x 2 a 2 ....
1 1 if k is divisible by r
1 xk
x kr
1 x k x 2k ....
r 0 0 otherwise
1 r 1
(1 x) 2
(r 1) x
r 0
r
1 2 x 3x 2 ....
1 C (n 1 r, r ) C(n 1 r, n 1)
(1 x) n
r 0
C (n 1 r , r ) x r
1 (1) r C (n 1 r, r ) (1) r C (n 1 r, n 1)
(1 x) n
r 0
C (n 1 r , r )(1) r x r
106
1 C (n 1 r, r )a r C (n 1 r , n 1)a r
(1 ax) n
C (n 1 r , r )a
r 0
r
xr
x(1 x x 2 x 3 x 4 ) [ x 2 (1 x x 2 . .. )]5
x11 (1 x x 2 x 3 x 4 ) (1 x x 2 . .. ) 5
1 x5 1
5
x
11
.
1 x 1 x
6
1
x (1 x )
11 5
1 x
107
x11 (1 x 5 ) C (5 r , r ) x r
r 0
Now we observe that the number of nonnegative integral solution
is the same as the coefficient of x 20 in A(x) .
Thus the coefficient of x 20 in A(x)
= coefficient of x 20 in x11 (1 x 5 ) C (5 r , r ) x r
r 0
= coefficient of x 9 in (1 x 5 ) C (5 r , r ) x r
r 0
= C (5 r , r ) x r x 5 C (5 r , r ) x r
r 0 r 0
Solution:
First let us find the generating function A(x) of the sequence
involving counting problem
e1 e2 e3 r where, 2 e1 5 , 3 e2 6 , 4 e3 7 .
Clearly
A( x) ( x 2 x 3 x 4 x 5 ) . ( x x x x ) . ( x 4 x 5 x 6 x 7 ) .
3 4 5 6
108
Now A(x) ( x 2 x 3 x 4 x 5 ) . ( x 3 x 4 x 5 x 6 ) . ( x 4 x 5 x 6 x 7 )
x 2 (1 x x 2 x 3 ) x 3 (1 x x 2 x 3 ) x 4 (1 x x 2 x 3 )
x 9 (1 x x 2 x 3 ) 3
3
1 x4
x 9
1 x
3
1
x (1 x )
9 4 3
1 x
in x (1 x )
1
17 9 4 3
=the coefficient of x
1 x
3
= the coefficient of x 8 in (1 x 4 ) 3
1
1 x
=the coefficient of x 8 in (1 x 4 ) 3 C (2 r , r ) x r
r 0
=the coefficient of x 8 in
[1 C (3,1) x 4 C (3,2) x 8 x12 ] C (2 r , r ) x r
r 0
=the coefficient of x 8 in
C (2 r, r ) x r C (3,1) x 4 C (2 r, r ) x r
r 0 r 0
C (3,2) x 8 C (2 r , r ) x r x12 C (2 r , r ) x r
r 0 r 0
109
Activity: 3.2
1. find the coefficient of x 20 in
A( x) ( x10 x11 ... x 25 ) ( x x 2 ....x15 ) 5 ( x 20 x 21 .... x 45 )
110
1
For instance, we know that
1 x
x
r 0
r
generates the sequence (1,1,1,....) .
x
Thus
1 x
x r 1 x n generates the sequence (0,1,1,1,....) and
r 0 n 1
x2
1 x
x
r 0
r 2
x n generates the sequence (0,0,1,1,1,....) .
n2
1
Similarly we know that
(1 x) 2
C (r 1, r ) x r (r 1) x r generates the
r 0 r 0
x
sequence (1,2,3,...) so that
(1 x) 2
(r 1) x r 1 nx n generates the
r 0 n 1
sequence (1,2,3,...) .
Note that the expression nx
n 1
n
describes that the coefficient of x 0 is 0
111
(r 2)(r 1)
the sequence
1.2 2.3 3.4
, , , ... , and therefore,
2 r 0 2 2 2
generates (r 2)(r 1)r 0 (1.2, 2.3, 3.4, ... ) . But
2
(1 x) 3
(r 2)(r 1) x
r 0
r
2x
then
(1 x) 3
(r 2)(r 1) x
r 0
r 1
(n 1)(n) x n generates the sequence
n 1
(n 1)(n)n0 (0,1.2, 2.3, 3.4, ... ) . Now since bn (n 1)(n) equals 0 when
2x
n 0 , we see that we can write
(1 x) 3
n 1
( n 1)( n ) x n
n 0
(n 1)(n) x n so
generates the sequence (0,0,1.2, 2.3, 3.4, ... ) , and the last term can be taken
n 0 to because the coefficient n(n 1) is 0 when n 0,1 .
Activity: 3.3
Using shifting properties of generating functions show that
6x
1. (n 2)(n 1)(n) x n
(1 x) 4 n 0
6x 2
2. (n 1)(n)(n 1) x n
(1 x) 4 n 0
112
we discussed about the methods of solving recurrence relation that can
be modeled using recurrence relations.
Objectives:
After these lessons the students will be able to:
define recurrence relation
solve counting problems using recurrence relation
prove some properties of Fibonacci number
solve recurrence relations using different methods discussed
bellow
Definition: 3.3.1
A recurrence relation is a formula that relates for any integer n 1 , the
nth term of a sequence A {ar }r 0 to one or more of the
113
9) an a0 an1 a1an2 ... an1a0 are examples of recurrence relations.
Definition: 3.3.4
Suppose n and k are non negative integers. A recurrence relations of the
Where c0 (n) , c1 (n) …., c n (n) and f (n) are functions of n is called
a linear recurrence relation. Except (7), (8) and (9) in the above examples
all are linear recurrence relation. Examples 7,8, and 9 are non-linear
recurrence relation.
If c0 (n) and c k (n) are not identically zero, then (1) is said to be a
linear recurrence relation of degree k . In example 3.3.2 (1-3) are linear
recurrence relation of degree 1 , examples 4 and 5 are of degree 2 and
example 6 is a linear recurrence relation of degree 3 .
If all c0 (n) , c1 (n) …., cn (n) are constants, then (1) is said to be linear
recurrence relation with constant functions. Examples 1, 2, 4 and 6 are
linear recurrence relation with constant functions, but not 3 and 5
If f (n) is identically zero, zero, then (1) is said to be a homogenous linear
recurrence relation; otherwise, it is called inhomogeneous.
Examples 3, 4 and 5 are homogenous linear recurrence relation but not 1,2
and 6.
Next let us discuss how to find a recurrence relation of certain kind of
counting problems, by considering the examples given below.
Examples: 3.3.5
1. The number of bacteria in a colony doubles every hour. Find a
recurrence relation for the number of bacteria at the end of n hours.
114
Solution:
Let a n the number of bacteria after n hours.
Since the number of bacteria doubles every hour, the relation
an 2an1 holds whenever n is a positive integer.
2. Consider the following problem, which was originally posed by
Leonardo di Pisa, also known as Fibonacci, in the thirteenth century
in his book Liber abaci. A young pair of rabbits (one of each sex) is
placed on an island. A pair of rabbits does not breed until they are
two months old. After they are old, each pair of rabbits produces
another pair each month.
i) Find a recurrence relation for the number of pairs of rabbits
on the island after n months, assuming that no rabbits ever
die.
ii) Find the number of rabbits after one year.
Solution:
i) Let us denote by Fn the number of pairs of rabbits after n
months. We will show that Fn , n=0, 1, 2, 3 … are the terms of
the Fibonacci sequence. The rabbit population can be
modeled using a recurrence relation as follow: We start one
pair of newly born rabbits since they are not yet mature
enough to reproduce. After 2 months we have 2 pairs of rabbits
because the first pair has now reproduced. After 3 months we have
3 pairs of rabbits since those born just last month cannot reproduce
yet, but the original pair has reproduced again. After 4 month we
have 5 pairs of rabbits because the first pair is continuing to
reproduce, the second pair has produced a new pair, and the third
115
pair is still maturing. For each integer, let Fn denote the number of
pairs of rabbits alive at the end of the nth month. Now at the end of
the first month, the number of pairs of rabbits on the island is F0 1 .
Since this pair does not breed during the second month, F1 1also.
To find the number of pairs after n months, add the number on the
island the previous month, Fn1 and the number of new born pairs,
which equals Fn2 , since each born pair comes from a pair at least 2
months old. In other words Fn is formed by starting with Fn1 pairs
of rabbits alive last month and adding the babies that can only come
from the Fn2 pairs alive 2 months ago. Hence Fn Fn1 Fn2 for
n 2 is the recurrence relation together with the initial conditions
F0 1 and F1 1.
F4 F3 F2 3 2 5 , F5 F4 F3 5 3 8
F6 F5 F4 8 5 13 , F7 F6 F5 13 8 21
F8 F7 F6 21 13 34 , F9 F8 F7 34 21 55
116
Activity: 3.2.10
1. Find the recurrence relation for the number of ways to arrange flags on a
flagpole n feet tall using 4 types of flags: red flags 2 feet high, or white
blue, and yellow flags each 1 foot high.
2. Find a recurrence relation for the number of ways to make a pile of n
chips using garnet, gold, red, white, and blue chips such that no two gold
chips are together.
3.3.1 Some properties of Fibonacci number
The relation Fn Fn1 Fn2 is called the Fibonacci relation and the
numbers Fn generated by the Fibonacci relation with the initial
conditions F0 1 F1 are called the Fibonacci numbers and the sequence
{Fn }n0 is called Fibonacci sequence.
From our calculations, we see that the first few terms of the Fibonacci
sequence are 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233,...
The Fibonacci sequence has many remarkable properties. We give two
in the next two examples.
Example: 3.3.1.1
Prove that the partial sums of the terms of the Fibonacci sequence
are S n F0 F1 F2 ... Fn Fn2 1 .
Proof:
From the Fibonacci relation Fn Fn1 Fn2 we observe that
Fn2 Fn Fn1 . This gives the numbers in array as follows:
F0 F2 F1
F1 F3 F2
F2 F4 F3
117
.
.
Fn Fn2 Fn1 .
Fn 2 F1 but, F1 1.
Hence S n F0 F1 F2 ... Fn Fn2 1 . This completes the proof.
Example: 3.3.1.2
Prove that F0 F2 F4 ... F2n F2n1
proof:
From the Fibonacci relation Fn Fn1 Fn2 we observe that
F0 F2 F4 ... F2n F0 ( F1 F0 ) ( F3 F2 .).. F2n1 F2n2
1 F2n1 1 since F0 1
Activity: 3.5
Prove that F0 2 F12 F2 2 ... Fn 2 Fn Fn1 .
3.3.2 Solving a recurrence relation
In this section we will discuss the different techniques of solving a
recurrence relation. First let us define what a solution of the
recurrence relation mean.
Objectives:
After these lessons the students will be able to:
118
define what a solution of a recurrence relation mean.
solve a linear recurrence relation using the methods of substitution,
generating functions , characteristic root and undetermined
coefficients
Definition: 3.3.2.1
Suppose that S is a subset of the nonnegative integers. Then a sequence
A {an }n0 is a solution to a recurrence relation over S if the values a n of
A make the recurrence relation a true for every value of n in S. That is the
0
119
Note that in the above example there are infinitely many different
solutions, one for each specific value of the constants. c1 and c2 . Such
solution is called general solution.
Suppose we are asked to find a solution of the recurrence relation in
example above for which a0 10 and a1 41 . These are called boundary
conditions (or initial condition).
Now a0 10 c1 c2 10 and a1 41 2c1 5c2 41 .
Now solving c1 c2 10
2c1 5c2 41 we get c1 3, c2 7 .
120
3.3.2.1 Solving recurrence relation by substitution
In the substitution method the recurrence for a n is used repeatedly to solve
for a n in terms of n . We desire that this expression involve no other terms
of the sequence except those given by boundary conditions. Let us also
illustrate the method in the next two examples.
Example: 3.3.2.1.2
Solve the recurrence relation an an1 f (n) for n 1 by substitution.
Solution:
Now an an1 f (n) for n 1 implies
a1 a0 f (1)
n
Thus a n a0 f (k ) is a solution of the given recurrence relation.
k 1
Example: 3.3.2.1.3
Solve the recurrence relation an an1 n where a0 2 by substitution.
Solution:
Now an an1 n implies
a1 a0 1 a1 a0 1
a2 a1 2 a2 a1 2
a3 a 2 3 a3 a 2 3
. .
. .
121
. .
an an1 n a n a n1 n
an a0 (1 2 ... n)
n n
2 (n 1) since a0 2 and 1 2 ... n (n 1) .
2 2
n
Hence an 2 (n 1) is a solution of the given recurrence relation.
2
Activity: 3.7
Solve the following recurrence relations by substitution.
1. an an1 n 2 , where a0 7
1
2. a n a n 1 , where a0 1
n(n 1)
3. an an1 3n , where a0 1
Divide-and-Conquer relation
The recurrence relation of the form an ca n d f (n) where c and d are
122
an 2an 2 n 1
n
2a n 2 22a n 4 1
2
2 2 an 4 n 2
2 2 an 4 2 2 [2an 8 (n 4) 1]
2 3 an 8 n 2 2 ,etc,
2an 2 2 2 an 4 n 2
2 2 an 4 2 an 8 n 2
3 2
.
.
2 k 1 a n 2k 1 2 a n
k
2k
n 2 k 1
kn (1 2 ... 2 k 1 )
kn (2 k 1) ,since (1 2 ... 2 k 1 ) 2 k 1
kn (n 1) ,since n 2 k
n log 2 (n) (n 1) ,since n 2 k implies k log 2 (n)
123
Solve the following divide-and-conquer relations by substitution:
1. an 2an 3 5 , where n 3k and a1 1
Solution:
Let A( x) a n x be the generating function for the sequence {an }n0 .
n
n 0
(1 7 x 10 x 2 ) A( x) a0 (a1 7a0 ) x
124
c1 c
A( x) 2 , for some constants c1 and c2 .
1 2 x 1 5x
c1 c
But A( x) 2
1 2 x 1 5x
c1 2 n x n c2 5 n x n
n 0 n 0
(c1 2 n c2 5 n ) x n
n 0
n 0
125
12 x 2 A( x) 12a0 x 2 12a1 x 3 ... 12an2 x n ...
(n 2)(n 1) n n
(c1 2 n c2 (n 1)2 n c3 2 )x
n 0 2
(n 2) n
Thus an c1 2 n c2 (n 1)2 n c3 2 is the general solution of the
2
given recurrence relation
Theorem 3.3.2.2.3 (General Solutions of the Fibonacci relation)
If Fn satisfies the Fibonacci relation Fn Fn1 Fn2 for n 2 , then there are
n n
1 5 1 5
constants C1 and C 2 such that Fn C1 C2
2 , where the
2
126
Proof:
To prove this result we apply the generating function method of solving
a recurrence relation.
Now Fn Fn1 Fn2 , Fn Fn1 Fn2 0 for n 2
let F ( x) Fn x n be the generating functions for the Fibonacci
n 0
Now we get
F ( x)(1 x x 2 ) F0 ( F1 F0 ) x
F0 ( F1 F0 ) x
F (x)
1 x x2
F0 ( F1 F0 ) x
(1 5 ) (1 5)
[1 x][1 x]
2 2
Thus, for whatever initial conditions on F0 and F1 , the method of partial
fractions applies to give F (x) C1
C2
(1 5 ) (1 5 )
[1 x] [1 x]
2 2
1 5 1 5
Letting a and b , we get
2 2
127
1 ax 1 bx n 0
F (x) C1 C2 C1 a n x n C 2 b n x n
n 0
(C a
n 0
1
n
C2b n ) x n
Fn x n (C1 a n C 2 b n ) x n
n 0 n 0
n n
1 5 1 5
Fn C1a C2 b C1
n n
C2
2 , for each n 0.
2
1 1 5 1 1 5
can find C1 and C 2 so that, the nth Fibonacci
5 2 5 2
number is
n 1 n 1
1 1 5 1 1 5
Fn .
5 2 5 2
Activity: 3.9
Solve the following recurrence relations using generating functions.
1. an 9an1 20an2 0 for n 2 with initial values a0 3 , a1 10
Note:
From the above examples we observe that, If A( x) a n x of a sequence
n
n 0
P( x)
generating function A(x) , where
Q( x)
128
... (ak 1 c1ak 2 ... ck 1a0 ) x k 1 and
Q( x) 1 c1 x c2 x 2 ... ck x k .
Example: 3.3.2.2.5
Let A(x) be the generating function of the sequence {an }n0 where
a n satisfies the recurrence relation an 5an1 3an2 0 for n 2 , a0 1 ,
Solution:
Clearly P( x) a0 (a1 5a0 ) x and Q( x) 1 5x 3x 2 .
P ( x) a0 (a1 5a0 ) x
Hence A(x) , since a0 1 , a1 2 , we get
Q( x) 1 5 x 3x 2
P( x) 1 7x
A(x) .
Q ( x) 1 5 x 3x 2
Activity: 3.10
P( x)
Write a general expression for A(x) , where A(x) is the generating
Q( x)
a 3 a 4 a5 2
3.3.2.3 Solving recurrence relation by Characteristic Roots
129
This method is nothing more than a synthesis of all that we have
learned from the method of generating functions. If we want to solve
an c1an1 c2 an2 ... ck ank 0 where ck 0, then we can find
P( x)
A(x) where Q( x) 1 c1 x ... ck x k is a polynomial of degree k .
Q( x)
C (t ) t k Q(1 t )
k 1
t k (1 c1 1 t c2 1 t 2 ... ck 1 t k ) t k c1t ... c k
Example 3.3.2.3.1
Find the characteristic polynomial for the recurrence relation
an 6an1 12an2 8an3 0 for n 3
Solution:
Clearly by the above discussion Q( x) 1 6 x 12 x 2 8x 3 ,
Hence the characteristic polynomial of the given recurrence relation
is C (t ) t 3Q(1 t )
t 3 (1 6(1 t ) 12(1 t 2 ) 8(1 t 3 ))
t 3 6t 2 12t 8
Activity 3.11
Find the characteristic polynomial for the recurrence
relation an 7an1 12an2 0 for n 2 .
130
Now let us discus how to solve the recurrence relation using the
characteristic roots method. Consider the following two cases.
1. The characteristic polynomial having distinct roots
If the characteristic polynomial C (t ) of a homogenous recurrence
relation an c1an1 c2 an2 ... ck ank 0 has distinct roots 1 , 2 ,..., k , then
the general form of the solutions for the relation is given by
an c11 c2 2 ... ck k where c1 , c2 ,..., ck are constants which may be
n n
c1 c 2 2
Now solving these equation we get c1 3 and c2 1 .
3c1 4c 2 5
131
2. The characteristic polynomial having multiple roots
If the characteristic polynomial C (t ) of a homogenous recurrence
Example: 3.3.2.3.6
Solve the recurrence relation an 7an1 16an2 12an3 0 for n 3
with the initial conditions a0 1 , a1 4 , and a2 8 .
Solution:
The characteristic polynomial is of the recurrence relation is
C (t ) t 3 7t 2 16t 12 (t 2) 2 (t 3) and its roots are 2 and 3 with
132
Now, a0 1 c1,0 c2,0 1 ,
133
We then have the following equations:
A( x) a0 a1 x a2 x 2 ... an x n ...
n 1
a0 3 (n 1) x n
A( x) n 1
1 x
3 (n 1) x n
a0
n 1
.
1 x 1 x
3x 2 x2
1 (n 1) x (1 x) 2
2
, since a0 2 and n
1 x (1 x)3
3x 2
2 x n 3 2 ( n(n 1) x n ) since,
n 0 n 0 (1 x) 3
3 2 (
n 0
n(n 1) x n )
(2 (3 2.n.(n 1)) x n for n 0
n 0
134
Let A( x) a n x be the generating function for the sequence {an }n0 ,
n
n 0
... (a n 5a n 1 6a n 2 ) x n . . .
n 2
a0 (a1 5a0 ) x 4 n x n
Thus A( x) n2
1 5x 6 x 2
a0 (a1 5a0 ) x 4 n
xn
n2 .
1 5x 6 x 2
1 5x 6 x 2
x2
But, 4 n x n 4 2 x 2 4 n2 x n2 4 2 x 2 4 n x n 4 2
2 n2 n 0 1 4x
135
a0 (a1 5a0 ) x 42 x 2
A( x)
1 5x 6 x 2 (1 4 x)(1 5 x 6 x 2 )
(c 4 n d 2 n e3n ) x n
n 0
2c4 n2 4 n
c 8
Hence an (8)4 n d 2 n e3n is the complete solution of the given IHR
an 5an1 6an2 4 n where n 2 and
136
42 x 2
Note: The expression also generates the sequence
(1 4 x)(1 5 x 6 x 2 )
Example: 3.3.2.4.3
Find the complete solution of the above example if f (n) 2 n .
Solution:
Let A( x) a n x be the generating function for the sequence {an }n0 , where
n
n 0
a0 (a1 5a0 ) x 2 n
xn
A( x) n 0
1 5x 6 x 2
(1 4 x)(1 5 x 6 x 2 )
Now 2 n x n 2 2 x 2 2 n2 x n2 , this by a change of dummy variables
2 n2
becomes,
22 x 2 a (a1 5a0 ) x 4x 2
22 x 2 2n x n . Thus, A( x) 0
n 0 1 2x (1 3x)(1 2 x) (1 3x)(1 2 x) 2
4x 2
Since A(x) and generates the same sequence, by partial
(1 3x)(1 2 x) 2
137
(c3n d 2 n e(n 1)3n ) x n
n 0
4x 2
Thus, the expression generates the sequence {an }n0 the
(1 3x)(1 2 x) 2
sequence, where
an a3n b2 n c(n 1)2 n
c 2
Thus 2n2 n is a particular solution of the inhomogeneous
relation an 5an1 6an2 2 n .
Note that in example 3.3.2.4.3, a particular solution was of the form cf (n) ,
but in example 3.3.2.4.4 a particular solution had the form cnf (n) . This is
because f (n) 4 n gave us the factor (1 4 x) in the denominator of the
138
expression for A(x) , and in this case 4 was not a root of the characteristic
polynomial so no higher power of (1 4 x) occurred in the denominator of
A(x) , but in the case of f (n) 2 n , the factor (1 2 x) 2 occurs in the
an anH anP becomes the complete solution of the HIR. Here we apply the
139
for several types of situations, we will not have to resort to generating
functions anymore; rather we will make educated guesses based on our
experience. Hence we follow the following rules.
63
c3n2 (32 7 . 3 10) 7 . 3n c .
2
140
63 n
Thus a np 3 is a particular solution and
2
63 n
an 3 c1 2 c2 5 , is the complete solution of the given relation.
n n
2
P
Note that if {a n1 }n0 is a particular solution to
an c1an1 c2 an2 ... ck ank f1 (n) and if {anP2 }n0 is a particular solution
to an c1an1 c2 an2 ... ck ank f 2 (n) , then {anP anP }n0 is a particular
1 2
c4 n2 (4 2 7 . 4 10) 4 n
c 8 .
141
Thus anp (8)4 n is a particular solution of the second relation.
2
63 n
Therefore, an anP anP
1 2
3 (8)4 is a particular solution
n
2
Solution:
Since the characteristic polynomial is C (t ) t 2 4t 4 (t 2) 2 and 2 is the
root of C (t ) with multiplicity 2 , thus particular solution is of the form
anp cn 2 2 n where c the constant is yet to be determined. Substituting
8c 4
c 1 2
relation.
2. A trial solution for products of polynomials and exponentials
Now let us suppose that f (n) ( p0 p1n ... pt n t ) a n where pi ‟s are
constants. The particular solution of the IHR
an c1an1 c2 an2 ... ck ank f (n) for n k is of the form
142
a) anP ( A0 A1n ... At n t ) a n if a is not the root of the characteristic
polynomial C (t ) and
b) anP n m ( A0 A1n ... At n t ) a n if a is the root of the characteristic
polynomial C (t ) of multiplicity m .
Example: 3.3.2.5.4
Solve the recurrence relation an 6an1 8an2 n4 n where a0 8 and a1 22 .
Solution:
Since 4 is the root of the characteristic polynomial
C (t ) t 2 6t 8 (t 2)(t 4) with multiplicity 1 , the particular solution takes
the form anP n( A0 A1n) 4 n . Substituting this expression into the recurrence
gives
n( A0 A1n) 4 n 6(n 1)( A0 A1 (n 1)4 n1 8(n 2)( A0 A1 (n 2)4 n2 n4 n
A0 A1 0
Now solving we get A0 1 and A1 1
3 A0 4 A1 2
143
Hence, an n(n 1)4 n (3)4 n (5)n4 n is the unique solution to the recurrence
relation with the given initial conditions.
Example: 3.3.2.5.5
Find a particular solution of an 2an1 an2 5 3n .
Solution:
Since 1 is the root of the characteristic polynomial C (t ) t 2 2t 1 (t 1) 2 of
multiplicity 2 , the particular solution takes the
form anP n 2 ( A0 A1n) A0 n 2 A1n 3 .
Substituting this expression into the recurrence gives
A0 n 2 A1n 3 2[ A0 (n 1) 2 A1 (n 1) 3 ] [ A0 (n 2) 2 A1 (n 1) 3 ] 5 3n , and this
144
b) an 4an1 n 2
c) an 2an1 an2 2 n
d) an 2an1 an2 4
e) an 3an1 1oan2 n 2 n 1
2. Find the complete solution (homogenous plus particular solutions) to
a) an 10an1 25an2 2 n , where a0 2 3 and a1 3 .
b) an 2an1 n 3 for n 1 , and a0 3
145