# Probability Question - Getting x heads from n coin tosses

1. Mar 3, 2015

### rede96

Hi I was hoping someone could help me with a simple probability question. I wanted to know how I could work out using just one coin the probability of getting x number of heads from n number of coin tosses.

Thanks

2. Mar 3, 2015

### Mentallic

What you're looking for is called a binomial distribution.

To get exactly x successes (we consider heads as being successes and tails as failures in this case) in n trials, the probability is

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

where p is the probability of success which in this case is 1/2, giving us

$$P={n \choose x}\left(\frac{1}{2}\right)^x\left(\frac{1}{2}\right)^{n-x}={n \choose x}\left(\frac{1}{2}\right)^n$$

And if you'll notice, 1/2^n is the probability of getting all heads (or no heads) so what P represents is the probability of getting all heads, multiplied by the number of ways that you can choose x from n.

3. Mar 3, 2015

### rede96

Thank you very much for your help, but just because I am not too great with the notation you have written, can you show me an example.

Say the probability of getting 90 heads from 100 coin tosses?

From your formula is this (100 / 90) x 0.590?

4. Mar 3, 2015

### Mentallic

No no, that first part isn't a division.

$${n \choose x}=\frac{n!}{x!(n-x)!}$$

Where the exclamation marks mean factorial. e.g. $5!=1\times 2\times 3\times 4\times 5 = 120$ so

$${100 \choose 90} = \frac{100!}{90!(100-90)!} = \frac{100!}{90!\times10!}$$

and since
90! = 1*2*3*4*...*88*89*90
100! = 1*2*...*89*90*91*...*99*100

(I've highlighted the common factors in blue)

Then in 100! / 90! we can cancel the first 90 factors, leaving us with 100! / 90! = 91*92*...*99*100
So finally,

$$\frac{100!}{90!10!} = \frac{91*92*...*99*100}{1*2*3*...*9*10}$$

So to find the chance of 90 heads out of 100 coin tosses, we have

$$\frac{91*92*...*99*100}{1*2*3*...*9*10}*\frac{1}{2^{100}}\approx 1.36*10^{-17}$$

or in other words, very, very unlikely. You're more likely to win the next two jackpot lotteries than to have this event occur.

Also keep in mind that what we've calculated is the chance to get exactly 90 heads. Not more, or less. Even getting exactly 50 heads is an unlikely scenario. You're very likely to get between 40 and 60 heads in 100 trials though.

If you want to calculate these results more easily, use a calculator:

http://www.wolframalpha.com/input/?i=(n+choose+x)+/+2^n,+n=100,+x=90

Just change the value of n and x in the calculation prompt to whatever you wish, and then choose approximate value in the substitution result.

5. Mar 3, 2015

### rede96

Ah ok. Thank you! Sorry Math was never my strong subject.

So using the link (thanks!) (binomial(n, x))/2^n~~1.36554×10^-17 =

17310309456440 / 1267650600228229401496703205376 which is appx 1.36 x 10-17

So just out of curiosity, what if I just wanted to ask: what is the probability that I will get 90 or over from a 100 flips? Which would probably be more applicable in my situation.

6. Mar 3, 2015

### Mentallic

Well, since we already know how to calculate the probability of getting exactly x heads in 100 tosses (for any x) then the probability of getting 90 or more heads is going to be the sum of all of the singular probabilities.

Chance to get 90 or more heads = chance for 90 heads + chance for 91 heads + ... + chance for 100 heads

In statistics, we denote the probability P to have an event X occur as P(X) and particular events where, say, we want 90 heads are denoted by P(X=90), and events such as 90 or more heads is denoted by $P(90\leq X \leq 100)$.

Anyway, with that math lesson aside, I'll give you a link for wolfram to calculate those events.

For some reason it wouldn't give an approximate solution, so I you'll have to plug the values in for yourself.

http://www.wolframalpha.com/input/?i=(sum(i=90+to+i=100)+(100+choose+i))+/+2^100

Where it should be

(sum(i=x to i=y) (n choose i)) / 2^n, n=100, x=90, y=100

which basically says, in n trials, count the probability of x up until y heads occurs. So in your case, you wanted to calculate 90 or more heads, so it's x=90 to y=100 heads.

7. Mar 5, 2015

### rede96

Thanks very much for your help and I don't mind the Math lesson. Wish I had more time to go back to school!

So I assume that if I wanted to find the probability of say it landing heads in the range of 40 to 60 times, I would just substitute i = 40 to i = 60 in the above formula?

This seems to make sense and I get a high probability of .999 when I work it out. So am guessing that is correct?

8. Mar 5, 2015

### PeroK

Yes, although .999 is too high. If you use Excel, I found the BINOMDIST function recently, which you might find useful. That gives P(40-60) = 0.965.

=BINOMDIST(60,100, 0.5, TRUE)-BINOMDIST(39,100, 0.5, TRUE)

TRUE means it's cumulative.

9. Mar 8, 2015

### rede96

Yes, I think I did the 0.999 between 30 and 70 and not 40 and 60. But the formula you posted was a great help. Thanks.