# Statistical coin flipping question

**URL:** <https://boards.straightdope.com/t/statistical-coin-flipping-question/292687>\
**Category:** Factual Questions\
**Created:** [March 3, 2005, 1:49am UTC](https://boards.straightdope.com/t/statistical-coin-flipping-question/292687 "2005-03-03T01:49:54Z")\
**Posts on this page:** 13\
**Page:** 2

<div class="post-metadata">

**Author:** ![Askance](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/askance/32/8281_2.png) [@Askance](https://boards.straightdope.com/u/Askance)\
**Post date:** [March 3, 2005, 11:41pm UTC](https://boards.straightdope.com/t/statistical-coin-flipping-question/292687/21 "2005-03-03T23:41:10Z")

</div>

> [@Iamu](#):
>
> I don’t think I explained my question clearly; I am asking for the point at which I can be 90% certain that the number of heads has equalled the number of tails **at least once**.

I don’t understand the distinction. If at flip _n_ H and T are equal so far, then you have satisfied your condition. If instead at that same flip you somehow discover that they did equal at some previous flip, then back when that previous flip was the current one you’re back in the position of the previous sentence.

---

<div class="post-metadata">

**Author:** ![Askance](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/askance/32/8281_2.png) [@Askance](https://boards.straightdope.com/u/Askance)\
**Post date:** [March 3, 2005, 11:42pm UTC](https://boards.straightdope.com/t/statistical-coin-flipping-question/292687/22 "2005-03-03T23:42:37Z")

</div>

> [@Cabbage](#):
>
> What **Askance** missed was that the OP is not interested in the probability of even heads and tails _at_ the nth flip, but the probability of even heads and tails at some point _during the course_ of the n flips.

I didn’t miss it, I just don’t see what difference that makes. See my previous post.

---

<div class="post-metadata">

**Author:** ![Askance](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/askance/32/8281_2.png) [@Askance](https://boards.straightdope.com/u/Askance)\
**Post date:** [March 3, 2005, 11:44pm UTC](https://boards.straightdope.com/t/statistical-coin-flipping-question/292687/23 "2005-03-03T23:44:50Z")

</div>

> [@Rico](#):
>
> As a seasoned Las Vegas devotee, I think I can say your hypothesis there is missing one important point:
> 
> _At no time during the series of flips does the size or shape of the coin (object) change. Therefore, assuming the tosses are not designed to ensure one outcome or the other (such as throwing the coin straight up without turning it over), the outcome of **each** throw is 50/50. This does not change on any throw._
> 
> [snip]
> 
> If the probability changed _at all_, games such as roulette would be able to be mathematically figured out and bet to the player’s advantage using only red and black bets. The green 0 and 00 spaces are the house’s only advantage, if you only bet red or black. If there were no 0 and 00, the house advantage would be zero, but then again, so would yours.
> 
> Make sense?

No. No-one’s saying the probability of any flip or combination of flips is changing. We’re simply looking at the odds of a certain outcome.

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [March 3, 2005, 11:45pm UTC](https://boards.straightdope.com/t/statistical-coin-flipping-question/292687/24 "2005-03-03T23:45:16Z")

</div>

> [@Askance](#):
>
> I don’t understand the distinction. If at flip _n_ H and T are equal so far, then you have satisfied your condition. If instead at that same flip you somehow discover that they did equal at some previous flip, then back when that previous flip was the current one you’re back in the position of the previous sentence.

It matters if you’re coding. **Iamu** wants to write a program that flips a coin a lot of times. How much is a lot? Enough that there’s a 90% probability that it had even heads and tails at some point.

---

<div class="post-metadata">

**Author:** ![Askance](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/askance/32/8281_2.png) [@Askance](https://boards.straightdope.com/u/Askance)\
**Post date:** [March 3, 2005, 11:59pm UTC](https://boards.straightdope.com/t/statistical-coin-flipping-question/292687/25 "2005-03-03T23:59:20Z")

</div>

Let me look at the numbers again.

After two flips there’s a 50% chance the condition will be satisfied (2/4); after 4 it is 37.5% (6/16). But of the 10 non-compliant outcomes at the 4-flip stage 4 did have even H/T back at the 2-flip stage, for a total of 10/16 or 62.5%.

Is that what we’re looking for here? A fifth flip won’t change the odds at all but a sixth one will presumably even-up some more of the non-compliant flip sequences without reducing the existing successes, so indeed the odds do mount up if I’m understanding the question correctly now.

The next thing I don’t understand is, what does this have to do with the article referenced re the Egg? As I read it it’s all about remembering the hits and not the misses, a classic pseudoscience strategy.

---

<div class="post-metadata">

**Author:** ![EllisDee](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/ellisdee/32/4531_2.png) [@EllisDee](https://boards.straightdope.com/u/EllisDee)\
**Post date:** [March 4, 2005, 2:27pm UTC](https://boards.straightdope.com/t/statistical-coin-flipping-question/292687/26 "2005-03-04T14:27:33Z")

</div>

> [@Cabbage](#):
>
> Actually, I do know for a fact that the probability of heads and tails being even at _some_ point converges to 1 as the number of flips increase, from having looked at random walks before. So it’s gotta be 90% eventually.

I disagree. This statement is the gambler’s fallacy redux. It is the basis on which many suckers chase bad bets with good money.

The idea is, I’ve seen more losses than wins than is statistically expected, so now I must conclude that there will be more wins than losses. That is incorrect logic. I used to point out that it is likely that those extra wins were realized in an amazing streak just before you walked up to the table, and the excessive losses you experience are simply the “evening out” phenomenon you are hoping for, only it’s going against you.

But then I was explained the most important statistical tidbit in reference to such a proposition. It was actually stated explicitly in this thread:

> [@aahala](#):
>
> As a side note, while the ratio of tails and heads is likely to become more and more even as the number of flips increase, the absolute difference is likely to grow.

That, in a nutshell, kills pretty much any chance of ever getting to an even number of heads and tails as you increase the number of trials.

10 flips: 6 H, 4 T (60%-40%, with 2 more heads than tails)  
100 flips: 57 H, 43 T (57%-43%, but now with 14 more heads than tails)  
1000 flips: 536 H, 464 T (53.6%-46.4%, but now with 72 more heads than tails)

At this point, what is the likelihood that you’ll get enough “extra” heads to even out the 72 “extra” tail disparity? Pretty slim, if any.

I’m a bit surprised by this thread. Clearly I’m missing something, but I would think this fact, so succinctly put by **aahala** , would end the discussion with a “no such evening out will ever be likely, much less 90% likely.”

Unless the answer is some very small number, like say 2 or 4 trials, what am I missing?

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [March 4, 2005, 4:25pm UTC](https://boards.straightdope.com/t/statistical-coin-flipping-question/292687/27 "2005-03-04T16:25:20Z")

</div>

> [@Ellis Dee](#):
>
> I disagree. This statement is the gambler’s fallacy redux. It is the basis on which many suckers chase bad bets with good money.

Nope. It’s a theorem in the study of random walks.

Suppose you have a sequence of random variables X[sub]0[/sub], X[sub]1[/sub], X[sub]2[/sub], … with X[sub]0[/sub] = 0 and X[sub]i + 1[/sub] = X[sub]i[/sub] + 1 (with equal probability for the two events).

Let E[sub]n[/sub] be the event that some value in the finite subsequence X[sub]1[/sub], …, X[sub]n[/sub] is equal to 0. As n increases without bound, P(E[sub]n[/sub]) converges to 1.

That’s not the gambler’s fallacy, but I can see where you might get confused.

---

<div class="post-metadata">

**Author:** ![aahala](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@aahala](https://boards.straightdope.com/u/aahala)\
**Post date:** [March 4, 2005, 6:14pm UTC](https://boards.straightdope.com/t/statistical-coin-flipping-question/292687/28 "2005-03-04T18:14:52Z")

</div>

> [@Ellis Dee](#):
>
> I’m a bit surprised by this thread. Clearly I’m missing something, but I would think this fact, so succinctly put by **aahala** , would end the discussion with a “no such evening out will ever be likely, much less 90% likely.”

It’s great to be cited even if your claim of my statement was not mine.😃

Mike and Freddy nailed the original question.

My aside was simply to point out the longer one goes without a match, the more difficult it becomes to reach eveness because a longer run for the lesser of heads or tails will likely be required. The “incremental” odds decrease with ever greater flips but the accumulated probability from the starting point to n do increase as n does.

I fully accept Freddy’s statement .9 can be reached… I can’t verify his “n” is correct but I strongly believe it is, given the nature of his post.

---

<div class="post-metadata">

**Author:** ![Pasta](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@Pasta](https://boards.straightdope.com/u/Pasta)\
**Post date:** [March 4, 2005, 7:14pm UTC](https://boards.straightdope.com/t/statistical-coin-flipping-question/292687/29 "2005-03-04T19:14:34Z")

</div>

To aid in discussion, here’s some output from a quick simulation. First some numbers, then some graphs.

This table shows the probability of having returned to zero at least once by some number of flips. (For odd _N_\>1, the answer is the same as for _N_-1.)

```auto

Num Prob
  2 0.500
  4 0.625
  6 0.688
  8 0.727
 10 0.755
...
 62 0.899
 64 0.901 (*)
 66 0.902
...

```

The answer to the OP, then: **64**.

Two graphs to looks at (with a red line drawn on each at 90%) :  
[The probability versus number of flips, out to _N_=1e5.](http://home.fnal.gov/~rbpatter/coinflip/panel1.gif) (Note the logarithmic _x_-axis.)  
[The same thing zoomed in on the 90% crossover region.](http://home.fnal.gov/~rbpatter/coinflip/panel2.gif) (Linear _x_-axis here.)

---

<div class="post-metadata">

**Author:** ![David\_Simmons](https://avatars.discourse-cdn.com/v4/letter/d/9de053/32.png) [@David\_Simmons](https://boards.straightdope.com/u/David_Simmons)\
**Post date:** [March 4, 2005, 8:05pm UTC](https://boards.straightdope.com/t/statistical-coin-flipping-question/292687/30 "2005-03-04T20:05:51Z")

</div>

> [@Askance](#):
>
> You’re begging the question; is there necessarily any such flip? Your assumption seems to be that as you flip the probability of this mounts up and will reach 90%, but I see no reason why that should be.
> 
> After two flips the probability of exactly half heads and half tails so far is 50%. After four it is 6/16 = 37.5%; so as you go on the probability actually lessens.

I haven’t read all of the posts and someone else might have already pointed this out. If so, I’m sorry.

I agree with you. There is no reason why the number of heads should ever exactly equal the number of tails. As a matter of simple fact, the difference between them gets bigger and bigger and their ratio approaches 50-50 as the number of tosses increases without limit.

---

<div class="post-metadata">

**Author:** ![Pasta](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@Pasta](https://boards.straightdope.com/u/Pasta)\
**Post date:** [March 4, 2005, 8:29pm UTC](https://boards.straightdope.com/t/statistical-coin-flipping-question/292687/31 "2005-03-04T20:29:22Z")

</div>

**Iamu** should correct me if I’m wrong, but the OP asks a question identical to the following:

You are about to flip a coin _N_ times (but you haven’t started yet!). How big an _N_ must you choose in order to give yourself a 90% chance of having equal heads and tails at some point.

This is in contrast to any question involving a situation where you’re partway through some particular sequence and you want to know when you might get back to equality.

This may or may not have anything to do with any confusion that may or may not be present in this thread.

---

<div class="post-metadata">

**Author:** ![Chronos](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chronos/32/134_2.png) [@Chronos](https://boards.straightdope.com/u/Chronos)\
**Post date:** [March 4, 2005, 8:32pm UTC](https://boards.straightdope.com/t/statistical-coin-flipping-question/292687/32 "2005-03-04T20:32:29Z")

</div>

The odds of this happening on any particular flip _n_ decreases as _n_ increases. But we’re interested in the odds of this happening at flip _n_ or earlier. This probability must increase with increasing _n_ (this part is trivial), and, in fact, increases to 1 as _n_ goes to infinity (this part is less trivial, but can be proven). Since the probability goes to 1 as _n_ goes to infinity, there must be some finite _n_ at which the probability passes 0.9 (as well as a finite _n_ where it passes .99, and one where it passes .99999999999999, etc.).

---

<div class="post-metadata">

**Author:** ![EllisDee](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/ellisdee/32/4531_2.png) [@EllisDee](https://boards.straightdope.com/u/EllisDee)\
**Post date:** [March 5, 2005, 10:44am UTC](https://boards.straightdope.com/t/statistical-coin-flipping-question/292687/33 "2005-03-05T10:44:06Z")

</div>

> [@ultrafilter](#):
>
> That’s not the gambler’s fallacy, but I can see where you might get confused.

I think I see where my confusion arose from. Thanks for letting me down gently; I’ve been making a fool of myself in GQ lately. That’s never fun.

[Previous page](https://boards.straightdope.com/t/statistical-coin-flipping-question/292687.md?page=1)
