farful
Lv 4

# Fun probability problem: Flip a coin until THT or THH appears. Which will appear first on average?

T = Tails

Suppose you keep flipping a coin until THT or THH appears.

Will it take longer on average for THT to appear or THH? Or will the they appear after the same amount of flips on average?

Bonus question: On average, which flip will THT first appear? On average, which flip will THH first appear?

Update:

Hint: answer is not what you think it is

Relevance

To add to the above answer: The odds of obtaining either of those combinations are 1 in 8. If you take each flip as a individual "experiment" with two possible outcomes, the odds of each are 1 in 2. To get the probability of any outcome of two tosses (HH, HT, TH, TT) you'd multiply the odds of each together (1/2 * 1/2). You can extend this as far as you want... in other words for each flip you multiply another 1/2.

Now looking at your two samples... THT, THH... there is a 1 in 4 chance that ONE of the two will appear, since the only difference is the last toss. But, as was already stated... the probability is exactly the same that either will occur first.

You can extend this to dice, as well... say you want to know the probability of getting 421 on three tosses... you'd multiply (1/6)(1/6)(1/6), to get a probability of 1 in 216.

Now, with that being said... let's look at your combinations a bit further. If we are starting from scratch and counting how many tosses it takes to get a certain pattern, things change...

If we are looking for THT, and we get the first two right (TH) and miss the last... we have to start from scratch again... not to bore you with systems of equations, but on average you will take 10 tosses to get this pattern from scratch.

If we are looking for THH, and we get the first two right (TH) and miss the last (getting a THT)... we STILL get a little better odds of getting the pattern again, because we've already started with a "T." Once again, not to bore you with systems of equations, you will average 8 tosses to get this pattern. The difference lies in the fact that you get a "head start" on matching it again if you miss the pattern.

COMMENT/EDIT: For the above discussion, I assume we start each experiment fresh... and count until we get the combination we desire. In that case, the THH combination will occur sooner more times than the other combination of THT. In other words, we are looking for one only to occur... not either/or. The bonus question asks for each pattern exclusively... not looking for both.

I know I overanswered the question... but many people have problems with this principle. If you want more, very technical details on this phenomenon, look up a "Markov chain" and get ready for some serious number crunching.

• Dr D
Lv 7

If your first throw is an H, then that affects nothing because neither of these combinations begin with H. So we are in business only when we get the first T.

By the same logic, if you get two T's in a row, it does not bring you any closer to a result. We are only in business when we get for the first time a TH in combination. Once this happens, whenever it happens, there is then a 50/50 chance of getting a T or H in the next throw.

The result is that THT and THH are equally likely.

Here's a follow up question for those interested:

Just to answer the last part of the question, on average how many flips are required to get a result. Note we are guaranteed a result once we get a TH in combination. Let's consider a sequence of m H's followed by n-m T's followed by an H.

HHH...HTTT...TTH

0 ≤ m ≤ n-1

n≥1

The last H occurs on the n+1 th toss. And we are guaranteed a result on the n+2 th toss.

Let X = number of tosses just before we get a TH.

X ≥ 1

There are n number of possibilities for choosing m (anything from 0 to n-1).

P(X=n) = n * (1/2)^(n+1)

This includes the prob of getting H on the n+1 th toss.

You can verify that ∑ P(X=n) = 1

Now E(X) = ∑n*P(X=n) = ∑ n^2 * (1/2)^(n+1) = 3

This means that on average, 3 tosses are required BEFORE we get a TH. So on average the H after the T occurs on the 4th toss. And hence we are guaranteed a result on the 5th toss.

On average, 5 tosses are required to produce a result, which I have argued earlier can be THT or THH with equal likelihood.

• Blah
Lv 5

It is (virtually) always a mistake to try to read timing into probability. Your problem is even simpler to illustrate; since the first 2 flips overlap, one doesn't even have to be concerned with them or the 1/8 probability of any of 3 tosses.

At any time when the previous two flips were TH, there is a 1/2 probability that the next flip will be a T, and 1/2 that the next will be an H, either of which completes your criteria.

Therefore, your questions comes down to relatively simpler (sounding at least) questions -- will it take longer to flip a T or a H? And the bonus question is equivalent to -- on which flip will a T first appear, and on which will an H first appear?

The shorts answers -- the same.

The same, since each independent flip has the same probability of occurence, 50%

Thus, even after 49 consecutive heads, the odds of the next flip being heads is still 50/50.

The key will be the sample size. With a small sample size you expect significant deviation from the statistical ideal of 50/50. As you increase the sample size (thousand or millions of events) you should see the ratio approach 1:1, assuming the coin is fair.