Key idea of this section
A k-multiset on n types: ((n k)) = C(n + k − 1, k) = (−1)ᵏ C(−n, k). ∑ₖ ((n k)) xᵏ = (1 − x)−n. Twelve ways to distribute k balls into n boxes: the twelvefold way.
Multisets
A multiset of size k on an n-element set N is a function m : N → ℤ≥0 with ∑ m(y) = k; m(y) is the multiplicity of y. Equivalently, it is a combination with repetition. Write ((n k)) for the number of such multisets.
Theorem 8.1. ((n k)) = C(n + k − 1, k).
First proof (stars and bars). Encode a multiset on N = {y₁, …, yₙ} as a word of k stars and n − 1 bars: m(y₁) stars, a bar, m(y₂) stars, a bar, and so on. This is a bijection onto words of length n + k − 1 with k stars, of which there are C(n + k − 1, k). ∎
Second proof (shifting). A k-multiset on [n] is a weakly increasing sequence 1 ≤ a₁ ≤ a₂ ≤ ⋯ ≤ ak ≤ n. The map aᵢ ↦ bᵢ = aᵢ + i − 1 sends it to a strictly increasing sequence 1 ≤ b₁ < b₂ < ⋯ < bk ≤ n + k − 1, that is, to a k-subset of [n + k − 1], and the map is invertible. ∎
The same shifting idea counts k-subsets of [n] with no two consecutive elements: subtracting i − 1 from the i-th smallest element gives an arbitrary k-subset of [n − k + 1], so there are C(n − k + 1, k). For n = 12 and k = 4 this gives C(9, 4) = 126.
Reciprocity and generating functions
Expanding (1 − x)−n = (1 + x + x² + ⋯)ⁿ, the coefficient of xᵏ counts the ways to write k = e₁ + ⋯ + eₙ with eᵢ ≥ 0, which is ((n k)). Comparing with Newton's series gives the reciprocity law
((n k)) = (−1)ᵏ C(−n, k),
which says that counting multisets is counting subsets "of a set of size −n". This is the simplest instance of combinatorial reciprocity, a phenomenon developed systematically by Stanley in the theory of Ehrhart polynomials and P-partitions.
Compositions and bounded solutions
The number of solutions of x₁ + ⋯ + xₙ = k in nonnegative integers is ((n k)) = C(n + k − 1, n − 1), and in positive integers (compositions of k into n parts) it is C(k − 1, n − 1), by substituting xᵢ = yᵢ + 1. Lower bounds are handled by substitution and upper bounds by inclusion–exclusion. For example, the solutions of x₁ + x₂ + x₃ = 10 with 0 ≤ xᵢ ≤ 4 number C(12, 2) − 3C(7, 2) + 3C(2, 2) = 66 − 63 + 3 = 6: we subtract, for each i, the solutions with xᵢ ≥ 5 (substitute xᵢ = 5 + yᵢ, leaving sum 5), and add back the solutions with two variables at least 5 (leaving sum 0). The six solutions are the rearrangements of (4, 4, 2) and (4, 3, 3).
Stirling numbers of the second kind
The Stirling number of the second kind S(k, n) is the number of partitions of [k] into n nonempty unlabelled blocks. It satisfies S(k + 1, n) = n S(k, n) + S(k, n − 1) (the element k + 1 joins one of the n blocks or forms a block alone), and the inclusion–exclusion of Lesson 1 gives
S(k, n) = (1/n!) ∑ⱼ₌₀ⁿ (−1)ʲ C(n, j)(n − j)ᵏ.
For instance S(5, 3) = (243 − 3 · 32 + 3 · 1)/6 = 25 and S(6, 3) = (729 − 192 + 3)/6 = 90. Counting all functions [k] → X with |X| = x according to the partition of [k] into nonempty fibres gives xᵏ = ∑ₙ S(k, n)(x)ₙ, the identity used in Lesson 5. The total Bk = ∑ₙ S(k, n) is the Bell number: 1, 1, 2, 5, 15, 52, 203, ….
The twelvefold way
Consider distributions of k balls into n boxes. The balls may be distinguishable (labelled) or not; the boxes may be distinguishable or not; and the distribution may be arbitrary, injective (at most one ball per box) or surjective (no empty box). This gives twelve counting problems, organised by Rota into the twelvefold way. With labelled balls and labelled boxes a distribution is a function from balls to boxes; forgetting the labels of the balls means passing to orbits under Sk, forgetting the labels of the boxes means passing to orbits under Sₙ.
balls boxes arbitrary injective surjective labelled labelled nᵏ (n)ₖ n! S(k, n) unlabelled labelled C(n + k − 1, k) C(n, k) C(k − 1, n − 1) labelled unlabelled ∑ⱼ≤ₙ S(k, j) 1 if k ≤ n S(k, n) unlabelled unlabelled ∑ⱼ≤ₙ pⱼ(k) 1 if k ≤ n pₙ(k)
Here pⱼ(k) denotes the number of partitions of k into exactly j parts, and the injective entries in the last two rows are 0 when k > n. The four entries in the arbitrary and injective columns of the first two rows are the subject of this course: the permutations (injections) and the combinations (injections modulo Sk), together with their versions with repetition (functions, and functions modulo Sk, that is, multisets). The rows with unlabelled boxes lead to set partitions and integer partitions, whose theory is much harder: there is no closed formula for p(n), and the Hardy–Ramanujan asymptotic p(n) ∼ exp(π√(2n/3))/(4n√3) is a deep theorem of analytic number theory.
Exercise
- (a)How many multisets of size 6 can be formed from 4 types?
- (b)In how many ways can 12 identical coins be given to 4 people so that each receives at least 2?
- (c)How many surjections are there from [6] onto [3]?
Show solution
Answers: (a) C(9, 6) = 84. (b) Give each person 2 coins first; the remaining 4 coins are distributed arbitrarily: C(4 + 3, 3) = 35. (c) 3! · S(6, 3) = 6 · 90 = 540, which agrees with 3⁶ − 3 · 2⁶ + 3 · 1⁶ = 729 − 192 + 3 = 540.