Combinatorial Probability

Counting as the Engine of Combinatorial Probability

When all outcomes in a finite sample space are equally likely, computing P(A)=∣A∣/∣Ω∣\mathbb{P}(A) = |A|/|\Omega| reduces probability to pure counting. This sounds simple, but counting is surprisingly subtle β€” the answer depends critically on whether order matters and whether repetition is allowed.

The four sampling paradigms developed in this section generate almost every counting problem in discrete probability. They also appear repeatedly in coding theory: the number of codewords in a codebook is an ordered sample without replacement; the number of distinct error patterns is an unordered sample; the multinomial coefficient counts the ways to assign nn symbols across rr bins. Getting the counting right is, in Feller's words, "a matter of utmost importance."

,

Definition:

The Four Sampling Paradigms

Given a set SS with ∣S∣=n|S| = n, we extract a sample of size kk. The number of distinct samples depends on two choices:

With replacement Without replacement
Ordered nkn^k n!(nβˆ’k)!\frac{n!}{(n-k)!}
Unordered (n+kβˆ’1k)\binom{n+k-1}{k} (nk)\binom{n}{k}
  • Ordered with replacement (sequences): nkn^k β€” each of kk draws has nn choices independently.
  • Ordered without replacement (permutations): n(nβˆ’1)β‹―(nβˆ’k+1)=n!/(nβˆ’k)!n(n-1)\cdots(n-k+1) = n!/(n-k)! β€” choices decrease by one with each draw.
  • Unordered without replacement (combinations): (nk)=n!/(k!(nβˆ’k)!)\binom{n}{k} = n!/(k!(n-k)!) β€” divide permutations by k!k! since order within the sample does not matter.
  • Unordered with replacement (multisets): (n+kβˆ’1k)\binom{n+k-1}{k} β€” equivalently, the number of ways to place kk indistinguishable balls into nn bins.
,

Theorem: Properties of Binomial Coefficients

For non-negative integers nn and kk with k≀nk \leq n:

  1. Symmetry: (nk)=(nnβˆ’k)\binom{n}{k} = \binom{n}{n-k}.
  2. Pascal's rule: (nk)=(nβˆ’1kβˆ’1)+(nβˆ’1k)\binom{n}{k} = \binom{n-1}{k-1} + \binom{n-1}{k}.
  3. Binomial theorem: (x+y)n=βˆ‘k=0n(nk)xkynβˆ’k(x+y)^n = \sum_{k=0}^{n} \binom{n}{k} x^k y^{n-k}.
  4. Sum: βˆ‘k=0n(nk)=2n\sum_{k=0}^{n} \binom{n}{k} = 2^n.
  5. Vandermonde's identity: (m+nr)=βˆ‘k=0r(mk)(nrβˆ’k)\binom{m+n}{r} = \sum_{k=0}^{r} \binom{m}{k}\binom{n}{r-k}.

Pascal's rule is the recursion underlying Pascal's triangle and enables efficient computation. The binomial theorem says the (nk)\binom{n}{k} are exactly the coefficients in the expansion of (x+y)n(x+y)^n, explaining the name "binomial coefficients." Property 4 follows by setting x=y=1x = y = 1.

Example: The Birthday Problem

In a group of nn people, what is the probability that at least two share a birthday? Assume 365 equally likely birthdays and that birthdays are independent.

,

Birthday Problem: Collision Probability

Plot the probability that at least two people in a group of nn share a birthday, as a function of nn. Also compare with the Poisson approximation.

Parameters
60
365

Definition:

Multinomial Coefficient

Let k1,…,krk_1, \ldots, k_r be non-negative integers with k1+β‹―+kr=nk_1 + \cdots + k_r = n. The multinomial coefficient (nk1,k2,…,kr)β‰œn!k1! k2!β‹―kr!\binom{n}{k_1, k_2, \ldots, k_r} \triangleq \frac{n!}{k_1!\, k_2! \cdots k_r!} counts the number of ways to partition a set of nn distinct objects into rr ordered groups of sizes k1,…,krk_1, \ldots, k_r.

The multinomial theorem generalizes the binomial theorem: (x1+x2+β‹―+xr)n=βˆ‘k1,…,krβ‰₯0k1+β‹―+kr=n(nk1,…,kr)x1k1β‹―xrkr.(x_1 + x_2 + \cdots + x_r)^n = \sum_{\substack{k_1,\ldots,k_r \geq 0 \\ k_1+\cdots+k_r=n}} \binom{n}{k_1,\ldots,k_r} x_1^{k_1} \cdots x_r^{k_r}.

The multinomial coefficient is fundamental in coding theory and information theory. The number of binary strings of length nn with exactly kk ones is (nk)\binom{n}{k} (the r=2r = 2 case). The number of sequences of nn symbols from an alphabet of size rr with prescribed type (k1,…,kr)(k_1, \ldots, k_r) is the multinomial coefficient β€” and bounding these counts is the starting point for the method of types in information theory (Book ITA, Chapter 3).

Example: Combinatorics in Binary Codes

(a) How many binary strings of length nn have Hamming weight exactly kk? (b) How many binary strings of length nn have Hamming weight at most tt? (c) In a random codebook of MM codewords, each chosen uniformly from {0,1}n\{0,1\}^n, what is the expected number of codeword pairs at Hamming distance exactly dd?

Historical Note: The Birthday Paradox in Cryptography and Hashing

1939–present

The birthday problem was apparently first solved by von Mises in 1939, though Feller popularized it in his 1950 classic. The "paradox" is psychological: humans drastically underestimate the number of pairs in a group. With nn people, there are (n2)β‰ˆn2/2\binom{n}{2} \approx n^2/2 pairs β€” and any single pair has a 1/365 chance of a collision. The expected number of colliding pairs is approximately (n2)/365β‰ˆn2/730\binom{n}{2}/365 \approx n^2/730, which equals 1 when nβ‰ˆ27n \approx 27.

In cryptography, the birthday attack exploits exactly this calculation: a hash function with 2m2^m-bit outputs has a collision probability of 50% after approximately 2m/22^{m/2} evaluations, not 2m2^m. This is why SHA-256 (256-bit output) is designed to resist attacks up to 21282^{128} operations, not 22562^{256}.

Birthday (Collision) Attack

Complexity: O(2m/2)O(2^{m/2}) expected, by the birthday bound
Input: Hash function H:{0,1}βˆ—β†’{0,1}mH: \{0,1\}^* \to \{0,1\}^m
Output: Collision pair (x,x′)(x, x') with H(x)=H(x′)H(x) = H(x'), x≠x′x \neq x'
Expected cost: O(2m/2)O(2^{m/2}) evaluations
1. Initialize hash table Tβ†βˆ…T \leftarrow \emptyset
2. repeat
3. \quad Sample xx uniformly from {0,1}βˆ—\{0,1\}^*
4. \quad Compute h←H(x)h \leftarrow H(x)
5. \quad if h∈Th \in T with stored preimage xβ€²x' then
6. \quad\quad return (x,xβ€²)(x, x') ⟡ collision found
7. \quad else store T[h]←xT[h] \leftarrow x
8. until collision found

The birthday bound is tight: by the Poisson approximation to the birthday problem, after kβ‰ˆ2ln⁑2β‹…2m/2k \approx \sqrt{2 \ln 2} \cdot 2^{m/2} evaluations, a collision exists with probability β‰₯1/2\geq 1/2.

Common Mistake: Ordered vs. Unordered: The Most Common Counting Mistake

Mistake:

In a lottery where 6 numbers are drawn without replacement from {1,…,49}\{1,\ldots,49\}, a student counts the total number of outcomes as 49Γ—48Γ—47Γ—46Γ—45Γ—44=49!/43!49 \times 48 \times 47 \times 46 \times 45 \times 44 = 49!/43!. This gives a much lower probability of winning than the correct answer.

Correction:

The lottery outcome is an unordered sample without replacement: the winner need not match the order of drawing, only the set of numbers. The correct count is (496)=49!/(6!β‹…43!)=13,983,816\binom{49}{6} = 49!/(6! \cdot 43!) = 13{,}983{,}816. The ordered count 49!/43!=10,068,347,52049!/43! = 10{,}068{,}347{,}520 overcounts each winning outcome by 6!=7206! = 720. The two counts differ by a factor of 720.

Rule: If the problem asks for a set of outcomes (the drawn numbers, a hand of cards, a subset of antennas), use combinations. If the problem asks for a sequence (the order of names drawn, a ranked list), use permutations.

Monty Hall Simulation

Simulate the Monty Hall problem. A car is hidden behind one of three doors; the host opens a losing door. Compare the win probability of the 'stay' vs 'switch' strategies across many simulations.

Parameters
2000
7

Quick Check

A wireless base station has 8 antennas and must select 3 to activate for a transmission. How many distinct antenna subsets can be chosen?

8Γ—7Γ—6=3368 \times 7 \times 6 = 336

(83)=56\binom{8}{3} = 56

83=5128^3 = 512

(103)=120\binom{10}{3} = 120

Combination

An unordered selection of kk elements from a set of nn, without replacement. Count: (nk)=n!/(k!(nβˆ’k)!)\binom{n}{k} = n!/(k!(n-k)!).

Related: Permutation, Binomial Coefficient

Permutation

An ordered selection of kk elements from a set of nn, without replacement. Count: n!/(nβˆ’k)!n!/(n-k)!. For k=nk=n: n!n! ordered arrangements of all nn elements.

Related: Combination