2

Apparently the answer is 14 Expected number of tosses to get 3 consecutive Heads, but I got 11. Can someone pinpoint the error to my solution?

Let $X_i$ = Expected number of tosses to ith head. Hence,

$$X_1 = 1 + 1/2*X_1$$

$$X_2 = X_1 + 1/2 + 1/2*X_2$$

$$X_3 = X_2 + 1/2 + 1/2*X_3$$

I know the first line is correct. Regarding the 2nd and 3rd lines, my reasoning is that for the $i$th roll, it's expected value must be the $(i-1)$th roll plus 50% chance of the next role being heads and if not, then everything is reset back to 0.

So, the Expected value of getting 2 heads is the expected value of getting one head + 50% chance of immediately getting the second head + the expected value of getting a tail, which resets the state back to the beginning.

-Edit-

Just to clarify since there is some confusion, I let $X_1, X_2, X_3$ to represent the expected value getting to 1,2, and 3 consecutive heads, respectively.

JobHunter69
  • 3,355
  • The first line implies $X_1=2$. – Henno Brandsma Aug 26 '19 at 16:59
  • X1 is the number of tosses, your first equation says 1/2X1=1 so it follows X1=2? so I cant understand what you do – trula Aug 26 '19 at 17:03
  • "everything is reset back to 0", which means we should have a new distribution for the first consecutive H following the reset back to 0, so that the number of tosses continues to increase. This new distribution is not reflected in $X_1$. As written, after a HHT, the number of tosses is reset to 0 and we start over from the $X_1$ distribution of first Hs. – Eric Towers Aug 26 '19 at 17:07
  • Even the definition of your variable is unclear. Where do you use the fact that you are requiring $3$ $\textit {consecutive}$ Heads? – lulu Aug 26 '19 at 17:07
  • @HennoBrandsma Yeah exactly, Expected number of tosses to get one head is 2 – JobHunter69 Aug 26 '19 at 17:16
  • @trula What do you mean? – JobHunter69 Aug 26 '19 at 17:16
  • @lulu X_i means expected number of tosses to get i consecutive heads – JobHunter69 Aug 26 '19 at 17:17
  • The expected number of tosses to get one head is $2$, you are correct. The expected number of tosses to get three consecutive heads given that you have two heads in a row currently is not $2$, but more than that. – JMoravitz Aug 26 '19 at 17:17
  • @JMoravitz Yes, but that's the third line. The third line is the expected number of tosses to get to 3 based on X_2, which is the expected number of tosses to get to two. – JobHunter69 Aug 26 '19 at 17:19

3 Answers3

4

Your argument is almost correct.

Consider $X_2$

Your type of reasoning means that half the time this will be $X_1+1$ and half the time this will be $(X_1+1)+X_2$. So your second line should have "+1+" instead of "+1/2+".

Ditto in line 3.

Then your method gives $X_1=2, X_2=6,X_3=14.$

2

The corrected equations:

$$\begin{array}{l}X_1 = 1 + \color{grey}{\frac{0}{2} +}\frac{X_3}{2}\\ X_2 = 1+\frac{X_1}{2}+\frac{X_3}{2}\\X_3=1+\frac{X_2}{2}+\frac{X_3}{2}\end{array}$$

Solving this gives $X_3 = 14$

To explain these, $X_i$ represents here for us the expected number of remaining tosses required in order to win the game. Winning the game here is having three consecutive heads in a row. So, for example $X_3$ represents the total number of additional tosses needed to win the game given that we have flipped no heads in a row so far (either because we are just starting, or because we most recently flipped a tail). Meanwhile, $X_1$ represents the total number of additional tosses needed to win the game given that we currently have two consecutive heads in a row and we need only one more to win.

Notice for $X_1$, we used $X_3$ on the right hand side, not $X_1$. If we only need one more head to win, i.e. if we have flipped two heads in a row currently... then if we flip a head then no more flips are necessary. If we were to have flipped a tail however, then we have to start back at the beginning, needing three heads in a row again. You might have been thinking that the problem was asking for something like "find the expected number of flips until having gotten a third head total (with any number of tails interspersed between)" which is different than having gotten three consecutive heads.

So, for $X_1$, we flip the coin (that is the "$1+$" part of the expression). Had we successfully flipped a head, (which occurs with probability $\frac{1}{2}$) then we require $0$ more flips. We are done. Had we flipped a tail however (which also occurs with probability $\frac{1}{2}$), then we need $X_3$ many more flips.

If we were in the situation that we need two more heads to win, i.e. that we have one head in a row currently, then we flip the coin (that is the "$1+$" in the expression). If we get a head (which occurs with probability $\frac{1}{2}$) then we still need $X_1$ many more flips to win. If we got a tail however we need $X_3$ many flips more to win.

JMoravitz
  • 79,518
  • Why is X1 = 1 + X3/2? I don't understand. – JobHunter69 Aug 26 '19 at 17:18
  • @Goldname because flipping at all adds $1$. Successfully getting a head, we need $0$ more flips, we are finished and done. Flipping a tail however, we are back at needing three consecutive heads again, and we need to get all three of those heads, no previous heads we may have had count towards this goal. – JMoravitz Aug 26 '19 at 17:19
  • I think there's a misunderstanding, I meant X1 to be the number of tosses to get one head, not getting three heads at one existing head – JobHunter69 Aug 26 '19 at 17:20
  • @Goldname So, if we have the meaning of our indices mixed up, then we could have instead $\begin{array}{l}X_1 = 1+\frac{X_2}{2}+\frac{X_1}{2}\X_2 = 1+\frac{X_3}{2}+\frac{X_1}{2}\X_3 = 1+\frac{0}{2}+\frac{X_1}{2}\end{array}$. The point being, our values should be in reference to the number of flips needed to end the game, not the number of flips needed to get to the next level. – JMoravitz Aug 26 '19 at 17:23
  • Right, I understand what you are saying, but I am mainly concerned about my method because I can't figure out the mistake here. Could you explain? – JobHunter69 Aug 26 '19 at 17:25
  • Thanks for showing me this alternative method – JobHunter69 Aug 26 '19 at 17:36
2

In general, the expected number of flips to get $n$ heads in a row can be obtained directly by solving $$X_n=\underbrace{\frac{1+X_n}{2}}_{T}+\underbrace{\frac{2+X_n}{2^2}}_{HT}+\underbrace{\frac{3+X_n}{2^3}}_{HHT}+\dots +\underbrace{\frac{n+X_n}{2^n}}_{H\dots HT}+\underbrace{\frac{n}{2^n}}_{H\dots HH}.$$ So for $n=3$, $$X_3=\frac{1+X_3}{2}+\frac{2+X_3}{4}+\frac{3+X_3}{8}+\frac{3}{8}\implies X_3=\frac{7/4}{1/8}=14.$$

Robert Z
  • 145,942