Lecture 7 Countings
Lecture 7 Countings
Counting
To apply Sum and product Rule in solving problems.
To apply Inclusion-exclusion Principle
To apply Pigeonhole Principle
Sum Rule/Addition Rule The Sum Rule says that,
If there are methods to complete
a task.
𝑤𝑛
The total different ways to
complete the task
+
Example 1:
Everyday, there are 2 trains routine, 5 express
bus routine, and 4 flight routine from Malaysia
to Singapore. How many different ways can a
passenger travel from Malaysia to Singapore?
Train
Total
Bus
different
5 ways
11
Fligh
t
4
Sum Rule/Addition Rule
Suppose a finite set A equals the union of k distinct
mutually disjoint subsets . Then
In
general, the Sum Rule can be written as:
Number of total different ways a task can be done
Example 2:
Town B
Product rule
Solution:
Jane needs 2 steps to complete this task.
Step 1: Choose a shirt. 5 different ways
Step 2: Choose a pair of jean. 4 different
ways
Exercise:
1. In how many ways can the word
“Computing” can be arranged?
2. In how many ways can 3 persons be
seated in an empty bus that has 44 seats.
Sum and Product rule
11
Inclusion-Exclusion Principle
For Three Sets
12
Inclusion-Exclusion Principle
Generally
13
Example 3
Scenario:
Out of 50 students in a class
◦ 30 took precalculus
◦ 18 took calculus
◦ 26 took Java
◦ 9 took both precalculus and calculus
◦ 16 took both precalculus and Java
◦ 8 took both calculus and Java
◦ 47 took at least one of the three courses.
Example 3
Questions:
a. How many students did not take any of the
three courses?
b. How many students took all three courses?
c. How many students took precalculus and
calculus but not Java? How many students
took precalculus but neither calculus nor
Java?
Example 3
Solutions:
a. 50-47=3
b. Let,
Example 3
Solutions:
c. Refer to diagram…
The Pigeonhole Principle
Ifm pigeons are put into n holes, where , at least
two pigeons must be in the same hole.
Also known as the Dirichlet Drawer Principle or
the Shoe Box Principle
18
Example 1
A drawer contains ten black and ten white socks.
What is the least number of socks to pull out to
be sure to get a matched pair?
3 Socks
Example 2
Let
a. If five integers are selected from A, must at least
one pair of the integers have a sum of 9?
b. If four integers are selected from A, must at least
one pair of the integers have a sum of 9?
Answers:
• Partition the set into the following
disjoint subsets having a sum of 9.
{1,8}, {2,7}, {3,6} and {4,5}
a. YES
b. NO
The End