Combinations Calculator (nCr)
C(n, r) — the number of unique groups of r items you can choose from n where order does NOT matter. Pascal's triangle visual, real-life examples, and Stirling's approximation for huge inputs.
Combinations — C(n, r)
Answer
Show your work
- FormulaC(n, r) = n! ÷ (r! × (n−r)!)→ order does NOT matter
- SubstituteC(52, 5) = 52! ÷ (5! × 47!)=
- Multiplicative shortcut(n × (n−1) × … × (n−r+1)) ÷ r!= n is large, so we cancel the (n−r)! and only multiply r terms in the numerator
Combinations Calculator — C(n, r) with full factorial expansion
Enter n (pool size) and r (selection size) and the calculator returns the number of unique groups of r you can choose from n where order does not matter. The show-your-work expands the formula step by step so you see the math, not just the answer. For huge results we show compact scientific notation with a "show full digits" expander and surface a Stirling-derived approximation for an independent magnitude check.
Combinations are the foundation of card games, lottery odds, and a huge slice of probability problems. Need ordered arrangements instead? See the Permutations calculator. Need n! by itself? See the Factorial calculator.
Where combinations show up in the real world
Combinations are everywhere: card games, lotteries, committees, subsets, the binomial theorem, random walks. Anytime you count distinct groups (not ordered sequences), C(n, r) is the answer.
Lottery odds
C(49, 6) = 13,983,816 distinct 6/49 tickets; C(69, 5) × 26 ≈ 292M for Powerball. The denominator of every "odds of jackpot" calculation.
Card hands
C(52, 5) = 2,598,960 poker hands, C(52, 13) = 635 billion bridge hands. All hand-frequency probabilities use combinations.
Committees & teams
Pick 5 people for a committee, 11 for a cricket team, 3 student reps from a class — choose-without-order = C(n, r).
Subsets & power sets
Σ_r C(n, r) = 2^n — total subsets of an n-element set. Used in algorithm analysis, inclusion-exclusion, and Boolean-algebra counts.
Binomial theorem
Coefficients of (a + b)^n. Why the binomial distribution P(X = k) = C(n, k) × p^k × (1−p)^(n−k) has C(n, k) in front.
Random walks & physics
Lattice path counts, microstates of indistinguishable particles, central binomial coefficients in random-walk return probabilities.
Combination or permutation? — the test
Ask: does the order matter?
- No → Combination: poker hands, lottery numbers, pizza toppings, picking a study group, handshake counts.
- Yes → Permutation: race medals (gold ≠ silver), PIN codes, seating order, word arrangements.
Math link: P(n, r) = C(n, r) × r! — a permutation is a combination times the r! ways to order it.
Quick reference — common combinations at a glance
| C(n, r) | Value | Scenario |
|---|---|---|
| C(5, 2) | 10 | 2-of-5 unordered |
| C(8, 3) | 56 | 3 pizza toppings from 8 |
| C(20, 5) | 15,504 | 5-person committee from 20 |
| C(49, 6) | 13,983,816 | 6/49 lottery jackpot odds |
| C(52, 5) | 2,598,960 | 5-card poker hands |
| C(52, 13) | ≈ 6.35 × 10¹¹ | Bridge hand |
| C(100, 50) | ≈ 1.01 × 10²⁹ | Largest in row 100 of Pascal's triangle |
Approximating C(n, r) for huge inputs
When the count exceeds 2^53 (about 9 × 10^15), 64-bit floats lose precision in the last digits. Two strategies:
- log10 sum: log10 C(n, r) = log10 P(n, r) − log10(r!). Each piece is a small log-sum that stays exact in float arithmetic — gives the magnitude (mantissa + exponent) directly.
- Stirling on each factorial: C(n, r) ≈ Stirling(n!) ÷ (Stirling(r!) × Stirling((n−r)!)). Closed-form, accurate to ~1/(12n) relative error. Used heavily in asymptotic analysis (random walks, statistical mechanics, information theory).
- Central-binomial shortcut: at r = n/2, C(2k, k) ≈ 4k / √(πk) — a Stirling consequence used for "central binomial coefficient" estimates.
The calculator uses the log-sum form for the displayed magnitude and surfaces the Stirling approximation as an educational sanity check.
Frequently asked questions
What is a combination?
▾
What is a combination?
▾A combination is a selection of r items from a pool of n where the ORDER doesn't matter. C(52, 5) = 2,598,960 means there are 2,598,960 distinct 5-card poker hands you can deal from a 52-card deck — and {Ace♠, King♥, Queen♦, Jack♣, 10♠} is the same hand as {10♠, Jack♣, Queen♦, King♥, Ace♠}, even though the cards came out in a different order.
What's the difference between a combination and a permutation?
▾
What's the difference between a combination and a permutation?
▾Order. Combinations don't care about the order: picking 3 students for a study group from a class of 20 is C(20, 3) = 1,140 distinct groups. Permutations DO care about order: assigning 3 different roles (president, VP, secretary) to 3 students from the same class is P(20, 3) = 6,840 — six times more, because each group of 3 students can fill the roles in 3! = 6 different ways. Math relationship: P(n, r) = C(n, r) × r!.
What is C(n, 0) and why does it equal 1?
▾
What is C(n, 0) and why does it equal 1?
▾C(n, 0) = 1 for any n. There is exactly one way to choose nothing (the empty selection). The formula confirms this: C(n, 0) = n! / (0! × n!) = 1 (since 0! = 1 by convention). It looks weird, but it makes formulas like the binomial theorem work cleanly at the boundaries.
Why is C(n, r) = C(n, n−r)?
▾
Why is C(n, r) = C(n, n−r)?
▾Symmetry. Choosing r items to take is the same as choosing n−r items to leave behind. C(52, 5) = C(52, 47) = 2,598,960 — the count of "5 cards I keep" equals the count of "47 cards I discard." The calculator uses the smaller of r and n−r internally to keep the multiplication chain short.
How does the calculator avoid computing huge factorials?
▾
How does the calculator avoid computing huge factorials?
▾Multiplicative shortcut. C(n, r) = (n × (n-1) × ... × (n-r+1)) / r!. For C(52, 5), we compute (52 × 51 × 50 × 49 × 48) / (5!) = 311,875,200 / 120 = 2,598,960 — without ever calculating 52! (which would overflow JavaScript). This keeps small answers exact even when the intermediate factorials wouldn't be representable.
When do I use combinations vs the multiplication principle?
▾
When do I use combinations vs the multiplication principle?
▾Use C(n, r) when you're forming a SET (unordered group) from a single pool. Use the multiplication principle (n × m × p × ...) when each "slot" has independent choices from possibly different pools — e.g., picking an outfit (3 shirts × 4 pants × 2 shoes = 24 outfits) is multiplication, not combinations.
Lottery odds — what do they mean?
▾
Lottery odds — what do they mean?
▾A typical 6/49 lottery has C(49, 6) = 13,983,816 distinct 6-number tickets. Your single ticket has a 1 / 13,983,816 chance of matching — about a 1-in-14-million shot. Buying 100 tickets brings it to 100 / 13,983,816 ≈ 1 in 140,000. Mathematically, the lottery is almost always a negative-expected-value bet — entertainment, not investment.
How does this relate to probability?
▾
How does this relate to probability?
▾Combinations are how you COUNT the favorable outcomes (or total outcomes) in many probability problems. Example: P(any 5 cards is a flush) = (C(13, 5) × 4) / C(52, 5) — combinations in both the numerator and denominator. Compute the counts here, then plug them into the Probability calculator.
What is Pascal's triangle and how does it relate to C(n, r)?
▾
What is Pascal's triangle and how does it relate to C(n, r)?
▾Pascal's triangle is the visual table of all C(n, r) values, with each entry being the sum of the two directly above it (Pascal's identity: C(n, r) = C(n−1, r−1) + C(n−1, r)). Row n contains C(n, 0), C(n, 1), …, C(n, n). The triangle is symmetric (left-right) because C(n, r) = C(n, n−r). Sum of any row n is 2^n.
What's the binomial theorem connection?
▾
What's the binomial theorem connection?
▾C(n, r) is also called a "binomial coefficient" because it appears as the coefficient in the expansion (a + b)^n = Σ C(n, r) × a^(n-r) × b^r. For example, (a + b)^4 = a⁴ + 4a³b + 6a²b² + 4ab³ + b⁴ — coefficients 1, 4, 6, 4, 1 are exactly C(4, 0..4), the 5th row of Pascal's triangle.
How big does C(n, r) get?
▾
How big does C(n, r) get?
▾It's biggest at r = n/2. C(50, 25) ≈ 1.26 × 10^14 — fits in a 64-bit float exactly. C(100, 50) ≈ 1.01 × 10^29 — beyond exact-integer precision. C(1000, 500) ≈ 2.7 × 10^299 — past Number.MAX_VALUE if you computed n! directly, but our multiplicative form keeps the intermediate small.
What is the central binomial coefficient and why is it useful?
▾
What is the central binomial coefficient and why is it useful?
▾C(2k, k) — the middle entry in row 2k of Pascal's triangle. Stirling-derived approximation: C(2k, k) ≈ 4^k / √(πk). Comes up everywhere: random walks (C(2n, n) / 4^n is the probability of returning to origin in 2n steps), the Catalan numbers, and the asymptotic analysis of binomial distributions.
What is Stirling's approximation, and why is it useful for C(n, r)?
▾
What is Stirling's approximation, and why is it useful for C(n, r)?
▾Stirling's formula: n! ≈ √(2πn) × (n/e)^n. Applied to C(n, r) = n!/(r!(n−r)!), it gives a closed-form magnitude estimate without big-integer arithmetic. Crucial for asymptotic analysis (probability, statistical mechanics, information theory) where you care about the magnitude of C(n, r), not the exact integer.
How big is Powerball — C(69, 5) × 26?
▾
How big is Powerball — C(69, 5) × 26?
▾C(69, 5) = 11,238,513 ways to pick the 5 white balls, multiplied by 26 red ball choices = 292,201,338 total tickets. Your odds of matching all 6 are about 1 in 292 million.
Where to next?
Combinations + permutations + factorial are the trio of counting tools — once you have the count, probability becomes easy.