Math 55: Discrete Mathematics

advertisement
Math 55: Discrete Mathematics
UC Berkeley, Fall 2011
Homework # 7, due Wedneday, March 14
Happy Pi Day!
(If any errors are spotted, please email them to “morrison at math dot
berkeley dot edu.”)
6.5.10 A croissant shop has plain croissants, cherry croissants, chocolate
croissants, almond croissants, apple croissants, and broccoli croissants.
How many ways are there to choose
(a) a dozen croissants?
Solution. This is equivalent to putting 12 indistinguishable objects into 6 distinguishable boxes. (The boxes are the 6 types of
croissants, and putting objects into them corresponds to choosing
that many of that type.) The number of ways of doing this is
6 + 12 − 1
= 6188.
12
(b) three dozen croissants?
Solution. Similar to part (a), this is equivalent to putting 36 indistinguishable objects into 6 distinguishable boxes. The number
of ways of doing this is
6 + 36 − 1
= 749, 398.
36
(c) two dozen croissants with at least two of each kind?
1
Solution. We may consider the first dozen croissants already picked
out (two of each of the six kinds). Thus the number is the number of ways of choosing the remaining dozen, which by part (a)
is 6188.
(d) two dozen croissants with no more than two broccoli croissants?
Solution. We will add up three cases: no broccoli croissants, exactly one broccoli croissant, and exactly two broccoli croissants.
These numbers are
5 + 24 − 1
= 20, 475
24
5 + 23 − 1
= 17, 550
23
5 + 22 − 1
= 14, 950.
22
(The first is choosing 24 croissants from the 5 non-brocolli types;
the second is choosing just 23, since we already have one broccoli;
the third is choosing just 22, since we already have two broccolis.)
Adding up, we have
20, 475 + 17, 550 + 14, 950 = 52, 975
ways total.
(e) two dozen croissants with at least five chocolate croissants and at
least three almond croissants?
Solution. We have already chosen the first eight, so we need only
choose the remaining sixteen. There are
6 + 16 − 1
= 20, 349
16
ways to do this.
(f) two dozen croissants with at least one plain croissant, at least
two cherry croissants, at least three chocolate croissants, at least
one almond croissants, at least two apple croissants, and no more
than three broccoli croissants?
2
Solution. We have already chosen the first nine croissants, so
we need merely count how many ways there are to choose the
last fifteen, without choosing more than three broccoli croissants.
Similar to part (c), this is the sum of
5 + 15 − 1
= 3, 876
15
5 + 14 − 1
= 3, 060
14
5 + 13 − 1
= 2, 380
13
5 + 12 − 1
= 1, 820.
12
These add to
3, 876 + 3, 060 + 2, 380 + 1, 820 = 11, 136
so there are 11, 136 ways of choosing.
6.5.22 How many ways are there to distribute 12 indistinguishable balls into
6 distinguishable boxes?
Solution. There are
6 + 12 − 1
= 6, 188
12
ways.
6.5.34 How many strings with five or more characters can be formed from the
letters in SEERESS?
Solution. We’ll count up how many can be formed with seven characters, with six characters, and with five characters, then add them
up.
For length seven, we are putting {1, 2, ..., 7} into the three boxes S, E,
and R, with S receiving three numbers, E receiving three numbers,
and R receiving one number. (For instance, if S gets 1, 2, 7, E gets
3
4, 5, 6 and R gets 3, this corresponds to the anagram SSREEES.)
There are
7!
= 140
3! · 3! · 1!
ways to do this.
For length six, we have several cases. If we left out an R, we are
putting {1, ..., 6} into two distinguishable boxes, each of which gets
6!
three numbers; there are 3!·3!
= 20 ways to do this. If we left out an S,
we are putting {1, ..., 6} into three boxes which get three, two, and one
6!
objects, respectively; there are 3!·2!·1!
= 60 ways to do this. Leaving
out an E symmetrically gives 60. Hence there are 20 + 60 + 60 = 140
strings of length six.
For length five, we once again have several cases:
• Leave out an S and an R: we get
an R: also 10.
• Leave out two S’s: we get
20.
5!
3!·1!·1!
• Leave out an S and an E: we get
5!
3!·2!
= 10. Leave out an E and
= 20. Leave out two E’s: also
5!
2!·2!·1!
= 30.
This gives a total of 10 + 10 + 20 + 20 + 30 = 90 strings of length five.
All told, we get that
140 + 140 + 30 = 310
strings with five or more characters can be formed from the letters in
SEERESS.
6.5.42 In bridge, the 52 cards of a standard deck are dealt to four players. How
many different ways are there to deal bridge hands to four players?
Solution. This is equivalent to putting 52 distinguishable objects into
4 distinguishable boxes, with each box getting 13 objects. There are
52!
≈ 5.36 × 1028
13! · 13! · 13! · 13!
ways to do this.
4
6.5.50 How many ways are there to distribute five distinguishable objects into
three indistinguishable boxes?
Solution. Using Stirling numbers, the answer is
3
X
S(5, j) = S(5, 1) + S(5, 2) + S(5, 3).
j=1
Let’s compute these out.
1−1
1 X
i 1
S(5, 1) =
(1 − i)5
(−1)
i
1!
i=0
1
=
· 15 = 1.
0
2−1
1 X
i 2
(2 − i)5
S(5, 2) =
(−1)
i
2!
i=0
1
2 5
2 5
=
2 −
1
2
0
1
1
= 25 − 2 = 15.
2
3−1
1 X
i 3
S(5, 3) =
(−1)
(3 − i)5
3!
i
i=0
1
3 5
3 5
3 5
=
3 −
2 +
1
6
0
1
2
1
= (243 − 96 + 3) = 25.
6
Adding these up gives a total of 41.
6.5.66 How many terms are there in the expansion of (x + y + z)100 ?
Solution. The number of terms in the expansion is the number of ways
of writing xa y b z c , where a + b + c = 100 and a, b, c are nonnegative
5
integers. This is the number of ways of putting 100 indistinguishable
balls into three distinguishable boxes. There are
3 + 100 − 1
= 5151
100
ways to do this.
7.1.12 What is the probability that a five-card poker hand contains exactly one
ace?
Solution. There are four possibilities for the ace, and then we must
choose 4 cards from the 48 non-ace cards. This gives us
48
4·
4
five-card hands with
exactly one ace. Dividing by the total number of
hands, which is 52
5 , we find
4·
48
4
52
5
≈ .299,
so the probability that a five-card poker hand contains exactly one ace
is about .299.
7.1.21 What is the probability that a fair die never comes up an even number
when it is rolled six times?
Solution. The probability that any given die roll comes up odd is 1/2.
Since the rolls are independent, the probability it comes up odd all
six times is 1/26 = 1/64. This is the probability that a fair die never
comes up an even number when it is rolled six times.
7.1.26 Find the probability of selecting none of the correct six integers in a
lottery, where the order in which these integers are selected does not
matter, from the positive numbers not exceeding
(a) 40.
(b) 48.
(c) 56.
6
(d) 64.
Solution. For 40, the number of ways of selecting all wrong numbers
is the number of ways of selecting six numbers from the 34 incorrect
40
numbers. There are 34
6 ways to do this. Since there are 6 ways
to choose numbers in total, the probability of selecting none of the
correct six integers is
34
6
40
6
≈ .35
The same argument gives the answers in the other cases:
42
6
48
6
50
6
56
6
58
6
64
6
≈ .43
≈ .49
≈ .54
7.1.36 Which is more likely: rolling a total of 8 when two dice are rolled or
rolling a total of 8 when three dice are rolled?
Solution. There are five ways to roll an 8 when two dice are rolled:
(2, 6), (6, 2), (3, 5), (5, 3), (4, 4);
since there are 36 rolls possible, the probability of rolling an 8 is 5/36 ≈
.139.
The ways to roll an 8 when three dice are rolled, before we consider
reordering, are:
(1, 1, 6), (1, 2, 5), (1, 3, 4), (2, 2, 4), (2, 3, 3)
Two have three distinct numbers, and so can each happen in six ways.
Three have two distinct numbers, and so can happen in three ways.
This gives 2 · 6 + 3 · 3 = 21 ways to roll an 8. Since there are 63 = 216
rolls possible, the probability of rolling an 8 is 21/216 ≈ .097.
Thus it is more likely to roll a total of 8 when two dice are rolled than
when three dice are rolled.
7
7.2.2 Find the probability of each outcome when a loaded die is rolled, if a
3 is twice as likely to appear as each of the other five numbers on one
die.
Solution. Let p be the probability of rolling a 1. The probability of 3 is
2p, and the probability of each other number is p. Since probabilities
must add to 1, we have
p + p + 2p + p + p + p = 1,
so p = 1/7. Hence the probability of a 3 being rolled is 2/7, and the
probability of any given other number being rolled is 1/7.
7.2.8 What is the probability of these events when we randomly select a permutation of {1, 2, ..., n} where n ≥ 4?
(a) 1 precedes 2.
Solution. The number of strings with 1 preceding 2 can be calculated
as follows. Choose the two spots for 1 and 2; there are
n
ways
to do this. Then fill in the other other n − 2 spaces
2
with the remainingn − 2 numbers; there are (n − 2)! ways to do
this. This gives n2 (n − 2)! ways to do this. Dividing by the n!
permutations possible, this gives a probability of
n
n(n − 1)/2
2 (n − 2)!
=
= 1/2.
n!
n(n − 1)
Alternative method: let A be the set of strings with 1 preceding
2, and B be the set of strings with 2 preceding 1. A and B are
disjoint, and A ∪ B has all the strings. Moreover, A and B are in
bijection: send a string to another string of A to a string of B by
switching 1 and 2. Hence A and B are of the same size, so much
each contain half of all strings. Thus the probability of choosing
an element of A is 1/2.
(b) 2 precedes 1.
Solution. A nigh-identical argument to part (a) gives 1/2.
(c) 1 immediately precedes 2.
8
Solution. We may treat 1 and 2 as a single entity that moves as
one, meaning we’re permuting n − 1 elements. There are (n − 1)!
ways to do this, and so there are (n − 1)! permutations with 1
immediately preceding 2. Dividing by the n! permutations total
gives a probability of 1/n that 1 immediately precedes 2.
Alternative method: First we calculate the probability of 1 being
in a position that has a number after it; all but the nth position
do, so there’s a probability of (n − 1)/n of this happening. Once
we have this, we ask what the probability of 2 being in the correct
spot is. Only one of the remaining n − 1 spots is directly after 1,
so there’s a 1/(n − 1) chance of this. Multiplying these gives us
our probability of 1/n.
(d) n precedes 1 and n − 1 precedes 2.
Solution. Let’s count up the number of strings satisfying this
property. First we’ll choose the four spots for 1, 2, n − 1, and
n. There are n4 ways to do this. Then there are six orders we
may place these four numbers into these four spots, giving us a
factor of 6. Then we must fill in the remaining n − 4 spots with
the remaining n − 4 numbers; there are (n − 4)! ways to do this.
Multiplying together, there are 6 n4 (n − 4)! permutations with
the desired property. Dividing by the n! total permutations gives
a probability of
6 n4 (n − 4)!
6n(n − 1)(n − 2)(n − 3)/4!
1
=
= .
n!
n(n − 1)(n − 2)(n − 3)
4
Alternative method: the event “n precedes 1” and “n−1 precedes
2” are independent, and the probability of each is 1/2 (by part
(a)), so the probability of both is 1/2 · 1/2 = 1/4.
(e) n precedes 1 and n precedes 2.
Solution. First we’ll count up the number of strings where n precedes 1 and 1 precedes 2. First
we’ll choose the three spots for
n
these numbers; there are 3 ways to do this. Then we’ll fill in
the n − 3 remaining
spots; there are (n − 3)! ways to do this. This
n
gives a total of 3 (n − 3)! = n!/3! ways to do this.
Now we’ll count up the number of strings where n precedes 2
and 2 precedes 1. By symmetry, there are n!/3! strings like this.
9
Hence there are 2n!/3! = n!/3 strings with n preceding 1 and n
preceding 2 (since either 1 precedes 2 or 2 precedes 1). This means
the probability of a random permutation having n preceding 1
and n preceding 2 is
n!/3
1
= .
n!
3
Alternative method: there are six possible orderings for 1, 2, n.
Let Ai be the set of permutations containing 1, 2, n in the ith
order, so that there are six sets, A1 , A2 , ..., A6 . These sets are
disjoint and A1 ∪ A2 ∪ ... ∪ A6 contains all the permutations.
Moreover, Ai is in bijection with Aj for all i and j: send a string
in Ai to a string in Aj with 1, 2, n switched to the appropriate
ordering. Thus all the sets are the same size, and each must
contain 1/6 of all permutations. Since we’re allowing two possible
orderings, n − 1 − 2 and n − 2 − 1, the permutations we are
interested in make up 1/6 + 1/6 = 1/3 of all permutations.
7.2.13 Show that if E and F are events, then p(E ∩ F ) ≥ p(E) + p(F ) − 1.
Proof. Note that p(E ∪ F ) is at most 1, since it is a probability. Using
the law of the excluded middle, this means that
1 ≥ p(E ∪ F ) = p(E) + p(F ) − p(E ∩ F ).
Adding p(E ∩ F ) to both sides gives
p(E ∩ F ) ≥ p(E) + p(F ) − 1,
as desired.
(∗) 7.2.16 Show that if E and F are independent events, then E and F are also
independent events.
Solution. We know that
p(E ∩ F ) = p(E)p(F ), and we want to show
that p E ∩ F = p E p F .
10
Using de Morgan’s law, the rule of the excluded middle, and the independence of E and F , we have
p E ∩ F =p E ∪ F
=1 − p (E ∪ F )
=1 − p(E) − p(F ) + p(E ∩ F )
=1 − p(E) − p(F ) + p(E)p(F )
=(1 − p(E))(1 − p(F ))
=p E p F ,
as desired.
7.2.24 What is the conditional probability that exactly four heads appear when
a fair coin is flipped five times, given that the first flip came up tails?
Solution. Let A be the event that exactly four heads appear, and let
B be the event that the first flip comes up tails. We have
p(A|B) =
p(A ∩ B)
1/25
1
1
=
= 4 = .
p(B)
1/2
2
16
7.2.34 Find each of the following probabilities when n independent Bernoulli
trials are carried out with probability of success p.
(a) the probability of no successes.
Solution. The probability of no successes is the probability of
each outcome being a failure. Since each failure has probability
(1 − p), and the trials are independent, there is a probability of
(1 − p)n of each outcome being a failure.
(b) the probability of at least one success.
Solution. The complement of “at least one success” is “no successes.” The probabilities of these two outcomes must add to 1.
We already calculated the probability of no successes as (1 − p)n ,
so the probability of at least one success is 1 − (1 − p)n .
(c) the probability of at most one success.
11
Solution. The probability of exactly one success is np(1 − p)n−1 :
there are n trials where the success could happen, and the probability of each such outcome is p(1 − p)n−1 . We’ve already calculated the probability of exactly zero successes as (1 − p)n . The
probability of either zero or one is the probabilities added minus
the probability of both happening; since both can’t happen, we
have a probability of np(1 − p)n−1 + (1 − p)n that there will be
at most one success.
(d) the probability of at least two successes.
Solution. This is the complement of at most one success. Hence
its probability is 1 minus the answer from part (c), namely
1 − np(1 − p)n−1 − (1 − p)n .
12
Download