How many tosses to flip a coin HHTH?

  • Context: Undergrad 
  • Thread starter Thread starter member 428835
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around calculating the expected number of coin tosses required to achieve the sequence HHTH, considering a coin with a probability ##p## of landing heads. Participants explore various mathematical approaches, including Markov chains and expected values, while debating the validity of different methods and assumptions.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant proposes using Markov chains to derive the expected number of flips, suggesting an average of 30 flips for a fair coin.
  • Another participant suggests that the probability of HHTH is ##p^3(1-p)## and that the expected number of flips is its inverse, initially calculating an average of 16 flips for a fair coin.
  • Some participants express skepticism about the simplicity of the latter approach, indicating it may not account for the complexity of the problem.
  • There is a discussion about the need to consider different scenarios based on the current state of the sequence (e.g., having HHT versus HHH) when calculating expected values.
  • One participant mentions the potential for using infinite series to compute expected values, questioning whether this could be applied to the problem at hand.
  • Another participant restates the problem in terms of binary sequences, seeking clarification on the average number of digits required to achieve a specific sequence.
  • Several participants highlight the importance of distinguishing between different failure scenarios and their implications for the expected number of tosses.
  • One participant outlines a structured approach to the problem, defining two games based on the sequences being targeted and the relevant probabilities for success and failure.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the correct method to calculate the expected number of flips. Multiple competing views and approaches are presented, with some participants challenging the validity of simpler methods in favor of more complex analyses.

Contextual Notes

There are unresolved assumptions regarding the probabilities and the transition between different states in the Markov chain. The discussion also reflects varying interpretations of the problem's requirements, particularly concerning the expected number of tosses versus the probability of achieving the sequence.

  • #31
And with ##p## as the probability of throwing a head we have:
$$N_0 = 1 + pN_1 + (1-p)N_0, \dots$$Which leads to:
$$N_1 = N_0 - \frac 1 p, \ N_2 = N_0 - \frac 1 p - \frac 1 {p^2}, \ N_3 = N_0 - \frac 1 p - \frac 1 {p^2} - \frac 1 {1-p}$$And$$N_3 = 1 + pN_0$$Which leads to the same result as before:
$$N_0 = \frac{1 + p^2 - p^3}{p^3(1-p)}$$
 
  • Like
Likes   Reactions: member 428835 and FactChecker
Physics news on Phys.org
  • #32
FactChecker said:
I think you mean 1121.11111111. I ran two simulations of 100,000 trials each and got 1122.58 and 1115.5 Each simulation took about 5 minutes. I don't think I will do it with 10 million trials as I did for p=1/2. :cool:
Yes, 1121.11111111. I have corrected my post. The results in the other thread were cut-and-pasted - and so they show the accurate values without being filtered through bio-data-processing elements.
 
  • Like
Likes   Reactions: FactChecker
  • #33
.Scott said:
Yes, 1121.11111111. I have corrected my post. The results in the other thread were cut-and-pasted - and so they show the accurate values without being filtered through bio-data-processing elements.
Ha! :-) Those dang bio-data-processing elements will get you every time!
 
  • #34
There's always the non-elegant-but-sure way:

1)It can be done after n throws, with probability $$P_n$$ with expected value $$ \Sigma n*P_n $$ . It may get somewhat messy, but after 15 or so throws, $$ n*P_n $$ is small-enough that you can ignore it. And it seems some sort of recursion would help compute $$P_n$$.

For $$n=4$$, the expected value contribution is :$$ 4*2^{-4}$$; for $$n=5: 5*2^{-5}$$. Then it becomes a bit more complicated, since you need to exclude the substring HHT at the beginning.
 
Last edited:
  • Skeptical
Likes   Reactions: PeroK
  • #35
@PeroK : What part are you skeptical about?
 
  • #36
WWGD said:
@PeroK : What part are you skeptical about?
All of it!

WWGD said:
There's always the non-elegant-but-sure way:
How is this a "sure" way, given that your attempt just gets immediately bogged down?
WWGD said:
1)It can be done after n throws, with probability $$P_n$$ with expected value $$ \Sigma n*P_n $$
How are you going to calculate ##P_n##?
WWGD said:
. It may get somewhat messy, but after 15 or so throws, $$ n*P_n $$ is small-enough that you can ignore it.
Given the expected value is ##18## throws, how can the probability become negligible after ##15## throws?
WWGD said:
And it seems some sort of recursion would help compute $$P_n$$.
"Some sort of recursion". Easy to say, but where's the attempted calculation?
WWGD said:
For $$n=4$$, the expected value contribution is :$$ 4*2^{-4}$$; for $$n=5: 5*2^{-5}$$. Then it becomes a bit more complicated, since you need to exclude the substring HHT at the beginning.
Calculating ##P_n = \frac 1 {16}## is something we can all see. It's trying to progress that method that's the problem.

It seems to me that you've been unable to make any progress with this "sure" method of calculation.
 
  • Skeptical
Likes   Reactions: WWGD
  • #37
PeroK said:
All of it!How is this a "sure" way, given that your attempt just gets immediately bogged down?

How are you going to calculate ##P_n##?

Given the expected value is ##18## throws, how can the probability become negligible after ##15## throws?

"Some sort of recursion". Easy to say, but where's the attempted calculation?

Calculating ##P_n = \frac 1 {16}## is something we can all see. It's trying to progress that method that's the problem.

It seems to me that you've been unable to make any progress with this "sure" method of calculation.
It is the _ definition_ of expected number of throws until obtaining the string hhth. Specifically the sum n*Pn , where n is the number of throws and Pn is the probability of obtaining the substring hhth after n throws. And 15 is an estimate, for 15*P15 being small-enough to not contribute substantially to the sum. This is my version of thinking out loud and not intended as a rigorous solution, which I never claimed it was. And, BTW, your expression $$Pn =\frac{1}{16}$$ is meaningless, and not what I wrote. This is $$P_4$$, not $$P_n $$. And your claim about n=15 is a non-sequitur. This is a weighted sum.
 
  • Skeptical
  • Sad
Likes   Reactions: weirdoguy and PeroK
  • #38
Be sad if you will.
 
  • Sad
Likes   Reactions: weirdoguy and PeroK
  • #39
WWGD said:
There's always the non-elegant-but-sure way:
I'm afraid that I don't follow any of it. I interpret "non-elegant-but-sure" to imply that it is straightforward to understand.
WWGD said:
1)It can be done after n throws, with probability $$P_n$$ with expected value $$ \Sigma n*P_n $$ .
Sure, that is the definition of the expected value of something. If ##P_n## is the first hit on throw ##n##, then it is the desired answer.
WWGD said:
It may get somewhat messy, but after 15 or so throws, $$ n*P_n $$ is small-enough that you can ignore it.
How can that be? We have calculated answers of 18 for p=1/2 and of 1121.11111111111 for p=1/10. How can everything over 15 be ignored?
WWGD said:
And it seems some sort of recursion would help compute $$P_n$$.
Too vague. This is the heart of the problem and should not be passed over vaguely like this. The subject of Markov processes addresses this directly.
WWGD said:
For $$n=4$$, the expected value contribution is :$$ 4*2^{-4}$$; for $$n=5: 5*2^{-5}$$. Then it becomes a bit more complicated, since you need to exclude the substring HHT at the beginning.
I agree that it gets more complicated, but I am not sure how you solve it in a "non-elegant-but-sure" way that you seem to recommend.

This seems to be a fairly standard Markov process hitting time problem that can be solved with a transition matrix and an initial-state vector of probabilities that summarize the first 4 throws. But I have not done the work and am not really proficient in that subject. I would refer you to this reference
 
Last edited:
  • Like
Likes   Reactions: PeroK
  • #40
Thread closed temporarily for Moderation...
 
  • #41
The horse is sore and tired, so the thread will remain closed. Thanks folks.
 
  • #42
Update -- here is a related post from a different thread for folks' info:

1652113427602.png


Jarvis323 said:
The other thread was locked, but I calculated it as a Markov process like @FactChecker suggested based on this link.

https://mpaldridge.github.io/math2750/S08-hitting-times.html

Here is the Markov process I came up with.

View attachment 301120
The hitting time from state ##e## to state ##1101## is

\begin{split}
\mu_{e,1101} &= 1 + 0.5 \mu_{e,1101} + 0.5 \mu_{1,1101} \\
&= 1 + 0.5 \mu_{e,1101} + 0.5 ( 1 + 0.5 \mu_{e,1101} + 0.5 \mu_{11,1101} ) \\
\end{split}

Need to calculate ##\mu_{11,1101}## in terms of ##\mu_{e,1101}## to continue.

\begin{split}
\mu_{11,1101} &=1 + 0.5 \mu_{11,1101} + 0.5 \mu_{110,1101} \\
&= 1 + 0.5 \mu_{11,1101} + 0.5 ( 1 + 0.5 \mu_{e,1101} ) \\ &= 3 + 0.5 \mu_{e,1101} \\
\end{split}

Now substitute.

\begin{split}
\mu_{e,1101} &= 1 + 0.5 \mu_{e,1101} + 0.5 ( 1 + 0.5 \mu_{e,1101} + 0.5 ( 3 + 0.5 \mu_{e,1101} ) ) \\
&= 2.25 + 0.875 \mu_{e,1101} \\
&= 18 \\
\end{split}
 
  • Like
Likes   Reactions: weirdoguy, WWGD and FactChecker

Similar threads

  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 6 ·
Replies
6
Views
1K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 16 ·
Replies
16
Views
3K