I How many tosses to flip a coin HHTH?

  • Thread starter Thread starter member 428835
  • Start date Start date
Click For Summary
The discussion revolves around calculating the expected number of coin tosses required to achieve the sequence HHTH using a coin with a probability p for heads. The initial approach involves using Markov chains to derive an equation for the expected value, which suggests that for a fair coin, the average number of flips is around 30. However, there is contention regarding the correctness of this analysis, with some participants suggesting that a simpler method might yield an average of 16 flips. The conversation also explores the complexity of different states in the Markov process, emphasizing that the expected number of flips cannot be simplified due to the varying probabilities of success and failure based on the current state. Ultimately, the participants agree that a more rigorous approach using Markov chains is necessary to accurately determine the expected number of tosses.
  • #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 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 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 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 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 weirdoguy and PeroK
  • #38
Be sad if you will.
 
  • Sad
Likes 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 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 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 5 ·
Replies
5
Views
1K
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 14 ·
Replies
14
Views
5K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 3 ·
Replies
3
Views
1K