nCr — Combination Calculator
Quick Examples
Enter n and r in the Calculate tab first, then return here for full working.
What Is a Combination?
A combination is a selection of r objects chosen from n distinct objects where the order of selection does not matter. Two selections that contain the same objects in different order count as one combination. The total number of such selections is C(n,r), read as "n choose r" or "nCr."
Suppose you have five students — A, B, C, D, E — and you need to pick two to represent the class. The group {A, B} is identical to the group {B, A}; the order in which you named them is irrelevant. There are C(5,2) = 10 such groups. Combinations appear throughout discrete mathematics, probability, and statistics because counting without regard to order prevents double-counting arrangements of the same underlying group.
According to the Wolfram MathWorld reference, combinations are among the foundational objects of combinatorics and appear directly in the binomial theorem, Pascal's triangle, and probability theory.
The Combination Formula — nCr
The standard combination formula is:
Where n is the total number of objects, r is the number selected, and ! denotes factorial. The formula divides the number of ordered selections (permutations) by r! — the number of ways to arrange the selected items — because all those arrangements represent the same unordered group.
Table: Variables in the Combination Formula
| Symbol | Name | Meaning |
|---|---|---|
| n | Population size | Total number of distinct objects available |
| r | Sample size | How many objects are selected |
| n! | n factorial | n × (n−1) × … × 2 × 1 (0! = 1 by definition) |
| r! | r factorial | Counts the arrangements of the chosen items; dividing by it removes order |
| (n−r)! | Complement factorial | Accounts for the unchosen items |
| C(n,r) | Combination | Number of distinct r-element subsets of an n-element set |
How to Calculate Combinations Step by Step
To calculate C(10, 3): write the formula, substitute the values, simplify the factorials, and divide. Here is the full method.
n = 10 (total items), r = 3 (items selected). Check that r ≤ n. Both are non-negative integers.
C(10, 3) = 10! / [3! × (10 − 3)!] = 10! / (3! × 7!)
10! / 7! = 10 × 9 × 8 (the 7! cancels). So C(10,3) = (10 × 9 × 8) / 3!
Numerator: 10 × 9 × 8 = 720. Denominator: 3! = 3 × 2 × 1 = 6.
C(10, 3) = 720 / 6 = 120. There are 120 ways to choose 3 items from 10 when order does not matter.
Result: C(10, 3) = 120. You can verify this instantly in the calculator above.
Calculating Combinations Without Full Factorials
Computing n! directly for large n produces enormous numbers, most of which cancel in the final division. A more practical method uses the multiplicative form:
This multiplies only r terms in the numerator. To reduce arithmetic further, use the symmetry identity C(n,r) = C(n, n−r) and compute whichever has the smaller r value. For C(52, 49), for example, it is far easier to compute C(52, 3) = (52 × 51 × 50) / 6 = 22,100 than to work with 49-term products.
Numerator: 20 × 19 × 18 × 17 × 16 = 1,860,480
Denominator: 5! = 120
C(20, 5) = 1,860,480 / 120 = 15,504
Factorials and Why 0! = 1
The factorial of n, written n!, equals the product of all positive integers from 1 to n. By definition, 0! = 1.
Factorial Reference Table
| n | n! | Expansion |
|---|---|---|
| 0 | 1 | By definition |
| 1 | 1 | 1 |
| 2 | 2 | 2 × 1 |
| 3 | 6 | 3 × 2 × 1 |
| 4 | 24 | 4 × 3 × 2 × 1 |
| 5 | 120 | 5 × 4 × 3 × 2 × 1 |
| 6 | 720 | 6 × 5 × 4 × 3 × 2 × 1 |
| 7 | 5,040 | 7! |
| 10 | 3,628,800 | 10! |
| 20 | 2,432,902,008,176,640,000 | 20! |
The value 0! = 1 preserves the identity C(n,0) = n! / [0! × n!] = 1, which is correct: there is exactly one way to choose nothing from any set. Without this convention, the combination formula would be undefined at r = 0 and r = n, breaking two important special cases.
The Symmetry Property: C(n,r) = C(n,n−r)
Every combination has a mirror image: C(n,r) = C(n,n−r) for all valid n and r. Choosing 3 items to include from 10 is equivalent to choosing the 7 items to exclude. Both problems produce the same count: 120.
C(n, n−r) = n! / [(n−r)! × (n−(n−r))!]
= n! / [(n−r)! × r!]
= C(n, r) ■
This identity has a practical use beyond its elegance. When r is large relative to n, compute C(n, n−r) instead, since the smaller value reduces the number of multiplication steps required. C(100, 97) is far easier to compute as C(100, 3) = 161,700.
Special Cases of C(n, r)
Table: Special Cases and Their Values
| Case | Formula | Value | Interpretation |
|---|---|---|---|
| r = 0 | C(n, 0) = n! / (0! × n!) | 1 | Exactly one way to choose nothing |
| r = n | C(n, n) = n! / (n! × 0!) | 1 | Exactly one way to choose everything |
| r = 1 | C(n, 1) = n! / (1! × (n−1)!) | n | n ways to pick a single item |
| r = n−1 | C(n, n−1) = n! / ((n−1)! × 1!) | n | n ways to leave exactly one item out |
| r = 2 | C(n, 2) = n(n−1)/2 | n(n−1)/2 | Pairs from n objects |
| r > n | Undefined (standard) | 0 | Cannot choose more than the total available |
Combinations vs. Permutations — The Core Difference
Combinations and permutations both count selections, but permutations treat different arrangements of the same items as distinct outcomes, whereas combinations do not. The relationship is: C(n,r) = P(n,r) / r!. Every set of r items has r! possible orderings, so dividing the permutation count by r! collapses all those orderings into a single combination.
Table: Combinations vs. Permutations — Formula and Key Distinction
| Property | Combination | Permutation |
|---|---|---|
| Order matters? | No | Yes |
| Formula | C(n,r) = n! / [r!(n−r)!] | P(n,r) = n! / (n−r)! |
| C(10,3) / P(10,3) | 120 | 720 |
| Ratio | C(n,r) = P(n,r) / r! | P(n,r) = C(n,r) × r! |
| Typical question | "How many groups?" | "How many arrangements?" |
Table: Scenario Decision Guide — Combination or Permutation?
| Scenario | Type | Reason |
|---|---|---|
| Choose 3 committee members from 10 | Combination | Only membership matters, not title or order |
| Award gold, silver, and bronze medals | Permutation | Each position is distinct |
| Deal a 5-card poker hand from 52 | Combination | The hand is defined by which cards it contains, not the dealing order |
| Arrange 5 books on a shelf | Permutation | Every ordering is a different arrangement |
| Select 4 students for a project team | Combination | Roles are identical — only membership matters |
| Assign 4 students to 4 named roles | Permutation | Each student gets a specific, distinguishable role |
| Choose 6 lottery numbers from 49 | Combination | The ticket wins regardless of number order |
| Create a 4-digit PIN (digits may repeat) | Permutation with repetition | Order of digits determines the PIN |
Where the Formula Comes From
The combination formula is derived from the permutation formula. The number of ordered selections of r objects from n is:
Each unordered group of r items corresponds to exactly r! ordered arrangements of those same r items. So the count of unordered groups is:
For C(5,2): P(5,2) = 5 × 4 = 20 ordered pairs. Each pair appears in 2! = 2 orders ({A,B} and {B,A}). So C(5,2) = 20 / 2 = 10. This is the central insight: combinations prevent the double-counting that permutations include.
Combination with Repetition
When the same item may be selected more than once, the formula changes to C(n+r−1, r), also called the multiset coefficient or "stars and bars." This counts the number of ways to choose r items from n types when any type may appear multiple times.
n = 5 (flavours), r = 3 (scoops selected)
C(5 + 3 − 1, 3) = C(7, 3) = 7! / (3! × 4!) = 35
There are 35 distinct combinations with repetition.
This is a fundamentally different calculation from C(5,3) = 10, which counts selections where each flavour appears at most once. Use the With Repetition tab in the calculator above for this formula. Do not confuse the two: the standard nCr formula applies only when items cannot be reused.
Pascal's Triangle and Combinations
Every entry in Pascal's triangle is a combination value. Row n, position r (starting from zero) equals C(n,r). Each interior entry obeys Pascal's identity: C(n,r) = C(n−1, r−1) + C(n−1, r).
Highlighted cells: C(5,2)=10 and C(5,3)=10 illustrate the symmetry identity.
Row 5 reads: C(5,0)=1, C(5,1)=5, C(5,2)=10, C(5,3)=10, C(5,4)=5, C(5,5)=1. The symmetry C(n,r)=C(n,n−r) is visible in the mirror structure of each row. The sum of row n equals 2n, representing the total number of subsets of an n-element set.
Combinations and the Binomial Theorem
Combination values are the coefficients in binomial expansions. The binomial theorem states:
= C(3,0)a3 + C(3,1)a2b + C(3,2)ab2 + C(3,3)b3
= 1·a3 + 3·a2b + 3·ab2 + 1·b3
This is why combinations are also called binomial coefficients. The notation nCr, C(n,r), Crn, and the parenthesised form all refer to the same value. The connection between combinations and polynomial algebra makes the combination formula one of the most cross-disciplinary results in mathematics.
How Combinations Are Used in Probability
Combinations count the total number of equally likely outcomes and the number of favourable outcomes, so the probability of an event is often a ratio of two combination values.
Table: Probability Examples Using Combinations
| Problem | Total outcomes | Favourable | Probability |
|---|---|---|---|
| 5-card hand from 52 cards | C(52,5) = 2,598,960 | C(4,1) for four aces and one other = 48 (approx.) | Very small |
| 6 numbers from 49 (lottery) | C(49,6) = 13,983,816 | 1 (the single winning combination) | 1 / 13,983,816 |
| 3 defectives from batch of 20 (4 defective) | C(20,3) = 1,140 | C(4,3) = 4 | 4/1,140 ≈ 0.0035 |
Combinations in Binomial Probability
The binomial probability formula uses C(n,k) directly:
C(n,k) counts the number of distinct ways k successes can occur among n independent Bernoulli trials. For example, if p = 0.3 and n = 10, the probability of exactly 3 successes is C(10,3) × 0.33 × 0.77 = 120 × 0.027 × 0.0824 ≈ 0.267. The binomial distribution page on Statistics Fundamentals covers this formula with full worked examples.
Combinations in the Hypergeometric Distribution
When sampling without replacement from a finite population, combinations govern the hypergeometric distribution:
Where N is the population size, K is the number of successes in the population, n is the sample size, and k is the number of successes observed. Each term in the numerator and denominator is a combination count.
15 Worked Examples
1. C(5, 2) — Choosing Students
C(5,2) = 5! / (2! × 3!) = 120 / (2 × 6) = 120 / 12 = 10
The 10 pairs: AB, AC, AD, AE, BC, BD, BE, CD, CE, DE.
2. C(10, 3) — Committee Selection
C(10,3) = (10 × 9 × 8) / (3 × 2 × 1) = 720 / 6 = 120
There are 120 ways to form a 3-person committee from 10 candidates.
3. C(20, 5) — Survey Sampling
C(20,5) = (20 × 19 × 18 × 17 × 16) / 5! = 1,860,480 / 120 = 15,504
4. C(52, 5) — Poker Hands
C(52,5) = 52! / (5! × 47!) = (52 × 51 × 50 × 49 × 48) / 120
= 311,875,200 / 120 = 2,598,960
There are over 2.5 million distinct poker hands.
5. C(49, 6) — Lottery Combinations
C(49,6) = 13,983,816
The probability of matching all 6 numbers with one ticket is 1 in 13,983,816.
6. C(100, 4) — Large n
= 94,109,400 / 24 = 3,921,225
7. Symmetry Check — C(10,3) vs C(10,7)
To verify: C(10,7) = 10! / (7! × 3!) = same denominator as C(10,3) rearranged. ✓
8. Special Case — C(8, 0)
There is exactly one way to choose no items from any collection.
9. Special Case — C(8, 8)
There is exactly one way to choose all 8 items from 8.
10. Binomial Probability — Exactly 2 Heads in 6 Flips
= 15 × 0.25 × 0.0625 = 15 × 0.015625 = 0.234375 (about 23.4%)
11. Combination with Repetition — Ice Cream
C(5+3−1, 3) = C(7,3) = 7! / (3! × 4!) = 5040 / 144 = 35
12. Card Probability — Probability of a Flush
Flush hands (5 cards of same suit): 4 × C(13,5) = 4 × 1,287 = 5,148
P(flush) = 5,148 / 2,598,960 ≈ 0.00198 (about 0.2%)
13. Pascal's Identity Check — C(6,2) = C(5,1) + C(5,2)
This is Pascal's recursion: each entry is the sum of the two entries above it.
14. Hypergeometric Probability — Quality Control
= C(4,1) × C(16,2) / C(20,3)
= 4 × 120 / 1,140 = 480 / 1,140 ≈ 0.421
15. Combination vs Permutation Comparison
P(8,3) = 8 × 7 × 6 = 336 (order matters — different officer assignment)
Choose 3 committee members from 8 (no roles):
C(8,3) = 336 / 6 = 56 (order irrelevant)
Common Mistakes with Combinations
Table: Common Errors and How to Avoid Them
| Mistake | Example | Correction |
|---|---|---|
| Using permutation when order does not matter | Counting committee arrangements with P(n,r) | Use C(n,r); only membership counts |
| Forgetting that 0! = 1 | Treating C(n,0) as undefined | 0! = 1 by definition; C(n,0) = 1 |
| Entering r > n | C(3, 5) | r cannot exceed n; the calculator returns an error |
| Using decimals for n or r | C(5.5, 2) | Both must be non-negative integers |
| Using the repetition formula when repetition is not allowed | C(n+r−1,r) for a lottery | Use C(n,r); lottery tickets cannot repeat numbers |
| Confusing C(n,r) with P(event) | Saying "C(49,6) is the probability of winning" | C(49,6) is the count of outcomes; P = 1/C(49,6) |
| Swapping n and r | Entering C(3,10) instead of C(10,3) | n must be the larger value; r ≤ n |
| Forgetting to divide by r! | Stopping at the permutation count | Always divide P(n,r) by r! to get the combination |
Combinations in Excel, Python, and R
Excel and Google Sheets
Excel and Google Sheets provide two distinct combination functions. Use the right one for each problem.
Table: COMBIN vs COMBINA
| Function | Syntax | What it computes | Formula |
|---|---|---|---|
| COMBIN | =COMBIN(n, r) | Standard combinations (no repetition) | C(n,r) = n!/[r!(n-r)!] |
| COMBINA | =COMBINA(n, r) | Combinations with repetition | C(n+r-1, r) |
=COMBIN(10, 3) ' Returns 120
=COMBINA(5, 3) ' Returns 35 (with repetition)
=COMBIN(52, 5) ' Returns 2,598,960 (poker hands)
=COMBIN(49, 6) ' Returns 13,983,816 (lottery)Python
Python's standard library provides math.comb() (Python 3.8+), which returns exact integer results.
import math
# Standard combination — exact integer
print(math.comb(10, 3)) # 120
print(math.comb(52, 5)) # 2598960
print(math.comb(49, 6)) # 13983816
print(math.comb(100, 4)) # 3921225
# Combination with repetition
def comb_with_rep(n, r):
return math.comb(n + r - 1, r)
print(comb_with_rep(5, 3)) # 35R
R provides choose(n, r) for combinations and lchoose(n, r) for the log of the binomial coefficient when results are very large.
choose(10, 3) # 120
choose(52, 5) # 2598960
choose(49, 6) # 13983816
# Log-combination for very large values
lchoose(100, 50) # log(C(100,50)) without overflowQuick Reference: What Every Learner Should Know About Combinations
| Concept | Formula / Value | Plain English |
|---|---|---|
| Combination | C(n,r) = n!/[r!(n-r)!] | Count of r-element subsets of an n-element set; order ignored |
| n | Total objects | The size of the pool you are choosing from |
| r | Objects selected | How many you pick; must satisfy 0 ≤ r ≤ n |
| Factorial | n! = n×(n-1)×…×1 | The product of all positive integers from 1 to n; 0!=1 |
| Symmetry | C(n,r) = C(n,n-r) | Choosing 3 to include equals choosing 7 to exclude (if n=10) |
| From permutations | C(n,r) = P(n,r)/r! | Divide ordered selections by the number of orderings of each group |
| Pascal's identity | C(n,r)=C(n-1,r-1)+C(n-1,r) | Each row of Pascal's triangle is built from the row above |
| Binomial coefficient | Coefficient of xr in (1+x)n | Same number appears in binomial expansions |
| Probability use | P = C(favourable) / C(total) | Ratio of combination counts when outcomes are equally likely |
| With repetition | C(n+r-1, r) | Use only when the same item may be selected multiple times |
| Binomial probability | C(n,k)pk(1-p)n-k | C(n,k) counts the arrangements of k successes in n trials |
| Excel | =COMBIN(n,r) | Returns the standard combination value; =COMBINA for repetition |
| Python | math.comb(n,r) | Exact integer result, no overflow (Python 3.8+) |
| R | choose(n,r) | Standard combinations; lchoose for log-scale large values |
Related Calculators and Guides on Statistics Fundamentals
Combinations connect to probability, counting, and distribution theory throughout statistics.
Frequently Asked Questions
A combination is a selection of r items from a set of n distinct items where the order of selection does not matter. The number of combinations is given by C(n,r) = n! / [r!(n−r)!], also written nCr or "n choose r." Choosing {A,B} from {A,B,C} is the same combination as {B,A}; only the membership of the group matters, not the order in which members were named.
The combination formula is C(n,r) = n! / [r!(n−r)!], where n is the total number of objects, r is the number selected, and ! denotes factorial. For C(10,3): 10! / (3! × 7!) = 3,628,800 / (6 × 5,040) = 3,628,800 / 30,240 = 120. The calculator above performs this calculation instantly and shows each step.
Combinations count unordered selections; permutations count ordered arrangements. C(n,r) = n!/[r!(n−r)!] counts groups. P(n,r) = n!/(n−r)! counts arrangements. For n=10, r=3: C(10,3) = 120 unordered groups, P(10,3) = 720 ordered arrangements. The relationship is C(n,r) = P(n,r)/r!, because each group of r items can be arranged in r! different orders.
nCr (also written C(n,r), nCr, or "n choose r") is the number of combinations of r items chosen from n items without regard to order. It equals n!/[r!(n−r)!] and is also called the binomial coefficient because it appears as the coefficient of xr in the binomial expansion of (1+x)n.
No. In standard combinations without repetition, r cannot exceed n because (n−r)! would require the factorial of a negative integer, which is undefined. If you enter r > n into this calculator, it will display an error message. C(n,r) is defined as 0 by convention when r > n, though this case is typically excluded from practical use.
0! = 1 by mathematical convention, chosen to maintain consistency across factorial-based formulas. With 0! = 1, the combination formula gives C(n,0) = n!/(0! × n!) = 1 (correct: one way to choose nothing) and C(n,n) = n!/(n! × 0!) = 1 (correct: one way to choose everything). Without this definition, the formula would fail at these important boundary cases.
The symmetry identity states that choosing r items to include is equivalent to choosing the (n−r) items to exclude. Both operations produce the same number of distinct groups. C(10,3) = C(10,7) = 120 because every 3-element subset defines a unique 7-element complement and vice versa. Practically, this lets you compute C(100,97) as C(100,3) = 161,700, which is far simpler.
Combination with repetition (also called the multiset coefficient or "stars and bars") counts selections where the same item type may appear more than once. The formula is C(n+r−1, r). Choosing 3 scoops of ice cream from 5 flavours where the same flavour can repeat gives C(7,3) = 35. This is distinct from the standard C(5,3) = 10 which assumes no flavour repeats. Always clarify whether repetition is permitted before applying a formula.
Row n of Pascal's triangle lists C(n,0), C(n,1), …, C(n,n) from left to right. Row 5 is 1, 5, 10, 10, 5, 1, corresponding to C(5,0) through C(5,5). Each interior entry satisfies Pascal's identity: C(n,r) = C(n−1,r−1) + C(n−1,r), meaning each number is the sum of the two above it. The sum of all entries in row n equals 2n.
Combinations count equally likely outcomes, so probability problems involving unordered selections use the ratio: P(event) = (favourable combinations) / (total combinations). Lottery odds use C(49,6) as the denominator. The binomial probability formula P(X=k) = C(n,k)pk(1−p)n−k uses C(n,k) to count the number of ways k successes can occur in n trials. The hypergeometric distribution uses a ratio of three combination values to model sampling without replacement.
C(5,2) = 5! / (2! × 3!) = (5 × 4) / (2 × 1) = 20 / 2 = 10. Using the multiplicative shortcut: multiply the top 2 values of 5! in the numerator (5 × 4 = 20) and divide by 2! = 2. The result is 10 distinct pairs from five objects.
The binomial coefficient is another name for C(n,r). The term comes from the binomial theorem: when you expand (a+b)n, the coefficient of an-rbr is C(n,r). For example, (a+b)4 = 1a4 + 4a3b + 6a2b2 + 4ab3 + 1b4, where the coefficients 1, 4, 6, 4, 1 are C(4,0) through C(4,4).
The multiplicative formula avoids computing full factorials: C(n,r) = [n × (n−1) × … × (n−r+1)] / r!. Only r terms appear in the numerator. For large values, first apply symmetry to ensure r ≤ n/2, then use this product. This is exactly the method the calculator uses internally to produce exact integer results efficiently.
C(52,5) = 2,598,960 distinct 5-card hands. Combinations are used rather than permutations because the final hand is the same regardless of the order cards were dealt. This is the denominator in most poker probability calculations. You can verify this using the C(52,5) quick example button in the calculator above.
C(49,6) = 13,983,816. Using the multiplicative method: (49 × 48 × 47 × 46 × 45 × 44) / 6! = 10,068,347,520 / 720 = 13,983,816. Each six-number selection from 49 numbers is one distinct ticket. The probability that one ticket matches the winning combination is exactly 1 in 13,983,816.