Combinations Calculator
Result
Combinations (order ignored)
- Permutations (order counted)
- 720
A combinations calculator answers the counting question underneath a lot of probability: how many ways are there to choose r items out of n. When the order of the picks is ignored the answer is a combination, and when the order matters the answer is a permutation — the same two numbers that most people mean by nCr and nPr. The page prints both at once, because a count that differs by a factor of r! between two readings is exactly the kind of thing that gets reported with the wrong one. A single switch decides whether repetition is allowed, and it changes both rows together: with repetition a choice of r items from n is a different count, and r may be larger than n.
Formula
combinations C(n, r) = n! / (r!(n − r)!) · permutations P(n, r) = n! / (n − r)! · with repetition: C = (n + r − 1)! / (r!(n − 1)!) and P = nʳ
- n
- How many different items there are to choose from — the size of the pool, not the number of picks
- r
- How many items get chosen. When repetition is off, r cannot exceed n; when it is on, r may be larger than n, because the same item is allowed to come up twice
- allow repetition
- Whether the same item may be picked more than once. This is not a formatting preference — it selects a different formula, and it is the setting that decides whether r larger than n is legal or impossible
- C(n, r)
- The number of combinations read as nCr: the ways to choose r items when the order of the picks is ignored, so that ABC and CBA count once
- P(n, r)
- The number of permutations: the ways to choose and then arrange r items, so that ABC and CBA are two different results. It is always the combination count times r!
Use it whenever a question is really "how many ways", which is most of the time a probability is being worked out by counting rather than by formula. Card hands, lottery draws, committee selections and seating arrangements are all this calculation, and the single decision that has to be made before any of them is whether the order matters — a poker hand is a combination, a podium finish is a permutation. The repetition switch matters in the cases where the same choice can be made twice: picking three scoops from a menu of flavours, where the order still does not matter but the flavours may repeat, is a combinations with repetition count rather than an ordinary one. The page does not compute probabilities, only the counts that probabilities are built from.
Worked examples
Ten items, choose three: 120 combinations or 720 permutations
- With the order ignored, C(10,3) = 10! / (3! × 7!) = (10 × 9 × 8) / (3 × 2 × 1) = 120
- With the order counted, P(10,3) = 10 × 9 × 8 = 720
- The two differ by 3! = 6, which is the number of ways to arrange three chosen items
- Check: 120 × 6 = 720
This is the pair the page exists to keep apart. The same three items have one combination and six permutations, so a count quoted without saying which one it is can be off by a factor of six here — and by a factor of 120 at five picks, which is where the errors stop being small enough to notice. The last step is the relationship worth remembering: the permutation count is always the combination count times the factorial of r, because every unordered pick can be arranged in exactly r! ways.
The same ten and three, with repetition allowed
- With repetition and the order ignored, C = (10 + 3 − 1)! / (3! × 9!) = C(12,3) = 220
- With repetition and the order counted, P = 10³ = 1000
- The pool is effectively larger for the combination count — the formula adds r − 1 to n — while the permutation count is simply one choice per slot
- Check: 220 is not 120, and 1000 is not 720 — flipping the switch moved both rows
Both rows changed, and that is the point of the switch rather than a detail of it. An implementation that adjusted only the combination count would print 220 and 720 next to each other, and both numbers would look plausible while describing different rules. Note also that the permutation count is now a power rather than a falling factorial: with repetition there are n choices in every one of the r slots, so the count multiplies out to nʳ instead of shrinking by one each time.
A five-card poker hand from a 52-card deck
- A hand is unordered, so the count is C(52,5) = 52! / (5! × 47!)
- Multiply the five falling terms: 52 × 51 × 50 × 49 × 48 = 311,875,200
- Divide by 5! = 120: 311875200 / 120 = 2,598,960
- The second row is the intermediate step of the first — that is what it means to say a hand is the ordered deal divided by the arrangements
2,598,960 is the number every poker probability is divided by, and it is the most-visited cell on this page. The two rows are worth reading together here because the permutation row is literally the numerator before the division by 5! — a hand of five cards can be dealt in 311,875,200 ordered ways, and every hand accounts for 120 of them. Seeing that the unordered count is the ordered count divided by the arrangements is the fastest way to stop confusing the two.
Six items, take all six: one combination, 720 permutations
- There is only one way to take everything, so C(6,6) = 1
- The permutations are the arrangements of all six items: P(6,6) = 6! = 720
- The factor between the rows is 720 = 6!, which is the r! rule at r = n
At r = n the two rows are as far apart as they can be, and the combination row collapses to 1 — there is no choosing left to do when everything is taken. It is a useful extreme to hold next to the poker hand: there the gap was a factor of 120, here it is a factor of 720, and the only thing that changed is how many arrangements each pick admits. If the permutation row is ever the one you wanted, this is the shape of the mistake at its largest.
Three flavours, five scoops: r larger than n
- Five scoops from three flavours, order ignored, repeats allowed: C = C(3 + 5 − 1, 5) = C(7,5) = 21
- With the order counted as well, P = 3⁵ = 243
- Both are legal only because repetition is on — with it off, choosing five from three is impossible and the page refuses the input
This is the case that makes the switch a correctness requirement rather than a preference. Choosing five things from a pool of three cannot be done without repeats, so with repetition off the page rejects it outright, and with it on the same inputs give two perfectly ordinary numbers. The combination row also shows why the formula adds r − 1 to the pool: allowing repeats makes the pool behave as though it were larger by one fewer than the number of picks, so three flavours taken five times at once count as seven things chosen five at a time.
Limitations
Both counts are exact integers up to a point, and past that point the page refuses rather than rounding. The counts grow fast — a hundred items chosen fifty at a time has thirty digits — and a computer's floating-point numbers stop being able to hold every integer exactly somewhere around the sixteenth digit, so a count that large would come back with its last digits wrong and look entirely ordinary. Rather than print a number that is wrong in a way nobody would catch, the page throws for counts beyond exact range; the same refusal covers pools over a thousand items and any negative count. Two further limits: the page counts and nothing else — it does not list the combinations, does not enumerate them, and does not compute the probability of drawing one, which is the count divided by the total. And the repetition switch means only one thing, that the same item may be taken more than once; it does not model drawing without replacement versus drawing with it in the sense of a deck, where the pool shrinks as cards leave it.
Frequently asked questions
- What is the difference between a combination and a permutation?
- A combination ignores the order of the picks and a permutation counts it. Choosing three people for a committee from ten is a combination, because the committee ABC is the same committee as CBA; handing those three a first, second and third prize is a permutation, because the assignments are different. The two counts are never close: the permutation count is the combination count multiplied by r!, the number of ways to arrange the r items that were picked. Both rows are printed on this page so that the factor is never guessed at — at r = 3 it is 6, and at r = 5 it is 120.
- What does the nCr on my calculator mean?
- nCr is the combinations calculator function: n is the size of the pool and r is how many are picked, and the result is the number of ways to choose them with the order ignored. It is the same number this page prints in the combinations row. The companion key, nPr, is the permutation count with the order counted, and it is the row underneath. A quick way to tell which one a problem wants is to ask whether swapping two of the picked items would produce a different outcome — if it would not, the answer is nCr.
- What changes when I allow repetition?
- Both formulas change, and so does which inputs are legal. With repetition off, the permutation count is a falling product — n × (n − 1) × … — and the combination count divides that by r!; with repetition on, the permutation count is simply n to the power r, and the combination count becomes the multiset count, which for n items taken r at a time works out as C(n + r − 1, r). The legality point is the one that catches people: with repetition off, r larger than n cannot be done at all and is rejected, while with repetition on it is an ordinary request, like five scoops from three flavours.
- Why does the page refuse some large inputs instead of giving an answer?
- Because the answer would be wrong in its last digits and would not look wrong. These counts grow extremely fast — fifty picks from a hundred items runs to about thirty digits — and the numbers a computer uses for arithmetic stop holding every integer exactly somewhere around the sixteenth digit. Past that line the result is a nearby number with a correct-looking beginning and a wrong ending, which is worse than no answer at all if the count is going into a probability or a report. So the page throws for counts it cannot represent exactly, in the same way it throws for a pool of more than a thousand items or a negative count.
- Does the repetition switch mean drawing with replacement?
- Not in the sense a deck of cards uses the phrase. The switch says only that the same item may be chosen more than once, which is what drawing with replacement gives you in a pool of independent choices. In a card problem the pool also shrinks as cards leave it, and the counts above already account for that through the falling product in the no-repetition formulas — a five-card hand is C(52,5), not 52 to the fifth. So the switch is about whether a repeat is allowed, and the pool shrinking is handled by the formula rather than by the switch.
- Why is there no lookup table under the calculator?
- Because a table would have to disagree with the panel. The table a page like this would want is a grid of n down one side and r across the other, but the answer in the panel is computed from the n and r you typed, so a fixed grid would show different numbers for the same inputs. The pages on this site that do carry a reference table are the ones whose tables describe a fixed set of values — a category boundary or a standard scale — rather than a computation of the inputs. Here the two rows of the panel are the answer, and they move with every keystroke.
References
- Combination — from Wolfram MathWorld (the number of ways of picking unordered outcomes from a set, also called the binomial coefficient and read "n choose k") — Wolfram MathWorld
- Permutation — from Wolfram MathWorld (a rearrangement of the elements of an ordered list, and the count of them for a set of a given size) — Wolfram MathWorld
- Multichoose — from Wolfram MathWorld (the number of multisets of a given length on a given number of symbols, which is the combinations with repetition count this page switches to) — Wolfram MathWorld