Download as pdf or txt
Download as pdf or txt
You are on page 1of 60

CHAPTER 4

COUNTING
BY, PR O F. M I T R AKSH I PAT I L
BASIC COUNTING PRINCIPLES

• In daily lives, many times one needs to find out the number of all
possible outcomes for a series of events.

• For instance, in how many ways can a panel of judges comprising of 6


men and 4 women be chosen from among 50 men and 38 women? How
many different 10 lettered PAN numbers can be generated such that the
first five letters are capital alphabets, the next four are digits and the
last is again a capital letter.

• For solving these problems, mathematical theory of counting is used.


BASIC COUNTING PRINCIPLES

• In order to decompose the difficult counting problems into simple


problems the Rule of Sum and The Rule of Product is used.

1. Sum Rule: Assume some event E can occur in m ways and a second
event F can occur in n ways, and suppose both events cannot occur
simultaneously. Then E or F can occur in m + n ways.

• In general, if there are n events and no two events occur in same time
then the event can occur in n1+n2..........n ways.

• Example: If 8 male professors and 5 female professors teaching DSGT,


then the students can be allotted the professor in 8+5=13 ways.
• Example: The mathematics department must choose either a student
or a faculty member as a representative for a university committee.
How many choices are there for this representative if there are 37
members of the mathematics faculty and 83 mathematics majors and
no one is both a faculty member and a student.

• Solution: By the sum rule it follows that there are 37 + 83 = 120


possible ways to pick a representative.
THE SUM RULE IN TERMS OF SETS

• The sum rule can be phrased in terms of sets.


|A ∪ B|= |A| + |B|
as long as A and B are disjoint sets.

• Or more generally,

|A1 ∪ A2 ∪ ··· ∪ Am |= |A1| + |A2| + ··· + |Am|

where Ai ∩ Aj = ∅ for all i, j


2. Product Rule : Suppose there is an event E which can occur in m
ways and, independent of this event, there is a second event F which can
occur in n ways. Then combinations of E and F can occur in m.n ways.

• In general, if there are n events occurring independently then all events


can occur in the order indicated as n1 x n2 x n3.........n ways.

• Example:

In class, there are 4 boys and 10 girls. If a boy and a girl have to
be chosen for the class monitor, the students can choose class
monitor in 4 x 10 = 40 ways.
• Example:
How many different license plates can be made if each plate
contains a sequence of three uppercase English letters followed by three
digits?

• Solution:
By the product rule, there are 26 · 26 · 26 · 10 · 10 · 10 = 17,576,000 different
possible license plates
COMBINING THE SUM AND PRODUCT RULE

• Example: Suppose statement labels in a programming language can


be either a single letter or a letter followed by a digit. Find the number
of possible labels.

• Solution: Use the product rule. 26 + 26 · 10 = 286


• Example-
A boy lives at X and wants to go to School at Z. From his home
X he has to first reach Y and then Y to Z. He may go X to Y by
either 3 bus routes or 2 train routes. From there, he can either
choose 4 bus routes or 5 train routes to reach Z. How many
ways are there to go from X to Z?

• Solution −
From X to Y, he can go in 3+2=5 ways (Rule of Sum).
Thereafter, he can go Y to Z in 4+5=9 ways (Rule of Sum).
Hence from X to Z he can go in 5×9=45 ways (Rule of
Product).
2. Let, A be a finite set & let B be any set, then
|A-B|=|A|-|A ∩ B|

Proof-

Consider, Venn diagram,

Here,
A=(A-B) ∪(A ∩ B) ….disjoint union of 2sets
So, By addition principle,
|A|= |A-B|+| A ∩ B|

So, |A-B|=|A|-| A∩ B|
3. Principle of Inclusion-Exclusion-
Let A & B be 2 sets. Then,
|A ∪ B|=|A|+|B|-|A ∩ B|

Proof- Consider diagram,


We may express A ∪ B as disjoint union
Of 2 sets by,
|A ∪ B|=|A-B| ∪ |B|
So, By addition Principle, we can write,
|A ∪ B|=|A-B| + |B|
=|A| -| A ∩ B|+|B|
|A ∪ B|=|A|+|B|-|A ∩ B|
Example-
From 1 to 50 how many are the multiples of 2 or 3 but not the multiples
of both?
• Solution-
From 1 to 100, there are 50/2=25 numbers which are
multiples of 2.
There are 50/3=16 numbers which are multiples of 3.
There are 50/6=8 numbers which are multiples of both 2 and 3.
So, |A|=25, |B|=16 and |A∩B|=8.
|A∪B|=|A|+|B|−|A∩B|
=25+16−8
=33
Example-

24 students out of 50 students like cold drinks, 36 like hot drinks and
each of them like at least one of the two. How many like both?
Solution-
Let X be the set of students who like cold drinks and Y be the set
of people who like hot drinks.

So, |X∪Y|=50, |X|=24, |Y|=36

|X∩Y|=|X|+|Y|−|X∪Y|=24+36−50=60−50=10

10 students like both.


4. Mutual Inclusion-Exclusion principle for 3 sets-
Let A ,B & C be 3 finite sets. Then,
|A ∪ B ∪ C|=|A|+|B|+|C|-|A ∩ B|-|B ∩ C|-|A ∩ C|+|A ∩ B ∩ C|

Proof- Let D denote union B ∪ C, then


A ∪ B ∪ C= A ∪ D
|A ∪ D|=|A|+|D|- |A ∩ D| …..By thm 3….Eqn 1
D=| B ∪ C|
=|B| +|C| -|B ∩C| ……..Eqn 2
|A ∩D|=|A ∩(B ∪ C)|
=|(A ∩B) ∪ (A ∩C)
=| A ∩B|+| A ∩C|- |A ∩B ∩C| ……Eqn 3

Substituting Eqn 2 & 3 in 1,


|A ∪ B ∪ C|=|A|+|B|+|C|-|A ∩ B|-|B ∩ C|-|A ∩ C|+|A ∩ B ∩ C|
Example-
In a survey of 260 college students, the following data was obtained.
64 had taken Maths Course.
94 had taken Computer Science Course.
58 had taken Business Course.
28 had taken both Maths & Business Course.
26 had taken both Maths & Computer Science Course.
22 had taken both Computer Science & Business Course.
14 had taken all three types of Courses.

i. How many students were surveyed who had taken none of the three
types of courses?
ii. Of the students, how many had taken only a Computer Science
Course?
Solution-
Let A- set of students taken Maths Course.
B- set of students taken Computer Science Course.
C- set of students taken Business Course.

Given- |A|= 64 |B|= 94 |C|=58


|A∩C|= 28
|A∩B|= 26
|B∩C|=22
|A∩B∩C|=14
i. By using Principal of Mutual Inclusion-Exclusion,
|A ∪ B ∪ C|=|A|+|B|+|C|-|A ∩ B|-|B ∩ C|-|A ∩ C|+|A ∩ B ∩ C|
=64+94+58-28-26-22+14
=154
Therefore, Students who have not taken either of the subjects,

|∪|- |A ∪ B ∪ C|
= 260-154
=106
So, 106 students had taken none of the three types of course.
ii. Students who have taken only Computer Science Course,

= |B|-|B∩A|-|B∩C|+|A ∩ B∩C|

= 94-26-22+14

=60
So, 60 students had taken only
Computer Science Course.
Example-
In a survey of 60 people, it was found that
25 read Newsweek magazine,
26 read Time and
26 read Fortune.
Also,
9 read both Newsweek and Fortune,
11 read both Newsweek and Time,
8 read both Time, and Fortune,
8 read no magazine at all.
a)Find the number of people who read all 3 magazines.
b) Draw the Venn diagram filling the correct number of people in all
regions of the Venn Diagram.
c) Determine the number of people who read exactly 1 magazine.
a)Given-
|N ∪ T ∪F| = 60 - 8 = 52
|N|=25 |T|=26 |F|=26
|N ∩ T|=11 |T ∩ F|=8 |N ∩ F|=9

By the principle of inclusion and exclusion,


|N ∪ T ∪F|=|N|+|T|+|F|-|N ∩ T|-|T ∩ F|-|N ∩ F|+|N ∩ T ∩ F|
52 =25+26+26-11-8-9 +|N ∩ T ∩ F|
So, |N ∩ T ∩ F|= 52- (77-28)
=52- 49
=3
3 people read all three magazines.
b)Venn Diagram-

c) People who read only one magazine


= 8+10+12
=30
PIGEONHOLE PRINCIPLE

• Theorem-
If n pigeons are assigned to m pigeonholes, & m<n, then at
least one pigeonhole contains two or more pigeons.
Example-
If 13 people are assembled in a room, show that at least 2 of them must
have their birthday in the same month.

Solution-

Let, the birth months-pigeons


calendar months-pigeonholes
Then, there are 13 pigeons & 12 pigeonholes.

Therefore,
By pigeonhole Principle, at least 2 people were born in the same
month.
• Show that if any 5 numbers from 1 to 8 are chosen, then 2 of them
will add up to 9.

• Solution-
Construct 4 diff sets, each containing 2 numbers that add up to
9 as-
A1={1,8}
A2={2,7}
A3={3,6}
A4={4,5}
Each of 5 nos. chosen must belong to one of these sets.
Since, there are only 4 sets, by pigeonhole principle, two of the
chosen numbers belong to the same set. These numbers add up to 9.
EXTENDED PIGEONHOLE PRINCIPLE

• If the number of pigeons are much larger than the number of


pigeonholes, then previous theorem can be restated to give a stronger
conclusion.
• Floor-
└3/2┘=1.5=1
└6/3┘=2
└9/4┘=2.25=2
• Ceil-
└3/2┘=1.5=2
└6/3┘=2
└9/4┘=2.25=3
EXTENDED PIGEONHOLE PRINCIPLE

• Theorem-
If n pigeons are assigned to m pigeonholes, then one of
the pigeonholes must obtain at least └(n-1)/m┘+1 pigeons.
• Example1-
• Show that if 30 dictionaries in a library contain a total of 61327 pages,
then one of the dictionaries must have at least 2045 pages.

• Solution-
Let n pages- pages &
m dictionaries- the pigeonholes
Assign each page to the dictionary in which it appears.
Then by extended pigeonhole principal, one dictionary must contain at
least ,
└(n-1)/m┘+1
=└ (61327-1) /30┘+1=
= 2045.2 pages
=2045 pages.
• Example2-

6 friends discover that they have total of 2161 Rs. with them on a trip
to the movies. Show that one or more of them must have at least 361
Rs.
• Solution-
Let Rupees-pigeons
Number of friends- Number of pigeonholes.
Then,
By Extended pigeonhole principle, one friend must have at least
└(n-1)/m┘+1
=└2160/6┘+1
=360+1
=361 Rs.
RECURRENCE RELATIONS

• We know that Permutations & Combinations are the most


fundamental tools for counting the elements of finite sets.

• But, these often prove inadequate in some cases.


• An important alternate approach is to use Recurrence Relations
(sometimes called Difference Equations) to define the terms of a
sequence.

• The procedure for finding the terms of a sequence in a recursive


manner is called recurrence relation.
• Definition-
• A recurrence relation is an equation that recursively defines a
sequence where the next term is a function of the previous
terms.

• Examples of Recurrence Relations-


• If Sn denotes the sum of first n positive integers, then Sn=n+Sn-1with
S1=1.
• The seq. 1,3,5,7,11,…. is defined by the recurrence relation an=an-1+2
with initial conditions a1=1.
• The Fibonacci series is defined by the recurrence relation an=an-1+ an-2
with initial conditions a0=1 a1=1.
ORDER OF RECURRENCE RELATION

• Order of Recurrence Relation is the difference between the largest and


smallest subscript appearing in the relation.

• For example,
an-3an-1 +2an-2=0 RR of order Two.

a2n+(an-1)2=1 RR of order One.


DEGREE OF RECURRENCE RELATION

• Degree of Recurrence Relation is the highest power of an.

• For example,

a4n+2a3n-1+18a2n-2 + an-3=1 RR of degree 4.


• A Recurrence Relation is called Linear Recurrence Relation if its degree
is 1.
• A Recurrence Relation of the form,
C0ar + C1ar-1+……+Ckar-k=f(r) ………(1)

Where C0,C1,C2, ……Ck are constants, is called RR of the order k with


constant coefficients.

The above RR(1) is said to be Linear Homogeneous relation of order k if


f(r )=0, otherwise,
It is called Non-linear Homogeneous relation f(r )≠0.
e.g. ar+2+6ar+1+18ar=0 is a Linear Homogeneous relation of order 2.
ar+2-6ar+1-ar=3r+2 is a Non-Linear Homogeneous relation of order 2.
HOMOGENEOUS SOLUTIONS

• Each linear recurrence is associated with its homo. Equation and the
solution of homo. Equation is called Homogeneous solution of the given
RR.

• Consider, kth order Linear RR with constant Coefficients.


C0ar + C1ar-1+……+Ckar-k=f(r)
Homogeneous RR of above RR is given by,
C0ar + C1ar-1+……+Ckar-k=0

Means for any linear RR, if f( r)=0(RHS term 0), then the given equation is
homo. RR.
• For example,
ar-6ar-1 +11ar-2 +6ar-3 =2r

Then its homogeneous Recurrence relation is,

ar-6ar-1 +11ar-2 +6ar-3 =0


HOW TO SOLVE HOMOGENEOUS RR

• To solve a Homogeneous Recurrence Relation, we define a term


called Characteristic Equation.
• Suppose C0ar + C1ar-1+……+Ckar-k=0 is the linear Homo. RR of order
k with constant coefficients.
• The solution of this equation is supposed to be of the form

ar =A k
1
• Substituting this into the relation, we get,

C0 (A 1
r) + C1 (A 1
r-1 )+ C2 (A 1
r-2) +…….+ Ck (A 1
r-k) =0.
C0 (A 1 )
r + C1 (A 1
r-1 )+ C2 (A 1 )
r-2 +…….+ Ck (A 1 )
r-k =0

A 1
r-k [C0 1
k + C1 1
k-1+
…….+ Ck]=0

Or
C0 1
k+ C1 1
k-1 +……+Ck =0.

Which is called as the Characteristic Equation of the RR,


1 is called the Characteristic Root
A k
1 is called the Homogeneous Solution to the RR.

Characteristic Equation of k degree has k roots.


HOW TO SOLVE LINEAR RECURRENCE RELATION

There can be Following cases while finding the roots-


• Case 1(Distinct Roots)-If all the roots are distinct, then the solution of
homo RR is given by,
ar= A1 r
1 + A2 r
2 + ….. + Ak r
k

where A1,A2,…. Ak are constants which are to be determined by


initial conditions.

• Case 2(Equal Roots)- If the Characteristic root is repeated say


1(repeated m times), then the term A1 1 is replaced by
r

(A1rm-1+ A2rm-2+…… +Am-1r+ Am) r


1

where A1,A2,…. Am are constants which are to be determined by initial


conditions.
HOW TO SOLVE LINEAR RECURRENCE RELATION

• Case 3(Complex Roots)- If α+iβ is the root of the characteristics


equation, then α-iβ is also the root, where α and β are real.
So, (α+iβ)K and (α-iβ)K are solutions of the equations. This implies
(α+iβ)K A1+α-iβ)K A2
is also a solution to the characteristics equation,
where A1 and A2 are constants which are to be determined.
Example-
Find the Solution of ar+2 – ar+1 - 6ar=0

Solution-
The Characteristic equation is,
2- - 6=0
2- 3 +2 - 6=0
( - 3) +2( -3)=0
( -3)( +2)=0
so,
=3, -2 are the characteristic roots of the eqn.
So the Solution of given RR is,
ar =A1 (3)r + A2(-2)r
Example-
Solve the recurrence relation
ar - 6ar-1 + 9ar-2 =0
Solution-
The Characteristic equation is,
2- 6 + 9=0 or x2- 6x + 9=0
( -3) 2=0
so,
=3, 3 are the characteristic roots of eqn.
Since, the roots are repeated, the Solution of given RR is,
ar =(A1 + A2 r)3r where A1,A2 are constants
Example-

Find the solution of


ar+2 + 2ar+1 - 3ar =0 that satisfies a0=1 a1=2.
Example-
Find the solution of
ar+2 + 2ar+1 - 3ar =0 that satisfies a0=1 a1=2.

Solution-
The Characteristic equation is,
2 +2 -3=0

2 +3 - -3=0
( +3)-1( +3)=0
( +3)( -1)=0
so,
=-3, 1 are the characteristic roots of eqn.
So, the Solution of given RR is,
ar = A1 (-3)r + A2(1)r where A1,A2 are constants
= A1 (-3)r + A2
To find A1 , A2, Putting r=0, we get,
ar = A1 (-3)r + A2
a0 = A1 (-3)0 + A2
1 = A1 + A2

Also, putting r=1, we get,


a1 = -3A1 + A2
2 = -3A1 + A2
On solving, we get,
A1=-1/4 A2=5/4
So, the Homogeneous solution of given RR is,
ar = -1/4 (-3)r +5/4
Example-

Find the solution of


ar =6ar-1 +9ar-2 with the initial conditions a0=1 a1=6.
Example-
Find the solution of
ar =6ar-1 +9ar-2 with the initial conditions a0=1 a1=6.

Solution-
The Characteristic equation is,
2 -6 +9=0

( -3) 2 =0
so,
=3, 3 are the characteristic roots of eqn(equal roots).
So, the Solution of given RR is,
ar =(A1r+ A2 )(3)r where A1,A2 are constants
To find A1 , A2, Putting r=0, we get,
ar =(A1 r+ A2 )(3)r
a0 = (A1 (0) + A2)(3)0
1 = A2

Also, putting r=1, we get,


a1 = (A1(1) + A2) (3)1
6 = (A1+ A2) 3
6 = 3A1+ 3A2

On solving, we get,
A1=1 A2=1
So, the Homogeneous solution of given RR is,
ar = (1r+1)(3)r
Example-

Find the solution of Fibonacci relation


ar =ar-1 +ar-2 with the initial conditions a0=0 a1=1.
Example-
Find the solution of Fibonacci relation
ar =ar-1 +ar-2 with the initial conditions a0=0 a1=1.

Solution-
The Characteristic equation is,
2 - -1=0

a=1,b=-1,c=-1
PARTICULAR SOLUTIONS(NON -HOMO. RR)

• Procedure for obtaining RR solution depends on the form of f(r )i.e. RHS
of given relation.

• Case1-If f(r ) is a polynomial degree t in r. i.e.


f(r )= f1rt+f2rt-1+……+ftr+ft+1 Then soln is,
P1rt+P2rt-2+….+Ptr+Pt+1

Case2- If f(r ) is in form of βr where β is not a chara. Root,


Pβr
Case3- If f(r ) is in form of (F1rt+F2rt-1+……+Ftr+Ft+1 ) βr where β is not a
chara. Root,
then, (P1rt+P2rt-1+….+Ptr+Pt+1) βr
PARTICULAR SOLUTIONS

Case4- If f(r ) is in form of (F1rt+F2rt-1+……+Ftr+Ft+1 ) βr where β is a chara.


Root of multiplicity (m-1),
then, rm-1 (P1rt+P2rt-1+….+Ptr+Pt+1) βr

Case 5- If f(r ) is in form of f(r ) =C (Constant) where 1 is not a chara.


Root,
then the solution is, P, a constant.

This form of parti. soln has nothing to do with order of RR. It only
depends on RHS.
• Example-
• Find the particular solution of the RR
ar -5ar-1 +6ar-2 =1

Soln-
In given RR, the RHS is a constant. So, the general form of particular solution
is,
ar(P) =P

By putting the value in given RR, we get,


P-5P+6P=1
2P=1
P=1/2
ar(P) =1/2
• Example-
• Find all solutions of the RR,
ar =5ar-1 -6ar-2 +7n

Soln-
In given RR, the RHS is,
ar =5ar-1 -6ar-2 +7n or ar -5ar-1 + 6ar-2 =7n
The Chara. Equation of the Eqn is,
2-5 +6=0
( -3) ( -2)=0
=3,2
Roots are distinct. So, Homo. Soln of RR is,
an =A13n+A22n where A1 & A2 are constants.
Here, f(n)= 7n .
So, the Solution is,
an(p) =P. 7n
By substituting the terms in given RR, we get,
P. 7n= 5P. 7n-1-6 P. 7n-2+ 7n
49P=35P-6P+49
20P=49
p=(49/20). 7n

Thus, the solutions are of the form ,

an =A13n+A22n P+(49/20) 7n
Thank You!!!

You might also like