Math 151 - Midterm Solutions

Math 151 - Midterm Solutions - Winter 2012
1. The following is a strategy for deciding who goes first in a game which is to be
played by N players. Each of the players flips a fair coin. If either (a) all coins
come out the same or (b) the number of heads and tails are identical, the flips are
repeated. If not, then the players in the majority (i.e. those who flipped heads if
there were more heads than tails and vice versa) drop out and the remaining players
repeat the process, until only one player is left, and he/she goes first.
(a) Suppose there are 3 players. What is the probability that the number of flips
is greater than 2?
Let X be the random variable equal to the number of flips.
P (X > 2) = 1 − P (X = 1) − P (X = 2)
=1−
=
6 2 6
− ·
8 8 8
1
.
16
(b) Again with 3 players, what is the expected value of the number of flips?
Note that for any positive integer n, we have
P (X = n) =
1 n
2 n−1 6 1 n−1 3
· =
· =3
.
8
8
4
4
4
Hence the expected value of the number of flips is
E[X] =
∞
X
n · P (X = n)
n=1
∞
X
1 n
n·3
4
n=1
∞
1 n
X
=3
n
4
n=1
=
1/4
=3
(1 − 1/4)2
4
= .
3
!
since
∞
X
n=1
nxn =
x
for |x| < 1
(1 − x)2
P∞
nxn =
x
(1−x)2
for |x| < 1? We get this by differP
1
n
entiating the infinite geometric series equation ∞
n=0 x = 1−x with respect to
How do we know that
n=1
x, and then multiplying both sides by x.
For another method of computing the infinite sum
n
1
n
, see Example
n=1
4
P∞
8b on page 156 of the book, which computes the expected value of a geometric
random variable.
(c) Suppose there are 4 players. What is the expected value of the number of
flips?
Note that for any positive integer n, we have
1 n
8 n−1 8
=
P (X = n) =
·
.
16
16
2
Hence the expected value of the number of flips is
E[X] =
∞
X
n · P (X = n)
n=1
∞
X
1 n
n
=
2
n=1
=
1/2
(1 − 1/2)2
since
∞
X
nxn =
n=1
x
for |x| < 1
(1 − x)2
= 2.
(d) Again with 4 players, what is the probability that the process ends?
The probability that the process ends is
P (X = 1) + P (X = 2) + . . . =
∞
X
P (X = n)
n=1
=
∞ X
1 n
n=1
=
2
by part (c)
1/2
1 − 1/2
by the formula for the sum of an infinite geometric series
= 1.
Hence the process ends with probability 1.
2. Suppose three numbers are chosen uniformly at random from among the integers
between 0 and 100 inclusive.
(a) What is the probability that the numbers add up to 100?
Let Xi denote the value of the i-th integer for i = 1, 2, 3. Then
P (three add to 100) = P (X1 + X2 + X3 = 100)
100
X
=
P (X1 + X2 + X3 = 100|X1 = k)P (X1 = k)
k=0
=
100
X
P (X2 + X3 = 100 − k)P (X1 = k)
k=0
=
100
X
(101 − k)
k=0
=
1
101
2 1
·
101
100
1 X
(101 − k)
1013 k=0
101(101 + 1)
1
·
1013
2
51
=
1012
≈ 0.005.
=
(b) What is the probability that two of the integers are equal, conditioned on the
requirement that the three integers add up to 100?
Note that 100 is not divisible by three, it is not possible that all three integers
are equal and add up to 100. The probability that two of the integers are
equal and the three integers add up to 100 is
P (two are equal and three add to 100)
= 3P (X1 = X2 , X1 + X2 + X3 = 100)
50
X
=3
P (X1 + X2 + X3 = 100|X1 = X2 = k)P (X1 = X2 = k)
=3
k=0
50
X
P (X3 = 100 − 2k)P (X1 = X2 = k)
k=0
2
50 X
1
1
·
=3
101
101
k=0
=
3 · 51
.
1013
Hence
P (two are equal and three add to 100)
P (three add to 100)
3 · 51/1013
=
51/1012
3
=
101
P (two are equal|three add to 100) =
≈0.0297
(c) Given again that the sum of the integers is 100, what is the probability that
all three are equal?
Since 100 is not divisible by three, it is not possible that all three integers
are equal and add up to 100. So the conditional probability that all three are
equal given the sum of the integers is 100 is zero.
(d) Given that the sum of all the integers is 100, what is the probability that the
first number drawn is a 7?
We have
P (X1 = 7, X1 + X2 + X3 = 100) = P (X1 = 7, X2 + X3 = 93)
= P (X1 = 7)P (X2 + X3 = 93) by independence
1
94
·
101 1012
94
=
.
1013
=
Thus the conditional probability that the first number drawn is a 7 given that
the three integers add up to 100 is
P (X1 = 7|X1 + X2 + X3 = 100) =
P (X1 = 7, X1 + X2 + X3 = 100)
P (X1 + X2 + X3 = 100)
94/1013
=
51/1012
94
=
5151
≈ 0.0182.
3. Let S = {1, . . . , n}. Suppose that subsets A and B are chosen independently from
S so that A and B are equally likely to be any of the 2n subsets of S (including
both the empty set and S itself).
(a) What is the probability that A ⊆ B?
There are a number of ways to approach this problem.
Solution 1. The easiest method is to do the following. For 1 ≤ i ≤ n, let Ci
be the event that A ∩ {i} ⊆ B ∩ {i}. Note that P (Ci ) = 43 . This is because Ci
occurs if i is in neither A nor B, if i is in both A and B, and if i is in B but
not in A, and because Ci does not occur if i is in A but not B. Note also that
for i 6= j, the events Ci and Cj are independent.
Thus
P (A ⊆ B) = P (C1 and C2 . . . and Cn )
= P (C1 ) · P (C2 ) · · · · · P (Cn ) by independence
3 n
=
4
Solution 2. A harder approach is to condition on the size of B (or A):
P (A ⊆ B) =
n
X
P (A ⊆ B|#B = i)P (#B = i).
i=0
There are 2n subsets of S, of which
n
i
have size i, so P {#B = i} =
n
i
n
/2 .
If #B = i, then B has 2i subsets, so the conditional probability that A ⊆ B
is 2i /2n . Thus
P {A ⊆ B}
n
n
X
2i i
=
2n 2n
i=0
n 1 X n i
= n
2
4 i=0 i
n X
n i
1
n
x = (1 + x)n at x = 2
= n · 3 since we can evaluate
4
i
i=0
3 n
=
.
4
(b) What is the probability that A ∩ B = ∅?
Again, there are a number of ways to solve this problem.
Solution 1. For 1 ≤ i ≤ n, let Di be the event that A ∩ B ∩ {i} = ∅. Note
that P (Di ) = 34 . This is because Di occurs if i is in neither A nor B, if i is
in A but not B, if i is in B but not in A, and because Di does not occur if
if i is in both A and B. Note also that for i 6= j, the events Di and Dj are
independent.
Thus
P (A ∩ B = ∅) = P (D1 and D2 . . . and Dn )
= P (D1 ) · P (D2 ) · · · · · P (Dn ) by independence
3 n
=
4
Solution 2. Alternatively, we can observe
P (A ∩ B = ∅) = P (A ⊆ S \ B)
= P (A ⊆ B) because B and S \ B have identical distributions
3 n
by part (a).
=
4
(c) What is the expected value of #(A ∩ B), where #(A ∩ B) is the number of
elements in the set A ∩ B?
For 1 ≤ i ≤ n, let Fi = #(A ∩ B ∩ {i}). Note that
1
E[Fi ] = p(Fi = 1) = ,
4
and that
#(A ∩ B) = F1 + F2 + · · · + Fn .
Because the expected value of a sum is the sum of the expected values, we
have that
E[#(A ∩ B)] = E[F1 + F2 + · · · + Fn ]
= E[F1 ] + E[F2 ] + · · · + E[Fn ]
1 1
1
+ + ··· +
4 4
4
n
= .
4
=
4. Suppose that we have two tests, T1 and T2 , for a disease. A positive test result is
indicative of the presence of the disease. The following table gives the probabilities
that a healthy patient or a patient with the disease will receive a positive test result
under test T1 or T2 .
Probability of a positive test result
Healthy Disease
T1
10%
95%
T2
8%
90%
We assume the tests are independent, so that the events of T1 and T2 being positive
are independent. Assume also that 5% of the population has the disease.
(a) Find the conditional probabilities P (Healthy|Ti positive) for i = 1, 2.
Let H = Healthy be the event that the patient is healthy, and let D = Disease
be the event that the patient has the disease.
P (H and T1 positive)
P (T1 positive)
P (T1 positive|H)P (H)
=
P (T1 positive|H)P (H) + P (T1 positive|D)P (D)
0.10 · 0.95
=
0.10 · 0.95 + 0.95 · 0.05
2
=
3
P (H|T1 positive) =
Similarly,
P (T2 positive|H)P (H)
P (T2 positive|H)P (H) + P (T2 positive|D)P (D)
0.08 · 0.95
=
0.08 · 0.95 + 0.90 · 0.05
P (H|T2 positive) =
≈ 0.6281
(b) Find the conditional probability P (Healthy|T1 and T2 are both negative).
P (H|T1 , T2 negative)
P (H and T1 , T2 negative)
P (T1 , T2 negative)
P (T1 , T2 neg.|H)P (H)
=
P (T1 , T2 neg.|H)P (H) + P (T1 , T2 neg.|D)P (D)
P (T1 neg.|H)P (T2 neg.|H)P (H)
=
P (T1 neg.|H)P (T2 neg.|H)P (H) + P (T1 neg.|D)P (T2 neg.|D)P (D)
=
by independence
=
0.90 · 0.92 · 0.95
0.90 · 0.92 · 0.95 + 0.05 · 0.10 · 0.05
≈ 0.99968
(c) Find the conditional probabilty P (Disease|T1 and T2 are both positive).
P (D|T1 , T2 positive)
P (D and T1 , T2 positive)
P (T1 , T2 positive)
P (T1 , T2 pos.|D)P (D)
=
P (T1 , T2 pos.|D)P (D) + P (T1 , T2 pos.|H)P (H)
P (T1 pos.|D)P (T2 pos.|D)P (D)
=
P (T1 pos.|D)P (T2 pos.|D)P (D) + P (T1 pos.|H)P (T2 pos.|H)P (H)
=
by independence
=
0.95 · 0.90 · 0.05
0.95 · 0.90 · 0.05 + 0.10 · 0.08 · 0.95
≈ 0.8491
5. Let X be a binomial random variable with number of trials equal to n and probability of success p. What value of p maximizes P {X = k}, for k = 0, 1, . . . , n?
Note that
n k
P {X = k} =
p (1 − p)n−k .
k
Our goal is to maximize this as a function of p ∈ [0, 1]. First let’s consider the
boundary points p = 0 or 1. It’s clear that p = 0 is the optimum choice for k = 0,
that p = 1 is the optimum choice for k = n, and that p = 0 or 1 is not the optimum
choice for any other value of k.
Next, we take the derivative of this function and set it equal to zero, to get
d
P {X = k}
dp
d n k
=
p (1 − p)n−k
dp k
n
=
kpk−1 (1 − p)n−k − (n − k)pk (1 − p)n−k−1
k
n k−1
=
p (1 − p)n−k−1 k(1 − p) − (n − k)p .
k
0=
We already considered the boundary cases p = 0 or 1, so we can assume p 6= 0, 1.
Hence for the derivative to equal zero, we need
0 = k(1 − p) − (n − k)p
=⇒ 0 = k − kp − np + kp
=⇒ 0 = k − np
=⇒ p =
Hence the value p =
k
n
k
n
maximizes P {X = k}, for k = 0, 1, . . . , n.
6. We suppose that a point (x, y) is chosen from the circular region D = {(x, y) |
x2 + y 2 ≤ 1}, in such a way that the probability that the point is chosen from any
region in D is proportional to its area.
(a) What is the probability that y ≥ 21 ?
Note the area of the circular region D is π.
The region y ≥
1
2
is drawn in blue below.
To get the area of the blue region, we take the the area of the blue and green
regions and subtract the area of the green region. The blue and green regions
form a sector of the circle with angle 60◦ +60◦ = 120◦ , and hence have combined
√
√ 1
3
π
1
area 120
3
·
π
=
.
The
green
region
is
a
triangle
with
area
·
=
. Hence
360
3
2
2
4
the area of the blue region is
The probability that y ≥
1
2
√
−
3
.
4
is equal to the area of the blue region divided by
the area of D, or
π
3
π
3
√
−
π
3
4
√
1
3
= −
≈ 0.1955
3
4π
(b) What is the conditional probability that y ≤ 0 given that x ≥ 12 ?
P (y ≤ 0 and x ≥ 21 )
1
P (y ≤ 0|x ≥ ) =
2
P (x ≥ 12 )
area of blue region
=
area of blue region and red regions
1
=
by symmetry.
2
(c) What is the probability that (x, y) lies inside the square S given by − √12 ≤
x, y ≤
√1 ?
2
area of blue region
√ area
√ of circle
2· 2
=
π
2
=
π
P ((x, y) in S) =
≈ 0.6366.
(d) What is the conditional probability that x + y ≥ 1 given that (x, y) is in S?
area of blue region
area of red and blue regions
√
√
1
· ( 2 − 1) · ( 2 − 1)
2
√ √
=
2· 2
√
3−2 2
=
4
P (x + y ≥ 1|(x, y) in S) =
≈ 0.429.
7. Let p(n) =
2
3n
for any integer n ≥ 1. Let X denote the random variable X(n) = n.
(a) Show that p defines a probability distribution on the set {1, 2, . . . , n, . . .}.
Note that p(n) =
2
3n
≥ 0 for all n ≥ 1, as required. Note also that
∞
X
2
2/3
= 1.
=
n
3
1
−
1/3
n=1
Hence p defines a probability distribution on the set {1, 2, . . . , n, . . .}.
(b) Determine the expected value of X.
∞
X
2
3n
n=1
∞
1 n
X
=2
n
3
n=1
E[X] =
n·
1/3
=2
(1 − 1/3)2
!
∞
X
since
nxn =
n=1
x
for |x| < 1
(1 − x)2
3
= .
2
P∞
nxn =
x
(1−x)2
for |x| < 1? We get this by differP
1
n
entiating the infinite geometric series equation ∞
n=0 x = 1−x with respect to
How do we know that
n=1
x, and then multiplying both sides by x.
For another method of computing the infinite sum
n
1
, see Example
n=1 n 3
P∞
8b on page 156 of the book, which computes the expected value of a geometric
random variable.
(c) Determine the variance of X.
Before we begin, let’s derive a formula we will need later. As described in part
(a), for |x| < 1 we know that
∞
X
nxn =
n=1
x
.
(1 − x)2
If we differentiate both sides with respect to x, we get
∞
X
n=1
2 n−1
nx
1 − x2
(1 − x)2 + 2x(1 − x)
=
.
=
(1 − x)4
(1 − x)4
Multiplying both sides by x, we get
∞
X
n=1
n2 xn =
x − x3
.
(1 − x)4
Now,
Var(X) = E[X 2 ] − (E[X])2
∞
X
2 3 2
=
n2 · n −
3
2
n=1
∞
X
1 n 9
−
=2
n2
3
4
n=1
!
1/3 − (1/3)3
9
=2
−
4
(1 − 1/3)
4
=3−
since
∞
X
n=1
n 2 xn =
x − x3
for |x| < 1
(1 − x)4
9
4
3
= .
4
(d) What is the conditional probability that n is divisible by 4 given that it is
divisible by 2?
P (4 divides n and 2 divides n)
P (2 divides n)
P (4 divides n)
=
P (2 divides n)
P∞ 2
34k
= Pk=1
∞
2
P (4 divides n|2 divides n) =
=
k=1 32k
2/81
1−1/81
2/9
1−1/9
1/40
1/4
1
= .
10
=
8. Suppose that 10, 000 monkeys are typing at typewriters, and that 4, 000 of them are
typing at 100 characters per minute and 6, 000 of them are typing at 200 characters
per minute. After how many years does it become likely that one of the monkeys
will have typed “Macbeth”?
Comments:
• Assume that “Macbeth” is a document with 300, 000 alphabetic characters. A
monkey must type “Macbeth” from start to finish. For a monkey to success-
fully type “Macbeth”, there can be no typos within the 300, 000 characters of
“Macbeth”, but the text before or after “Macbeth” can be gibberish.
• Your answer should only be an estimate, and will require assumptions about
the document, so different estimates will be possible. State clearly all assumptions you make.
First let’s state our assumptions. We assume that there are 26 characters in Macbeth (we are ignoring punctuation and spaces) and that there are 26 characters on each
keyboard. We assume that a monkey types a key by choosing one of the 26 characters
uniformly at random. We assume that the monkeys are able to continue typing at their
paces indefinitely. We assume that the monkeys are typing independently of each other.
Moreover, we assume that whenever we compare a copy of “Macbeth” with a copy
shifted by a fixed amount, the two copies never coincide on the region of overlap. This
allows us to assume that the event that “a monkey types Macbeth starting at his ith character” is weakly independent of the event that “the same monkey types Macbeth
starting at his j-th character”, even when i and j are such that the two copies of Macbeth
would overlap. Hence we can treat each of the events
Ei (j) = “Monkey j types Macbeth beginning at his i-th character”,
indexed by i and j, as independent of each other.
Next, let’s compute how many trials we obtain in a year. There are 525,600 minutes in
a year. The monkeys who type 100 characters per minute will type 5.256 × 107 characters
in a year. The monkeys who type 200 characters per minute will type 1.0512 × 108
characters in a year. This means that the first and second kinds of monkey will perform
approximately 5.256 × 107 and 1.0512 × 108 trials per year, respectively. Since there
are 4,000 monkeys of the first type and 6,000 of the second, together they will perform
approximately
4, 000 · 5.256 × 107 + 6, 000 · 1.0512 × 108 ≈ 8.5 × 1011
trials during a year.
Lastly, we need to see how many trials are required before the probability that one
of the monkeys will type Macbeth is at least 21 . We will use the Poisson approximation.
The probability of success for any given trial is p =
1
.
26300,000
Let n be the number of
trials. We need to choose n such that
1
1
= P (at least one success) ≈ exp −n · 300,000 .
2
26
Taking the natural log of both sides, we see that we need
−n
26300,000
1
≈ ln
2
or
n
26300,000
1
= ln(2)
≈ − ln
2
or
n ≥ ln(2) · 26300,000
Recall that n is the number of trials we need so that the probability that one of the
monkeys will type Macbeth is at least 12 . Since there are approximately 8.5 × 1011 trials
per year, our estimate is that the number of years until it becomes likely that one of the
monkeys will type Macbeth is
n
ln(2) · 26300,000
=
8.5 × 1011
8.5 × 1011
years.