ToolNimba

๐Ÿ”ข Combinations with Repetition Calculator (Multiset Coefficient)

Shihab Mia By Shihab Mia ยท Updated 2026-07-02

This combinations with repetition calculator is provided for educational reference. Results are computed from the standard multiset coefficient formula C(n + r - 1, r). For graded coursework, exams, or research, confirm that repetition and order assumptions match your problem and verify important results independently.

With repetition allowed, C(n+r-1, r)
-
Without repetition, standard C(n, r)
-
How the answer is built
-

Enter n (number of distinct types, 1 or more) and r (how many you pick, 0 or more). Repetition lets you pick the same type more than once.

Combinations with repetition count how many ways you can choose r items from n types when the same type may be picked more than once and order does not matter, and the answer is the multiset coefficient C(n+r-1, r). For example, scooping 3 cones from 5 flavors with doubles allowed gives C(7, 3) = 35 distinct cups. Enter n (the number of types) and r (how many you choose) into this combinations with repetition calculator and it returns C(n+r-1, r) instantly, alongside the standard no-repeats count C(n, r) for comparison.

What is the Combinations with Repetition Calculator?

A combination with repetition (also called a multiset, a combination with replacement, or n multichoose r) is a selection of r items drawn from n distinct types, where any type may appear any number of times and the arrangement does not matter. Because repeats are allowed, the result is usually larger than an ordinary combination. The count is given by the multiset coefficient C(n + r - 1, r), which equals (n + r - 1)! / (r! (n - 1)!). The same value can be written C(n + r - 1, n - 1), since those two binomial coefficients are equal by symmetry.

The cleanest way to understand the formula is the stars and bars argument. Imagine you must place r identical stars into n labelled bins, one bin per type, where the number of stars in a bin says how many of that type you chose. To mark the boundaries between the n bins you need n - 1 dividers, the bars. Lay out the r stars and n - 1 bars in a single row: every distinct arrangement of that row corresponds to exactly one valid selection. There are r + (n - 1) positions in total, and you simply choose which r of them hold stars, which is C(n + r - 1, r). That single picture explains where every part of the formula comes from, and it is why a combinations with repetition calculator only needs two inputs.

Combinations with repetition differ from the three other counting cases you meet alongside them. Ordinary combinations C(n, r) forbid repeats and ignore order. Permutations nPr forbid repeats but respect order. Permutations with repetition give n^r when order matters and repeats are allowed. Combinations with repetition are the remaining case: repeats allowed, order ignored. Choosing the right one hinges on two yes or no questions, can an item be picked again, and does the order of the picks matter. Get those two answers right and the formula follows.

A useful mental check is that with repetition r is free to exceed n, because a single type can be reused. Choosing 10 scoops from 5 flavors is a valid multiset problem, evaluated as C(5 + 10 - 1, 10) = C(14, 10) = 1001, even though the no-repeats count C(5, 10) does not exist. This freedom is exactly why the multiset coefficient grows much faster than plain nCr as r climbs, and why the calculator shows both numbers side by side so the gap is obvious.

The multiset coefficient appears far beyond dessert counting. It equals the number of non-negative integer solutions to x1 + x2 + ... + xn = r, the number of monomials of degree r in n variables, the number of distinct outcomes when rolling r identical dice with n faces, and the number of ways to distribute r identical objects among n recipients. Whenever you are distributing identical things into labelled groups, or counting selections where duplicates are allowed and sequence is irrelevant, the same formula C(n + r - 1, r) does the work.

When to use it

  • Counting the ways to choose a handful of scoops, donuts, or sweets from a fixed set of flavors where repeats are allowed and order does not matter.
  • Working out how many non-negative integer solutions an equation like x1 + x2 + ... + xn = r has, a direct stars and bars problem.
  • Counting distinct outcomes when rolling several identical dice, where only the multiset of faces matters, not which die showed what.
  • Finding the number of monomials of a given degree in several variables, a common step in algebra and combinatorics courses.
  • Counting how many ways r identical objects (coins, votes, tokens) can be distributed among n labelled people or boxes.
  • Sanity-checking probability and inventory problems where duplicate selections are valid, such as picking a bag of mixed candy by type.

How to use the Combinations with Repetition Calculator

  1. Enter n, the number of distinct types you can choose from (must be 1 or more).
  2. Enter r, how many items you are selecting in total (0 or more, and repeats are allowed).
  3. Read the combinations-with-repetition count C(n+r-1, r) from the highlighted box.
  4. Compare it with the standard no-repeats count C(n, r) shown alongside, and check the working line to see the formula applied.
  5. Adjust n or r and the result updates instantly, so you can test how allowing repeats changes the count.

Formula & method

Combinations with repetition = C(n + r - 1, r) = (n + r - 1)! / (r! (n - 1)!), where n is the number of distinct types and r is the number of items chosen. This equals C(n + r - 1, n - 1) by symmetry. By stars and bars it is the number of ways to place r identical stars into n bins separated by n - 1 bars.
Combinations With Repetition: Stars & Bars Choose r = 3 scoops from n = 5 flavors, repeats allowed C(n + r - 1, r) = C(5 + 3 - 1, 3) = C(7, 3) = 35 One valid selection: 2 of flavor A, 0 of B, 1 of C, 0 of D, 0 of E * * | | * | | r = 3 stars (picks) + n - 1 = 4 bars (dividers) = 7 positions Choose which 3 of the 7 positions hold stars: C(7, 3) = 35 Compare: With repetition C(7, 3) = 35 No repetition C(5, 3) = 10

Worked examples

An ice cream shop has 5 flavors. You buy a cup with 3 scoops and doubles are allowed. How many distinct cups are possible if order does not matter?

  1. Here n = 5 types and r = 3 picks, with repetition allowed.
  2. Apply the formula: C(n + r - 1, r) = C(5 + 3 - 1, 3) = C(7, 3).
  3. C(7, 3) = 7 x 6 x 5 / (3 x 2 x 1) = 210 / 6 = 35.
  4. For comparison, with no repeats it would be C(5, 3) = 10, so allowing doubles more than triples the count.

Result: C(7, 3) = 35 distinct cups with repetition (versus 10 without).

How many non-negative integer solutions does x1 + x2 + x3 + x4 = 10 have?

  1. Each unit of the total 10 is a star; the 4 variables are 4 bins, needing n - 1 = 3 bars.
  2. So n = 4 types and r = 10 items, and the answer is C(n + r - 1, r) = C(4 + 10 - 1, 10) = C(13, 10).
  3. C(13, 10) = C(13, 3) = 13 x 12 x 11 / (3 x 2 x 1) = 1716 / 6 = 286.

Result: There are C(13, 10) = 286 non-negative integer solutions.

You roll 2 identical six-sided dice. How many distinct outcomes are there if you only care about the multiset of faces, not which die is which?

  1. A face value is a type, so n = 6, and you have r = 2 dice, with repetition allowed (both dice can show the same face).
  2. Apply the formula: C(n + r - 1, r) = C(6 + 2 - 1, 2) = C(7, 2).
  3. C(7, 2) = 7 x 6 / (2 x 1) = 42 / 2 = 21.
  4. This matches the 21 unordered pairs: 6 doubles plus 15 mixed pairs. Note that 6^2 = 36 counts ordered outcomes instead.

Result: C(7, 2) = 21 distinct unordered outcomes for two dice.

Combinations with repetition C(n+r-1, r) versus standard C(n, r) for small n and r

n typesr chosenWith repetitionNo repetition
3263
42106
533510
635620
104715210

Which counting formula to use, by repetition and order

Repeats allowed?Order matters?FormulaName
NoNoC(n, r)Combination
NoYesn! / (n - r)!Permutation
YesNoC(n + r - 1, r)Combination with repetition
YesYesn^rPermutation with repetition

The same multiset problem, described in four common wordings

Problem wordingn (types)r (picks)Answer
Choose 3 scoops from 5 flavors, doubles ok53C(7, 3) = 35
x1 + ... + x4 = 10, non-negative integers410C(13, 10) = 286
Distribute 6 identical coins to 3 people36C(8, 6) = 28
Roll 2 identical six-sided dice, unordered62C(7, 2) = 21

Common mistakes to avoid

  • Using n instead of n + r - 1 in the top of the binomial. The combinations-with-repetition formula is C(n + r - 1, r), not C(n, r). Forgetting to add r - 1 to the top index gives the ordinary no-repeats count and badly undercounts the true number of selections.
  • Confusing types (n) with picks (r). n is the number of distinct kinds available to choose from, and r is how many you take in total. Swapping them changes the answer unless n and r happen to be equal, so read each problem carefully before plugging in.
  • Counting order when it should be ignored. If two orderings of the same picks count as the same outcome (like the contents of a bag), use combinations with repetition. If order distinguishes them, you want a permutation count of n^r instead.
  • Assuming r cannot exceed n. With repetition allowed, r can be larger than n because the same type may be chosen many times. Choosing 10 scoops from 5 flavors is perfectly valid, and the formula handles it. Only the no-repeats count needs r at most n.
  • Using n - 1 stars and r bars by mistake. Stars represent the r picks and bars represent the n - 1 dividers between types. Reversing them, for example placing n - 1 stars and r bars, computes the wrong binomial. Keep it straight: r stars, n - 1 bars, C(n + r - 1, r).
  • Requiring each type at least once when the problem does not. The standard formula counts selections where a type may appear zero times. If every type must appear at least once, subtract one of each first, reducing to C(r - 1, n - 1). Applying the plain formula to an at-least-one problem overcounts.

Glossary

Combination with repetition
A selection of r items from n types where repeats are allowed and order does not matter, counted by C(n + r - 1, r).
Multiset coefficient
Another name for the combinations-with-repetition count, often written as n multichoose r.
Stars and bars
A counting technique that places r identical stars into n bins using n - 1 bars, giving C(n + r - 1, r) arrangements.
Binomial coefficient
The value C(a, b) = a! / (b! (a - b)!), the number of ways to choose b items from a distinct items without repetition.
Multiset
A collection in which the same element may appear more than once, so only the counts of each type matter, not their order.
Combination with replacement
A synonym for combination with repetition, borrowed from sampling where a chosen item is put back before the next pick.
n (types)
The number of distinct kinds of item available to pick from.
r (picks)
The number of items you select in total, with repeats permitted.

Frequently asked questions

What is the formula for combinations with repetition?

The number of combinations with repetition is the multiset coefficient C(n + r - 1, r) = (n + r - 1)! / (r! (n - 1)!), where n is the number of distinct types and r is how many items you choose. It can also be written C(n + r - 1, n - 1) by the symmetry of binomial coefficients.

How do you calculate combinations with repetition by hand?

Compute C(n + r - 1, r). First add: the top number is n + r - 1 and the bottom is r. Then evaluate the binomial coefficient as (n + r - 1)! / (r! (n - 1)!). For example with n = 5 and r = 3 you get C(7, 3) = 35.

How does stars and bars explain the formula?

Picture r identical stars (your picks) and n - 1 bars (dividers between the n types) laid in a row. Every arrangement of stars and bars corresponds to one valid selection. There are n + r - 1 positions, and you choose which r hold stars, giving C(n + r - 1, r).

Can r be larger than n with repetition?

Yes. Because the same type can be chosen many times, r may exceed n. For example you can pick 10 scoops from just 5 flavors. This is different from ordinary combinations, where r must not be larger than n.

What is the difference between combinations with and without repetition?

Without repetition each type can be chosen at most once, counted by C(n, r). With repetition a type can be chosen any number of times, counted by the larger value C(n + r - 1, r). In both cases the order of the picks is ignored.

When should I use combinations with repetition instead of permutations?

Use combinations with repetition when repeats are allowed and order does not matter, such as the contents of a bag. If order matters as well as repeats, use permutations with repetition, which give n^r instead.

Is the multiset coefficient the same as combinations with replacement?

Yes. Combinations with repetition, combinations with replacement, multiset coefficient, and n multichoose r are all names for the same count, C(n + r - 1, r). Different fields favor different terms but the value is identical.

How do combinations with repetition count non-negative integer solutions?

The number of non-negative integer solutions to x1 + x2 + ... + xn = r equals C(n + r - 1, r). Each variable is a type (a bin) and each unit of the total r is a star, so the stars and bars formula applies directly.

What if every type must be chosen at least once?

Give each of the n types one item first, which uses up n picks, then distribute the remaining r - n freely. The count becomes C(r - 1, n - 1), valid when r is at least n. This is the positive-integer-solutions version of stars and bars.

Does this calculator handle large values of n and r?

Yes, within the limits of standard number precision. The result grows very quickly, so extremely large inputs can produce values too big to display exactly, but for typical homework and everyday counting problems the calculator returns exact whole numbers.

Sources