2

Suppose you are done tossing a fair coin $n$ times. Now, you tell a completely rational person how many times you have tossed, i.e. the value of $n$, and then ask them what is the probability that $100$ heads in a row happened exactly once.

Is there any value of $n$ for which they'd be almost sure (their answer would be $\geq 0.9$) that it has happened exactly once?

EDIT:This answer may have flaws. Since it's not going to happen for a small value of $n$. So, we assume that $n$ is very large.

We assume $n$ to be a multiple of $100$. Even if the exact value of $n$ is not a multiple of $100$, then a number in the range $1-50$ can be added to it or subtracted from it to make it a multiple of $100$. Adding or subtracting this value from a relatively very large $n$ won't have much effect on $n$.

So, the number of trails is a multiple of $100$. Let's assume $100$ tosses in a row to be one Bernoulli trail. Then the number of trails is $\frac{n}{100}$. Getting $100$ heads in a row is a success. So, the probability of success is $\frac{1}{2^{100}}$ And, the probability of failure is $1-\frac{1}{2^{100}}$. So, the probability of exactly one success in $\frac{n}{100}$ trails is:

$$\binom {\frac{n}{100}}{1}\frac{1}{2^{100}} \left( 1-\frac{1}{2^{100}}\right)^{\frac{n}{100}-1}\: \: \: ...(1)$$

Now, $\left(1-\frac{1}{2^{100}}\right)^{\frac{n}{100}-1}=e^{\left({\frac{n}{100}-1}\right)\log{\left(1-\frac{1}{2^{100}}\right)}}$

$\log{\left(1-\frac{1}{2^{100}}\right)}\approx \frac{-1}{2^{100}}$, $\frac{n}{100}-1\approx \frac{n}{100}$

So, $e^{\left({\frac{n}{100}-1}\right)\log{\left(1-\frac{1}{2^{100}}\right)}}\approx e^{\frac{-n}{100\cdot 2^{100}}}$

Equation $(1)$ becomes:

$$\frac{n}{100\cdot 2^{100}} e^{\frac{-n}{100\cdot 2^{100}}}$$

So, $$\frac{n}{100\cdot 2^{100}} e^{\frac{-n}{100\cdot 2^{100}}}\geq 0.9$$

I don't know how to solve this type of equation. Also, what are the flaws in this method?

Ryder Rude
  • 1,417
  • I wrote an answer describing practically how to calculate this a few months ago. But I don't know if you want a more theoretical description or would be OK with a practical one. – mathreadler Nov 26 '17 at 01:04
  • I can figure out that $n$ has to be a number far away from $100$ because at $n=100$, the probability is $\frac{1}{2^{100}}$ which is nowhere close to $1$. So, if such $n$ exists, it should be a large number. – Ryder Rude Nov 26 '17 at 01:04
  • @mathreadler A theoretical one would be better. – Ryder Rude Nov 26 '17 at 01:06
  • @mathreadler I'll post one answer of my own. It's not complete and may have flaws. – Ryder Rude Nov 26 '17 at 01:06
  • 1
    How would you consider the sequence $T\underbrace{HH...HH}_{101~\text{heads}}T$? Is that a) 100 heads in a row happened twice? b) once? or c) no times at all? – JMoravitz Nov 26 '17 at 01:09
  • https://math.stackexchange.com/a/2218235/213607 here is outline of a machinery to help you calculate it. – mathreadler Nov 26 '17 at 01:10
  • @mathreadler I don't have that advanced knowledge in matrices. Couldn't understand it mostly. – Ryder Rude Nov 26 '17 at 01:43
  • @JMoravitz Wow, I didn't think about that. Whichever one of these choices makes the problem least complicated. – Ryder Rude Nov 26 '17 at 01:59

2 Answers2

3

A characteristic time till this event happens is pretty easy to calculate. Such an event has a probability of $2^{-100},$ so you'll succeed on average after $2^{100}$ attempts. Translating this into a time (or number of coinflips) is a little tricky cause you don't know how many flips each failed attempt takes. But it takes no more than $100$ so we have an upper bound of $100 \times 2^{100}$ coinflips for a characteristic time. Of course that's a gross overestimate.. in fact since you have a $1/2$ probability of flipping tails and ending your attempt, the average attempt length is $2.$ This suggests a duration of $2^{101}.$

The average number of flips till you get a streak of $100$ is exactly calculable and has the value $2^{101}-2.$ So not a bad estimate.

Now, you want a scale for which you can be reasonably sure that exactly one streak of $100$ has occurred. There is a complication here because as JMoravitz says in the comments, there's some ambiguity as to what constitutes two streaks. If you let $101$ heads in a row count as two streaks then it is very possible to have two streaks in nearly the same amount of time as one streak and there's no hope of finding a scale where you can be reasonably sure there's only one. If you demand that the streaks be separated by at least one tail, then it stands to reason that the characteristic time to two streaks is about twice that to one streak. This is better, but still hardly the separation of scales required to be reasonably sure that there is has been one and reasonably certain that there hasn't been two.

We can use the crude approximation above to give an estimate how long it takes to be reasonably sure you have at least one streak of $100.$ As we said, there is a $2^{-100}$ probability per attempt, so the probability of missing $n$ attempts is $$ (1-2^{-100})^n.$$ If you want this less than $\epsilon$ you need $$n > \frac{\ln \epsilon}{\ln(1-2^{-100})} \approx 2^{100}\ln(1/\epsilon) $$ attempts. And recalling that an attempt takes about two flips this works out to about $2^{101}\ln(1/\epsilon)$ coinflips. So if we want a $95\%$ probability, we have $\ln(1/0.05)\approx 3$ so that means we need about $3 \times 2^{101}$ flips to have this level of confidence there's been one. Since the mean time till two streaks (by the second definition) is something like $2\times 2^{101}$ which is less than this, it's probably not the case that there's a sweet spot where you're pretty sure there's been one, but pretty sure there hasn't been two.

1

Your edit is a reasonable approximation. Essentially you are removing the overlap between tries, so it is like you do $n$ trials, each one being $100$ flips of a coin, with success being all the flips being heads. This is well modeled by a Poisson distribution where the expected number of successes is $\frac n{2^{100}}$. We maximize the chance of exactly $1$ success when the expected number is $1$, so when $n=2^{100}$. In that case the chance of exactly one is $\frac 1e \approx 0.368$. There is no number of tries that gets you $0.9$ chance of exactly one success.

Ross Millikan
  • 374,822
  • But there are combinations like: 'Tails, then 100 heads and then alternate T and H for the rest of the trails.' This combination has 100 heads streak happening exactly once but my method would count it as 0 successes. – Ryder Rude Nov 26 '17 at 03:59
  • Also, there are combinations where 100 heads streak is happening more than once like: "100 heads, then one tail then 100 heads, then alternate T and H for the rest of the trails". This combination has 100 heads streak happening twice but my method would count it as just one success. – Ryder Rude Nov 26 '17 at 04:03
  • In your model you have many more tosses. A simple assumption for the original problem is that a run of $100$ is equally likely to start any time, so it should take about $2^{100}$ tosses for it to be reasonable to see a run of $100$. What makes it hard is the correlation between the runs starting at different points. In you new model you have $100 \cdot 2^{100}$ tosses but there are no correlations, which makes the calculations much easier. I had thought of posting this before you added it. – Ross Millikan Nov 26 '17 at 04:41