Transcript Document

Discrete Mathematics, 1st Edition
Kevin Ferland
Chapter 6
Basic Counting
1
6.1 The Multiplication Principle
(Dinner Choices). A guest at a formal dinner
has 4 entrée choices and 2 dessert choices.
If a guest’s dinner is entirely determined by
these two choices, then how many different
dinner choices are there?
The total number of dinner choices is given by
the product 4 · 2 = 8.
Ch6-p303
2
EXAMPLE 6.1 (Solution) (Cont.)
Ch6-p304
3
THEOREM 6.1
Ch6-p304
4
6.2 Permutations and Combinations

Permutations
A permutation of a set of objects is an
ordering of those objects. Permutations
reflect selections for which an ordering is
important.
Ch6-p311
5
EXAMPLE 6.8
(Lining Up). How many ways are there to put 8
children in a line to get ice cream?
Ch6-p311
6
EXAMPLE 6.8 (Solution)
There are 8 children from which to pick the
child who is first.
Then there are 7 children left from which to pick
the second child.
Then there are 6 left, and so on.
Therefore, there are
8 · 7 · 6 · 5 · 4 · 3 · 2 · 1 = 8! = 40320
ways to line up the children.
Ch6-p311
7
THEOREM 6.2
Ch6-p311
8
DEFINITION 6.1
A permutation of k objects from a set of size n
is an ordered list of k of the n objects.
The number of permutations of k objects from n
is denoted P(n, k).
Ch6-p312
9
THEOREM 6.3
Ch6-p313
10
Combinations
DEFINITION 6.2
A combination of k elements from a set of size n
is a subset of size k.
Ch6-p313
11
THEOREM 6.4
Ch6-p313
12
EXAMPLE 6.18
How many license plates consisting of 6 digits (0
to 9) with exactly 2 of the same digit are
possible?
Ch6-p314
13
EXAMPLE 6.18 (Solution)
There are 10 digits from which to choose the
repeated one.
There are  62  ways to choose the two positions to
contain the repeated digit.
Ch6-p314
14
EXAMPLE 6.18 (Solution) (Cont.)
Then there are P(9, 4) ways to fill in the 4
remaining distinct digits.
By the Multiplication Principle, there are
6-digit license plates with exactly 2 digits the
same.
Ch6-p314
15
6.3 Addition and Subtraction
Ch6-p320
16
6.3 Addition and Subtraction
EXAMPLE 6.20
How many possible license plates consisting of
6 digits (0 to 9) have either all digits distinct
or all digits the same?
Ch6-p320
17
EXAMPLE 6.20 (Solution)
There are P(10, 6) plates with all digits distinct
and 10 with all digits the same.
Certainly no one plate can have both of these
properties. Hence, the total number of
license plates under consideration is
P(10, 6) + 10 = 151210.
Ch6-p320-321
18
THEOREM 6.6
Ch6-p322
19
EXAMPLE 6.26
A byte is a binary number consisting of 8 digits.
How many bytes have at least 2 zeros?
There are 28 binary sequences of length 8.
Of them, 1 has no zeros and 8 have one zero.
Since the rest have at least 2 zeros, there are
28 − (1 + 8) = 247
sequences with at least 2 zeros.
Ch6-p323
20
THEOREM 6.7
Ch6-p323
21
EXAMPLE 6.29
A standard (6-sided) die is rolled a sequence of
5 times. In how many ways can the
sequence of numbers resulting be all even or
all multiples of 3?
Ch6-p325
22
EXAMPLE 6.29 (Solution)
Since there are 3 even values (2, 4, and 6),
there are 35 ways to get all even numbers.
Since there are 2 multiples of 3 (3 and 6), there
are 25 ways to get all multiples of 3.
Only the value 6 is both even and a multiple of
3, so there is 1 way to do both .
Therefore, the desired number of ways is
35 + 25 − 1 = 274.
Ch6-p325
23
6.4 Probability
EXAMPLE 6.31
Consider the task of tossing two dice and
recording the numbers showing. Compute
the probability that the sum is 8.
Ch6-p328
24
EXAMPLE 6.31 (Cont.)
The set of possible results of our task is thus
S = { (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6),
(2, 1), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6),
(3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6),
(4, 1), (4, 2), (4, 3), (4, 4), (4, 5), (4, 6),
(5, 1), (5, 2), (5, 3), (5, 4), (5, 5), (5, 6),
(6, 1), (6, 2), (6, 3), (6, 4), (6, 5), (6, 6) }.
Ch6-p328
25
EXAMPLE 6.31 (Solution)
From the possible results listed in S, we are interested
in the subset
E = {(2, 6), (3, 5), (4, 4), (5, 3), (6, 2)}.
The probability of E is given by
.
Ch6-p328
26
DEFINITION 6.3
Let S be a finite sample space. The outcomes
in S are said to be equally likely if ∀ x, y ∈
S, P(x) = P(y).
That is, ∀x ∈ S, P(x) =
1
.
|s|
Ch6-p329
27
DEFINITION 6.4
If the outcomes in a finite sample space S are
all equally likely, then the probability of an
event E is given by
|E|
P( E ) 
|S|
Ch6-p329
28
THEOREM 6.9
Ch6-p330
29
EXAMPLE 6.34
The license plates issued by a certain state
consist of 3 letters (A to Z) followed by 4
digits (0 to 9). If all possible plates are
equally likely to be chosen, then what is the
probability that a randomly chosen plate will
have some letter or digit repeated?
Ch6-p330-331
30
EXAMPLE 6.34 (Solution)
The sample space S is the set of all possible
plates consisting of 3 letters followed by 4
digits. Hence,
|S| = 263 · 104 = 175760000.
Ch6-p331
31
EXAMPLE 6.34 (Solution) (Cont.)
Let E be the subset of plates in which some
letter or digit is repeated.
Clearly, |Ec| = P(26, 3) · P(10, 4) = 78624000.
The desired probability is
Ch6-p331
32
THEOREM 6.10
Ch6-p331
33
EXAMPLE 6.36
(Home Security). A home security code
consists of 4 digits (0 to 9). If all such codes
are equally likely to be chosen, then what is
the probability that a randomly chosen code
will contain exactly 1 three or exactly 2
sixes?
Ch6-p331
34
EXAMPLE 6.36 (Solution)
Let S be the sample space of all possible 4digit codes. Let E be the subset of codes
containing exactly 1 three, and let F be the
subset of codes containing exactly 2 sixes.
So E ∪ F consists of all codes containing
exactly 1 three or exactly 2 sixes.
We seek P(E ∪ F).
Ch6-p331
35
EXAMPLE 6.36 (Solution) (Cont.)
Since
Ch6-p332
36
EXAMPLE 6.36 (Solution) (Cont.)
Theorem 6.10 gives that
Ch6-p332
37
Conditional Probability
DEFINITION 6.5
Let E and F be events in a sample space S
with P(F) > 0. The conditional probability
of E given F , denoted P(E | F ), is given by
P( E  F )
P( E | F ) 
.
P( F )
Ch6-p332
38
EXAMPLE 6.37
At a company picnic, the children played a
soccer game, after which one player’s name
was randomly drawn to win a prize.
The winning team in the soccer game consists
of 7 girls and 4 boys, and the losing team
consists of 5 girls and 6 boys.
Given that the prize winner is a boy, what is the
probability that he also comes from the
winning soccer team?
Ch6-p332
39
EXAMPLE 6.37 (Solution)
Let S be the set of 22 children that played
soccer, let E be the event that the prize
winner is from the winning team, and let F be
the event that the prize winner is a boy.
The probability that we seek is P(E|F).
Ch6-p333
40
EXAMPLE 6.37 (Solution) (Cont.)
Note that E ∩ F is the event that the prize winner is a
boy from the winning team.
Clearly,
We conclude that
Ch6-p333
41
DEFINITION 6.6
Two events E and F in a sample space S are
said to be independent if
P(E ∩ F ) = P(E) · P(F ).
Ch6-p333
42
EXAMPLE 6.38
Consider the experiment of tossing two dice in
sequence. Let E be the event that the first die
shows a value of at most 3, let F1 be the
event that the values on the two dice are the
same, and let F2 be the event that the sum of
the values on the two dice is 5.
Note that
Ch6-p333
43
EXAMPLE 6.38 (Cont.)
(a) Are E and F1 independent?
Solution.
and
.
It follows that
So yes, E and F1 are independent.
Ch6-p333
44
EXAMPLE 6.38 (Cont.)
(b) Are E and F2 independent?
Solution.
and
.
It follows that
So no, E and F2 are not independent.
Ch6-p333
45
THEOREM 6.11
Ch6-p334
46
THEOREM 6.11 -- Proof
E = E ∩ S = E ∩ (F1 ∪ ·· ·∪ Fn) = (E ∩ F1) ∪ ··
·∪(E ∩ Fn) is a disjoint union.
It follows that
Ch6-p334
47
COROLLARY 6.12
Ch6-p334
48
EXAMPLE 6.39
In a recent election, the majority of female
voters preferred a different candidate from
the one preferred by the majority of the male
voters.
Exit polls showed that 75% of female voters
chose candidate A, whereas 55% of male
voters chose candidate B.
Ch6-p334
49
EXAMPLE 6.39 (Cont.)
Assume that each voter chose either candidate
A or candidate B and that an equal number
of men and women voted.
(a) Which candidate won the election? Explain.
(b) If a randomly chosen voter is known to have
voted for candidate A, then what is the
probability that the voter is a female?
Ch6-p334
50
EXAMPLE 6.39 (Solution)
To be simple, let A be the event that a voter
chooses candidate A, let B be the event that
a voter chooses candidate B, let F be the
event that a voter is female, and let M be the
event that a voter is male.
Ch6-p334
51
EXAMPLE 6.39 (Solution) (Cont.)
Based on the exit polls and the assumption that
each voter chose A or B, we know that
P(A | F) = .75, P(B | F) = .25,
P(A | M) = .45, P(B | M) = .55.
We are also assuming that
P(F) = P(M) = .5.
Ch6-p334
52
EXAMPLE 6.39 (Solution) (Cont.)
(a) To determine who won, we apply Theorem
6.11. Observe that
P(A) = P(A | F)P(F) + P(A | M)P(M)
= (.75)(.5) + (.45)(.5) = .6.
Since candidate A received 60% of the votes,
candidate A won the election.
Ch6-p334
53
EXAMPLE 6.39 (Solution) (Cont.)
(b) We seek P(F | A), the probability that a
voter is female given that she voted for
candidate A.
For this, Bayes’ Formula gives that
Ch6-p335
54
6.5 Applications of Combinations
(Choices with Repetition)
EXAMPLE 6.42 (Barbecue Orders).
A barbecue is attended by 7 people.
Each person has the choice of a hamburger, a piece of
barbecued chicken, or a hot dog (but only one in
each case) for the first food item.
If the cook will barbecue all 7 items at the same time
and does not care who ordered what, then how
many different barbecue orders are possible for the
cook? We assume that there are ample supplies of
each food type.
Ch6-p341
55
EXAMPLE 6.42 (Solution)
This is considered a problem involving choices with
repetition, since the cook may receive multiple
requests for any of the 3 items:
hamburger B, barbecued chicken C, or hot dog D.
Ch6-p346
56
EXAMPLE 6.42 (Solution) (Cont.)
A total order would consist of a list of length 7 of B’s,
C’s, and D’s, but with no specified number of any
particular choice. For example, one order might be
CBBDBDB. To help motivate our counting technique,
such an order could be recorded in the form of a
table.
Ch6-p346
57
EXAMPLE 6.42 (Solution) (Cont.)
Imagine that the cook simply places a  in the
appropriate column of an order sheet as
each order is taken. At the end, the order
could more efficiently be recorded as a
sequence of length 9 consisting of 7 ’s and
2 |’s.
||
Ch6-p346
58
EXAMPLE 6.42 (Solution) (Cont.)
Here the headers B, C, D are understood. The
point is that this is a binary sequence of
length 9 containing 7 ’s (and 2 |’s). Note that
the number of |’s is one fewer than the
number of item choices. We conclude that
the number of possible barbecue orders is
Ch6-p346
59
THEOREM 6.13
Ch6-p346
60
6.6 Correcting for Overcounting
EXAMPLE 6.44 (Seating Arrangements).
How many ways are there to seat 5 girls at a circular
table if the particular seat taken by each girl does not
matter and what matters to each girl is
(a) who is sitting to her left and who is sitting to her
right?
(b) who is sitting next to her (which side does not
matter)?
Ch6-p351
61
EXAMPLE 6.44 (Solution)
Temporarily call one seat the head of the table.
If we keep track of which girl is seated at the head, then
there are 5! ways to seat the girls clockwise around
the table.
However, 5! is an overcounting of what we want, since
we have carried the extra structure of who is
seated at the head of the table.
Given any such seating, if all of the girls stood up and
shifted one position clockwise, then the new
seating should be considered the same as the
original.
Ch6-p351
62
EXAMPLE 6.44 (Solution) (Cont.)
(a) Each girl would still have the same neighbor
to her left and the same neighbor to her
right. Since there are 5 different rotations of
any seating, we need to divide the original
5! count by 5.
Therefore, there are
different seatings
around the table.
Ch6-p351
63
EXAMPLE 6.44 (Solution) (Cont.)
(b) When which neighbor is to the left of a girl
and which is to the right no longer matters,
there are fewer than 24 different seatings.
Since only the set of 2 neighbors matters, if we
take the mirror reflection of any seating from
part (a), then the reflected seating should
now be considered the same as the original.
Ch6-p351
64
EXAMPLE 6.44 (Solution) (Cont.)
Reflection preserves neighbors (and switches sides).
Ch6-p351
65
EXAMPLE 6.44 (Solution) (Cont.)
Since each seating from part (a) should be
paired with its reflection, we need to divide
the answer from part (a) by 2.
Thus, there are
different seatings in
which only neighbors matter.
Ch6-p351
66