Module 1
Module 1
CLASS-1
Pigeonhole Principle
Rook Polynomials
In many situations of computational work, we employ two basic rules of counting, called the Sum Rule and the Product
Rule. These rules are restated and illustrated in the following paragraphs.
Suppose two tasks 𝑇1 and 𝑇2 are to be performed. If the task 𝑇1 can be performed in 𝑚 different ways and the task 𝑇2
can be performed in n different ways and if these two tasks cannot be performed simultaneously, then one of the two tasks
More generally, if 𝑇1 , 𝑇2 , 𝑇3 …….𝑇𝑘 are 𝑘 tasks such that no two of these tasks can be performed at the same time
and if the task 𝑇𝑖 can be performed in 𝑛𝑖 different ways, then one of the 𝑘 tasks (namely 𝑇1 or 𝑇2 or 𝑇3 …….or 𝑇𝑘 ) can be
Example 1: Suppose there are 16 boys and 18 girls in a class and we wish to select one of these students (either a boy or a
The number of ways of selecting a boy is 16 and the number of ways of selecting a girl is 18. Therefore, the number of
Example 2: Suppose a Hostel library has 12 books on Mathematics, 10 books on Physics, 16 books on Computer Science
and 11 books on Electronics. Suppose a student wishes to choose one of these books for study.
Suppose that two tasks 𝑇1 and 𝑇2 are to be performed one after the other. If 𝑇1 can be performed in 𝑛1 different ways, and
for each of these ways 𝑇2 can be performed in 𝑛2 different ways, then both of the tasks can be performed in 𝑛1 𝑛2
different ways.
More generally, suppose that 𝑘 tasks 𝑇1 , 𝑇2 , 𝑇3 …….𝑇𝑘 are to be performed in a sequence. If 𝑇1 can be performed in 𝑛1
different ways and for each of these ways 𝑇2 can be performed in 𝑛2 different ways, and for each of 𝑛2 different ways of
performing 𝑇1 and 𝑇2 in that order, 𝑇3 can be performed in 𝑛3 different ways, and so on, then the sequence of tasks 𝑇1 ,
Example 4. Suppose a person has 8 shirts and 5 ties. How many different ways of choosing a shirt and a tie?
Example 5. Suppose we wish to construct sequences of four symbols in which the first 2 are English letters and the
SOLUTION: If no letter or digit can be repeated then the number of different sequences that we can construct is
26 × 25 × 10 × 9 = 58500.
If repetition of letters and digits are allowed then the number of different sequences that we can construct is
26 × 26 × 10 × 10 = 67600.
18-04-2023 DISCRETE MATHEMATICS AND GRAPH THEORY 6
Example 6. Suppose a restaurant sells 6 South Indian dishes, 4 North Indian dishes, 3 hot beverages
and 2 cold beverages, for breakfast, a student wishes to buy 1 South Indian dish and 1 hot beverage,
or 1 North Indian dish and 1 cold beverage.
SOLUTION: Then he can have the first choice in 6 × 3 = 18 ways and he can have the second choice in 4 ×
2 = 8 ways. The total number of ways he can buy his breakfast items is 18 + 8 = 26.
Example 7. There are 20 married couple in a party. Find the number of ways of choosing one woman
and one man from the party such that the two are not married to each other.
SOLUTION: from the party, a woman can be chosen in 20 ways. Among the 20 men in the party, one is her
husband. Out of the 19 other men one can be chosen in 19 ways. Therefore, the required number is 20 × 19
= 380.
plates have only vowels (A, E, I, O, U) and even digits (0, 2 , 4 , 6, 8)?
SOLUTION: Each of the first two positions in a plate can be filled in 5 ways (with vowels and each of the remaining four places can
be filled in 5 ways (with digits 0, 2, 4, 6, 8). Therefore, the number of possible license plates of the given type is (5 × 5) × (5 × 5 × 5 ×
5) = 56 = 15,625.
• Example 9. There are four bus routes between the places A and B and three bus routes between the places B and C. Find the
number of ways a person can make a round trip from A via B if he does not use route more than once.
SOLUTION: The person can travel from A to B in four ways and from B to C in three ways, but only two ways from C to B and only
in three ways from B to A if he does not use a route more than once. Therefore, the number of ways he can make the round trip under
(a) How many distinct cars (of this company) can be manufactured? (b) Of these how many have the same colour?
SOLUTION:
(a) By the product rule, it follows that the number of distinct cars that can be manufactured is 4 × 12 × 2 × 3 = 288.
(b) (b) For any chosen colour, the number of distinct cars that can be manufactured is
• 4 × 3 × 2 = 24.
SOLUTION: Here we consider numbers of the form xyz, where each of x, y, z represents a digit under given
restrictions. Since xyz has to be even, z has to be 0, 2, 4, 6, or 8. If z is 0, then x has 9 choices and if z is 2, 4, 6 or 8 (4
choices) then x has 8 choices. (Note that x cannot be zero). Therefore, z and x can be chosen in (1 × 9) + (4 × 8) = 41
ways. For each of these ways, y can be chosen in 8 ways. Hence, the desired number is 41 × 8 = 328.
SOLUTION: We first note that no integer of the required type can contain more than 4 digits. Let s1, s2, s3, s4 denote the
number of integers of the required type containing one, two, three, four digits respectively.
• Since there are four digits, there are four integers containing exactly one digit (i.e. s1 = 4), there are 4 × 3 = 12 integers
containing exactly two digits (i.e. s2 = 12), there are 4 × 3 × 2 = 24 integers containing exactly three digits (i.e. s3 = 24)
and there are 4 × 3 × 2 × 1 = 24 integers containing exactly three digits (i.e. s4 = 24). Therefore, the required number is
• s1 + s2 + s3 + s4 = 64
• Suppose we wish to select, with repetition, a combination of r objects from a set of n distinct
(𝑛+𝑟−1)!
• 𝐶 𝑛 + 𝑟 − 1, 𝑟 ≡ ≡ 𝐶 𝑟 + 𝑛 − 1, 𝑛 − 1
𝑟!(𝑛−1)!
𝑥1 + 𝑥2 + … … . . . + 𝑥𝑛 = 𝑟
Example 1. A bag contains coins of seven different denominations, with at least one dozen coins in each
denomination. In how many ways can we select a dozen coins from the bag?
The selection consists in choosing with repetitions, r = 12 coins of n = 7 distinct denominations. The number of
ways of making this selection is
18!
• 𝐶 7 + 12 − 1, 12 = 𝐶 18,12 = = 18,564
12!6!
18-04-2023 DISCRETE MATHEMATICS AND GRAPH THEORY 13
Example 2. In how many ways can we distribute 10 identical marbles among 6 distinct containers?
• The selection consists in choosing with repetitions, r = 10 marbles for n=6 distinct containers. The required number is
15!
• 𝐶 6 + 10 − 1, 10 = 𝐶 15,10 = = 3003
10!5!
Example 3. A cake shop sells 20 kinds of cakes. If there are at least a dozen cakes of each kind, in how many ways a dozen
cakes can be chosen?
• 𝐶 20 + 12 − 1, 12 = 𝐶 31,12 = 141,120,525
𝑥1 + 𝑥2 + 𝑥3 + ⋯ … + 𝑥6 = 9 − 𝑥7
Where 9 − 𝑥7 ≤ 9 so that 𝑥7 is a non-negative integer. Thus, the required number is the number of non-negative
𝑥1 + 𝑥2 + 𝑥3 + ⋯ … + 𝑥7 = 9
This number is
15!
𝐶 7 + 9 − 1, 9 = 𝐶 15,9 = = 5005
9! 6!
𝑥2 ≥ 1, 𝑥3 ≥ 1.
• The number of non-negative integer solutions of this equation is the required number. This number is
16! 16 ×15
• 𝐶 3 + 14 − 1, 14 = 𝐶 16, 14 = = = 120
14!2! 2
𝑥3 ≥ 4, 𝑥4 ≥ 2, 𝑥5 ≥ 0.
• The number of non-negative integer solutions of this equation is the required number, and the number is
23!
• 𝐶 5 + 19 − 1, 19 = 𝐶 23, 19 = = 8855.
19!4!
Statement: - If 𝑛 pigeons occupy 𝑚 pigeonholes and if 𝑚 < 𝑛 then at least one pigeonhole contains two or more
pigeons
A simple Illustration of above principle is that, If 6 pigeons occupy 4 pigeon holes, then at least one pigeonhole must
𝑛−1
Statement: - If 𝑛 pigeon are assigned to 𝑚 pigeonholes then one of the pigeonholes must contains at least +1
𝑚
pigeons.
1. Show that if you pick any five numbers from the integers 1-8, then two of them must add up to 9.
As it given that any two of the numbers out of the 5 numbers we have chosen should be equal to sum 9.
Let's add every two numbers so that we can get one such pair of numbers whose sum would be 9.
Case 1>. 1 + 3 = 4
Case 2>. 3 + 4 = 7
Case 3>. 4 + 7 = 11
Case 4>. 7 + 8 = 15
Case 5>. 8 + 1 = [ 9 ]
18-04-2023 DISCRETE MATHEMATICS AND GRAPH THEORY 20
PROBLEMS
Hence in Case 5 we get a pair of numbers 8 and 1 whose sum is equal to 9 , so we present them together in a same set as
{8,1}.So according to Pigeonhole Principle ,We can take any 5 numbers and there will always exist one pair whose sum is
equal to 9.
points inside the triangles, Prove that at least two of these points are such that the
Solution: -
Consider a Δ DEF formed by midpoint of the sides BC, CA, AB divide ABC into four small
Treating each of the triangle as pigeonhole and 5 points chosen inside the triangle as a pigeon.
We find by using pigeonhole principle that at least one portion must contain two or more
points.
3. Show that if 30 dictionaries in a library contain a total of 61,327 pages, then one of the dictionaries must have at
𝑛−1
Therefore 𝑝+1= +1
𝑚
61327 − 1
= +1
30
= 2044.2 + 1
= 2044 + 1 = 𝑝 + 1 = 2045
4. Show that if seven colors are used to paint 50 bicycles, at least eight bicycles will be the same color.
We need to prove p + 1 = 8
n−1
Therefore p+1 = +1
m
50−1
= +1
7
= 7 + 1
p + 1 = 8
5. If 13 people are assembled in a room, show that at least two of them must have their birthdays in the same month.
We need to prove p + 1 = 2
n−1
Therefore p+1 = +1
m
13−1
= +1
12
= 1 + 1
p+1 =2
6. How many friends must you have to guarantee that at least 5 of them will have birthdays in the same month?
We have to find n = ?
n−1
Therefore p + 1 = +1
m
48 = n – 1
n−1
5= +1
12 n = 48 +1
n−1
5−1= n = 49
12
n−1
4=
12
4 × 12 = n − 1
7. Six books each of physics, chemistry, mathematics and four books of biology totally contains 12225 pages. Find the
If S is a finite set, then the number of elements in S is called cardinality of S and is denoted by S . If A and B are subset of S,
A ∪ B = A + B − A ∩ B −− −(1)
Thus, to determine the elements of A ∪ B, we include all elements of A and B, but exclude all elements common to A and B.
ഥ∩ B
A ഥ = A ∪ B and
A∪B = S − A∪B
ഥ∩ B
A ഥ = A ∪ B = S − A − B + A ∩ B − −(2)
The formula (1) and (2) are equivalent to one another, and either of these is referred to as Addition Principle or the Principle
of inclusion-exclusion.
| A1 A2 A3 | = | A1 | + | A2 | + | A3 | - | A1 A2 | - | A1 A3 | - | A2 A3 | + | A1 A2 A3 |
A1 A2 . . . An = 𝐴1 ∩ 𝐴2 ∩ 𝐴3……………….∩ 𝐴𝑛 .
𝐴1 ∩ 𝐴2 ∩ 𝐴3 …. .∩ 𝐴𝑛 = A1 A2 . . . An
= 𝑆 − A1 A2 . . . An
N= 𝑆1 − 𝑆2 + 𝑆3 + ⋯ … . . +(−1)n−1 𝑆𝑛 -----(5)
ഥ = 𝑆0 − 𝑆1 + 𝑆2 − 𝑆3 + ⋯ … . . +(−1)n 𝑆𝑛 -----(6)
𝑁
Where 𝑆0 = 𝑆
𝑆1 = Σ | Ai |
𝑆2 = Σ | Ai Aj |
𝑆3 = Σ | Ai Aj Ak |
𝑆𝑛 = Σ | A1 A2 ... An |
18-04-2023 DISCRETE MATHEMATICS AND GRAPH THEORY 30
GENERALIZATION
The principle of inclusion-exclusion as given by equation (6) gives the number of elements in 𝑠 that satisfy none of the
conditions.
The following expression determines the number of elements in 𝑆 that satisfy exactly 𝑚 𝑜𝑓 𝑛 conditions 0 ≤ 𝑚 ≤ 𝑛 .
𝑚+1 𝑚+2 𝑛
𝐸𝑚 = 𝑆𝑚 − 𝑆𝑚+1 + 𝑆𝑚+2 − ⋯ … … + (−1)n−m 𝑆
1 2 𝑛−𝑚 𝑛
Further, the following expression determines the number of elements in 𝑆 that satisfy at least 𝑚 𝑜𝑓 𝑛 conditions 1 ≤ 𝑚 ≤ 𝑛 .
𝑚 𝑚+1 𝑛−1
𝐿𝑚 = 𝑆𝑚 − 𝑆𝑚+1 + 𝑆𝑚+2 − ⋯ … … + (−1)n−m 𝑆
𝑚−1 𝑚−1 𝑚−1 𝑛
EXAMPLE 01
Solution:
EXAMPLE 02
Solution:
EXAMPLE 03
Solution:
EXAMPLE 04
Solution:
EXAMPLE 05
Solution:
EXAMPLE 06
Solution:
EXAMPLE 07
Solution:
Solution:
EXAMPLE 09
EXAMPLE 10
EXAMPLE 11
A permutation of 𝑛 distinct objects in which none of the objects is in its original place is called derangement. The number
If there are n integers 1 2 3 ⋯ 𝑛, then the derangement is that 1 should not be in first place, 2 should not be second place, 3
Examples:
ii. Suppose we have 2 things, the arrangement is 1 2 and the only possible derangement is 2 1. Hence 𝐷2 = 1.
iii. Suppose we have 3 things, the arrangement is 1 2 3 and the only possible derangements are 3 1 2 and 2 3 1. Hence
𝐷318-04-2023
= 2. DISCRETE MATHEMATICS AND GRAPH THEORY 53
DERANGEMENTS – NOTHING IS IN ITS RIGHT PLACE
1 1 1 −1 𝑛
𝑑𝑛 = 𝑛! 1 − + − ± ⋯ +
1! 2! 3! 𝑛!
𝑛
−1 𝑘
𝑑𝑛 = 𝑛! ×
𝑘!
𝑘=0
If 𝑛 is large that is 𝑛 ≥ 7 𝑑𝑛 = 𝑛! × 𝑒 −1 .
1 1 1 −1 𝑛
𝑑𝑛 = 𝑛! 1 − + − ± ⋯ +
1! 2! 3! 𝑛!
1 1 1 1
𝑑4 = 4! 1 − + − +
1! 2! 3! 4!
1 1 1
= 24 × 1 − 1 + − +
2 6 24
= 12 − 4 + 1 = 9
Now we check that the nine derangements of 1 2 3 4 are
2143, 2341, 2413, 3142, 3412, 3421, 4123, 4312, 4321 totally 9 arrangement.
Thus, 𝐷4 = 9 and the same is verified by listing all derangements.
3. Seven books are distributed among 7 students for reading. The books are recollected and redistributed. In how many
ways will each student get to read two different books.
Solution
Given 7 books are distributed to 7 students in 7 P7 = 7! Ways.
As books are recollected and redistributed so that each student get to read two different books means that we need to find the
derangement of 7 books multiplied total number of arrangements = 7! × 7! × e−1 = 9342708.48 ≈ 9342709
𝑑𝑛 1 1 −1 𝑛
𝑝=1− = 1 − + − ⋯….
𝑛! 1! 2! 𝑛!
For 𝑛 ≥ 7, this is approximated to
𝑝 = 1 − 𝑒 −1 = 1 − 0.3679 = 0.6321
Introduction
Chess is an indoor game played between to opponents on opposite side using board which contain 64 of alternating
colours. Each player has 16 pieces of pawns in opposite colours white and black with various names placed on each square
of keeping top 2 rows and bottom 2 rows on the board having 8 rows and 8 columns consist 16 squares.
Rook is the name of the pawn placed on square of the chess board. Two of the pawns placed on any board having squares
greater than or equal to two are said to be attack each other if they are in the same row or column.
Rook Polynomial:
Consider a board 𝐶, that assemble a chess board or part of a chess board, consisting of 𝑛 number of a square pawns are to
be placed in the squares such that no two pawns occupy the same squares. Two pawns on the board having more than two
squares are set to be captured each other. If they(pawns) are in the same row or same column of the same board.
For 2 ≤ 𝑘 ≤ 𝑟, let 𝑟𝑘 denote the number of ways in which 𝑘 pawns can be placed on a board 𝐶 such that no two pawns
𝑅𝑘 𝑥 = 𝑟 𝐶, 𝑥 = 1 + 𝑟1 𝑥 + 𝑟2 𝑥 2 + 𝑟3 𝑥 3 + … … … + 𝑟𝑛 𝑥 𝑛
is the rook polynomial for each board 𝐶. Here 𝑟1 always represents the number of squares on the board.
Product Formula:
Suppose a board 𝐶 is made of two parts 𝐶1 and 𝐶2 where 𝐶1 and 𝐶2 have no square in same row or column of 𝐶 such
parts of 𝐶 are called disjoint sub board of 𝐶 then the rook polynomial of 𝐶 can be written as 𝑟 𝐶, 𝑥 = 𝑟 𝐶1 , 𝑥 𝑟 𝐶2 , 𝑥
In generally,
𝑟 𝐶, 𝑥 = 𝑟 𝑐1 , 𝑥 𝑟 𝑐2 , 𝑥 … … … 𝑐𝑛 , 𝑥
Expansion Formula:
Let 𝐶 be the given board we choose particular square ⊛. Let D be the board obtained from C by deleting the row and
column containing the ⊛ and let E be the board obtained from C by deleting only the square ⊛.
Solution
w.k.t 𝑟 𝐶, 𝑘 = 1 + 𝑟1 𝑥 + 𝑟2 𝑥 2 + 𝑟3 𝑥 3 + … … … + 𝑟𝑛 𝑥 𝑛
𝑟 𝐶, 𝑥 = 1 + 𝑥
The number of ways in which two rooks can be place on this board such that no two pawns capture each other is 𝑟2 = 2
Because the two possible such positions are 1,4 & (2,3)
Three rooks cannot be place in this board such that no two pawns capture each other. Thus 𝑟3 = 0. Similarly, 𝑟4 = 0 and
so on.
𝑟 𝐶, 𝑥 = 1 + 4𝑥 + 2𝑥 2
18-04-2023 DISCRETE MATHEMATICS AND GRAPH THEORY 63
PROBLEMS
1 2 3
3. Find the rook polynomial for the following 𝟑 × 𝟑 board
4 5 6
Solution 7 8 9
w.k.t 𝑟 𝐶, 𝑥 = 1 + 𝑟1 𝑥 + 𝑟2 𝑥 2 + 𝑟3 𝑥 3 + … … … + 𝑟𝑛 𝑥 𝑛 .
We note that 2 non-capturing rooks can be placed on the board in the following
positions
1,5 , 1,6 , 1,8 , 1,9 , 2,4 , 2,7 , 2,6 , 2,9 , 3,4 , 3,5 , 3,7 , 3,8 , 4,8 , 4,9 ,
Thus 𝑟2 = 18
4 5 6
Next, we look out for the positions of placing 3 mutually non attacking rooks. The
Thus, 𝑟3 = 6
Later we find that four or more mutually non-capturing rooks can not be placed on
Note:
𝑟 𝐶, 𝑥 = 1 + 1! (𝑛 𝐶1 )2 𝑥 + 2! (𝑛 𝐶2 )2 𝑥 2 + 3! (𝑛 𝐶3 )2 𝑥 3 + ⋯ + 𝑛! (𝑛 𝐶𝑛 )2 𝑥 𝑛
The positions for 2 non-capturing rooks are 1,4 , 1,5 , 1,7 , 2,3 , 2,5 , 2,6 , 3,5 ,
The board has no positions for four or more mutually non-capturing rooks cannot be placed on
𝑟 𝐶, 𝑥 = 1 + 7𝑥 + 10𝑥 2 + 2𝑥 3
6. Find the rook polynomial for the 𝟑 × 𝟑 board by using expansion formula
Solution
w.k.t 𝑟 𝐶, 𝑥 = 1 + 𝑟1 𝑥 + 𝑟2 𝑥 2 + 𝑟3 𝑥 3 + … … … + 𝑟𝑛 𝑥 𝑛 .
The 3 × 3 board is given below
1 2 3
4 5 6
7 8 9
Let us mark the square which is at the centre of the board as ⊛. Then the boards 𝐷 and 𝐸 as
shown bellow (the shaded parts are the deleted parts)
1 2 3 1 2 3
4 5 6 4 5 6
7 8 9 7 8 9
The board 𝐷 has no positions for three or more mutually non-capturing rooks cannot be placed on
𝑟 𝐷, 𝑥 = 1 + 4𝑥 + 2𝑥 2
18-04-2023 DISCRETE MATHEMATICS AND GRAPH THEORY 70
PROBLEMS E
1 2 3
4 5 6
7 8 9
1,5 , 1,7 , 1,8 , 2,4 , 2,5 , 2,6 , 2,8 , 3,4 , 3,6 , 3,7 , 4,7 , 4,8 , 5,6 , 5,7
Thus 𝑟2 = 14
The positions for 3 non-capturing rooks are 1,5,7 , 2,4,8 , 2,5,6 , (3,4,7). Thus 𝑟3 = 4
The board has no positions for four or more mutually non-capturing rooks cannot be placed on board. Thus 𝑟4 = 0.
Thus, by expansion formula, the rook polynomial for board C can be written has
𝑟 𝐶, 𝑥 = 𝑥𝑟 𝐷, 𝑥 + 𝑟 𝐸, 𝑥
𝑟 𝐶, 𝑥 = 𝑥 1 + 4𝑥 + 2𝑥 2 + 1 + 8𝑥 + 14𝑥 2 + 4𝑥 3
𝑟 𝐶, 𝑥 = 1 + 9𝑥 + 18𝑥 2 + 6𝑥 3.
7. Find the rook polynomial for the board shown below (shaded part)
1 2
3 4
5 6
7 8
9 10 11
Solution
We note that the given board 𝐶 is made up of two disjoint sub-boards 𝐶1 and 𝐶2, where 𝐶1 is the 2 × 2 board with
r C1 , x = 1 + 4x + 2x 2
r C2 , x = 1 + 7x + 10x 2 + 2x 3
Therefore, the product formula yields the rook polynomial for the given board as
r C, x = r C1 , x r C2 , x
r C, x = 1 + 4x + 2x 2 1 + 7x + 10x 2 + 2x 3
Her 𝑟𝑘 is the coefficient of 𝑥 𝑘 in the rook polynomial of the board of 𝑚 rows and 𝑛 columns
whose squares represent the forbidden places (under the specified conditions).
18-04-2023 DISCRETE MATHEMATICS AND GRAPH THEORY 76
PROBLEMS
1. An apple, a banana, a mango and an orange are to be distributed to four boys B1,
B2, B3, B4 The boys B1 and B2 do not wish to have apple, the boy B3 does not
want banana or mango, and B4 refuses orange. In how many ways the distribution
can be made so that no boy is displeased?
Solution: The situation can be described by the board shown below in which the rows respectively
represent apple, banana, mango and orange, and the columns represent the boys B1, B2, B3, B4,
respectively. Also, the shaded squares together represent the forbidden places in the distribution.
Let us consider the board C consisting of the shaded squares in above Figure. We
note that C is formed by the mutually disjoint boards C1, C2, C3 shown in below
figure
Accordingly, we have
T2
𝑆𝑜 = 5! = 120, 𝑆1 = (5 − 1)!. 𝑟1 = 264
T3
T4 therefore
T5
18-04-2023 DISCRETE MATHEMATICS AND GRAPH THEORY 79