0
$\begingroup$

Say you flip a fair coin until the number of heads is either exactly 3 more then the number of tails or the number of tails is 3 more then heads. The 3 heads or tails do not have to be consecutive. What is expected number of flips ?

My analysis is as follows:

The following sequences are relevant:

HHH,TTT,HT,TH,HHTT,TTHH. I have ended each sequence because either game is complete or reset to start.

The expected length E is then calculated as follows: E=(1/4)(3)+ (2/4)(2+E)+(1/8)*(4+E) The first term is for HHH,TTT; 1/4 is the sum of the 2 probabilities and 3 is the number of flips of each. The 2nd term is for HT,TH; 2/4 is the sum of the 2 probabilities and each has 2 flips. The 3rd term is for HHTT and TTHH. Solving E= 6. Is this solution correct. ?

Also would like to know expected length of game if game ends when only the number of heads is 3 more then the number of tails.

$\endgroup$
6
  • 1
    $\begingroup$ $6$ seems awfully low...and why are you so sure the sequence must restart so quickly? What about $HHTHTHT\cdots$? that one never restarts, right? $\endgroup$
    – lulu
    Apr 24, 2022 at 17:03
  • 1
    $\begingroup$ I would do it from states. Lets $S(i)$ denote the state in which the current leader (either $H$ or $T$ needs $i$ more to clinch victory. Thus you start in $S(3)$. Let $E(i)$ be the expected number of tosses it takes from $S(i)$. Work from there. $\endgroup$
    – lulu
    Apr 24, 2022 at 17:05
  • $\begingroup$ I also suggest simulating it, to get a feel for the answer $\endgroup$
    – lulu
    Apr 24, 2022 at 17:08
  • $\begingroup$ @lulu : please explain states and what S(3) means . Could you provide some more detail please. Thank you. $\endgroup$
    – user263904
    Apr 24, 2022 at 17:10
  • 1
    $\begingroup$ State based arguments work well in cases, like this one, where even if your path might be long, you are sure you will revisit familiar ground frequently. Your mistake was to assume that you had to revisit the starting state frequently, which is not accurate. Note that my example, $HHTHTHT\cdots$ moves to $S(1)$ after two tosses and then alternates between $S(2)$ and $S(1)$. $\endgroup$
    – lulu
    Apr 24, 2022 at 17:15

1 Answer 1

1
$\begingroup$

The absolute difference between $H$ and $T$ before the game ends can be $0, 1\;$or $\,2$, represented by states $x, y, z$

From $x$, one step inevitably takes you to $y$, and you can shuttle back and forth between $x,y,z$, until a "good" toss from $z$ ends the game.
So the equations are
$\displaylines{x = 1 + y\\ y = 1 + 0.5z + 0.5x\\z = 1 + 0.5y}$

Solve for $x$

$\endgroup$
6
  • $\begingroup$ @ true blue anil : 1) could you please write the equations if probability of winning is p and losing is 1-p. 2) could you possibly write a recursive solution also for winning by a margin of 3. Thank you.. $\endgroup$
    – user263904
    Apr 30, 2022 at 16:37
  • $\begingroup$ @user263904: Are you asking for the tosses needed to win by a margin of $3$ for the player who has a probability of p ? $\endgroup$ Apr 30, 2022 at 16:58
  • $\begingroup$ @ true blue anil : Ok forget about player and deal only with flips of a coin with prob of head p and tail 1-p. Want to know expected number of flips to win by a margin of 3 heads or tails . Would the equations be : 1) X= 1+Y, Y = 1 + p*Z + (1-p)*X and Z= 1+ (1-p)Y ?? Also would like a recursive solution if possible .Thank you . $\endgroup$
    – user263904
    Apr 30, 2022 at 17:26
  • $\begingroup$ For the player with probability p to win with a margin of $3$, the equations will be $x=1+py, y = 1+pz+(1-p)*x, z = 1 +(1-p)*y $\endgroup$ Apr 30, 2022 at 18:26
  • $\begingroup$ @ true blue anil : i assume your original equations were for p=1/2. Your original eqn was X=1+Y. Now you are saying X= 1 + pY which would be 1+ 1/2 Y so what is the story ?? I dont understand.. $\endgroup$
    – user263904
    Apr 30, 2022 at 19:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .