Formula: nCr & nPr Mathematical Identity
- totalN: Total N (numeric parameter)
- chooseR: Choose R (numeric parameter)
Count ordered arrangements and unordered subsets from a set of n elements.
Ask whether swapping two chosen items gives a different outcome. If a team of Asha and Ben is the same as a team of Ben and Asha, use combinations. If Asha first and Ben second differs from the reverse, as with ranked prizes or named roles, use permutations. For the default 12 and 4, that is the difference between 495 and 11,880 outcomes.
It counts unordered selections where an item can be picked more than once, sometimes called multisets. Think of choosing 4 doughnuts from 12 varieties when you may take several of the same kind. The formula is C(n + r minus 1, r), which for 12 and 4 is C(15, 4), or 1,365 selections. Unlike ordinary combinations, r may exceed n here.
Because it is not about choosing r items. It counts every subset of the full set, from the empty set up to all n items, and each item is either in or out. With 12 items that gives 2 to the power 12, or 4,096 subsets. It is also the sum of C(12, r) across every r from 0 to 12.
Zero, for both combinations and arrangements without replacement, and that is what the page shows. You cannot pick 7 distinct items from 5, so there are no ways to do it, and the sentence under the result says so. The with replacement line can still be above zero, because items may repeat. Read that line only if your problem genuinely allows repeats.
No. Both are counts of whole items, so the page accepts whole numbers from 0 to a thousand and shows an error message for a decimal or negative value. The gamma function extends factorials to non-integers in advanced maths, but that is not a counting question and not what this calculator does. Round your problem to whole items before entering it.
There is exactly one way to choose nothing: the empty selection. The formula agrees, since 0 factorial is defined as 1, giving n factorial divided by n factorial. The same reasoning makes C(n, n) equal 1. Both values matter in sums like the subset count, where leaving them out would give the wrong total.
Multiply r falling terms starting at n to get P(n, r). For 12 and 4 that is 12 times 11 times 10 times 9, or 11,880 ordered picks. Then divide by r factorial, here 24, to get C(n, r), which is 495 groups. For small sets you can also list outcomes. With 6 items choose 2 you should find 15 pairs and 30 ordered pairs.
Use the combinations line, because a hand or a ticket is a set and order does not matter. Five cards from 52 gives 2,598,960 hands, so any one specific hand has a probability of one in 2,598,960 on a fair deal. Six numbers from 49 gives 13,983,816, the odds for one ticket matching all six. For odds of a type of hand, count the qualifying hands and divide.
Yes, within the 0 to a thousand input range the page counts with whole-number arithmetic of unlimited size, and the sentence under the result shows every digit. The poker preset's 311,875,200 arrangements and the lottery preset's 562,949,953,421,312 subsets are exact. For the longest results, copy the figure from that sentence rather than the result line if you need all the digits.
No. On a lock, the order of the numbers matters and digits can repeat, so it is an ordered selection with replacement. A 3-digit lock with digits 0 to 9 has 10 to the power 3 settings, which is n to the power r. None of the four lines on this page describes it, which is a good reminder to check the two questions first.
Yes. The first field is the size of the pool, n, and the second is how many you pick, r. Swapping them changes the question completely. Twelve items choose four gives 495 combinations, while four items choose twelve gives zero, since you cannot pick twelve distinct items from four. If the result looks surprising, confirm n is the larger number and read the sentence under the result, which repeats both values.
Start with the default, n = 12 and r = 4, and picture twelve people from whom you need four. If you are forming a committee where every member is equal, the order you pick them in does not matter, and there are 495 different committees. That is the headline C(n, r) figure.
If instead you are filling four named roles, say chair, deputy, secretary and treasurer, then picking Asha as chair and Ben as deputy is a different outcome from the reverse. Now the count jumps to 11,880 outcomes. That is the P(n, r) line.
The page shows two more lines. With replacement, where the same item may be picked more than once and order still does not matter, the count is 1,365 selections. And 2 to the power 12, the number of possible subsets of any size including the empty one, is 4,096 in all.
All four lines come from the same twelve items. Which one you need depends entirely on two questions about your problem. Does order matter? And can an item be used more than once? Answer those before you read any number off the page, because the four answers differ by a factor of more than twenty.
Every unordered group of four can be arranged in 4 factorial ways, which is 4 times 3 times 2 times 1, or 24. So the number of ordered selections must be 24 times the number of unordered ones. Check it on the default: 495 times 24 gives 11,880 exactly.
The same ratio holds for any n while r stays at 4, and the general rule is that permutations equal combinations times r factorial. The poker preset shows it with r = 5: there are 2,598,960 five-card hands from 52 cards, and 311,875,200 ordered deals of five cards, which is the hand count times 5 factorial. The lottery preset, 6 numbers from 49, gives 13,983,816 combinations and 10,068,347,520 arrangements, the first times 6 factorial.
That relationship is a quick test that you have read the right line. If you need permutations and your answer is smaller than the combinations line, you have swapped them. It also gives an easy way to work by hand: compute P(n, r) as n times (n minus 1) and so on for r terms, then divide by r factorial to get C(n, r). For the default that is 12 times 11 times 10 times 9, which is 11,880, and dividing by 24 leaves 495 combinations.
Working this way avoids ever computing 12 factorial in full. The formula on the page is written with whole factorials, but most of them cancel, and the product of r falling terms is all that is left.
Move from the default 12 and 4 to the poker preset of 52 cards and 5 chosen, and the combinations jump from 495 to 2,598,960 hands. That is the number of distinct five-card hands in a standard deck, and it is why a particular hand, say a specific royal flush, has odds of one in 2,598,960 on a fair deal.
The lottery preset, 6 numbers from 49, gives 13,983,816 combinations. Only the set of numbers matters on a ticket, not the order they are drawn in, so this is the line that sets the odds of a single ticket winning the jackpot. The arrangements line, 10,068,347,520, would only matter if the draw had to come out in the order you wrote it.
The subsets line grows faster than any of them. It ignores r and doubles with every extra item, so 12 items give 4,096 subsets, 49 give 562,949,953,421,312 and 52 give 4,503,599,627,370,496 subsets. It counts every possible selection of any size, from nothing at all to the whole set.
With replacement sits between the two ordinary counts. For the poker inputs it gives 3,819,816, more than the plain combinations because repeats are allowed, though repeats make no sense for a single deck. It belongs to problems like choosing scoops or coins, where the same kind can be picked twice.
For fixed r, combinations grow roughly like n to the power r divided by r factorial, so small changes to a large n move the answer a lot. Double-check the pool size before anything else.
Enter n = 12 and r = 8 and the combinations line still says 495 combinations. That is not a glitch. Every way of picking 8 people out of 12 is also a way of leaving 4 out, so the two counts must match. In symbols, C(n, r) equals C(n, n minus r).
The permutations line does not share this symmetry. Arranging 8 people in order involves far more sequences than arranging 4, because each extra position multiplies the count by the number of people still available. The page shows a much larger permutation figure for r = 8 than for r = 4, even though the combinations are identical.
The symmetry is handy when r is large. C(12, 11) is the same as C(12, 1), which is simply 12. And at the extremes, C(n, 0) and C(n, n) are both 1: there is exactly one way to choose nothing and exactly one way to choose everything. The page reports 1 for r = 0, which is correct, and 1 combination for r = n.
Combinations peak in the middle, at r equal to half of n. For twelve items that is r = 6, and every step away from 6 in either direction lowers the count.
Both fields are counts of distinct items, so the page accepts whole numbers from 0 to a thousand and shows an error for anything else. A decimal such as 7.2, or a negative number, is refused rather than quietly rounded. That is the right behaviour: there is no such thing as 7.2 items to choose from.
The case that confuses people most is r larger than n. Without replacement you cannot choose seven different items from a set of five, so the combinations and arrangements lines both show 0, and the sentence under the result explains why. That zero is the correct answer, not a failure.
With replacement is different. Repeats are allowed, so choosing more items than there are kinds is perfectly possible, and that line stays above zero when r exceeds n. If your problem allows repeats, that is the line to read.
At the other end, r = 0 gives 1 on every choosing line, because there is exactly one way to choose nothing. n = 0 with r = 0 also gives 1, for the same reason. These edge values matter when you sum counts across every r, as the subset total does.
Factorials grow brutally fast. Twelve factorial is already in the hundreds of millions, and the subset count for a deck of 52 cards runs to sixteen digits. Ordinary floating point arithmetic keeps only about fifteen or sixteen significant digits, so a calculator built on it starts padding long answers with rounded zeros.
This page works with whole-number arithmetic of unlimited size for n and r up to a thousand, so the counts are exact. The sentence under the result prints every digit. For the lottery preset it gives 10,068,347,520 arrangements, and for the poker preset 311,875,200, both exact.
For the very longest results, compare the result line with the sentence. The sentence is the one to copy if you need every digit, for example to compute an exact probability as a fraction or to check a proof. A long number is easier to sanity-check by its digit count than by reading it: if two methods agree on the first few digits and on the length, they almost certainly agree everywhere.
When a count is so large that only its size matters, logarithms are often more useful. The log of C(n, r) can be summed term by term without forming the huge number, which is how probability work with large decks or long sequences is usually done.
Most mistakes with this calculator come from choosing the wrong line, not from the arithmetic. A few examples using inputs I ran make the distinctions concrete.
Choosing 2 players from 10 to play a singles match is a combination: 45 pairings. Choosing a winner and a runner-up from the same 10 is a permutation: 90 outcomes, exactly twice as many because each pair can finish either way round. Picking 2 scoops of ice cream from 10 flavours, where two scoops of the same flavour is allowed, is the with replacement line: 55.
A 4-digit PIN is none of these. Digits can repeat and order matters, so the count is simply 10 to the power 4. The page does not have a line for ordered selection with replacement, because that case needs no combinatorics: it is n to the power r.
Probability questions usually divide one count by another. The chance that a particular group of 4 is drawn at random from 12 is one in 495 for any single group. The chance that 4 named people take 4 named roles in a random draw is one in 11,880 by comparison. Getting the denominator from the right line is the whole problem.