Lecture 15
Lecture 15
(CSE 0611101)
2
The Product Rule
• The product rule: Suppose that a procedure can be
broken down into a sequence of two tasks. If there
are n1 ways to do the first task and for each of these
ways of doing the first task, there are n2 ways to do
the second task, then there are n1n2 ways to do the
procedure.
3
The Product Rule
If A1, A2 ,…, Am are finite sets, then the number of
elements in the Cartesian Product of these sets is
the product of the number of elements in each set.
• |A1 A2 … Am|= |A1||A2| …|Am|
4
The Product Rule: Example
• Example 2 (p. 336): The chairs of an auditorium are to be
labeled with a letter and a positive integer not exceeding 100.
What is the largest number of chairs that can be labeled
differently?
• Solution: The procedure of labeling a chair consists of two
tasks, namely, assigning one of the 26 letters and then
assigning one of the 100 possible integers to the seat. The
product rule shows that there are 26.100 = 2600 different
ways that a chair can be labeled.
Therefore, the largest number of chairs that can be labeled
differently is 2600.
5
The Product Rule: Example
• Example 3 (p. 336): There are 32 microcomputers in a
computer center. Each microcomputer has 24 ports. How
many different ports to a microcomputer in the center
are there?
• Solution: The procedure of choosing a port consists of
two tasks, first picking a microcomputer and then picking
a port on this microcomputer. Because there are 32 ways
to choose the microcomputer and 24 ways to choose the
port no matter which microcomputer has been selected,
the product rule shows that there are 32.24 = 768 ports.
6
The Sum Rule
• The sum rule: If a task can be done either in
one of n1 ways or in one of n2 ways, where
none of the set of n1 ways is the same as any
of the set of n2 ways, then there are n1+n2
ways to do the task.
7
The Sum Rule
• The sum rule: If A1, A2 ,…,Am are disjoint finite sets,
then the number of elements in the union of these
sets is the sum of the number of elements in each
set.
|A1 A2 … Am|= |A1| + |A2| + … + |Am|
8
The Inclusion-Exclusion Principle
• Suppose that a task can be done in n1 or n2 ways, but that some of
the set of n1 ways to do the task are the same as some of the n2
other ways to do the task. In this situation, we cannot use the sum
rule to count the number of ways to do the task.
• To correctly count the number of ways to do the two tasks, we add
the number of ways to do it in one way and the number of ways to
do it in the other way, and then subtract the number of ways to do
the task in a way that is both among the set of n1 ways and the set
of n2 ways. This technique is called the principle of inclusion-
exclusion.
Also called the subtraction principle for counting
|A1 A2 |= |A1|+|A2|- |A1 A2 |
9
5.2 The Pigeonhole Principle
• If there are more pigeons than pigeonholes, then
there must be at least one pigeonhole with at least
two pigeons in it.
• Theorem 1: (The Pigeonhole Principle) If k is a
positive integer and k+1 or more objects are placed
into k boxes, then there is at least one box containing
two or more of the objects.
– Proof (by contraposition)
– Also called the Dirichlet drawer principle
10
FIGURE 1 : There Are More Pigeons Than
Pigeonholes
11
The Pigeonhole Principle
12
The Generalized Pigeonhole Principle
13