This is a generalisation of Q18 from 50 Challenging Problems in Probability.
Q:
When n coins are tossed, what is the probability that exactly k are heads?
Assume first that we have a fair coin, and thus the probability of getting a heads or a tails is 1/2.
Let Xn(ω)=(t1(ω),…,tn(ω)) denote a possible realisation of a sequence of n coin tosses from a random sampling ω from the space of all possible random samplings Ω. Then, we wish to determine
P(#Xn(ω)=k)=ω∈Ω#Xn(ω)=k∑P(Xn(ω)).
Since the coin is fair, the probability of getting any number of heads, say k, followed by n−k tails is exactly (1/2)k(1/2)n−k=(1/2)n. Therefore
P(#Xn(ω)=k)=∣{ω∈Ω:#Xn(ω)=k}∣(21)n,
and thus is dependent purely on the number of ways in which we can obtain exactly k heads out of n tosses, which is precisely (kn).
Therefore