Question:A fair coin is flipped independently until the first Heads is observed. Let the random variable K be the number of tosses until the first Heads is observed plus 1. For example, if we see TTTHTH, then K=5. For K=1,2,3...K, let Xk be a continuous random variable that is uniform over the interval [0,5] . The Xk are independent of one another and of the coin flips. Let X = ∑ Xk (from k=1 to K). Find the mean and variance of X . You may use the fact that the mean and variance of a geometric random variable with parameter p are 1/p and (1-p)/p^2, respectively.
My attempt:
E[N] = 1/p = 2
E[Xk] = 1/2 *5 = 5/2
E[X] = E[N]*E[Xk]
=2 * 5/2 = 5
Var[N] = (1-p)/p^2 = 2
var[Xk] = 1/12 * 5^2 = 25/12
Var[X] = E[N]var[Xk] + (E[Xk]^2)(var[N])
=....
But both my E[X] and Var[X] gave wrong answers :(
3 answers
Ok, I know my mistake, I didn't read the question carefully, but was on the right track
How did you take into account the "plus 1"?
Firstly, I assume N=K in your solutions. The expected value and variance of X can be found via Law of Iterated Expectation (LIE) and Law of Total Variance (LTV):
E[X]=E[E[X|K]], var(X)=E[var(X|K)]+var(E[X|K])
For the expectation, your approach is correct, but it can be found via LIE:
E[X|K]=KE[Xk]→E[KE[Xk]]=E[K]E[Xk]
You just need to correct your expectation for K: E[K]=1/p+1, since it is of the form 1+Y, where Y is a geometric RV with parameter p. Also, note that var(K)=var(1+Y)=var(Y)=(1−p)/p2 as yours.
For the variance, we need var(X|K)=var(∑Xk|K)=Kvar(Xk), and by LTV:
var(X)=E[Kvar(Xk)]+var(KE[Xk])=var(Xk)E[K]+E[Xk]2var(K)
Substituting:
E[X] = 15/2
Var[X] = 18.75
E[X]=E[E[X|K]], var(X)=E[var(X|K)]+var(E[X|K])
For the expectation, your approach is correct, but it can be found via LIE:
E[X|K]=KE[Xk]→E[KE[Xk]]=E[K]E[Xk]
You just need to correct your expectation for K: E[K]=1/p+1, since it is of the form 1+Y, where Y is a geometric RV with parameter p. Also, note that var(K)=var(1+Y)=var(Y)=(1−p)/p2 as yours.
For the variance, we need var(X|K)=var(∑Xk|K)=Kvar(Xk), and by LTV:
var(X)=E[Kvar(Xk)]+var(KE[Xk])=var(Xk)E[K]+E[Xk]2var(K)
Substituting:
E[X] = 15/2
Var[X] = 18.75