What a combination counts, and what it deliberately ignores
A combination is a selection in which order carries no information. If you deal yourself the ace of spades, the seven of hearts and the two of clubs, it makes no difference which card arrived first — you hold one hand, not six. The combination count answers a single question: how many distinct sets of size r can be formed from a pool of n distinct items?
That question is everywhere once you notice it. Lottery odds are a combination count. So is the number of possible five-card poker hands, the number of ways to pick a jury of twelve from a panel of forty, the number of subsets a QA engineer must test when any three of eight feature flags may be on, and the number of terms in an expanded binomial. Every one of those problems collapses ordered outcomes that a person would describe with the same words.
The companion count is the permutation, which keeps order. Every combination of r distinct items corresponds to exactly r! orderings, so the two counts sit in a fixed ratio: P(n, r) = C(n, r) × r!. That single identity is the fastest way to decide which one you need. Ask yourself whether swapping two chosen items produces a different outcome. If it does — a podium, a PIN, a batting order — you want the permutation calculator. If it does not, you want this one.
Where n! / (r!(n − r)!) comes from
Build the formula in two moves rather than memorising it. First count the ordered selections, then divide out the orderings you did not want.
Step one: count with order. You have n choices for the first pick, n − 1 for the second, and so on down to n − r + 1 for the last. Multiplying gives the falling product n(n−1)…(n−r+1), which equals n! ÷ (n − r)!. The factorials are just a compact way of writing that product: the full n! runs all the way down to 1, and dividing by (n − r)! cancels the tail you never used.
Step two: divide out the order. Each set of r distinct items was counted once for every way of arranging those r items among themselves, and there are r! such arrangements. Dividing by r! collapses them to one. That produces n! ÷ (r!(n − r)!).
Two structural facts fall straight out. C(n, r) = C(n, n − r), because choosing which items to take is the same act as choosing which to leave — that symmetry is why the reference table below is a mirror image about its centre. And Pascal's rule, C(n, r) = C(n−1, r−1) + C(n−1, r), says that every selection either contains a particular nominated item or does not; add the two cases and you have them all. Pascal's rule is what generates Pascal's triangle, and it is also the safest way to compute large coefficients by hand, since it never requires an enormous factorial. If you want the factorials themselves, the factorial calculator shows exact values and digit counts.
This calculator does not evaluate n! directly. It builds the answer by the multiplicative recurrence C(n, k) = C(n, k−1) × (n − k + 1) ÷ k, which stays exact in ordinary 64-bit arithmetic far longer, and it switches to logarithms of the gamma function once the true value passes 1015. Beyond that point the display becomes scientific notation because no exact answer will fit.
Worked example: five-card hands from a 52-card deck
How many five-card poker hands exist? Here n = 52 and r = 5, and repetition is off because a deck holds one of each card.
- Count the ordered deals. 52 × 51 × 50 × 49 × 48. Take it in stages: 52 × 51 = 2,652; × 50 = 132,600; × 49 = 6,497,400; × 48 = 311,875,200. That is P(52, 5).
- Count the orderings of one hand. 5! = 5 × 4 × 3 × 2 × 1 = 120.
- Divide. 311,875,200 ÷ 120 = 2,598,960 distinct hands.
- Convert to odds. One specific hand — say the royal flush in spades — has probability 1 ÷ 2,598,960 = 0.0000003848, or about 3.85 × 10−5 percent.
Now check the same number by the symmetry rule. C(52, 5) must equal C(52, 47), the number of ways to choose the 47 cards left in the deck. Nobody would compute the second by multiplying 47 terms, but the identity guarantees they match — and it is the reason this calculator always reduces r to the smaller of r and n − r before multiplying.
One more, by hand, to fix the repetition case. A shop sells five ice-cream flavours and you buy three scoops, repeats allowed. The shifted count is n + r − 1 = 5 + 3 − 1 = 7, so the answer is C(7, 3) = (7 × 6 × 5) ÷ (3 × 2 × 1) = 210 ÷ 6 = 35 distinct tubs. The ordered count is 53 = 125, which is smaller than 35 × 6 = 210 — a direct demonstration that a selection containing a repeat has fewer than 3! distinct orderings.
How to read the result
The headline number is a count of possibilities, so its practical meaning depends entirely on what you do with it next.
As odds. If every selection is equally likely — a fair lottery draw, a well-shuffled deck, a random sample without replacement — then the probability of any one named selection is 1 ÷ C(n, r). This is where the numbers become vivid. C(49, 6) = 13,983,816, so a single UK Lotto line wins the jackpot about once in fourteen million attempts. Adding a second drum multiplies rather than adds: five white balls from 69 give C(69, 5) = 11,238,513 ways, and each pairs with one of 26 red balls, so the full space is 11,238,513 × 26 = 292,201,338. Multiplying independent stages like that is standard practice, and you can carry the result into the probability calculator or the at-least-one probability calculator if you want to know the chance across many tickets.
As a workload. Testing every three-way interaction among eight feature flags means C(8, 3) = 56 cases; among twenty flags it means C(20, 3) = 1,140. Combination counts grow polynomially in r but explosively in n, which is exactly why exhaustive testing stops being feasible so abruptly.
As a coefficient. C(n, r) is the coefficient of xr in the expansion of (1 + x)n — the same numbers that appear in the binomial expansion calculator and in the binomial probability formula. The row of coefficients peaks in the middle and falls away symmetrically; the chart this calculator draws is that shape.
Sanity-check any result three ways. C(n, 0) and C(n, n) must both be 1. C(n, 1) must be n. And the whole row for a given n must sum to 2n, since every item is either in a subset or out of it — for n = 5 the row is 1, 5, 10, 10, 5, 1, which totals 32 = 25.
Combination counts for common values of n and r
| n | r = 2 | r = 3 | r = 4 | r = 5 |
|---|---|---|---|---|
| 10 | 45 | 120 | 210 | 252 |
| 20 | 190 | 1,140 | 4,845 | 15,504 |
| 30 | 435 | 4,060 | 27,405 | 142,506 |
| 40 | 780 | 9,880 | 91,390 | 658,008 |
| 50 | 1,225 | 19,600 | 230,300 | 2,118,760 |
Read across to see how fast the count climbs with r, and down to see how much faster it climbs with n. Going from n = 10 to n = 50 at r = 5 multiplies the count by more than eight thousand.
Mistakes that produce the wrong count
- Using a combination where order matters. Gold, silver and bronze from eight runners is P(8, 3) = 336, not C(8, 3) = 56. The words "arrangement", "sequence", "ranking", "code" and "schedule" all signal a permutation.
- Forgetting that the pool must hold distinct items. C(n, r) counts selections from n items you can tell apart. Choosing 3 letters from the word LEVEL is not C(5, 3), because the two Ls and two Es are interchangeable and the double counting has to be removed by hand.
- Adding stages that should be multiplied. When a draw has separate pools — main balls plus a bonus ball, a starter plus a main plus a dessert — multiply the counts. Adding them answers a different question entirely.
- Reaching for repetition when the pool is simply large. Repetition means the same item can appear twice in one selection. Drawing 6 balls from 49 without putting any back is a no-repetition problem even though 49 is a big pool.
- Treating the with-repetition count as a set of equally likely outcomes. There are 21 unordered results when you roll two dice, but they are not equally likely: a 6-6 arises one way out of 36 and a 6-5 arises two ways. The count is right; the uniform-probability assumption is not.
- Computing n! first. 52! overflows a double and 1000! has 2,568 digits, yet C(52, 5) is under three million. Cancel before you multiply, or use Pascal's rule.
- Rounding a huge coefficient and calling it exact. Past about 1015 a 64-bit float can no longer hold every digit. This page switches to scientific notation and says so rather than printing digits it cannot vouch for.
Repetition, and the four counting problems people confuse
Counting problems sort into a two-by-two grid: order matters or it does not, repetition is allowed or it is not. Naming the cell you are in solves most of the difficulty before any arithmetic starts.
Ordered, no repetition gives P(n, r) = n! ÷ (n − r)!. Ordered, with repetition gives nr — the four-digit PIN case, 104 = 10,000. Unordered, no repetition is the standard C(n, r) on this page. Unordered, with repetition is C(n + r − 1, r), the "stars and bars" count.
That last formula deserves its picture. Lay out r stars for the items you are taking and n − 1 bars to divide them into n flavour bins. Every arrangement of the stars and bars is one selection, and there are r + n − 1 positions of which you choose r to be stars — hence C(n + r − 1, r). Three scoops from five flavours becomes three stars and four bars in seven slots: C(7, 3) = 35.
Two nearby tools handle cases this calculator does not. When your pool contains repeated identical items and you want arrangements of all of them — the letters of MISSISSIPPI, say — you need the multiset formula n! ÷ (n₁! n₂! … nk!), which the permutation calculator provides. And when you are drawing without replacement from a pool that contains two kinds of item and you want the probability of a particular mix, that is the hypergeometric distribution: five red from a bag of twelve red and eight blue is C(12, 5) × C(8, 0) ÷ C(20, 5), a ratio of combination counts that the hypergeometric distribution calculator assembles for you. If your draws are independent with a fixed success probability instead, use the binomial distribution calculator.
Key terms
- Combination
- An unordered selection of items from a set. Written C(n, r), nCr, or as n above r inside large brackets.
- Binomial coefficient
- Another name for C(n, r), used because it is the coefficient of xr when (1 + x)n is expanded.
- Permutation
- An ordered arrangement. P(n, r) = C(n, r) × r! for distinct items, so permutations always come out at least as large as the matching combination count.
- Multiset
- A collection in which the same item may appear more than once and order is still ignored. Counting multisets is the with-repetition case, C(n + r − 1, r).
- Pascal's rule
- C(n, r) = C(n−1, r−1) + C(n−1, r). Splits every selection according to whether it contains one nominated item, and generates Pascal's triangle row by row.
- Falling factorial
- The product n(n−1)…(n−r+1) — the ordered count before orderings are divided out. Equal to n! ÷ (n−r)!.
