0
$\begingroup$

Suppose that there is a biased coin and we flip the coin until 2 of the most recent 3 flips are heads. Let $p$ be the probability that it is heads. Also, let $X$ be the random variable which represents the total flips. If the first 2 flips are heads, then $X=2$. How can we find the expected value of $X$?

$\endgroup$

closed as off-topic by heropup, colormegone, zz20s, Leucippus, Chris Godsil Apr 8 '16 at 0:33

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – heropup, colormegone, zz20s, Leucippus
If this question can be reworded to fit the rules in the help center, please edit the question.

0
$\begingroup$

This answer is for $p=\frac12$; you can work it out for general $p$ accordingly.


A non-terminal state is characterized by one of three combinations of the last two flips: TH, HT, TT, and the process effectively starts off in state TT. The expected numbers of total flips satisfy

\begin{align} \def\n#1{n_{\textsf{#1}}} \n{HT}&=1+\frac12\n{TT}\;,\\ \n{TH}&=1+\frac12\n{HT}\;,\\ \n{TT}&=1+\frac12\left(\n{TH}+\n{TT}\right)\;. \end{align}

Substituting the first equation into the second and then the second into the third yields

$$ \n{TT}=1+\frac12\left(1+\frac12\left(1+\frac12\n{TT}\right)+\n{TT}\right)\;, $$

with solution $\n{TT}=\frac{14}3$.

$\endgroup$
  • $\begingroup$ Why are we solving for $n_{TT}$ exactly? I don't understand that step. $\endgroup$ – user329579 Apr 7 '16 at 20:43
  • $\begingroup$ @user329579: Because the way it's set up, you effectively start off as if you'd just got TT: If you get H on the first flip, you don't stop. $\endgroup$ – joriki Apr 7 '16 at 20:48
0
$\begingroup$

$X$ is also the number of expected more flips if you have just flipped tails-tails. Let $Y$ be the number of expected more flips if you have just flipped tails-heads and $Z$ the number of expected more flips if you have just flipped heads-tails. Now write three coupled equations for $X, Y$ and $Z$.

$\endgroup$
0
$\begingroup$

It is reasonably clear that the expectation exists. Let $w$ be the required expectation. We condition on the results of the first few tosses.

The winning strings are HH, HTH, HTT followed by a winning string, and T followed by a winning string. In the cases HTT followed by a winning string, and T followed by a winning string, the expected number of additional tosses required is $w$. Thus $$w=2p^2+3p^2(1-p)+(3+w)p(1-p)^2+(1+w)(1-p).$$ Solve for $w$.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.