Combination Calculator (nCr)
Calculate combinations using the formula C(n, r) = n! / (r! * (n - r)!). Combinations count the number of ways to choose items where order does not matter.
Combinations count the number of ways to choose r items from a group of n, where order doesn't matter. The notation C(n,r) or "n choose r" or nCr appears throughout probability, statistics, and combinatorics. Real-world examples: choosing a 5-card poker hand from 52 cards, selecting a 12-person jury from 50 candidates, forming a 3-person committee from 10 employees, or calculating lottery combinations.
This calculator returns C(n,r) = n! / (r! × (n-r)!). The result is also called the "binomial coefficient" because it appears in the expansion of (a+b)^n. For large n, results can be extremely large — C(52, 26) is over 495 trillion.
Combinations are essential for: - **Probability calculations**: lottery odds, hypergeometric distribution. - **Card games**: poker hand probabilities. - **Sampling theory**: number of possible samples. - **Genetics**: gene combinations. - **Computer science**: subset enumeration.
Inputs
Results
Combinations (nCr)
120
Formula
C(10, 3) = 10! / (3! × 7!)
n!
3,628,800
r!
6
(n-r)!
5,040
Formula
How to use this calculator
- Enter total items (n).
- Enter items chosen (r).
- Calculator returns C(n, r).
- Verify r ≤ n (can't choose more than available).
- For probability problems with equal likelihood, P = 1/C(n,r).
- Watch out for large numbers — overflow possible at large n.
Worked examples
Lottery odds
**Scenario:** Pick 6 numbers from 49 for lottery. What's the chance of winning? **Calculation:** C(49, 6) = 49! / (6! × 43!) = 13,983,816 ways. P(winning) = 1 / 13,983,816 ≈ 7.15 × 10⁻⁸. **Result:** Odds are 13.98 million to 1. To have 50% chance of winning, you'd need ~9.7 million tickets.
Poker hand
**Scenario:** Number of possible 5-card poker hands from 52-card deck. **Calculation:** C(52, 5) = 52! / (5! × 47!) = 2,598,960. **Result:** 2,598,960 possible hands. Each specific hand has probability 1/2,598,960. Various hand categories (one pair, two pair, etc.) make up subsets of this.
Committee selection
**Scenario:** Choose 3-person committee from 10 employees. How many possible committees? **Calculation:** C(10, 3) = 10! / (3! × 7!) = 120 different committees. **Result:** 120 distinct committee selections. Order doesn't matter (Alice, Bob, Carol = Bob, Alice, Carol).
When to use this calculator
**Use combinations when:**
- Choosing items where order doesn't matter. - Subsets of fixed size. - Sampling without replacement. - Probability of specific selections. - Counting possible groupings.
**Use permutations instead when:**
- Order matters (arrangements, rankings). - Sequences of events. - Linear orderings.
**Common applications:**
- **Card games**: hand combinations. - **Lotteries**: winning number combinations. - **Sampling**: number of possible samples. - **Genetics**: allele combinations. - **Group projects**: team selections. - **Quality control**: which parts to inspect. - **Sports**: bracket combinations.
**Probability with combinations:**
P(specific outcome) = 1 / C(n, r) for uniform selection.
For multiple specific outcomes: count favorable / total.
**Hypergeometric distribution:**
For sampling without replacement: P(k successes in n trials) = C(K,k) × C(N-K, n-k) / C(N, n)
Where N = population, K = successes in population.
**Examples in probability:**
| Scenario | Combination needed | |---|---| | Lottery odds | C(49, 6) = 13.98M | | Poker royal flush | C(13,1) × C(4,1) / C(52,5) | | Two pair odds | C(13,2) × C(4,2)² × C(44,1) / C(52,5) | | Bridge hand types | Various C(n, r) combinations |
**Counting principle:**
Combinations are part of broader counting: - Multiplication: independent choices multiply. - Addition: mutually exclusive cases add. - Permutations: ordered arrangements. - Combinations: unordered selections.
**Programming combinations:**
Direct calculation: - Python: math.comb(n, r) or scipy.special.comb() - R: choose(n, r) - Excel: COMBIN(n, r) - C/C++: factorial calculation
For large n: use approximation or log-space.
**Pascal's triangle:**
Each row r contains C(r, 0), C(r, 1), ..., C(r, r). Each entry equals sum of two above. Generates all combinations systematically.
**Binomial theorem:**
(a + b)^n = Σ C(n, k) × a^(n-k) × b^k
The binomial coefficients are the combinations.
**Common counting principles:**
| Type | Formula | Example | |---|---|---| | Permutation | n! | Arrange 5 books: 5! = 120 | | Permutation (subset) | n!/(n-r)! | 5 from 10 in order: 30,240 | | Combination | n!/(r!(n-r)!) | 5 from 10 unordered: 252 | | Multinomial | n!/(r₁!r₂!...rₖ!) | Multiple groups |
**Stars and bars:**
Distribution problems: number of ways to put n identical items in k groups = C(n+k-1, k-1).
**Computer science applications:**
- Combinatorial search. - Subset enumeration. - Knapsack problems. - Cryptographic key combinations. - Algorithm analysis.
**Beyond simple combinations:**
- Permutations with repetition. - Combinations with repetition. - Multinomial coefficients. - Restricted combinations.
**Common errors:**
- Confusing nCr with nPr. Order matters in P; not in C. - Trying to choose more than available (r > n). - Forgetting C(n, 0) = C(n, n) = 1. - Computing for very large n without overflow protection.
Common mistakes to avoid
- Confusing combinations with permutations. C ignores order; P respects order.
- Trying to compute C(n, r) where r > n. Mathematically zero.
- Forgetting r! / (n-r)! division. Just dividing by n! gives wrong answer.
- Computing for very large numbers without log scale. Overflow common.
- Treating C(n, 0) and C(n, n) as undefined. Both equal 1.
- Using nCr formula when nPr is appropriate. Order matters in many cases.
- Confusing with factorials. n choose r is not the same as r!.