How many tosses to flip a coin HHTH?

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

The discussion focuses on calculating the expected number of coin flips required to achieve the sequence HHTH using Markov chains. The initial analysis suggested an average of 30 flips for a fair coin, but further examination revealed that the correct expected number is 16 flips. The participants emphasized the importance of considering conditional probabilities and the structure of the Markov process, particularly how different states affect the expected number of flips. The conversation also touched on the potential for using infinite series to derive the expected value.

PREREQUISITES
  • Understanding of Markov chains and their applications in probability theory
  • Familiarity with expected value calculations and infinite series
  • Basic knowledge of probability distributions, particularly geometric distributions
  • Ability to manipulate and solve equations involving probabilities and expectations
NEXT STEPS
  • Study Markov chain transition matrices and their role in calculating expected values
  • Learn about geometric series and their applications in probability
  • Explore advanced topics in probability theory, such as hitting times and absorbing states
  • Implement simulations in Python to empirically verify expected values for coin toss sequences
USEFUL FOR

Mathematicians, statisticians, computer scientists, and anyone interested in probability theory and Markov processes will benefit from this discussion.

  • #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
822
  • · 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