Review of Combinatorial Problems !: FYI: Counting Cards!
Review of Combinatorial Problems !: FYI: Counting Cards!
Combinatorial
Problems
Example
What is the probability p of randomly selecting a card from
a 52-card deck that is either a face card or a diamond?
Solution:
Let F be the set of face cards (King, Queen or Jack), and D be the
set of cards that are diamonds. We need P(F ∪ D).
F ∩ D is the set of face cards that are diamonds and there are only
3 of them: |F ∩ D | = 3 and P(F ∩ D) = 3/52
1
Product Rule:
Using the Multiplication Principle
Choice 1 Choice 2
… Choice r
All the r sets of
n ways n ways choices take place! n ways
Total number of choices is n× n × …× n = nr
We are given a set of n elements
We make r independent choices and we replenish
the set of n elements after each choice.
2
Ordered Samples
without Replacements
set of n independent choices
(no replicas)
Choice 1 Choice 2
… Choice r
All the r sets of
n ways n - 1 ways choices take place! n – r + 1 ways
Total number of choices is n(n – 1)(n – 2)…(n – r + 1)
We are given a set of n elements
We make k independent choices and we DO NOT
replenish the set of n elements after each choice.
Permutations
Definition: A permutation of a set of distinct objects is an
ordered arrangement of a subset of these objects.
3
Permutations
The number of r-permutations of a set with n elements is denoted
by P(n, r) or rPn.
There is exactly one way to order zero elements, i.e., there is one
list with no elements in it, the empty list.
P(n,n) = n!
Example
What is the probability p to have a permutation of the
letters A, B, C, D, E, F, G, H that contains the string
“ABC” ?
Solution:
• The number of permutations of the eight letters is 8!
Circular Permutations
Definition: A circular permutation of a set of
distinct objects is an ordered arrangement in a
circle of a subset of these objects.
4
Circular Permutations
Theorem: The number of circular r-permutations of a
set with n distinct elements is: P(n, r ) / r = n! / r(n – r)!
Proof:
There are P(n, r) linear r-permutations for a set of n elements.
The linear permutations can be grouped into groups of r permutations that
maintain the same adjacencies among ordered elements. Each of this
groups results in the same circular r-permutation. Q.E.D.
Example:
Consider the set {a, b, c, d} and two possible circular permutations:
a a
a b c d
a d b c
b c d a d b c d
d b c a
c d a b
b c a d
d a b c
c c a d b b
Combinations: Unordered
Samples without Replacement
Definition: A k-combination of a set of n
elements is an unordered selection of k elements
from the set.
Combinations (FYI)
Theorem: The number of k-combinations of a set of n
elements is
" n% n!
C(n,k) = $ ' =
# k & k!(n − k)!
Proof:
The linear k-permutations of a set of n elements can be counted by
first selecting each k-combination (the subset of chosen elements)
and then
€ obtaining all the linear permutations of that subset.
Hence, P(n, k) = C(n, k) P(k, k)
Substituting the definitions of P(n, k) and P(k, k) and solving for
C(n, k) we have:
P(n,k) n!
C(n,k) = =
P(k,k) k!(n − k)! Q.E.D.
5
Sum Rule:
Using the Addition Principle
Choice 1 Choice 2
… Choice k
Only one of the k
x1 ways x2 ways choices can take place! xk ways
Total number of choices is x1+ x2+ …+ xk
Making any given choice negates the others!
We have a linear arrangement of the resulting choices!
6
Example: Selections
If 3 balls are randomly drawn without replacement from a bag
containing 6 green and 5 red balls, what is the probability that
one of the balls is green and the other two are red?
Answer: Consider independent unordered selections of the balls
from the bag.
There are C(11, 3) ways to select any 3 balls.
There are C(6, 1) ways to select a green ball from the six available.
There are C(5, 2) ways to select the 2 red balls from the 5 available.
The selection of a green ball is independent of the selection of 2
red balls. Hence, there are C(6, 1) × C(5, 2) ways to select the 3
balls from the bag.
Therefore, p = [ C(6, 1) C(5, 2) ] / C(11, 3) = 4/11
19
Example
Assume that car licenses consist of four letters and three digits,
and that any of 26 letters and 10 digits can be selected with equal
probability for any position of the license. What is the probability
p to have a license that reads CMPE107 or 107CMPE if no
repetitions of letters or numbers are allowed?
Answer:
There are only two ways to have “CMPE107” or “107CMPE”
(a) select the positions for the letters, (b) select the letters to be
used, and (c) select the numbers to be used. Thus:
2 2(4!3!)(22!7!)
p= = ≈ 2.2 ×10 −10
! 7 $ 7!26!10!
# &P(26, 4)P(10, 3)
" 4 %
20
Example:
Sequence of Tosses
A fair coin is tossed five times. What is the
probability that we observe exactly one tail?
Answer: ___ ___ ___ ___ ___
1 2 3 4 5
The total number of outcomes is 25 = 32
To have one tail only implies that, once we get a tail in one trial,
the other trials must result in heads. Hence, the problem can be
viewed as choosing in which trial we can have a tail as the
outcome.
There are C(5, 1) = 5 ways to pick the toss in which
we observe the tail.
Therefore, the probability is 5/32 21
7
Example: Selections
A card deck is shuffled and the cards are then distributed among 4
players, with 13 cards for each player. What is the probability that
each player receives ONE ace?
Answer: Approach the problem as permutations of 52 cards in 52 bins.
With no restrictions, the number of ways to place 52 cards in 52 bins is 52!
With the restriction of having one ace per player, the problem is divided into
three independent tasks: Giving an ace to a player, placing each ace in the 13
bins given to a player, and placing no-ace cards in the remaining 48 bins.
There are 4! ways to decide which ace goes to which player.
Each ace can be placed in 13 different bins.
We thus have 4! (134) ways to place the aces in the available 52 bins.
There are 52 – 4 = 48 bins left after placing the aces, and hence 48! ways to
place no-ace cards in the available bins.
Therefore, the probability is: 4!48!(134 ) 134
=
52! ! 52 $
# &
" 4 % 22
Example: Selections
Tom (A) and Jerry (B) belong to a pool of 12
individuals in which any person is equally
likely to be chosen for a team of five. What is
the probability that a team of is formed from
a pool of 12 individuals if the team cannot
contain A and B together?
Answer: Using P[Ac] = 1 – P[A]
The total number of teams is C(12, 5) = 12! / (5! 7!)
To number of teams that can be formed containing A and B
equals: C(10, 3) = 10! / (3! 7!)
The probability of forming a team with A and B is then
C(10, 3)/C(12, 5) = (5 × 4)/(12 × 11) = 20/132 = 5/33.
Therefore, the probability of forming a team without A and B
together equals: 1 – C(10, 3)/C(12, 5) = 1 – 5/33 = 28/33
23
Permutations with
Indistinguishable Objects
Theorem: The number of different permutations of n objects,
where there are ni undistinguishable objects of type i (1 ≤ i ≤ k)
is n!/(n1! n2! … nk!)
Proof: We have n positions.
• The n1 objects of type 1 can be placed in C(n, n1) ways and we have
n – n1 positions left.
• The n2 objects of type 2 can be placed in C(n – n1, n2) ways and we
have n – (n1+n2) positions left.
• The selection process continues until we have n – (n1+n2+…+nk-1)
positions left and hence nk objects of type k can be placed in
C(n1+n2+…+nk-1, nk) ways.
• Because place choices are independent, the product rule results in:
n!
C(n,n1 ) ⋅ C(n − n1,n 2 ) ⋅ ...⋅ C(n − n1 − n 2 − ...− n k−1 ) =
n1!n 2!...n k!
8
Example
If all 26 letters of the alphabet are equally likely to be
used to form a word of six letters with repetitions
allowed, what is the probability p of having a word
consisting of any permutation of the word HAWAII?
Answer:
There are 266 different words of six letters if repetitions
6! 6 × 5 × 4 × 3× 2
= = 180
1!⋅2!⋅1!⋅2! 2×2
Therefore, p = 180/266
26
27