HW5 Solutions: X y X, Y
HW5 Solutions: X y X, Y
(a) (8 pts.) Show that if two random variables X and Y are independent, then
E[XY ] = E[X]E[Y ]
= E[X]E[Y ]
(i) (7 pts.) What is the covariance between two independent random variables?
Answer: Note that X − µX is independent of Y − µY (since they are shifted versions of X and
Y respectively). Hence using part(a), we write expectation of the product as the product of the
expectations.
(ii) (7 pts.) For two general random variables X and Y (not necessarily independent), express the
variance of X + Y in terms of the variance of X, the variance of Y , and the covariance of X and Y .
= E (X − µX + Y − µY )2
= E (X − µX )2 + (Y − µY )2 + 2(X − µX )(Y − µY )
1
Now applying the linearity of expectation we have
(iii) (7 pts.) Show that if X and Y are two independent random variances, then
Answer: Combining our results from the previous parts we can write
(d) In the problem where n = 3 homeworks are randomly returned to n = 3 students, compute the variance
of the number of students that get their own homeworks back in two ways.
(i) (7 pts.) Directly by using the distribution of the number of students that get their homework back
which we calculated in class.
Answer: Recall from class that the pmf for the n = 3 case is given by
1/3 x = 0
pX (x) = 1/2 x = 1
1/6 x = 3
2
Also recall that the mean is 1. Using this information we calculate the variance as
X
Var(X) = (x − 1)2 pX (x)
x∈{0,1,3}
Since there is only one outcome in which both student 1 and student 2 get their correct homework
back (namely when all 3 get them back), it has P(XZ = 1) = 1/6 so the expectation is
3
2. (50 pts.) Bit Torrent
Consider the Bit Torrent problem where m chunks of a movie are randomly distributed across infinite number
of servers. Each server has a uniformly and independently selected chunk of the movie. I query the servers
one-by-one and download whatever chunk I find on each server to my local hard disk. Suppose each server
query takes 1 second and each chunk of the movie plays for t seconds (t integer). Answer each of these
questions. None of the final answers should involve summations.
(a) (10 pts.) What is the expected time to get the first chunk of the movie so that I can start watching the
movie? What is the distribution of this random variable?
Answer: Let T1 be the random variable denoting the time to get the first chunk of the movie then
T1 ∼ Geom(1/m) which we know has mean given by E[T1 ] = m
(b) (20 pts.) What is the expected time to get the first two chunks of the movie? (Hint: consider the first
time to see either the first chunk or the second chunk of the movie.)
Answer: Let T˜1 ∼ Geom(2/m) be the time to get either the first or second chunk of the movie and
T˜2 ∼ Geom(1/m) be the time to get the remaining chunk. The second random variable is geometric by
the memoryless property of the geometric distribution. Our total time to collect the first two movies is
T̃ = T˜1 + T˜2 so by linearity of expectation and the mean of a geometric random variable,
(c) (20 pts.) I start playing the movie once I get the first chunk of the movie. What is the probability that
I have the second chunk of the movie on my hard disk before I finish playing the first chunk so that I
can immediately continue playing the movie?
Answer: Let T1 and T2 be the time until we collect the first and second chunks respectively then we
want to calculate the following probability P(T2 − T1 ≤ t) where t ∈ Z++ (this notation means t is a
positive integer. With just one + means including 0). Using total probability we can write
By the symmetry of the problem we know P(T2 < T1 ) = P(T2 > T1 ) = 1/2. Furthermore, the quantity
P(T2 − T1 ≤ t|T2 < T1 ) = 1 since t is defined to be a positive quantity. Plugging in we can write,
4
Now using the PMF of the geometric distribution and the sum of a geometric series we can simplify
t
X 1
P(T2 − T1 ≤ t) = 1/2 + 1/2 (1 − 1/m)i−1
m
i=1
t−1
1 X
P(T2 − T1 ≤ t) = 1/2 + 1/2 · (1 − 1/m)i
m
i=0
1 1 − (1 − 1/m)t
P(T2 − T1 ≤ t) = 1/2 + 1/2 ·
m 1 − (1 − 1/m)
= 1 − 1/2 · (1 − 1/m)t