There is a fair coin and a biased coin that flips heads with probability 1/4. You randomly pick one of the coins and flip it until you get a heads. Let X be the number of flips you need. Compute E(X) and Var[X].
In the question, I did:
Let H denotes to get a head, $$P(H)= \frac12*\frac12+\frac12*\frac14=\frac38$$ $$E(X)=\frac1p=\frac83$$ $$Var(X)=\frac q{p^2} = \frac {40}9$$
but the TA said the answer is $$E(X)=3$$ $$Var(X)=8$$ I hava no clue where I did it wrong
The expected number of tosses to get a head if the probability of a head is $p$ is $E[X_p] = {1 \over p}$.
(This can be quickly checked from the equation $p\cdot 1 + (1-p)\cdot (E[X_p] +1) = E[X_p]$ .)
Then if $C=1$ with probability ${ 1\over 2}$ if you choose the fair coin and $C=0$ with probability ${ 1\over 2}$ if you choose the biased coin the outcome will be $C\cdot X_{1 \over 2} + (1-C) \cdot X_{1 \over 4}$ and so \begin{eqnarray} E[C\cdot X_{1 \over 2} + (1-C) \cdot X_{1 \over 4}] &=& E[C\cdot] E[ X_{1 \over 2}] + E[1-C] \cdot E[X_{1 \over 4}] \\ &=& {1 \over 2} \cdot 2 + { 1\over 2} \cdot 4 \\ &=& 3 \end{eqnarray}