Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 58

LECTURE

Basic Counting, Pigeonhole principles


There are several rules of counting. They are given by the names:

(a) The product rule / The multiplication rule


(b) The sum rule / The addition rule
(c) The subtraction rule / The difference rule (rule of inclusion-exclusion)
(d) The division rule
Question:
Example:

Suppose I go to a shop to buy a shirt, a trouser and a jacket. In the shop, there are 20
different kinds of shirts, 10 different kinds of trousers, and 5 different kinds of jackets.
How many ways/choices to choose a shirt, a trouser and a jacket ?

Solution:
Using the product rule , there are 20 ×10 × 5=1000 choices available .
Example:
Suppose I need to make a question paper of “Discrete Mathematics and Applications”
from the first five chapters of the textbook. The chapters 1,2,3,4,5 contain numbers of
questions respectively, 30, 35, 50, 26, 40. How many choices do I have to choose five
questions such that one question is chosen from each chapter ?

Solution:
Using the product rule , there are 30 ×35 × 50 ×26 × 40=54,600,000 choices available .
Question:

Solution: According to the product rule, there are (3)(5)=15 choices.


(a)

(b)
Example: Consider S={a,b,c}, then number of different subsets of S are
{ },{a},{b},{c},{a,b},{a,c},{b,c},{a,b,c}. There are 8 number of subsets of S.
Similarly, the number of distinct bit strings of length |S|=3 are
000,001,100,101,010,011,110,111 which are also 8. Hence in general, there exists a 1 to 1
correspondence between number of subsets of S and number of bit strings of length |S|.
(Given below in the figure are two full binary trees obtained via recursion).
Example:
The Sum Rule
Note: If the student must select one project from each list, then the number of
possibilities will be (23)(15)(19)=6555 (using product rule).
Selection of Class Representative (CR)

Suppose we want to select a CR from a class of 40 students, in which 15 are boys and 25
are girls.

(i) If the CR must be a boy, then how many choices there are ?
Ans: 15, since there are 15 boys available.

(ii) If a CR could be a boy or a girl, then how many choices are there ?
Ans: 15 + 25=40 (by sum rule).

(iii) If we want to select two CRs, so that one must be a boy and another must be a girl,
then how many choices there are ?
Ans: 15 (by product rule).
Example: Sum Rule
Sum Rules in Sets

Example:
Let the total number of students in a class of discrete math is 38. These students appeared
in a final exam of DM. Of them, 35 students passed and 3 failed the final exam (assuming
nobody was absent).
Then
(Principle of Inclusion-Exclusion)
Q. How many numbers between 1 though 50 that are not divisible by 3 ?

Sol: Count the numbers that are divisible by 3 are = 16, or |A|=16
Number of elements in the set = 50, or |S|=50.
The number of elements in S not divisible by 3 are
= |S| - |A|
= 50-16
= 34.
Principle of Inclusion and Exclusion in Sets
Example:

Q. How many bit strings of length 7 either start with bit 1 or end with bits 000 ?

Solution:
Number of bit strings of length 7 that start with 1 bit are .
1 - - - - - -
Number of bit strings of length 7 that end with 000 bits are
- - - - 0 0 0
Number of bit strings of length 7 that start with 1 bit and end with 000 bits are
1 - - - 0 0 0
Hence the bit strings of length 7 that either start with bit 1 or end with 000 bits are:

Note: For each blank slot, there will be two choices of bit strings (0 or 1), hence by product
rule, the number of choices will be like
Example:
Example:

Q: How many numbers between 1 and 50 are divisible by either 3 or 5 ?


Ans: Numbers divisible by 3 are: 16 (i.e., 3,6,9,12,15,18,21,24,27,30,33,
36,39,42,45,48).
Numbers divisible by 5 are: 10 (i.e., 5,10,15,20,25,30,35,40,45,50).
Numbers divisible by both 3 and 5 are: 3 (i.e., 15,30,45).
Hence the total numbers divisible by either 3 or 5 are: 16+10-3=23.
(Here we used the inclusion-exclusion rule or the subtraction rule).

Q: How many numbers between 1 and 50 that are not divisible by both 3 and 5 (i.e., neither by
3 nor by 5) ?
Ans: 50 - 23=27 =
(i.e., 1,2,4,7,8,11,13,14,16,17,19,22,23,26,28,29,31,32,34,37,38,41,43,44,46,47,49).

Q: How many numbers between 1 through 50 that are divisible by 3, and not by 5 ?
Ans: 16 - 3=13 = .

Q: How many numbers between 1 through 50 that are divisible by 5, and not by 3 ?
Ans: 10 – 3 = 7 .
Exercises.
Example:

Q. How many numbers from 1 through 50 that are divisible either 2 or 3 or 5 ?

Sol:
The total number of elements in the set S = {1,2,…, 50} are
The number of elements in S that are divisible by 2 are:
The number of elements in S that are divisible by 3 are:
The number of elements in S that are divisible by 5 are:
The number of elements in S that are divisible by 2 and 3 are:
The number of elements in S that are divisible by 3 and 5 are:
The number of elements in S that are divisible by 2 and 5 are:
The number of elements in S that are divisible by 2 and 3 and 5 are:

The number of elements in S that are divisible by either 2 or 3 or 5 are:

=
= 36
Q. How many numbers from 1 through 50 that are divisible by :
(i) 2 and 3, but not by 5
(ii) 3 and 5, but not by 2
(iii) 2 and 5, but not by 3
(iv) 2, but not by 3 and not by 5
(v) 3, but not by 2 and not by 5
(vi) 5, but not by 2 and not by 3
(vii)Not by 2, not by 3 and not by 5

Sol:

(viii)
(ix)
(x)
Example:
Exercises:
Question:

Solution:

There are 4 choices of


different paths.
Question:

Solution:

Complete the solution !


Q. Suppose that a girl has 3 pairs of shoes, and she randomly picks 4 single shoes
from them. Show that she has got one pair of shoes too ?

Ans: In this example, there are three pairs (pigeonholes) and four single shoes
(pigeons), therefore by employing pigeonhole principle, there are more pigeons than
pigeonholes. Hence, she must get a pair of shoes.

Q: Suppose a classroom contains 40 students. The students take off their shoes. The
shoes are collected and mixed well. How many single shoes be picked so that we are
guaranteed to obtain a single pair ?

Ans: 41
Q. Suppose that there are 3 men and 5 women at a party. Show that if these people are
lined up in a row, at least two women will be next to each other ?

Ans: Let us denote men by M and women by W and arrange them such that no two men
are next to each other and not at the either end of the line. According to pigeonhole
principle, we may consider men as pigeonholes and women as pigeons, then this
principle implies that at least two women would be next to each other.
Q. Assume that there are four batches of students. How many students should be
picked so that 4 students belong to the same batch are obtained ?

Ans: Let the four batches are B1, B2, B3 and B4 (pigeonholes). Picking 17 students
(pigeons) would guarantee to find 4 students from a single batch.

Ans: 4(12)+1=49 min


Generalized Pigeonhole Principle
Assignment No. 2

Q.1. Among integers 1 to 1000, (a) how many of them are not divisible by 3, nor by 5, nor
by 7 ? (b) how many are not divisible by 5 or 7 but divisible by 3 ?

Q.2. In a class of 80 students, 50 students know English, 55 know French and 46 know
German language. 37 students know English and French, 28 students know French and
German, 7 students know none of the languages. Find out:
(a) How many students know all the 3 languages ?
(b) How many students know exactly 2 languages ?
(c) How many know only one language ?

Q.3 Define the following sets recursively:


(d) S={a, aa, aaa, aaaa, ….}
(e) S={a, aaa, aaaaa, …}
(f) S={1, 2, 4, 8, 16, ….}
(g) S={2, 4, 16, 256, ….}
(h) S={1, 2, 3, 4 ….}

THE END

You might also like