hw02 Sol
hw02 Sol
Dr. A. B. Dieker
Homework 2
due on Friday February 7, 2025, 11:59pm EST
Include all intermediate steps of the computations in your answers. If the answer is readily
available on the web (e.g., on wikipedia), then credit is only given for the intermediate steps.
NT T H = NT T + AT T →T T H ,
There are two ways to calculate E[AT T →T T H ]. The first relies on the observation that AT T →T T H
is geometric with parameter p, since after getting the first TT we wait until we get an H and
then we have obtained the first TTH. This argument implies that E[AT T →T T H ] = 1/p.
The second way is to condition on the coin flip after the first TT. We find that
E[AT T →T T H ] = E[AT T →T T H |heads after first TT]P (heads after first TT)
+ E[AT T →T T H |tails after first TT]P (tails after first TT)
= 1 × p + (E[AT T →T T H ] + 1) × (1 − p).
(e) At each i Pfor which Xi = 1 a cycle is added to the total number of cycles. We conclude
that N = ni=1 Xi .
(f) By linearity of expectation, we have mn = E(N ) = ni=1 E(Xi ) = ni=1 P (Xi = 1). Note
P P
that Xi = 1 if and only if i is the last of 1, 2, . . . , i, and each permutation of 1, 2,P. . . , i is
equally likely to appear in the deck of cards. Once again we conclude that mn = ni=1 1i .
For the variance, we use the law of total variance, which gives us:
X X
! " !# " X #!
X X X
Var Ui = E Var Ui X + Var E Ui X .
i=1 i=1 i=1
X
!
X 105
Var U1 = Var(U1 )E(X) + (E(U1 ))2 Var(X) = .
3
i=1
2
(a) Let Y be a Bernoulli random variable defined by
(
1, if it rains tomorrow
Y =
0, if it doesn’t rain tomorrow.
(c) Using the conditional variance formula, Var(X) = E[Var(X|Y )] + Var[E(X|Y )]. As seen
before, we have (
3 Y = 0,
E[X|Y ] = Var(X|Y ) =
9 Y = 1.
A different way of saying this is E[X|Y ] = 3 + 6Y . From Var(X|Y ) = E[X|Y ] we immedi-
ately find that E[Var(X|Y )] = E[E[X|Y ]] = E[X] = 6.6. We next observe that
6 6
Var(E[X|Y ]) = Var(3 + 6Y ) = 36 × × 1− = 8.64.
10 10
You can also find this without the conditional variance formula. We have Var(X) =
E(X 2 ) − (E(X))2 . Moreover, E(X 2 |Y = 1) = Var(X|Y = 1) + (E(X|Y = 1)2 = 90 and
E(X 2 |Y = 0) = Var(X|Y = 0) + (E(X|Y = 0))2 = 12. Conditioning as before yields
Now we note that Var(Yi |X) = E(Yi2 |X) − (E(Yi |X))2 = E(Yi2 |X) − X 2 and we therefore
obtain that E[Var(Yi |X)] = E(Yi2 ) − E(X 2 ). Using Var(X) = E(X 2 ) − (E(X))2 , we deduce
that Var(Yi ) = E(Yi2 ) − (E(X))2 .
3
We also find that
Clearly the left-hand side is minimized when we pick Yi such that its variance is the lowest. ,