Problem set 1 Solutions

Spring 2015
18.310 Solution for Homework 1
1. Give an example of 3 events A1 , A2 and A3 which are pairwise independent, i.e. such that
any 2 of them are independent, but which are not independent.
Solution: Take the event space Ω = {1, 2, 3, 4}, and choose one element with uniform probability. Take X to be the value chosen and the events A = {1, 2}, B = {1, 3} and C = {1, 4}.
Then clearly P(A) = P(B) = P(C) = 1/2, and all pairwise intersections are equal to {1},
making the probability of an intersection equal to 1/4 agreeing with the pairwise product.
This is the definition of independence of two events. Furthermore, the 3-way intersection
A ∩ B ∩ C = {1} as well, so
P(A ∩ B ∩ C) = 1/4 6= 1/8 = P(A)P(B)P(C).
Hence the events A, B and C are not independent.
2. Let X be a uniformly random subset of [n] := {1, 2, . . . , n}; as there are 2n subsets on n
elements, each subset is chosen with probability 21n .
(a) Let Ai be the event that i ∈ X. Show that the events Ai for i = 1, . . . , n are independent.
Solution: Choose an arbitrary set of indices I ⊆ [n]. Then, we can calculate
P(∀i ∈ I : Ai ) = P(I ⊆ X) =
1
2n−|I|
= |I| ,
2n
2
by counting case, and on the other hand
Πi∈I P(Ai ) = Πi∈I
1
2n−1
= |I| .
n
2
2
The equality implies independence of the family of events, since our set I is arbitrary.
(b) Let Y be a random subset chosen independently from X. What is E(|X ∪ Y |).
Solution: Let’s denote Bi the event that i ∈ Y and notice that
X
|X ∪ Y | =
1Ai ∪Bi .
i∈[n]
By linearity of expectation, and calculating the expectation of an indicator variable
X
X
X
E(
1Ai ∪Bi ) =
E(1Ai ∪Bi ) =
P(Ai ∪ Bi ).
i∈[n]
i∈[n]
HW1-1
i∈[n]
Now, use independence to compute
P(Ai ∪ Bi ) = 1 − P(Ai ∩ Bi ) = 1 − P(Ai )P(Bi ) = 3/4.
Putting everything together we get
E(|X ∪ Y |) = 3n/4.
(c) What is the probability that X ∪Y = [n] (again assuming that X and Y are independent
uniformly random sets). Justify your answer.
Solution 1: Note that X ∪ Y = [n] is equivalent to X c ⊆ Y (where X c stands for
[n] \ X), which in turn is equivalent to ∃S ⊆ [n] : X c = S ⊆ Y . Now notice that this is
a union of disjoint events, so we may calculate
X
X
P(∃S ⊆ [n] : .X c = S ⊆ Y ) =
P(X c = S ⊆ Y ) =
P(X c = S)P(S ⊆ Y ).
S
S
Where we have used the independence of X and Y . Now, since X is uniformly distributed, the first term of this sum is 1/2n . The second one we have calculated in the
first part and is equal to 1/2|S| . Putting this together we get
n
n 1 X 1
1 X n 1
1
1 n
3
P(X ∪ Y = [n]) = n
= n
= n 1+
=
.
i
2
|S|
2
2
2
4
i 2
i=0
S
Solution 2: There is a simpler solution (with little calculations). Let Ai be the event that
i ∈ X, and similarly Bi the event that i ∈ Y . We have already seen that the Ai ’s are
independent, and so are the Bi ’s. In fact, together, the 2n events {Ai }i∈[n] and {Bi }i∈[n] are
independent (this could be derived from the fact that X and Y are independent, together
with the above). This means


\
Y
Y
Y 3 3 3/4
P(X∪Y = [n]) = P 
=
,
(Ai ∪ Bi ) =
P(Ai ∪Bi ) =
(1−P(Ai ∩Bi )) =
4
4
i∈[n]
i∈[n]
i∈[n]
i∈[n]
where we have used independence in the second and fourth equality.
3. One hundred people line up to board a plane, but the first person has lost his boarding
pass and takes a uniformly random seat instead. Each subsequent passenger takes his or her
assigned seat if available, and otherwise takes a uniformly random seat among the remainning
seats. What is the probability that the last passenger ends up in his her own seat.
Solution: Let’s number the seats the same way the passengers are: assume the ith passenger
was originally assigned seat i. Note that what happens to the last passenger only depends on
which seat among 1 and 100 gets taken first. If seat 1 is taken first then the last passenger
gets his own seat, while if seat 100 gets taken first then the last passenger will get seat 1.
In particular, the last passenger cannot get any other seat than 1 or 100. We claim that
the probability that the last passenger ends up in his/her own seat is precisely 0.5. Let us
formalize this a bit. Consider the sample space S of all possible seat assignments. Each such
HW1-2
seat assignment σ has a certain probability p(σ) of occurring. For example, if σ is the identity
(i.e. every passenger gets his own seat), we have that p(σ) = 1/n. But if σ is the permutation
assigning person i to seat i + 1 (for i = 1, · · · , 99) and person 100 to seat 1 then we have
1
p(σ) = 100!
. What is p(·) actually does not matter much. Let A be the event that person 100
gets his own seat. Consider any possible seat assignment σ and define τ = f (σ) to be the seat
assignment in which the seats of the persons sitting in seats 1 and 100 are inverted. Observe
that (i) f (f (σ)) = σ, (ii) p(f (σ)) = p(σ) and (iii) f (A) ∩ A = ∅ and P(f (A) ∩ A) = 1 where
A is the event that person 100 gets his own seat. This implies that P(A) = 1 − P(A) = 0.5.
4. Let Ai be the event that it snows on day i of February (with 1 ≤ i ≤ 28). Assume that these
events Ai are independent and that P(Ai ) = 0.5.
(a) Let p be the probability that, during the month of February, there exist 6 consecutive
days with snow followed by a day without snow. Give an expression for p and simplify
as much as possible.
Solution:Define Xi to be the probability that the required sequence occurs starting
on day i. The required probability is then p = P(∪i∈{1,...,22} Xi ). Using the inclusionexclusion formula we get that
p=
22
X
P(Xi ) −
i=1
X
P(Xi ∩ Xj ) +
i<j
X
P(Xi ∩ Xj ∩ Xk ) − P(X1 ∩ X8 ∩ X15 ∩ X22 ),
i<j<k
since the days in which these events happen can’t overlap! It remains to calculate each of
the probabilities, and over how many elements we are summing. Clearly P(Xi ) = (1/2)7 ,
P(Xi ∩ Xj ) = (1/2)14 if |i − j| ≥ 7 and P(Xi ∩ Xj ∩ Xk ) = (1/2)21 if |i − j| ≥ 7 and
|j −k| ≥ 7, and all other are zero. The first sum has 22 = 21+1
elements, the second one
1 P
P
P22
P15 P22
14+2
has i=1 j=i+7 1 = 2 = 120 terms, and the last one has 8i=1 15
j=i+7
k=j+7 1 =
7+3
28
= 120. Finally P(X1 ∩ X8 ∩ X15 ∩ X22 ) = (1/2) , which gives us
3
p = 22(1/2)7 − 120(1/2)14 + 120(1/2)21 − (1/2)28 ,
or around 16.5%.
(b) Let X be the random variable equal to the number of ocurrences of such sequences of 6
snowy days followed by a day
P with no snow. What is E(X)? what is Var(X)?
Solution: Note that X = 22
i=1 1Xi , so that by linearity of expectation
E(X) =
22
X
P(Xi ) =
i=1
22
.
27
Note that E(X) is around 0.18 which makes sense, since the probability of having one
of the sequences was around 0.16. On the other hand
2
E(X ) =
22
X
i=1
E(12Xi )
+2
X
E(1Xi 1Xj ) =
i<j
22
X
P(Xi ) + 2
i=1
and hence
V ar(X) = E(X 2 ) − E(X)2 =
HW1-3
X
P(Xi ∩ Xj ) =
i<j
22 120 222
+ 14 − 14 .
27
2
2
22 120
+ 14 ,
27
2
5. Consider a uniformly random permutation σ on [n] = {1, 2, . . . , n}. Call i a fixed point if
σ(i) = i. Let X be the random variable denoting the number of fixed points in a uniformly
random permutation σ. (When discussing absent-minded math professors, we saw in lecture
that P(X = 0) ∼ 1e as n tends to infinity.)
(a) What is E(X)? What is V ar(X)?
Solution: Let Yi be the event that i is a fixed point. Then by linearity of expectation
E(X) =
n
X
E(1Yi ) =
i=1
n
X
P(Yi ) =
i=1
n
X
(n − 1)!
i=1
n!
= 1.
On the other hand,
E(X 2 ) =
n
X
i=1
P(Yi ) + 2
X
P(Yi ∩ Yj ) = 1 + (n2 − n)
i<j
(n − 2)!
=2
n!
so
V ar(X) = 1.
(b) Use Chebyshev’s inequality to give an upper bound on P(X ≥ t) for any given integer
t ≥ 2.
Solution: By Chebyshev’s inequality and the preceding answer, we have that P(|X−1| ≥
a) ≤ a12 . Now,
P(X ≥ t) = P(X − 1 ≥ t − 1) ≤ P(|X − 1| ≥ t − 1) ≤
HW1-4
1
.
(t − 1)2