A binomial coefficient counts the ways to choose k successes from n trials when order does not matter. In a binomial probability mass function, it counts the arrangements that produce exactly k successes. section 3.1.2
Use the coefficient with the remaining binomial-PMF terms:
- n is the total number of trials, k is the number of successes, and p is the probability of success on each trial. section 3.1.2
- The probability of exactly k successes multiplies the coefficient by p^k and (1 − p)^(n − k). section 3.1.2
- Compute it directly as n! divided by k!(n − k)!. section 3.1.2
Twenty trials, seven successes
With n = 20 and k = 7, the coefficient is 77,520. With p = 0.5, the resulting probability of exactly seven successes is 7.39288330078125%; with p = 0.2, it is 5.454985048652523%. section 3.1.2
>>> pmf = [(np.math.comb(n, j) * (p[i] ** j) * \ >>> ((1 - p[i]) ** (n - j))) for j in k]
Apply the coefficient across possible success counts to calculate binomial PMF values in Python. section 3.1.2



