ET
May 8, 2026
How to compute combinations with repetitions (stars and bars)?
I am studying combinatorics and I understand the basic combinations formula for choosing items from distinct items without repetition.
But I am confused about combinations with repetition (also called multisets). The formula is:
where is the number of types and is the number of items chosen.
Can someone explain:
- Why the formula is using the stars and bars analogy?
- How to apply it to: "How many ways to buy 10 donuts if there are 5 flavors available?"
- What about the equation with ? How many non-negative integer solutions?
- What changes if (positive solutions)?
1 answers286 views
Loading comments...
1 Answer
DS
Dr. Sarah MitchellMay 9, 2026 Accepted**Stars and Bars Explanation:**
We want to choose $k$ identical items from $n$ types, allowing repetition. Represent the $k$ items as stars ($*$), and use $n-1$ bars ($|$) to separate the $n$ types.
For example, choosing 10 donuts from 5 flavors: arrange 10 stars and 4 bars in a row. The number of stars before the first bar = number of flavor 1 donuts, between bar 1 and 2 = flavor 2, etc.
Total arrangements = $\binom{10 + 5 - 1}{10} = \binom{14}{10} = 1001$.
**General Formula:**
$$\binom{k + n - 1}{k} = \binom{k + n - 1}{n - 1}$$
**Applying to Equations:**
For $x_1 + x_2 + x_3 + x_4 = 15$ with $x_i \geq 0$:
- $n = 4$ types, $k = 15$ items
- Solutions: $\binom{15 + 4 - 1}{15} = \binom{18}{3} = 816$
For **positive** solutions $x_i \geq 1$:
Let $y_i = x_i - 1 \geq 0$. Then $y_1 + y_2 + y_3 + y_4 = 15 - 4 = 11$.
Solutions: $\binom{11 + 4 - 1}{11} = \binom{14}{3} = 364$
**Key Insight:** The stars and bars method converts combinatorial selection with repetition into counting arrangements of identical objects and dividers. This is one of the most powerful tools in combinatorics.
Loading comments...