01 / 20

Combinations with
Repetition

Learn how to count selections where order does not matter and items can be chosen more than once, using the powerful stars and bars technique.

Discrete Math

What Are Combinations with Repetition?

A combination with repetition (also called a multiset) is a way to choose \( k \) items from \( n \) types when order does not matter and each type may be selected more than once.

Order?
Does not matter. Choosing apple then banana is the same as banana then apple.
Repetition?
Allowed. You can pick the same item multiple times.

Why Does This Matter?

Combinations with repetition appear in many real scenarios where you select from categories and duplicates are allowed.

Shopping
Choosing 6 donuts from 4 varieties at a bakery.
Distributing
Placing 10 identical coins into 3 different jars.
Equations
Counting non-negative integer solutions to \( x_1 + x_2 + x_3 = 7 \).

The Stars and Bars Model

The key insight is to represent each selection as a sequence of stars (items chosen) separated by bars (dividers between types).

3 scoops from 4 flavors: one arrangement ★ | ★ | | ★ Vanilla Choco Straw. Mint Another arrangement: all 3 scoops are Chocolate | ★ ★ ★ | |
\( k \) stars + \( n-1 \) bars = \( n+k-1 \) total symbols
Choose which positions are bars (or stars): that is the count!

The Core Formula

The number of ways to choose \( k \) items from \( n \) types with repetition allowed is:

This equals the number of ways to arrange \( k \) stars and \( n - 1 \) bars in a row of \( n + k - 1 \) positions.

Why Does the Formula Work?

1
Create a sequence of symbols. Line up \( n + k - 1 \) blank slots.
2
Place the bars. Choose \( n - 1 \) of those slots for bars. The remaining \( k \) slots become stars.
3
Read off the selection. Stars before the first bar = count for type 1, stars between bars 1 and 2 = count for type 2, and so on.
4
Every arrangement is unique. Each distinct placement of bars gives a different multiset, and vice versa.

With vs. Without Repetition

Without Repetition With Repetition
Notation \( \binom{n}{k} \) \( \binom{n+k-1}{k} \)
Duplicates Not allowed Allowed
Constraint \( k \leq n \) \( k \) can exceed \( n \)
Example: 3 from 4 \( \binom{4}{3} = 4 \) \( \binom{6}{3} = 20 \)
Model Subset of size \( k \) Stars and bars

The Four Counting Scenarios

Order Matters Order Doesn't Matter
No Repetition Permutation: \( \frac{n!}{(n-k)!} \) Combination: \( \binom{n}{k} \)
With Repetition Perm. w/ rep: \( n^k \) Comb. w/ rep: \( \binom{n+k-1}{k} \)

How to Apply the Formula

1
Identify the types. Determine \( n \): how many distinct categories are available?
2
Identify the selections. Determine \( k \): how many items are you choosing in total?
3
Check conditions. Confirm that order does not matter and repetition is allowed.
4
Plug in. Compute \( \binom{n + k - 1}{k} \).
5
Simplify. Expand the factorial or use Pascal's triangle for small values.

Example 1: Donut Selection

A bakery offers 4 types of donuts. You want to buy 6 donuts. How many different selections can you make?

\( n = 4 \) types, \( k = 6 \) donuts
★ ★ | ★ | ★ ★ | ★
\( \binom{4+6-1}{6} = \binom{9}{6} = \frac{9!}{6!\,3!} = 84 \)

Example 2: Integer Solutions

How many non-negative integer solutions does the equation \( x_1 + x_2 + x_3 = 7 \) have?

1
Identify: \( n = 3 \) types (variables), \( k = 7 \) selections (units).
2
Apply formula: \( \binom{3 + 7 - 1}{7} = \binom{9}{7} = \binom{9}{2} \).
3
Compute: \( \binom{9}{2} = \frac{9 \times 8}{2} = 36 \).

Example 3: Coins in Jars

Distribute 10 identical coins into 5 distinct jars. How many ways?

★★★ Jar 1 ★ Jar 2 0 Jar 3 ★★★★ Jar 4 ★★ Jar 5 One possible distribution: 3 + 1 + 0 + 4 + 2 = 10

The Equation Connection

The number of multisets of size \( k \) from \( n \) types is exactly the number of non-negative integer solutions to:

★ Stars
Each star is one unit to distribute. There are \( k \) stars total.
| Bars
Each bar separates one variable from the next. You need \( n - 1 \) bars.

Enumerating: \( n = 3, k = 2 \)

Choose 2 items from types \( \{A, B, C\} \) with repetition. The formula gives \( \binom{3+2-1}{2} = \binom{4}{2} = 6 \). Let us list them all:

Multiset Stars and Bars {A, A} ★★ | | {A, B} ★ | ★ | {A, C} ★ | | ★ {B, B} | ★★ | {B, C} | ★ | ★ {C, C} | | ★★

Common Mistakes to Avoid

✕ Using \( \binom{n}{k} \)
The ordinary combination formula does not allow repetition. You need \( \binom{n+k-1}{k} \).
✕ Swapping \( n \) and \( k \)
Remember: \( n \) is the number of types, \( k \) is the number of selections. Mixing them up changes the answer entirely.
✕ Counting Order
If the problem says "how many different selections," order does not matter. Use combinations, not permutations (\( n^k \)).

Summary and Quick Reference

Concept Details
Formula \( \binom{n+k-1}{k} = \binom{n+k-1}{n-1} \)
Model \( k \) stars + \( n-1 \) bars
Equivalent problem Non-negative integer solutions to \( x_1 + \cdots + x_n = k \)
Key condition Order irrelevant, repetition allowed
Total symbols \( n + k - 1 \)

Question 1 of 5

A candy shop has 5 types of candy. You want to buy 8 pieces (repetition allowed, order doesn't matter). How many selections are possible?

Question 2 of 5

How many non-negative integer solutions does the equation \( x_1 + x_2 + x_3 + x_4 = 5 \) have?

Question 3 of 5

In the stars-and-bars model, choosing \( k \) items from \( n \) types requires arranging how many symbols in total?

Question 4 of 5

You must place 12 identical balls into 3 distinct boxes. How many ways can this be done?

Question 5 of 5

Which of the following problems is NOT equivalent to a combination-with-repetition problem?