Concept 05 / 09Permutations and Combinations
Distributing Identical Objects: Stars and Bars and Integer Solutions of Equations
Counting non-negative and positive integer solutions of x1 + x2 + ... + xr = n, identical objects into distinct boxes, handling lower and upper bounds by substitution and inclusion-exclusion, and the coefficient method with generating functions.
How many ways can identical objects be distributed among distinct boxes? Equivalently, how many solutions does have in non-negative integers? Here is the number of objects in box .
Stars and bars. Represent a distribution as a row of stars (the objects) and bars (dividers between boxes). The stars before the first bar go to box , those between the first and second bars to box , and so on. The figure shows . Every arrangement of stars and bars gives exactly one distribution, and vice versa. The arrangement is fixed by choosing which of the positions hold the bars, so
number of non-negative solutions .
For positive solutions (each , no empty box), first put one object in each box, then distribute the remaining freely: . Equivalently, choose of the gaps between stars in a row to place the dividers.
Lower bounds: if , substitute . The equation becomes , which is counted by stars and bars.
Upper bounds: if , use inclusion-exclusion. Count all solutions, subtract those where some (substitute to handle the violation), add back those where two variables violate their bounds, and so on. Alternatively, use the coefficient method: the number of solutions is the coefficient of in . Each factor lists the allowed values of one variable, and multiplying out collects the ways the exponents can add to . The generating function method handles any mixture of constraints, such as 'even values only' (use ).
Useful expansions for the coefficient method: (which is stars and bars in disguise), and .
Which model applies? This is the question that decides the answer.
Identical objects into distinct boxes: stars and bars.
Distinct objects into distinct boxes, any number per box: (each object chooses a box).
Distinct objects into distinct boxes, none empty: onto functions, .
Identical objects into identical boxes: partitions of , counted by listing (no simple formula).
Distinct objects into identical boxes: partitions of a set (Stirling numbers), usually small enough to count by cases.
Key Takeaways:
- , : .
- : .
- Lower bounds: shift variables; upper bounds: inclusion-exclusion or the coefficient method.
- Number of solutions with bounds = coefficient of in .
- Identical into distinct: stars and bars. Distinct into distinct: .
- The number of terms in the expansion of is .
- Pitfall: using stars and bars for distinct objects, or for identical ones.
Brain-Teaser 1: In how many ways can identical chocolates be given to children so that each child gets at least and no child gets more than ?
Solution: With , substitute : with . Without the upper bound: . Subtract solutions where some : set , leaving a sum of : each, times children, . Two variables at least would need a sum of at least : impossible. So the answer is . Check with the coefficient method: the coefficient of in is also . Shifting for lower bounds and inclusion-exclusion for upper bounds is the standard two-step routine.
Brain-Teaser 2: How many non-negative integer solutions does have with even?
Solution: Write , , with . For each , the equation has non-negative solutions. Summing for to : . A parity condition on one variable is easiest handled by summing over its allowed values; each inner count is a small stars-and-bars count.
Brain-Teaser 3: How many terms are there in the expansion of ? How many in ?
Solution: A term in the first expansion is with , all distinct monomials, so the count is . In the second, the terms are powers of a single variable , from to , and every power appears, giving terms. The difference is instructive: stars and bars counts distinct monomials only when the variables are independent; with one variable, many different combinations collapse onto the same power.
Practice this concept
Free · no account required · instant solutions