UniMaths
Free chapterTry everything here: cards, proofs and practice. Sign up free to save your progress and unlock all 5 chapters.Sign up free
COMB2 · 1

Counting

10 concepts · 25 questions

Binomial identities and combinatorial proof, inclusion–exclusion, derangements, surjections and Stirling numbers.

Overview 1The plan of this section

Counting well means finding the right bijection or the right correction for overcounting.

  1. Combinatorial proof of binomial identities (Prop. 1.1), including Vandermonde (Prop. 1.2).
  2. Stars and bars for distributions (Prop. 1.3).
  3. Inclusion–exclusion in general form (Thm 1.4), giving derangements (Cor. 1.5) and surjections (Prop. 1.6).
  4. Stirling numbers of the second kind (Def. 1.7) and their recurrence (Prop. 1.8).

Double counting, stars and bars, inclusion–exclusion, derangements ≈n!/e\approx n!/e, Stirling numbers.

Proposition 1.1Binomial identities by double counting

For 0≤k≤n0\le k\le n:

  1. (nk)=(nn−k)\binom nk = \binom n{n-k};
  2. k(nk)=n(n−1k−1)k\binom nk = n\binom{n-1}{k-1};
  3. ∑k=0n(nk)=2n\sum_{k=0}^n\binom nk = 2^n and ∑k(−1)k(nk)=0\sum_k(-1)^k\binom nk = 0 (n≥1n\ge1);
  4. ∑j=kn(jk)=(n+1k+1)\sum_{j=k}^n\binom jk = \binom{n+1}{k+1} (hockey stick).

Symmetry, committee–chair, 2n2^n, alternating sum 00, hockey stick — all by double counting.

Proof

Proposition 1.2Vandermonde's identity

∑k=0r(mk)(nr−k)=(m+nr)\sum_{k=0}^r\binom mk\binom n{r - k} = \binom{m + n}r. In particular ∑k(nk)2=(2nn)\sum_k\binom nk^2 = \binom{2n}n.

Vandermonde: split a committee by where its members come from. ∑(nk)2=(2nn)\sum\binom nk^2 = \binom{2n}n.

Proof

Proposition 1.3Stars and bars

The number of solutions of x1+⋯+xk=nx_1 + \dots + x_k = n in non-negative integers is (n+k−1k−1)\binom{n + k - 1}{k - 1}; in positive integers it is (n−1k−1)\binom{n - 1}{k - 1}. Equivalently, the number of multisets of size nn from kk types is (n+k−1n)\binom{n + k - 1}n.

nn identical items into kk boxes: (n+k−1k−1)\binom{n + k - 1}{k - 1} (stars and bars).

Proof

Theorem 1.4Inclusion–exclusion

For finite sets A1,…,AnA_1, \dots, A_n,

∣⋃iAi∣=∑∅≠S⊆[n](−1)∣S∣+1∣⋂i∈SAi∣.\Big|\bigcup_iA_i\Big| = \sum_{\emptyset\ne S\subseteq[n]}(-1)^{|S|+1}\Big|\bigcap_{i\in S}A_i\Big|.

Equivalently, the number of elements of a set X⊇⋃AiX\supseteq\bigcup A_i lying in none of the AiA_i is ∑S⊆[n](−1)∣S∣∣AS∣\sum_{S\subseteq[n]}(-1)^{|S|}|A_S| with A∅=XA_\emptyset = X.

∣⋃Ai∣=∑(−1)∣S∣+1∣AS∣|\bigcup A_i| = \sum(-1)^{|S|+1}|A_S|; each element is counted exactly once.

Proof

Corollary 1.5Derangements

A derangement is a permutation with no fixed point. Their number is

Dn=n!∑k=0n(−1)kk!,D_n = n!\sum_{k=0}^n\frac{(-1)^k}{k!},

so Dnn!→1e\frac{D_n}{n!}\to\frac1e, and DnD_n is the nearest integer to n!e\frac{n!}e. They satisfy Dn=(n−1)(Dn−1+Dn−2)D_n = (n - 1)(D_{n-1} + D_{n-2}).

Dn=n!∑k≤n(−1)kk!≈n!/eD_n = n!\sum_{k\le n}\frac{(-1)^k}{k!}\approx n!/e; Dn=(n−1)(Dn−1+Dn−2)D_n = (n - 1)(D_{n-1} + D_{n-2}).

Proof

Proposition 1.6Counting surjections

The number of surjections [n]→[k][n]\to[k] is ∑j=0k(−1)j(kj)(k−j)n\sum_{j=0}^k(-1)^j\binom kj(k - j)^n.

Surjections [n]→[k][n]\to[k]: ∑j(−1)j(kj)(k−j)n\sum_j(-1)^j\binom kj(k - j)^n.

Proof

Definition 1.7Stirling numbers of the second kind

S(n,k)S(n, k) is the number of partitions of [n][n] into kk nonempty unlabelled blocks. Since labelling the blocks gives a surjection onto [k][k], the number of surjections is k!S(n,k)k!S(n, k). The Bell number Bn=∑kS(n,k)B_n = \sum_kS(n, k) counts all partitions.

S(n,k)S(n, k): partitions into kk blocks; surjections =k!S(n,k)= k!S(n, k).

Proposition 1.8The Stirling recurrence

S(n,k)=S(n−1,k−1)+kS(n−1,k)S(n, k) = S(n - 1, k - 1) + kS(n - 1, k) for 1≤k≤n1\le k\le n, with S(0,0)=1S(0, 0) = 1. Also xn=∑kS(n,k)x(x−1)⋯(x−k+1)x^n = \sum_kS(n, k)x(x - 1)\cdots(x - k + 1).

S(n,k)=S(n−1,k−1)+kS(n−1,k)S(n, k) = S(n - 1, k - 1) + kS(n - 1, k) (is nn alone or not?).

Proof

Check 1.9Check: counting problems

  • Are objects distinct or identical? Do boxes have labels? Is order important?
  • Distinct into labelled: knk^n; surjective: inclusion–exclusion; unlabelled: Stirling.
  • Identical into labelled: stars and bars.
  • "None of the properties": inclusion–exclusion. Check small cases by brute listing.

Distinct/identical, labelled/unlabelled, ordered? Then the matching formula; test small nn.