1

The distribution of heads in coin tosses is 50%, but in reality, what is the chance that 2n tosses (keeping the number of tosses even) will turn up EXACTLY 50% heads and 50% tails?

More generally, how many tosses will you have to throw to get within 10^(-6), say, of exactly 50%?

Note: I'm not sure I'm actually asking a clear question...

Marcos
  • 523
  • 1
  • 5
  • 14
  • 1
    Possible duplicate of https://stats.stackexchange.com/questions/375096/odds-of-a-large-sample-size-given-a-binary-choice-exactly-splitting-their-answ/ – Glen_b Jun 22 '20 at 01:02
  • Also see discussion here: https://stats.stackexchange.com/a/213995/805 for some additional background detail – Glen_b Jun 22 '20 at 01:25

1 Answers1

5

Coin throws are most probably modeled as binomial random variables. If I throw the coin $2n$ times, then the probability I get exactly $n$ heads and $n$ tails would be

$$ P(x = n) = {2n \choose n} p^{n}(1-p)^{n} $$

Assuming the coin is fair, we get

$$ P(x = n)={2n \choose n} \dfrac{1}{2^{2n}} $$

which very quickly becomes 0. That's because there are more ways to NOT get 50/50 tosses than ways to get 50/50 tosses. You can easily plot this using any software of your choice or just compute it for a given number of throws.

As to your second question, jt would be better to talk about the probability of being within some range of 50/50 rather than asking for a number which would guarantee you achieve this precision. In the limit, the sampling distribution for the sample proportion looks like

$$ \hat{p} \sim \mathcal{N} \left( p, \dfrac{p(1-p)}{n} \right) $$

The probability that the sample proportion is within $d$ of 0.5 is

$$ P( \vert \hat{p} - 0.5 \vert < d ) = P(-d+0.5 < \hat{p}< d+0.5) $$

I'm sure this could be simplified further in terms of CDFs and then inverted with some clever algebraic approximation so that you get flips as a function of probabilities, but frankly its Sunday and I'll let someone else do that. Because we are using a normal as our approximation, this is quite easily computed as a function of $n$.

d = 1e-6

prob = pnorm(d+0.5, 0.5, 0.25/1:1e6) - pnorm(-d+0.5, 0.5, 0.25/1:1e6)

plot(prob, type = 'l')

enter image description here

Demetri Pananos
  • 24,380
  • 1
  • 36
  • 94
  • 3
    When n is not small, the probability is approximately $\frac{1}{\sqrt{n\pi}}$, an approximation derived by de Moivre (essentially using the approximation later named for Stirling). e.g. tossing a coin 100 times, the probability of 50 heads is approximately $1/\sqrt{50\pi}\approx 0.07979$ while the correct binomial probability is about $0.7959$. – Glen_b Jun 22 '20 at 00:49
  • 1
    @Glen_b I knew the community could come up with something like that. BTW, you're missing a zero in the second probability you quote. – Demetri Pananos Jun 22 '20 at 00:54
  • 1
    Sorry, you're right, that last one should be $0.07959$; I can't edit it now. The relative error takes a while to become small. There are better approximations than Stirlings but that $\frac{1}{\sqrt{n\pi}}$ is nice and compact and quite sufficient for a lot of purposes. – Glen_b Jun 22 '20 at 00:56
  • Thanks for your answer. I'll have to study it further, but I appreciate the completeness. If I understand it, it would be simpler to just say that the probably is just (1/2)^number _of_tosses. Your'e right that it's wrong to say anything about margin (d): that there's hardly anything that can be guaranteed at all, except that it won't be off by *more* than n tosses per 2n. – Marcos Jun 22 '20 at 01:26
  • 1
    @Marcos If this answer gives you the information you need, please consider accepting it. – Demetri Pananos Jun 22 '20 at 01:27
  • It's interesting that the probability of getting 50/50 gets lower with more coin tosses, which suggests that there is a "butterfly effect" of sorts happening with the coin tosses (something I'd suspected): that extra bit of information must be coming form the universe itself or micro-changes in the player -- so that one could potentially "read" the series of tosses and learn nearly everything about the tosser or extract divine knowledge of sorts. I'm suggesting something like information theory, where the more improbable something is, the more KNOWLEDGE you've gained by learning it. – Marcos Jun 22 '20 at 01:53