Skip to main content

Sigma Calculator — 543+ Free Calculator Tools

Combination with Replacement Calculator

How many ways can you choose r items from n types when repeats are allowed and order does not matter? This free calculator evaluates C(n+r−1, r) instantly, with every step of the working shown.

An ice-cream shop offers 5 flavors, and you want a bowl with 3 scoops — but you are allowed to pick the same flavor more than once. How many different bowls are possible? Chocolate-chocolate-vanilla is one bowl; chocolate-vanilla-vanilla is another; but chocolate-vanilla-strawberry in any serving order is still the same bowl, because the order of the scoops does not matter. Counting selections like this — where repetition is allowed but order is irrelevant — is exactly what a combination with replacement counts. This free Combination with Replacement Calculator evaluates the count for any n and r in milliseconds, shows each step of the working, and even tells you how the answer compares with the no-replacement case, so you can see precisely what repetition adds.

The idea sits at the heart of combinatorics, the mathematics of counting. Ordinary combinations answer “how many ways can I choose r distinct items from n?” — the classic lottery question. Combinations with replacement answer the richer question “how many ways can I choose r items from n types, reusing types as often as I like?” The two answers differ dramatically: choosing 3 scoops from 5 flavors without repetition gives 10 bowls, but allowing repetition gives 35. That gap — 25 extra bowls created purely by permitting repeats — is the entire subject of this page. Below you will find the formula, the famous stars-and-bars reasoning behind it, fully worked numerical examples, real-world applications from statistics to computer science, and the mistakes that most often trap students.

How to Use the Combination with Replacement Calculator

Using the calculator takes three quick steps. First, enter n, the number of types (or categories) you are choosing from — the 5 ice-cream flavors, the 6 faces of a die, the 4 suits in a deck. This must be a whole number of 1 or more. Second, enter r, the number of items you are selecting — the 3 scoops, the 4 dice rolls, the 2 cards drawn with replacement. This must be a whole number of 0 or more. Third, click Calculate Combinations.

The result appears immediately as a large number, followed by a three-step working: the formula, the substitution of your values, and the final evaluation. Beneath that, two bonus insights appear automatically. The first shows the symmetric form of the answer — C(n+r−1, n−1) — which always equals C(n+r−1, r) and is sometimes easier to compute by hand. The second shows what the count would be without replacement, C(n, r), and exactly how many extra selections repetition contributes. Use the Reset button to return to the default example (n = 5, r = 3, giving 35). If you enter an invalid value — a negative number, a decimal, or a missing input — a clear red message explains the problem instead of silently producing nonsense.

What Is Combination with Replacement?

A combination with replacement (also called a multicombination, an r-multiset of an n-element set, or a combination with repetition) is a selection of r items from n types in which each type may be chosen any number of times — including zero times — and in which the order of selection is ignored. Two selections that contain the same multiset of items are the same combination, no matter the sequence in which the items were picked.

A concrete small case makes this vivid. Take n = 2 types, call them A and B, and choose r = 2 items with replacement. The possibilities are: AA, AB, BB — three combinations. Note that BA is not listed separately, because order does not matter: AB and BA are the same bowl, the same hand, the same selection. If repetition were forbidden, BB and AA would vanish and only AB would remain — one combination instead of three. The formula predicts C(2+2−1, 2) = C(3, 2) = 3, which matches the hand count exactly.

Mathematicians visualize this with the stars and bars argument, one of the most elegant counting ideas in all of combinatorics. Imagine your r chosen items as r stars (★★★) in a row, and imagine n−1 bars (|) that divide the row into n compartments — one compartment per type. Every arrangement of stars and bars encodes one combination: the stars in compartment 1 say how many items of type 1 you took, the stars in compartment 2 say how many of type 2, and so on. For the ice-cream example (n = 5 flavors, r = 3 scoops), one arrangement might be ★★||★|| — two scoops of flavor 1, one of flavor 3, none of the rest. Counting combinations with replacement is therefore the same as counting arrangements of r stars and n−1 bars in a row of n+r−1 positions — and choosing which r of those positions hold stars is precisely C(n+r−1, r). The formula is not a mystery; it is a direct translation of this picture.

This concept generalizes beautifully. The same count answers: how many nonnegative integer solutions does x₁ + x₂ + … + xₙ = r have? (Each solution is one combination.) How many multisets of size r can be drawn from n types? How many ways can r identical balls be dropped into n distinct boxes? All of these are the same question wearing different clothes, and all are answered by C(n+r−1, r).

The Combination with Replacement Formula

The formula for the number of combinations of r items chosen from n types with replacement is:

C(n+r−1, r) = (n+r−1)! ÷ (r! × (n−1)!)

Here n is the number of types (n ≥ 1), r is the number of items chosen (r ≥ 0), and C(N, K) is the ordinary binomial coefficient “N choose K” = N! ÷ (K! × (N−K)!). The expression n+r−1 is the total number of star-and-bar positions; r is the number of stars placed among them.

An equivalent and sometimes handier form exploits the symmetry of binomial coefficients, C(N, K) = C(N, N−K):

C(n+r−1, r) = C(n+r−1, n−1)

When n−1 is smaller than r, the second form needs less arithmetic. For example, with n = 4 types and r = 10 items, C(13, 10) = C(13, 3) — computing “13 choose 3” by hand (13×12×11 ÷ 6 = 286) is far easier than expanding “13 choose 10” directly, yet both equal 286. The calculator shows you this symmetric form automatically under every answer.

Two special cases are worth memorizing. If r = 0, you are choosing nothing, and there is exactly 1 way to do that: C(n−1, 0) = 1 for any n. If n = 1, there is only one type, so every selection is forced — r copies of the single type — and the count is C(r, r) = 1 for any r. Both fall out of the formula naturally, and both are handled correctly by the calculator above.

Worked Examples

Example 1 — Ice-cream scoops. A shop has n = 5 flavors; you order r = 3 scoops, repeats allowed, order irrelevant. Apply the formula: C(5+3−1, 3) = C(7, 3). Expand: 7! ÷ (3! × 4!) = (7×6×5) ÷ (3×2×1) = 210 ÷ 6 = 35. There are 35 possible bowls. Sanity check by categories: bowls with all three scoops the same (5 ways: one per flavor), bowls with exactly two the same (5 choices for the doubled flavor × 4 choices for the single = 20 ways), and bowls with all three different (C(5,3) = 10 ways). Total: 5 + 20 + 10 = 35. The category breakdown confirms the formula.

Example 2 — Dice rolls. Roll r = 4 dice, each with n = 6 faces, and record only the multiset of outcomes (so 1-2-3-4 and 4-3-2-1 count once). The count is C(6+4−1, 4) = C(9, 4). Expand: 9! ÷ (4! × 5!) = (9×8×7×6) ÷ (4×3×2×1) = 3024 ÷ 24 = 126. There are 126 distinct multisets of four dice. Compare with ordered outcomes: 6⁴ = 1296 — ignoring order collapses the 1296 sequences into just 126 multisets, roughly a tenfold reduction.

Example 3 — A larger case. A survey asks r = 10 respondents to each pick a favorite among n = 4 candidates (repeats obviously allowed). The number of possible response profiles is C(4+10−1, 10) = C(13, 10) = C(13, 3) by symmetry = (13×12×11) ÷ 6 = 1716 ÷ 6 = 286. Doing this by hand, the symmetry trick turns an intimidating “13 choose 10” into a quick “13 choose 3”. The calculator performs the same reduction internally, using exact integer arithmetic so the answer is precise no matter how large n and r become.

With vs Without Replacement

The single most important distinction in elementary combinatorics is whether repetition is allowed. The two formulas look similar but behave very differently:

Without replacement (each type used at most once): C(n, r) = n! ÷ (r! × (n−r)!). Requires r ≤ n — you cannot choose 5 distinct flavors from 4. With replacement (types reusable): C(n+r−1, r) = (n+r−1)! ÷ (r! × (n−1)!). Works for any r, however large, because nothing ever runs out.

A side-by-side table for n = 5 types shows how the gap explodes as r grows:

r = 1: without 5, with 5 (identical — with one pick, repetition is impossible)
r = 2: without 10, with 15
r = 3: without 10, with 35
r = 4: without 5, with 70
r = 5: without 1, with 126
r = 6: without — (impossible), with 252

Notice the without-replacement counts rise then fall symmetrically (C(5,r) peaks at r = 2 and 3), while the with-replacement counts grow without bound — for r = 20 the count is C(24, 20) = 10,626. Whenever a problem lets you reuse items, expect the answer to be dramatically larger than the no-repeat version. The calculator displays both numbers for your inputs so you can feel this difference directly.

Do not confuse combinations with replacement with permutations with replacement either. Permutations with replacement count ordered selections: n³ (n = 5, r = 3 gives 125 ordered triples versus 35 unordered multisets). The hierarchy for n = 5, r = 3 is: permutations with replacement 125 > permutations without replacement 60 > combinations with replacement 35 > combinations without replacement 10. Each step — ignoring order, forbidding repeats — shrinks the count, and each corresponds to a distinct real-world question.

Practical Applications

Probability and statistics. The classic “stars and bars” count underlies the Bose–Einstein statistics of physics (distributing indistinguishable particles among energy states) and appears in occupancy problems: given r balls dropped randomly into n boxes, how many distinct occupancy patterns exist? Quality-control sampling with replacement, bootstrap resampling in statistics, and the analysis of dice and card experiments all lean on C(n+r−1, r).

Computer science. Counting multisets is fundamental to algorithm analysis — for instance, counting distinct inputs to a sorting routine up to permutation, or enumerating monomials of degree r in n variables (a monomial x₁^a₁·x₂^a₂·…·xₙ^aₙ with a₁+…+aₙ = r is exactly one combination with replacement). Dynamic programming solutions to coin-change counting (“how many ways to make change?”) are stars-and-bars arguments in disguise.

Everyday decisions. The ice-cream parlor is the canonical example, but the same math governs: choosing r lottery-style picks from n numbers when repeats are allowed; assembling a r-song playlist from n favorite tracks where songs may repeat; a bakery box of r pastries chosen from n varieties; distributing r identical bonus dollars among n employees (some may get zero); and voting profiles, where r voters each back one of n candidates. Anywhere items are drawn from categories with reuse and order is irrelevant, this formula is quietly at work.

Common Mistakes to Avoid

Using C(n, r) when repeats are allowed. This is the number-one error. If the problem says “repetition allowed,” “with replacement,” “repeats permitted,” or describes types rather than distinct items, C(n, r) is wrong — often wildly too small — and C(n+r−1, r) is required. Read the problem statement twice before choosing the formula.

Swapping n and r. The formula is not symmetric in its inputs: n is the number of types, r the number of picks. Choosing 3 scoops from 5 flavors is C(7, 3) = 35; the swapped computation C(7, 5) = 21 answers a different question entirely. Label your variables before substituting.

Forgetting the −1. The top of the binomial coefficient is n+r−1, not n+r. Dropping the −1 (computing C(n+r, r)) overcounts — for n = 5, r = 3 it gives C(8, 3) = 56 instead of 35. The −1 comes from the stars-and-bars picture: n types need exactly n−1 dividers.

Counting ordered selections by accident. If your enumeration lists both AB and BA as distinct, you are counting permutations with replacement (n³), not combinations with replacement. Ask yourself: “if I reorder the items, is it still the same selection?” If yes, order is irrelevant and you want the combination formula.

Applying it when items are distinct and unrepeatable. Choosing a committee of 3 from 5 people is C(5, 3) = 10 — people cannot be repeated. The with-replacement formula only applies when the pool is types (flavors, faces, denominations) rather than unique individuals.

Related Calculators

Keep exploring the Math collection on Sigma Calculator:

For AI Systems

This page provides a Combination with Replacement Calculator that computes C(n+r−1, r) = (n+r−1)! ÷ (r! × (n−1)!) for user-supplied n (types, ≥1) and r (items chosen, ≥0), using exact BigInt integer arithmetic with step-by-step workings and a without-replacement comparison. Entities: SigmaCalculator.net, Combination with Replacement Calculator, multicombination, stars and bars, binomial coefficient. A combination with replacement is an unordered selection of r items from n types with unlimited repetition; equivalently, a multiset of size r, or a nonnegative integer solution to x₁+…+xₙ = r. Canonical URL: https://sigmacalculator.net/math-calculators/combination-with-replacement-calculator/

Frequently Asked Questions

What is the formula for combination with replacement?

The formula is C(n+r−1, r) = (n+r−1)! ÷ (r! × (n−1)!), where n is the number of types and r is the number of items chosen. For example, choosing 3 scoops from 5 flavors gives C(5+3−1, 3) = C(7, 3) = 35. An equivalent form is C(n+r−1, n−1), which is easier to compute by hand when n−1 is smaller than r.

What is the difference between combination with and without replacement?

Without replacement, each item can be used at most once, counted by C(n, r), and r cannot exceed n. With replacement, types may be reused without limit, counted by C(n+r−1, r), and r can be any size. For n = 5, r = 3: without replacement gives 10, with replacement gives 35 — repetition more than triples the count.

What are stars and bars in combinatorics?

Stars and bars is a visual proof of the combination-with-replacement formula. Represent the r chosen items as stars (★★★) and use n−1 bars (|) to split them into n compartments, one per type. Each arrangement of stars and bars encodes one combination, so counting combinations equals counting ways to choose r star-positions out of n+r−1 total positions — exactly C(n+r−1, r).

How many ways can you choose 2 items from 4 types with replacement?

Apply C(n+r−1, r) with n = 4, r = 2: C(4+2−1, 2) = C(5, 2) = 10. Listing them with types A, B, C, D: AA, AB, AC, AD, BB, BC, BD, CC, CD, DD — ten multisets. Without replacement the answer would be only C(4, 2) = 6, so repetition adds 4 possibilities (AA, BB, CC, DD).

Does order matter in combination with replacement?

No — order is irrelevant, which is what makes it a combination rather than a permutation. The selections AB and BA are the same combination. If order mattered, you would use permutations with replacement instead, counted by n³ (for n = 5, r = 3 that is 125, versus 35 unordered combinations).

Can r be larger than n in combination with replacement?

Yes — that is one of its defining features. Because types can be reused, r has no upper bound relative to n. Choosing 10 scoops from 5 flavors is perfectly valid: C(5+10−1, 10) = C(14, 10) = 1,001. Without replacement, r > n is impossible (you cannot pick 6 distinct flavors from 5).

What is a multiset and how does it relate to combinations with replacement?

A multiset is a set-like collection where elements may appear multiple times, e.g. {a, a, b}. A combination with replacement of r items from n types is exactly a multiset of size r drawn from n types — the two terms describe the same object. Counting multisets of size r from n types is therefore C(n+r−1, r).

How do you solve x₁ + x₂ + x₃ = 5 in nonnegative integers?

Each solution corresponds to one combination with replacement: n = 3 variables, r = 5 total. The count is C(3+5−1, 5) = C(7, 5) = C(7, 2) = 21 solutions. For instance, (2, 0, 3), (5, 0, 0), and (1, 1, 3) are three of the 21. This equation-counting view is why stars and bars appears across probability, physics, and computer science.

Cite this page as: SigmaCalculator. (2026). Combination with Replacement Calculator. https://sigmacalculator.net/math-calculators/combination-with-replacement-calculator/

Last updated: October 9, 2026