Stars and Bars definition
Stars and bars counts ways to distribute identical objects among distinct groups.
Stars and Bars in a picture
How it works
For n identical items and k groups, write n stars and k − 1 bars. The bars separate the groups, and adjacent bars allow empty groups. Choose the k − 1 bar positions from n + k − 1 total positions. This counts the nonnegative integer solutions to x₁ + ⋯ + xₖ = n.
Worked examples
Distribute four identical tokens to two boxes. How many ways?
Use one bar in five positions, giving 5.
How many nonnegative triples sum to 3?
C(5, 2) = 10.
How many positive triples sum to 7?
Give each group one first, then distribute 4 more. C(6, 2) = 15.
Common mistake
Use a different method for distinct items or groups with upper limits, or adjust the count to account for those limits.
Quick check
How many bars are needed for four groups?
Show answer
Three.
What does an adjacent pair of bars show?
Show answer
An empty group between them.
How many nonnegative pairs sum to 5?
Show answer
Six.
Sources
Flashcard
Stars and Bars
Reveal the definition
Stars and bars counts ways to distribute identical objects among distinct groups.
Effortless Math. “Stars and Bars.” Math Dictionary.



