DM_Lecture_04_Edited
DM_Lecture_04_Edited
Faculty of Computing
1 Introduction to Counting
2 Addition Rule (Sum Rule)
3 Multiplication Rule (Product Rule)
4 Subtraction Rule (Principle of Inclusion-Exclusion)
5 Division Rule
6 Permutations
Definition
Counting is the process of determining the number of elements in a
set or the number of ways to arrange or choose objects.
Examples
Counting outcomes in a game
Determining possible combinations of clothes
Calculating the number of unique passwords that can be created
“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.”
If there are 3 red shirts and 2 blue shirts, then the total number of choices
of selecting a shirt is:
3+2=5
1 A student can choose a computer project from one of three lists. The
three lists contain 23, 15, and 19 possible projects, respectively. No
project is on more than one list. How many possible projects are there
to choose from?
2 A class has 10 boys and 15 girls. If one student is to be selected, how
many choices are there?
Multiply the number of choices for appetizers by the number of choices for
main courses:
3 × 4 = 12 combinations.
1 How many outcomes are there when rolling a die and flipping a coin
at the same time?
2 A new company with just two employees, Sanchez and Patel, rents a
floor of a building with 12 offices. How many ways are there to assign
different offices to these two employees?
3 How many different bit strings of length seven are there?
4 How many different license plates can be made if each plate contains
a sequence of three uppercase English letters followed by three digits
(and no sequences of letters are prohibited, even if they are obscene)?
“If a task can be done in either n1 ways or n2 ways, then the number of
ways to do the task is n1 + n2 minus the number of ways to do the task
that are common to the two different ways.”
Determining the number of bit strings of length 8 that satisfy at least one
of the following conditions:
starting with a 1 or ending with the two bits 0 0:
“If a task can be completed in n ways, but these n ways are grouped such
that exactly d of them correspond to the same result (or outcome), then
the total number of distinct ways to complete the task is dn ”
Among any group of 367 people, there must be at least two with the
same birthday, because there are only 366 possible birthdays.
In any group of 27 English words, there must be at least two that
begin with the same letter, because there are 26 letters in the English
alphabet.
100
Among 100 people there are at least 12 ∼ 9 who were born in the
same month.
Imagine that you have 5 students. Consider arranging all five students
n = 5, r = n = 5
P(n, n) = n!
p(5, 5) = 5! = 5 × 4 × 3 × 2 × 1 = 120
”MISSISSIPPI”?
n = 11
M:1 I :4 S :4 P:2
n!
P=
n1 ! × n2 ! × ... × nk !
11!
=
1! × 4! × 4! × 2!
= 34650