Comp2804 Assign 3 Ans

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

COMP2804: Discrete

Structures II

Assignment 3 Solutions
Question 1

1. Three hats are on a table. One of the hats has $3 under it, the others have nothing under
them. You choose a hat uniformly at random and get to keep what you find there. Let A
be the event "the hat you picked has $3 under it." What is Pr(A) ?
2. Nine hats are on a table. Three of the hats each have $1 under them, the others have
nothing under them. You choose three of the hats uniformly at random. For each
i ∈ {0, 1, 2, 3} , let Bi be the event "the hats you picked have a total of $i under
them." What are Pr(B0 ) , Pr(B1 ) , Pr(B2 ) , and Pr(B3 ) ?

Answer 1
1. Pr(A) = 1/3
9
2. This is a uniform probability space of size (3) = 84, so all we need to do is compute
the size of each event. We start with the two easiest ones.
There is only one way to get $3, so |B3 | = 1 therefore
Pr(B3 ) = 1/(93) = 1/84.
In order to get $0, we have to choose our hats from the 6 hats with nothing under
6 6 9
them, so |B0 | = (3), so Pr(B0 ) = (3)/(3) = 20/84 = 5/21 .
To compute |B1 | we use the Product Rule with this procedure: First choose one of
the three hats with $1 under it and then choose two of the 6 hats with nothing

| 1| = (3) ⋅ (6) = 45
:
under them. Therefore |B1 | = (31) ⋅ (62) = 45, so
Pr(B1 ) = 45/84 = 15/28 .
For |B2 | we use the Product Rule again, and this time we get
|B2 | = (32) ⋅ (61) = 18, so Pr(B2 ) = 18/84 = 3/14
Question 2
A standard deck D of playing cards has 52 cards, each of which has a suit in
S = {♠, ♥, ♦, ♣} and a rank in
R = {2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, A} . For each suit in S and each rank
in R, the deck has exactly one card with that suit and that rank, i.e., D = S × R .

A poker hand H is a set of 5 cards taken uniformly at random from a single deck.

1. A flush is a poker hand made up of cards all having the same suit. For example,
{!, ", #, $, %} is a flush (the suit is ♦). Let A be the event "H is a flush." What is
Pr(A) ?
2. A straight is a poker hand made up of cards that appear sequentially in the order listed
above. For example, {&, ', (, ), *} is a straight. Let B be the event "H is a
straight."" What is Pr(B) .
3. A straight flush is a poker hand that is both a straight and a flush. For example,
{+, ,, -, ., /} is a straight flush. What is Pr(A ∩ B)?
Answer 2
52
This is another uniform probability space, this time with size ( 5 ) .

1. We can compute |A| with the Product Rule: Choose one of the 4 suits and then choose
5 of the 13 cards with that suit. Therefore |A| = 4 ⋅ (13 5 ) and
Pr(A) = |A|/(52 5 ) = 33/16660.
2. We can compute |B| with the Product Rule: Choose the rank of the lowest card in the
{2, 3, 4, 5, 6, 7, 8, 9, 10}
:
straight, which can be anything in {2, 3, 4, 5, 6, 7, 8, 9, 10} and then choose one
5
of the 4 suits for each card in the straight. Therefore |B| = 9 ⋅ 4 and
Pr(B) = |B|/(52 5 ) = 192/54145 .
Note: I will also accept answers that treat A, 2, 3, 4, 5 as a flush. In this case
|B| = 10 ⋅ 45 and Pr(B) = 128/32487 .
3. The Product Rule works here again, but you only get to choose one suit for all the cards
in the straight, so |A ∩ B| = 9 ⋅ 4 and
Pr(A ∩ B) = |A ∩ B|/(52 5 ) = 3/216580 .
Note: I will also accept answers that treat A, 2, 3, 4, 5 as a flush. In this case
|A ∩ B| = 10 ⋅ 4 and Pr(A ∩ B) = 1/64974 .
Question 3
Blackjack (also called 21) is a card game where the me and the dealer each receive two cards
from a standard deck of playing cards. I see both my cards but only see the dealer's second
2, 3, 4, 5, 6, 7, 8, 9, 10 have the obvious values; the cards of
card. The cards or ranks
ranks J, Q, K each count as 10. The cards with rank A can count as 1 or 11 depending
on which value helps the hand the most. The winner is the player who gets a hand closest to
21 without going over.
1. If the two cards I am dealt have a total value of 21 then I get a blackjack, and I win! For
example, if I am dealt {0, 1} or {2, 3} then I get a blackjack. Let B be the event "I
am dealt a blackjack." What is Pr(B) ?

2. In the casino version of blackjack, the rules for the dealer are simple. As long as the
value of their hand is less than 17 they must take another card. Sometimes this causes
the dealer's hand to exceed 21 in which case the dealer busts and I win. Suppose that my
hand is currently {4, 5}. The dealer has two cards, one of which is " and the other I
can't see. Even though I am certain that the dealer's hand beats mine right now, I decide
to do nothing else and hope that the rules cause the dealer to bust.
(Keep in mind that the dealer's hidden card and any other cards the dealer is forced to
49
:
take now come from a deck of 49 cards that does not include 4,5, or ".)

1. Let D be the event, "the dealer is forced to take at least one more card." For
example, this happens when the dealer's hidden card is 0, so their hand has a value
of 6 + 10 < 17. What is Pr(D)?
2. Let X be the event, "the dealer is forced to take one more card and this card causes
the dealer to bust." For example, this happens when the dealer's hidden card 0 and
then they draw a 6, so their hand has a value of 6 + 10 + 8 > 21 . What is
Pr(X) ?
Answer 3
1. For this question the only thing that matters is the two cards I am dealt, so this is a
52
uniform probability space of size ( 2 ) . We can compute |B| using the Product Rule
and the observation that one of the cards I am dealt must be one of the 4 aces and the
other card must {10, J, Q, K} × {♠, ♥, ♦, ♣} .
be in Therefore,
|B| = 4 ⋅ 4 ⋅ 4 = 64 and Pr(B) = 64/(522 ) = 32/663.
2. For these two parts, three cards are already showing so any remaining choices come
from a set of 49 cards that are not showing.
1. The event D occurs precisely when the dealer's hidden card has value 10 or less.
We can count these directly (remembering to not count the three cards that are
already showing), but it's easier to use the Complement Rule. The only cards of
rank greater than 10 are the four aces, so there 49 − 4 = 45 options for the
dealer's hidden card that will force the dealer to draw another card. There
|D| = 45 and Pr(D) = 45/49.
2. The event X depends on two cards: The dealer's hidden card and the next card to
be drawn from the deck. There are 49 choices for the hidden card and, once that is
revealed, there are 48 choices for the next card, so the sample space has size
49 ⋅ 48.
The event X can only occur if the value of the dealer's hand is currently at

i ∈ {12, … , 16}
:
least12 and at most 16. For each i ∈ {12, … , 16}, let Xi be the
event "The value of the dealer's hand is currently Xi and the next card the
dealer draws will make the dealer bust." By the Sum Rule,
|X| = ∑16 i=12 |Xi |.
Consider X12 , which implies the dealer's hidden card is one of the 3
remaining cards of rank 6 . In this case, the dealer will bust if the next card has
a value of 10. There are 3 choices for the hidden card (it's one of the 3
remaining rank-6 cards) and 4 × 4 = 16 choices for the next card the
dealer draws (anything in {10, J, Q, K} × {♠, ♥, ♦, ♣} will make
the dealer bust). Therefore |X13 | = 3 ⋅ 16 = 48 .
The analysis of X13 is similar: the hidden card has to have rank 7 and the
next card can be anything in {9, 10, J, Q, K} × {♠, ♥, ♦, ♣} .
Therefore |X13 | = 4 ⋅ 5 ⋅ 4 = 80.
The analysis of X14 has another thing to look out for. The dealer's hidden
card must have rank 8 and then the dealer will bust if they take any card in
{8, 9, 10, J, Q, K} × {♠, ♥, ♦, ♣}. This latter set has size 6 ⋅ 4
but, by now, one of the rank-8 cards is missing. This means that
|X14 | = 4 ⋅ (6 ⋅ 4 − 1) = 92
The analysis of X15 is similar to X14 , but we get
|X15 | = 4 ⋅ (7 ⋅ 4 − 1) = 108 .
For X16 things change again. The event X16 occurs when the dealer's
hidden card is one of the 16 rank-10 cards and the next card has rank at least
6 . By the time we get to the second step there is a missing rank-10 card and a
missing rank-6 card. Therefore, |X16 | = 16 ⋅ (8 ⋅ 4 − 2) = 480 .
So now we finish up with
|X| = ∑16|Xi | = 48 + 80 + 92 + 108 + 480 = 808
i=12
and Pr(X) = 808/(49 ⋅ 48) = 101/294

Question 4
20 18 2
:
I have a cooler containing 20 bottles of beer: 18 identical bottles of Hoegaarden and 2
identical bottles of Grolsch. I reach into the cooler, remove a random bottle and pass it to my
friend Michiel and then I reach into the cooler again, remove a random bottle and keep it for
myself.

1. Describe the sample space S for this experiment.


2. For each elementary event ω ∈ S , determine Pr(ω).
Let A be the event "Michiel gets a bottle of Grolsch" and let B be the event "I get a
bottle of Hoegaarden."
3. What is Pr(A ∩ B)?
4. What is Pr(A ∪ B) ?
5. Are the events A and B independent?

Answer 4
1. There is more than one answer for this question, but here one possible sample space. Let
X := {h1 , … , h18 , g1 , g2 } be the set 18 Hoegaarden and 2 Grolsch bottles.
Let S := {(a, b) : a, b ∈ X, a ≠ b} where a denotes the bottle that Michiel
gets and the b denotes the bottle that I get.
2. The probability distribution in this sample space is uniform, so
Pr(ω) = 1/|S| = 1/(20 ⋅ 19) for each ω ∈ S .
3. A ∩ B = {(a, b) : a ∈ {g1 , g2 }, b ∈ {h1 , … , h18 }. By the Product
Rule, |A ∩ B| = 2 ⋅ 18 , so

Pr(A ∩ B) = |A ∩ B|/|S| = 2 ⋅ 18/20 ⋅ 19 = 9/95 .


4. By the Product Rule, |A| = 2 ⋅ 19 and |B| = 18 ⋅ 19 . By the principle of
inclusion-exclusion,

|A ∪ B| = |A| + |B| − |A ∩ B| = 2 ⋅ 19 + 18 ⋅ 19 − 2 ⋅ 18
= 344

Pr(A ∪ B) = |A ∪ B|/|S| = 344/(20 ⋅ 19) = 86/95


:
so Pr(A ∪ B) = |A ∪ B|/|S| = 344/(20 ⋅ 19) = 86/95
5. We have everything we need to check if Pr(A ∩ B) = Pr(A) ⋅ Pr(B) .
When we do, we find that

9 9 1 9
P r(A ∩ B) = ≠ = ⋅ = Pr(A) ⋅ Pr(B) .
95 100 10 10
Therefore A and B are not independent.

Question 5
Let(S, Pr) be a probability space and let A, B ⊆ S be two events, with
Pr(A) > 0 and Pr(B) > 0 .
1. Suppose you are told that Pr(A ∪ B) = Pr(A) + Pr(B) . Prove that A and
B are not independent.
2. Suppose you are told that Pr(A ∩ B) < Pr(A) ⋅ Pr(B) . What can you say
¯¯¯¯ ¯¯¯¯
about the relationship between Pr(A ∩ B) and Pr(A) ⋅ Pr(B)?

Answer 5
1. By the Principle of inclusion-exclusion,
Pr(A ∪ B) = Pr(A) + Pr(B) − Pr(A ∩ B). But we are told that
Pr(A ∪ B) = Pr(A) + Pr(B) so it must be that Pr(A ∩ B) = 0. But
Pr(A) > 0 and Pr(B) > 0 so Pr(A) ⋅ Pr(B) > 0. Therefore
Pr(A) ⋅ Pr(B) > 0 = Pr(A ∩ B) ,
so A and B are not independent.
¯¯¯¯
2. A = (A ∩ B) ∪ (A ∩ B) and the two sets on the right hand side of this
equation are disjoint. So, by the Sum Rule
Pr(A) = Pr(A ∩ B) + Pr(A ∩ ¯B
¯¯¯
). Rearranging this we get
Pr(A ∩ ¯¯¯¯)
:
Pr(A ∩ ¯B
¯¯¯
) = Pr(A) − Pr(A ∩ B)
> Pr(A) − Pr(A) ⋅ Pr(B)
= Pr(A)(1 − Pr(B))
= Pr(A) ⋅ Pr(¯B
¯¯¯
) ,

so we conclude that Pr(A ∩ ¯B


¯¯¯
) > Pr(A) ⋅ Pr(B).
Question 6
Consider the following game. Four players P1 , … , P4 each have a bag with one red hat
and one blue hat in it. They turn off the lights and each player Pi chooses a random hat hi
(red or blue) from their own bag and puts it on. Then they turn the lights back on. No player
knows the colour of the hat they are wearing but they can see the colours of the other three
players' hats.

This is a cooperative game in which all the players win if at least two of the four players
correctly guess the colour of their own hat.

(Before answering Part 2 of this question, make a guess about whether the answer will be
different than the answer for Part 1.)

Pi independently and uniformly and randomly


1. Suppose that each player guesses a
colour gi ∈ {red, blue} and guesses that their hat has colour gi .
If the players use this strategy, what is the probability that the players win the game?
2. Suppose that each player Pi first looks at the colours of the three hats the other players
are wearing and then guesses that their hat has the same colour as the majority. For
example, if P1 sees that hats h2 , h3 , and h4 are red, blue, and red, then P1 guesses
that their own hat h1 is red.
If the players use this strategy, then what is the probability that the players win the game?

Answer 6
j ∈ {0, … , 4}
:
1. For each j ∈ {0, … , 4}, let Aj be the event "exactly j players correctly guess
their own hat colour". Then the probability that the players win the game is

Pr(A2 ∪ A3 ∪ A4 ) = Pr(A2 ) ∪ Pr(A3 ) ∪ Pr(A4 )


4 4 4
= ( )/16 + ( )/16 + ( )/16
2 3 4
11
=
16
2. To analyze this strategy, carefully check the rules and realize that the only way the
players can lose is if there are exactly two red hats and two blue hats. The probability
4
that this happens is (2)/16 = 6/16 . Therefore, by the Complement Rule, the
probablity that the players win using this strategy is 1 − 6/16 = 10/16 .

Question 7
When studying probability, we usually define an experiment and then study the probability of
one or more possible outcomes of the experiment. In maximum likelyhood estimation, we
observe the outcome of an experiment and then try to determine which experiment is most
likely to have produced that outcome. Here is a simple example.

We have a coin and two hypotheses about that coin:

H1: The coin has a head on one side and a tail on the other side
H2: The coin has tails both sides

We are clumsy and every time we try to turn the coin over to see the other side we drop it.
When this happens, the coin lands on one of its two sides uniformly at random, so we're never
sure if we're seeing the other side or the same side we were just looking at.

1. Suppose we toss the coin and observe that it comes up heads. What is the probability of
this outcome under H1? What is the probability of this outcome under H2?
:
2. Suppose we toss the coin and observe that it comes up tails. What is the probability of
this outcome under H1? What is the probability of this outcome under H2?
3. Assuming that H1 or H2 is the correct hypothesis, describe and analyze a procedure (that
may involve tossing the coin many times) that identifies the correct hypothesis, H1 or H2
with probability at least 999999/1000000. More precisely, if the experiment is
taking place under the rules of H1, then your procedure should output H1 with
probability at least 999999/1000000. If the experiment is taking place under the
rules of H2, then your procedure should output H2 with probability at least
999999/1000000
Answer 7
1. For each i ∈ {1, 2}, we let Pri denote the probability function on hypothesis Hi . If
A is the event "a coin toss comes up heads" then Pr1 (A) = 1/2 and
Pr2 (A) = 0.
¯¯¯¯ ¯¯¯¯
2. Pr1 (A) = 1/2 and Pr2 (A) = 1.
3. Toss the coin n times. If all the tosses came up tails then output H2, otherwise output
H1. Under hypothesis H1, this algorithm only outputs H2 if all n coin tosses come up
tails, which happens with probability 1/2n . Therefore,
Pr1 (output H2) = 1/2n and Pr1 (output H1) = 1 − 1/2n .
Under hypothesis H2, the algorithm always outputs H2, so
Pr2 (output H2) = 1 and Pr2 (output H1) = 0 .
Therefore, under hypothesis H2, the algorithm is correct with probability 1 and under
n
hypothesis H1, the algorithm is correct with probability 1 − 1/2 . Therefore, under
n
either hypothesis, the algorithm is correct with probability at least 1 − 1/2 .

Question 8
Update: The first sentence of this question has been updated. The value of n is odd, so the
number of heads and number of talks are always different.
:
Let n be an odd integer. In this question we want to prove the identity

n
∑ ( )/2n = 1/2
n
k=⌈n/2⌉
k

using a combinatorial proof, but when we do this with probability, we call it the probabilistic
method. In particular, we'll define an experiment and an event E such that

n
∑ ( )/2n = Pr(E) = 1/2
n
k=⌈n/2⌉
k

Suppose we toss a fair coin n times. Each coin toss comes up heads or tails with equal
probability and indepedently of all other coin tosses. Let E be the event "the number of heads
is greater than the number of tails".

1. Explain, in a sentence or two, why Pr(E) = 1/2.


2. For each i ∈ {0, … , n}, let Ei be the event "the coin came up heads exactly Ei
times". What is Pr(Ei ) ?
n n n
3. Explain why Pr(E) = ∑k=⌈n/2⌉ (k )/2

Answer 8
1. Since n is odd the number of heads is never equal to the number of tails. Furthermore,
there is complete symmetry between heads and tails in this question, so any argument
¯¯¯¯
you could make for one also applies to the other. In other words, Pr(E) = Pr(E ) .
¯¯¯¯
By the Complement Rule Pr(E) + Pr(E ) = 1, so
¯¯¯¯
Pr(E) = Pr(E ) = 1/2.
2. The number of outcomes in which the coin comes up exactly i times is the same as the
n
number of bitstrings of length n that contain exactly i 1s, which is ( i ). Therefore
|Ei | = (ni) and Pr(Ei ) = (ni)/2n .
k > n/2
:
3. The eventE occurs precisely when we get k > n/2 heads. Therefore, by the Sum
n n n n
Rule Pr(E) = ∑k=⌈n/2⌉ Pr(Ek ) = ∑k=⌈n/2⌉ ( k )/2 . Therefore,

n
= Pr(E) = ∑ ( )/2n .
1 n
2 k
k=⌈n/2⌉
:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy