Stars and Bars¶
Description¶
Let . Stars and bars is a counting method for the number of ways to distribute identical objects among distinct boxes, often by representing objects as stars and dividers as bars.
Interpretation¶
Stars and bars turns a problem of distributing identical objects among boxes into an arrangement problem. It is useful when objects are identical and only the counts in each box matter.
The six stars and two bars in the figure represent . Every arrangement of six stars and two bars corresponds to one nonnegative integer solution of . Choosing the two bar positions among eight positions gives distributions. In the general notation below, objects and boxes require bars.
Key Results¶
- Stars and bars counts nonnegative integer solutions to .
- The number of such solutions is .
- Positive integer solutions can be counted by first giving one object to each box.
Examples¶
- The number of ways to distribute ten identical candies among four children is a stars-and-bars count.
- The number of nonnegative solutions to is counted by stars and bars.
- Allocating identical spare parts among labelled warehouses can use stars and bars.
Prerequisites¶
Related Concepts¶
- Discrete Uniform Distribution
- Binomial Coefficient
- Combination
- Sampling With and Without Replacement
Sources¶
- Probability Theory for EOR · Week 1
Keywords: combinations with repetition, multiset coefficient, Bose-Einstein counting Symbols: element of, natural numbers
Last updated: 20 October 2026 03:02
Stars and BarsCountingDiscrete Uniform DistributionBinomial CoefficientCombinationSampling With and Without Replacement