Binomial distribution problem / biased coin toss

binomial distributionprobability

I've got a text where the following statement appears:

You have a biased coin that has a 51% chance of coming up heads and 49% chance of coming up tails. Tossing it 1,000 times, you will generally obtain more or less 510 heads and 490 tails, majority of heads. If you do the math, you will find that the probability of obtaining a majority of heads after 1,000 tosses is close to 75%. The more you toss the coin, the higher the probability (e.g., with 10,000 tosses, the probability climbs over 97%).

This is a Bernoulli experiment executed 1000 times so we are dealing with a binomial distribution.

So doing the math (with python)

from scipy.stats import binom

n = 1000  # tosses
p = 0.51 # probability of head (coin is biased)
x = 501  # to get majority of heads out of 1000 tosses I need just 501
binom.pmf(x, n, p)  # scipy library

0.021451693818843456

And for 10000 tosses

n = 10000  # tosses
p = 0.51 # probability of head (coin is biased)
x = 5001  # to get majority of heads out of 10000 tosses I need just 5001
binom.pmf(x, n, p)  # scipy library

0.0011231912772331355

Assuming I'm wrong, where is my error?

Thanks

Best Answer

You are using the probability mass function when you should be using the cumulative distribution function or its complement

1 - binom.cdf(x-1, n, p) might give you what you are looking for. Or you could take a sum

Related Question