Distributions & Stars and Bars
Distributing objects into bins, integer partitions, compositions
What you need to know
- Stars and bars (also called balls and urns). The equation has solutions in whole numbers that are zero or positive, and if every is at least . Why: line up stars and bars. The bars cut the stars into groups ( means ), so you choose which of the spots are bars. Example: has solutions, or with each at least .
- Identical objects to different people (or boxes) is the same count: is what person gets. If person must get at least , give them first. (In symbols, use , which only has to be zero or positive.) Example: identical candies to kids, at least each: hand out , then share the other in ways.
- Upper limits ( at most ) need inclusion-exclusion (PIE): subtract the solutions with some variable over , then add back the overlaps. See the worked example.
- Different objects into different boxes is not stars and bars. Each of the objects picks a box: ways. Example: different books to kids: ways.
- Identical objects into identical boxes (partitions) have no formula; list them, largest part first. Example: splits into parts in ways: , , , , , , .
- Ordered sums. can be written as an ordered sum of positive whole numbers (any number of parts) in ways. Why: in , each of the plus signs either stays or is erased. Example: has , such as , , and .
How AMC 10 tests it
- Problems 10–18: "How many ways can identical candies be given to children if each gets at least one?"
- Equations in disguise: numbers whose digits add up to a given total, the number of terms in an expansion, ways to pay an amount with coins.
- Problems 18–24: a cap ("no child receives more than ") that forces PIE, or a twist about identical versus different objects.
- Often the top or bottom of a probability fraction.
Standard approaches
- Sort first: identical or different objects? Identical or different boxes? Only identical objects into different boxes is stars and bars.
- Shift variables to remove lower limits, then use .
- For upper limits, count all, subtract the cases with one variable too big, add back the cases with two, subtract the cases with three, and so on. Stop when that many variables cannot all be too big at once.
- For small or identical boxes, list the partitions from the largest part down.
- Check on a tiny case you can list.
Worked example
How many ordered triples of nonnegative integers satisfy with , , and ?
(A) (B) (C) (D) (E)
Solution. "Nonnegative" means zero or positive.
Step 1: ignore the limits. With stars and bars: solutions.
Step 2: subtract the too-big cases. If , write , with zero or positive. Then , which has solutions. The same holds for and for , so subtract .
Step 3: add back the overlaps. A solution with two variables at least was subtracted twice. If and , then and : one solution for each of the pairs, so add back . All three is impossible.
Step 4: combine. .
Check. The triples are the orderings of , , and : .
The answer is .
Pitfalls
- Using when the objects are different (the answer is ) or the boxes are identical (list the partitions).
- Mixing up (every part at least ) with (parts can be ): versus for .
- Forgetting to add back the double overlaps after subtracting the over-the-limit cases (here that gives , choice (A)).
- Miscounting bars: boxes need bars, not .
Traps that recur
- Distributing the five 2's without requiring every factor to exceed 1, which counts factors equal to 1 and overcounts badly. (2020 AMC 10B #25)
- Forgetting that dice cannot show 0 and counting solutions to a sum of 10 over 7 nonnegative variables, or worrying about the upper bound 6 when it cannot bind. (2018 AMC 10A #11)
- Dropping the constant 1 from the count (treating the exponents as summing to exactly N with no slack), which gives C(N-1, 3) and no matching choice. (2016 AMC 10A #20)
- Treating the six cookies as distinguishable and answering 3^6 = 729, choice (E). (2003 AMC 10A #21)
Problems, easiest first
Open any of them to try it here; the worked solution is on the problem's own page.