Math 2.0

Combinatorics Proof

Proof of stars and bars by a bijection with subsets

Builds on Combinations with repetitionBijective functionBijection principleNumber of k-element subsetsSymmetry of binomial coefficientsBijective iff it has a two-sided inverse

Proof

We match the multisets with the solutions, and the solutions with subsets of positions of the bars. Let XX be the nn-element set and put N=n+k−1N = n + k - 1.

  1. Fix a bijection i↦eii \mapsto e_i from {1,…,n}\set{1, \dots, n} to XX.
  2. A multiset of size kk on XX is a function μ:X→ℕ\mu : X \to \N with ∑x∈Xμ(x)=k\sum_{x \in X} \mu(x) = k. Send it to the tuple (μ(e1),…,μ(en))(\mu(e_1), \dots, \mu(e_n)).
  3. This tuple solves x1+⋯+xn=kx_1 + \dots + x_n = k in natural numbers, since the sum over XX is the sum over the eie_i.
  4. Conversely, a solution (x1,…,xn)(x_1, \dots, x_n) gives the multiset ei↦xie_i \mapsto x_i. The two maps are mutually inverse. So multisets and solutions are equinumerous.
  5. Let SS be the set of solutions. For (x1,…,xn)∈S(x_1, \dots, x_n) \in S, put p0=0p_0 = 0 and pj=x1+⋯+xj+jp_j = x_1 + \dots + x_j + j for 1≤j≤n1 \le j \le n.
  6. Then pj−pj−1=xj+1≥1p_j - p_{j-1} = x_j + 1 \ge 1 for 1≤j≤n1 \le j \le n, so p0<p1<⋯<pnp_0 < p_1 < \dots < p_n. Also pn=k+n=N+1p_n = k + n = N + 1.
  7. Hence p1,…,pn−1p_1, \dots, p_{n-1} are n−1n - 1 distinct elements of {1,…,N}\set{1, \dots, N}. Let β(x1,…,xn)\beta(x_1, \dots, x_n) be the set {p1,…,pn−1}\set{p_1, \dots, p_{n-1}}.
  8. Conversely, let T⊆{1,…,N}T \subseteq \set{1, \dots, N} have n−1n - 1 elements. List them in increasing order as q1<⋯<qn−1q_1 < \dots < q_{n-1}, and put q0=0q_0 = 0 and qn=N+1q_n = N + 1.
  9. Put xj=qj−qj−1−1x_j = q_j - q_{j-1} - 1 for 1≤j≤n1 \le j \le n. Each xj≥0x_j \ge 0 because qj−1<qjq_{j-1} < q_j.
  10. The sum telescopes: x1+⋯+xn=qn−q0−n=N+1−n=kx_1 + \dots + x_n = q_n - q_0 - n = N + 1 - n = k. So γ(T)=(x1,…,xn)\gamma(T) = (x_1, \dots, x_n) lies in SS.
  11. For this solution, x1+⋯+xj+j=qj−q0=qjx_1 + \dots + x_j + j = q_j - q_0 = q_j for every jj. So β(γ(T))=T\beta(\gamma(T)) = T.
  12. Starting from a solution, the list of step 6 is the increasing listing of β(x1,…,xn)\beta(x_1, \dots, x_n). Step 9 then returns xj=pj−pj−1−1x_j = p_j - p_{j-1} - 1. So γ(β(x1,…,xn))=(x1,…,xn)\gamma(\beta(x_1, \dots, x_n)) = (x_1, \dots, x_n).
  13. By the inverse criterion, β\beta is a bijection from SS to the set of (n−1)(n-1)-element subsets of {1,…,N}\set{1, \dots, N}.
  14. By the number of kk-element subsets, there are (Nn−1)\binom{N}{n-1} such subsets. Numbering them and composing with γ\gamma gives ∣S∣=(Nn−1)|S| = \binom{N}{n-1}, as in the bijection principle.
  15. Since n≥1n \ge 1 and k≥0k \ge 0, we have n−1≤Nn - 1 \le N and N−(n−1)=kN - (n - 1) = k. By the symmetry of binomial coefficients, (Nn−1)=(Nk)\binom{N}{n-1} = \binom{N}{k}.
  16. By step 4, the number of multisets of size kk on XX is also (n+k−1k)\binom{n + k - 1}{k}.

Idea

Write a solution as a row of kk stars, split into nn groups by n−1n - 1 bars. The row has n+k−1n + k - 1 places, and the solution is determined by which places hold bars. So solutions match subsets of n−1n - 1 places, and there are (n+k−1n−1)=(n+k−1k)\binom{n+k-1}{n-1} = \binom{n+k-1}{k} of them.

Reading path

To understand this page from the ground up, read these 51 pages in order. The foundations come first. The path takes the proofs Proof of the number of k-element subsets by induction, Proof that a composition of injections is injective, Proof that a function is bijective iff it has a two-sided inverse, Proof of the complement principle, Proof of Pascal's rule from the recursive definition, Proof that a composition of surjections is surjective, Proof of the symmetry of binomial coefficients from the factorial formula, Proof of the factorial formula for binomial coefficients by induction, Proof of the rule of sum, Proof of the bijection principle.

  1. Binomial coefficient definition
  2. Cardinality of a finite set definition
  3. Combination definition
  4. Combinations with repetition definition
  5. Element definition
  6. Factorial definition
  7. Proposition concept
  8. Proof of Pascal's rule from the recursive definition proof
  9. Set definition
  10. Conjunction definition
  11. Implication definition
  12. Predicate definition
  13. Pascal's rule statement
  14. Empty set object
  15. Ordered pair definition
  16. Intersection definition
  17. Existential quantifier definition
  18. Universal quantifier definition
  19. Proof of the factorial formula for binomial coefficients by induction proof
  20. Cartesian product definition
  21. Disjoint sets definition
  22. Subset definition
  23. Uniqueness quantifier definition
  24. Factorial formula for binomial coefficients statement
  25. Binary relation definition
  26. Proof of the symmetry of binomial coefficients from the factorial formula proof
  27. Function definition
  28. Symmetry of binomial coefficients statement
  29. Codomain definition
  30. Function composition definition
  31. Identity function definition
  32. Injective function definition
  33. Surjective function definition
  34. Left inverse definition
  35. Right inverse definition
  36. Proof that a composition of injections is injective proof
  37. Proof that a composition of surjections is surjective proof
  38. Bijective function definition
  39. Composition of injections is injective statement
  40. Composition of surjections is surjective statement
  41. Proof of the rule of sum proof
  42. Proof that a function is bijective iff it has a two-sided inverse proof
  43. Rule of sum statement
  44. Bijective iff it has a two-sided inverse statement
  45. Proof of the bijection principle proof
  46. Proof of the complement principle proof
  47. Bijection principle statement
  48. Complement principle statement
  49. Proof of the number of k-element subsets by induction proof
  50. Number of k-element subsets statement
  51. Proof of stars and bars by a bijection with subsets proof

Where this leads

1 page builds on this one.

Further reading

  1. Web https://en.wikipedia.org/wiki/Stars_and_bars_(combinatorics), Theorem two
About this page
TagKB70806JGH
URIm2://KB70806JGH
Kindproof
WritingW0 stub
MSC05A10
ProvesStars and bars
UsesCombinations with repetition, Bijective function, Bijection principle, Number of k-element subsets, Symmetry of binomial coefficients, Bijective iff it has a two-sided inverse
Changed4 November 2026

Markdown · JSON · Edit on GitHub

What this page needs for W1

  • an inventory row: the row of the inventory that the node accounts for (0 of 1)

The writing levels say how complete the text of a page is. They do not measure its truth.

What links here

No page links to this page yet.