Binomial Coefficient

Example
We have 4 balls marked with numbers 1,2,3,4. From these we draw 2. What is the probability that these 2 balls are marked 1 and 2?

We can count the number of ways to draw 2 balls:



\mid\{(1,2), (2,3), (1,3), (1,4), (2,4), (3,4)\}\mid \quad = \quad 6 $$

The draw (1,2) is one of these, so the probability is 1/6. This can also be calculated using the binomial coefficient:



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

The probability of a random draw is:



P = \frac{1} $$

where n is the set of distinct elements to draw from and k is the number of elements drawn.

Our example, the probability af drawing the balls 1 and 2 from the 4 balls:



P = \frac{1} \quad = \quad \frac{1}{\frac{4!}{2!(4-2)!}} \quad = \quad \frac{2!(4-2)!}{4!} \quad = \quad \frac{4}{24} \quad = \quad \frac{1}{6} $$

Another example could be the probability of drawing a royal flush in the game of poker. There are 4 different royal flushes and 52 cards. Then we have:



P(\mbox{royal flush}) = \frac{1} \quad = \quad \frac{1}{\frac{52!}{4!(52-4)!}} \quad = \quad \frac{4!(52-4)!}{52!} \quad = \quad \frac{4!\cdot48!}{52!} \quad \approx \quad 1.5391 \cdot 10^{-6} $$

This Python program demonstrates calculation using the binomial function:

def fac(x): if x==0: return 1 else  : return x*fac(x-1) def bin(n, k): return fac(n) / (fac(n-k)*fac(k)) print "                                                [ 52 ]" print "The probability of a royal straight flush is 1 / [ 4 ] = %.4e" % (1. / bin(52,4))