Binomial Coefficient Calculator
Calculate the binomial coefficient C(n, r) exactly, plus permutations nPr and the factorials n!, r! and (n − r)!, with step-by-step working for n up to 1,000.
Step-by-step solution
About this calculator
The binomial coefficient C(n, r), read “n choose r”, is the number of ways to choose r items from n distinct items when the order does not matter. It is the same number as the r-th entry in row n of Pascal’s triangle, the coefficient of xʳ in the expansion of (1 + x)ⁿ, and the C(n, k) factor in the binomial probability formula.
This calculator uses exact whole-number arithmetic, so nothing is rounded: C(1000, 500), for example, has 300 digits and every one of them is shown. It also gives the number of permutations nPr (where order does matter) and the three factorials that appear in the formula.
How to use it
- Enter n, the total number of items (a whole number from 0 to 1,000).
- Enter r, how many you choose (from 0 to n).
- Read C(n, r), nPr and the factorials. Long numbers can be copied with the Copy button.
- The step-by-step section shows the shortcut used: cancelling the larger factorial so only r small factors are multiplied.
The formulas
Combinations (order does not matter)
C(n, r) = n! / (r! · (n − r)!)n! counts every ordering of all n items. Dividing by r! and (n − r)! removes the orderings inside the chosen group and inside the left-over group, which do not create a different selection.
Multiplicative shortcut
C(n, r) = [n · (n − 1) · … · (n − r + 1)] / r!The (n − r)! cancels out, so only r factors on top are needed. Using the smaller of r and n − r keeps the work short, because C(n, r) = C(n, n − r).
Permutations (order matters)
P(n, r) = n! / (n − r)! = C(n, r) · r!Each unordered selection of r items can be arranged in r! orders, so there are r! times as many permutations as combinations.
Pascal’s rule
C(n, r) = C(n − 1, r − 1) + C(n − 1, r)Either a particular item is chosen (then choose r − 1 from the other n − 1) or it is not (choose all r from the other n − 1). This is why each number in Pascal’s triangle is the sum of the two above it.
Worked examples
Example 1: five-card poker hands
How many different 5-card hands can be dealt from a standard 52-card deck? The order you receive the cards in does not matter, so this is C(52, 5).
- Multiply the top five factors: 52 × 51 × 50 × 49 × 48 = 311,875,200. This is also P(52, 5), the number of ordered deals.
- Divide by 5! = 120 to remove the orderings of the five cards.
- 311,875,200 / 120 = 2,598,960.
Answer: There are C(52, 5) = 2,598,960 possible hands, so any one specific hand has a probability of 1 in 2,598,960.
Example 2: a 6-from-49 lottery
A lottery draws 6 numbers from 1 to 49. How many different tickets are possible, and what is the chance that one ticket matches all six?
- Top factors: 49 × 48 × 47 × 46 × 45 × 44 = 10,068,347,520.
- Divide by 6! = 720: 10,068,347,520 / 720 = 13,983,816.
- Probability of a single ticket winning = 1 / 13,983,816 ≈ 7.15 × 10⁻⁸.
Answer: C(49, 6) = 13,983,816. Buying one ticket gives a chance of about 7.2 × 10⁻⁸ of matching all six numbers.
When to use the binomial coefficient calculator
- Use C(n, r) when you pick a group and the order inside the group does not matter: committees, card hands, lottery numbers, which questions on a test are answered correctly.
- Use nPr when the order matters: race finishing positions, PIN codes without repeated digits, seating people in numbered chairs.
- The items must be distinct, and each one can be picked at most once (no repetition).
When it does not apply
- Choosing with repetition allowed (for example scoops of ice cream where flavours can repeat): the count is C(n + r − 1, r), which you can get here by entering n + r − 1 in place of n.
- Arrangements of letters with repeated letters (such as MISSISSIPPI): that needs the multinomial coefficient n! / (a! · b! · …).
Common mistakes
- Using nPr when order does not matter. For a committee of 3 from 10 people, P(10, 3) = 720 counts each committee 3! = 6 times; the right answer is C(10, 3) = 120.
- Computing the full factorials on a standard calculator. 171! is larger than an ordinary floating-point number can hold, so n! / (r!(n − r)!) overflows long before C(n, r) itself is large. Cancel first, or use exact arithmetic as this tool does.
- Forgetting the edge cases: C(n, 0) = C(n, n) = 1 because 0! = 1, and C(n, r) = 0 when r > n.
- Rounding a large result written in scientific notation and then using it in further exact counting. To turn a count into a probability of k successes, use the binomial distribution calculator.
Frequently asked questions
What does nCr mean?
nCr is the number of combinations of n items taken r at a time, the same number as the binomial coefficient C(n, r) or “n choose r”. For example, 5C2 = 10.
What is the difference between nCr and nPr?
nCr counts selections where order does not matter; nPr counts arrangements where it does. nPr = nCr × r!, so nPr is always at least as large.
Why is 0! equal to 1?
There is exactly one way to arrange zero items (do nothing). Defining 0! = 1 also makes formulas such as C(n, 0) = n! / (0! · n!) = 1 work without special cases.
Why is it called the binomial coefficient?
Because C(n, r) is the coefficient of xʳyⁿ⁻ʳ when the binomial (x + y)ⁿ is multiplied out. For example (x + y)³ = x³ + 3x²y + 3xy² + y³, and 1, 3, 3, 1 are C(3, 0) to C(3, 3).
How does nCr relate to the binomial distribution?
In P(X = k) = C(n, k) · pᵏ · (1 − p)ⁿ⁻ᵏ, the coefficient counts how many different sequences of n trials contain exactly k successes. Each such sequence has the same probability, pᵏ(1 − p)ⁿ⁻ᵏ.
What is the largest n this calculator handles?
n up to 1,000. The results are exact integers; n! for n = 1,000 has 2,568 digits, and the page shows every digit along with the digit count.