probability of getting 50 heads from tossing a coin 100 times

Solution 1:

The coefficient ${2n \choose n}$ for $n$ large can be approximated well (using Stirling's formula) by ${2n \choose n} \approx 4^n / \sqrt{n \pi} $. In particular, letting $n=50$ gives ${100 \choose 50} \approx 4^{50}/ \sqrt {50 \pi}$.

Solution 2:

See How to calculate binomial probabilities for how to calculate these probabilities while avoiding numerical overflow or underflow.

Also, I believe you meant to type 2^-100 instead of 2^-10 in your question.

Solution 3:

The numbers in question here, of course, can be computed exactly. For example, using bignum or GAP (or even WolframAlpha -- the exactly link won't work on here, but I'm sure you can type in "(100 choose 50)*2^(-100)" yourself).

On my home computer, in GAP, it took less than a millisecond. To make it more interesting, I also computed ${100000 \choose 50000} \cdot 2^{-100000}$, which took a bit more than 17 seconds.

gap> Binomial(100,50)/2^100;
12611418068195524166851562157/158456325028528675187087900672
gap> time;
0
gap> Binomial(100000,50000)/2^100000;
<<an integer too large to be printed>>/<<an integer too large to be printed>>
gap> time;
17266

In fact, provided the coin has probability 1/2, the probability will always have a terminating decimal expansion (since binomial coefficients are integers, and 2 divides 10). Here it is in this case:

0.0795892373871787614981270502421704614029315404247333213573478705171737601631321012973785400390625