Chapter 5, Section 5.1: The Basics of Counting
Chapter 5, Section 5.1: The Basics of Counting
1
The Basics of Counting
37 + 83 = 120
Example
• A student has to do a computer project
– He can choose a project from one of three
lists.
– The three lists contain 23, 15, and 19
possible projects, respectively.
• How many possible projects are there to
choose from?
Example
• How many possible projects are there to
choose from?
• No project is on more than one list, so we
can use the Sum Rule:
23 + 15 + 19 = 57
The Product Rule
• Suppose that a procedure can be broken
down into two tasks such that both tasks
must be done, in sequence:
– The first task can be done in n1 ways
– The second task can be done in n2 ways
after the first task has been done
• Then there are n1n2 ways to do the
procedure.
Example
• 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?
Example
• What is the largest number of chairs that
can be labeled differently?
• We can think of this problem as involving
a sequence of two tasks:
▪ Assign a letter between A and Z
▪ Assign a number between 1 and 100
• The Product Rule says that there are 26 *
100 = 2600 ways to do this.
• So we can label 2600 chairs.
Example
• Will it make a difference in how many
chair we can label if we assign the number
first and then the letter?
• No; in either case we can label 2600
chairs.
Example
Total of: 26 * 26 * 26 * 10 * 10 * 10
Example
n!
P(n,r) = n(n-1)(n-2) … (n-r+1) =
(n-r)!
n!
Pn, r
n r !
• So our formula for this problem would be:
P(8, 3) = 8! / (8 – 3)! = 8! / 5! = 336
Example
52!
C 52,5
5!(52 5)!
52! / (5!(52 – 5)!) = 2,598,960
Example
• What are the odds of being dealt a hand of 5-card stud
containing two pair?
• First, let’s look at the steps in the process of forming a 5-card
hand containing two pairs, say 2 eights and 2 aces:
a) Choose two face values out of 13 possible face values for the
pairs (eights and aces):
13 choose 2 = 78
b) Choose two cards from the smaller face value (8♣, 8♠):
4 choose 2 = 6
c) Choose two cards from the larger face value (A♠, A♣):
4 choose 2 = 6
d) Choose one card from those remaining (9♦):
44 choose 1 = 44 (eliminating the 8 face cards already
considered: 52 – 8 = 44)
• By the Product Rule, H = 78 • 6 • 6 • 44 = 123,552.
Example
• H = 123,552 = the number of different
ways we can form a five-card poker hand
containing 2 pair.
• T = 2,598,960 = the total number of
different five-card poker hands that can be
dealt from a standard deck of 52 playing
cards.
• So, the probability of obtaining a hand with
two pairs is H / T = 123,552 / 2,598,960 or
4.75%.
Summary
(x+y)0 = 1
(x+y)1 = x + y
(x+y)2 = x2 + 2xy + y2
(x+y)3 = x3 + 3x2y + 3xy2 + y3
(x+y)4 = x4 + 4x3y + 6x2y2 + 4xy3 + y4
Example
Instead of multiplying, the expansion of (x+y)3
can be found by combinatorial reasoning:
(x+y)3 = (x+y) • (x+y) • (x+y)
j 0
n n n n 1 n n 2 2 n n 1 n n
x x y x y ... xy y
0 1 2 n 1 n
Example
Expand (x + y)4.
4
4 4 j j
(x + y) 4
x y
j 0 j
4 4 4 3 4 2 2 4 3 4 4
x x y x y xy y
0 1 2 3 4
25 25! 25!
5,200,300
13 13! 25 - 13! 13!12!
Example
• What is the coefficient of x12y13 in the expansion
of (2x-3y)25 ?
• Note that (2x-3y)25 = (2x + (-3y))25
• According to the binomial theorem:
25
25
2 x 3 y
25
2 x 3 y
25 j j
j 0 j
• The coefficient of x12y13 is obtained when j = 13:
25 12 25! 25! 12 13
2 - 3
13 12 13
2 3 2 3
13 13! 25 - 13! 13!12!
Corollary 1
n
n n n n n n
... 2 n
k 0 k 0 1 2 n 1 n
Proof Using Subsets
n
n n n n n n
... 2 n
k 0 k 0 1 2 n 1 n
A set with n elements has 2n different subsets.
Each subset consists of 0 elements, 1 element, 2
elements, … or n elements.
There is only 1 subset with 0 elements, the empty set.
There are n subsets with a single element.
n!
There are 2!n 2! subsets with 2 elements.
…
There are n subsets with n-1 elements.
There is only 1 subset with n elements.
Proof Using Combinations
n
n n n n n n
... 2 n
k 0 k 0 1 2 n 1 n