2

As seen in this question, André Nicolas provides a solution for 5 heads in a row.

Basically, for any sort of problem that relies on determining this sort of probability, if the chance of each event is 50/50, then no matter what the composition of values, the linear equation would be the same?

For example, in the case of flipping 5 coins, and wanting to find out how many flips are needed for 4 consecutive tails followed by a head, is the same form as trying to find how many flips for 5 heads?

specifically:

$$x=\frac{1}{2}(x+1)+\frac{1}{4}(x+2)+\frac{1}{8}(x+3)+\frac{1}{16}(x+4)+\frac{1}{32}(x+5)+\frac{1}{32}(5).$$

Where $\frac{1}{32}(x+5)$ denotes the last flips chance of landing a tails after 4 heads in a row (.5*.5*.5*.5*(P(tails))

If I was using an unfair coin in the same example as above (HHHHT) with a 60% chance to land on heads, would the equation be:

$$x=\frac{1}{2}(x+1)+\frac{1}{4}(x+2)+\frac{1}{8}(x+3)+\frac{1}{16}(x+4)+\frac{1}{40}(x+5)+\frac{1}{40}(5).$$

Anon29
  • 55

2 Answers2

2

No, it is not the same. For this pattern, the argument holds well (if you keep flipping heads) until four tosses. But on the fifth toss, if you flip heads you are done, but if you flip tails you are not back to the start-you have potentially flipped the first of your winning series. You will need to consider states where you have flipped some number of tails so far.

For the unfair coin problem, aside from that objection, the $\frac 12$ would become $\frac 25$ for the first one because you have a $40\%$ chance to land tails and be back at start. Again, the first four flips work fine (with $0.4^n$) but you need to worry about states with one or more heads in the bank.

Ross Millikan
  • 374,822
  • Ah, I see where I made a poor assumption, so for a fair coin if I wanted HT, it would be: $$ x=\frac{1}{2}(x+1)+\frac{1}{4}(x+1)+\frac{1}{4}(2) $$

    As landing two heads like you said would not set be back two flips, but only one? (Or do I need another state)

    – Anon29 Apr 27 '13 at 00:35
1

Suppose that the probability of head is $p$, and the probability of tail is $1-p$, where $0\lt p\lt 1$.

Let $x$ be the expected number of tosses until we first get the sequence HHHHT. As in the solution in the previous problem, we will obtain a linear equation for $x$.

If the first toss is T, (probability $1-p$) our expectation is $1+x$. That contributes $(1-p)(1+x)$ to the mean.

Similarly, first two tosses HT contributes $p(1-p)(2+x)$ to the mean, and HHT contributes $p^2(1-p)(3+x)$, and HHHT contributes $p^3(1-p)(4+x)$. Of course HHHHT contributes $p^4(1-p)(5)$.

But computing the contribution of HHHHH involves an additional idea.

For HHHHH, the contribution is $p^5 (5+w)$ where $w$ is the mean waiting time for a tail. That is a standard problem (mean of a geometric distribution) and we have $w=\frac{1}{1-p}$.

Alternately, we can forget about HHHHT, and HHHHH, and note that HHHH contributes $p^4(4+w)$ to the mean.

Remark: For more general problems of this character, it is easier to set up an appropriate set of states $s_1, s_2,\dots, s_n$ and let $e_1,e_2,\dots,e_n$ be the expected (further) costs when we are in the various states. We can fairly often reduce the problem to solving a set of linear equations in the $e_i$.

André Nicolas
  • 507,029
  • If I just focus on your first case of getting a Heads then a Tails, I don't follow with how your expectation follows for the fact that we failing on the second flip only sets us back one flip, as opposed to two, which is what I assume the (2+x) indicates? – Anon29 Apr 27 '13 at 00:48
  • That's the second case. The first case (previous paragraph), which yields $1+x$ (I had a typo "$1=x$", shift key didn't quite work) is first toss T. The case HT (second case) sets us back $2$. – André Nicolas Apr 27 '13 at 00:57
  • Ah, I think I see, so in the case of HT, is p(1-p)(2+x) actually equlivant to what I posted in the other comment section? – Anon29 Apr 27 '13 at 01:07
  • It is $x+2$, as in your post and in the answer I have given. I do not understand the second $x+1$ of the comment. – André Nicolas Apr 27 '13 at 01:13
  • That was a mistake on my part, I was looking at the wrong part of your solution. The solution being one flip less than HH also makes sense. Thank's for your solution. – Anon29 Apr 27 '13 at 01:17