Lelifi·tools

Binomial Coefficient Calculator

Choosing 3 of 10 gives 120 groups: 10 x 9 x 8 = 720 ordered picks, divided by the 6 orders each group appears in. Choosing 5 cards from a 52 card deck gives 2,598,960. The calculator keeps the exact integer even where a spreadsheet overflows.

Enter n, the size of the pool, and k, how many you pick. Order does not matter, so picking 3 of 10 counts as one group whatever the order. The exact integer is returned, however many digits it has.

Enter a pool size n and a pick size k to get C(n, k), the number of ways to choose k items from n when order does not matter, with symmetry and row sum checks included.

By the Lelifi editors ·

Key takeaways

Rows 0 to 5 of Pascal's triangle, with each row total on the rightrow total1111212141331814641161510105132Each entry is C(n, k). Row 5 adds to 32, which is 2^5.
Rows 0 through 5 of Pascal's triangle, with each row total on the right. Every entry is a binomial coefficient C(n, k), and row 5 adds to 32, which is 2^5.
On this page
  1. What the binomial coefficient counts
  2. The formula, and why the factorials cancel
  3. Worked example: five card hands
  4. Symmetry, Pascal's rule and row sums
  5. How the calculator handles huge values
  6. Where the numbers show up
  7. Common slips and quick checks

What the binomial coefficient counts

A binomial coefficient answers one counting question: how many ways can you pick k items out of a pool of n when the order of the pick does not matter? Two toppings from a list of 8, three starters from a 10 player roster, five cards from a 52 card deck. Each answer is written C(n, k), read as n choose k, and those three examples come to 28, 120 and 2,598,960.

The word coefficient comes from algebra. When you expand (1 + x)^n, the number in front of x^k is C(n, k), which is why these counts are called the coefficients of the binomial theorem. The OpenStax Precalculus chapter on counting principles builds the same rule from the multiplication principle: count the ordered picks first, then divide out the orders each group was counted in.

That division at the end is the whole idea. Line up 3 of 10 players in a batting order and there are 10 x 9 x 8 = 720 arrangements. Every group of 3 shows up in that count 3! = 6 times, once per order, so the number of distinct groups is 720 / 6 = 120. Nothing about the players changed between the two counts, only whether the order counted.

The formula, and why the factorials cancel

The closed form is C(n, k) = n! / (k! x (n - k)!). The exclamation mark is the factorial, the product of every whole number from 1 up to that number, so 5! = 120.

Read the formula as a correction. The numerator counts all n! orderings of the pool. The k! in the denominator removes the orderings inside the chosen group, and the (n - k)! removes the orderings inside the leftovers, because neither reshuffles the group itself.

SymbolWhat it meansIn C(10, 3)
nsize of the pool10 players
khow many you pick3 starters
n!every ordering of the pool3,628,800
k!orderings inside the group6
(n - k)!orderings inside the leftovers5,040
C(n, k)distinct groups120

Worked with the factorials: 10! = 3,628,800, 3! = 6 and 7! = 5,040, so the denominator is 6 x 5,040 = 30,240 and 3,628,800 / 30,240 = 120. That 30,240 is the overcount, the number of times each group of 3 was listed.

Notation varies more than people expect. C(n, k), nCk, a tall pair of brackets around n over k, and the function binom(n, k) all mean the same number. The MathWorld entry on the binomial coefficient collects the identities that connect them, including the symmetry and the Pascal rule used further down this page.

Worked example: five card hands

A 5 card hand from a 52 card deck is the standard case. Writing out 52! is hopeless by hand, so cancel first: the 47! in the denominator wipes out 47 of the 52 factors, and you are left with the top five numbers over 5!.

The top five factors are 52, 51, 50, 49 and 48, which multiply to 311,875,200. Divide by 120 and 311,875,200 / 120 = 2,598,960 distinct hands. That is C(52, 5), and the same number comes back for C(52, 47) because discarding 47 cards is the same act as keeping 5.

The same count drives poker probabilities. A flush, five cards of one suit, can come from any of the 4 suits, and each suit offers C(13, 5) = 1,287 hands, so 4 x 1,287 = 5,148 flushes in all. The chance of being dealt one is 5,148 / 2,598,960 = 0.00198, a shade under 0.2 percent. The OEIS entry A007318 lists Pascal's triangle as a sequence, which is the same table of coefficients in a different layout.

Cards kept (k)Hands, C(52, k)What it counts
01the empty hand
152single cards
21,326starting hands in hold'em
322,100three card groups
4270,725four card groups
52,598,960poker hands

Symmetry, Pascal's rule and row sums

Choosing which k to keep is the same as choosing which n - k to discard, so C(n, k) = C(n, n - k). Out of 52 cards, a hand of 5 and a hand of 47 both number 2,598,960. A calculator uses the smaller of k and n - k internally, which also halves the multiplication work.

Pascal's rule builds the entire triangle from one line: C(n, k) = C(n - 1, k - 1) + C(n - 1, k). For C(10, 4) that reads C(9, 3) + C(9, 4) = 84 + 126 = 210. The split covers every group exactly once: either a particular person is in the group, and you pick 3 more from the other 9, or that person is out, and you pick all 4 from the other 9.

Row 6 of the triangle shows the two habits these numbers have, symmetry and a fixed total.

k0123456
C(6, k)1615201561

The row adds up to 1 + 6 + 15 + 20 + 15 + 6 + 1 = 64, which is 2^6, because a row lists the counts of every subset of an n item set and a set of 6 items has 64 subsets. A second pattern, the hockey stick, adds a diagonal: 1 + 3 + 6 = 10, which is C(5, 3). In general the partial sums down column r land on C(n + 1, r + 1).

How the calculator handles huge values

The factorial form gives out long before the numbers do. A double precision float tops out near 1.8 x 10^308, and the factorial of 171 crosses that line, so a spreadsheet that computes 170! correctly returns an error one row later even though the coefficient itself is an ordinary integer.

The fix is to never build the factorials. Multiply and divide one term at a time, k terms in all, dividing at each step so the running value stays a whole number. That multiplicative form is what the calculator uses, on top of exact integer arithmetic, which is why C(100, 50) comes back as 100891344545564193334812497256, all 30 digits of it, and not as a rounded float with a tail of zeros.

Past a point the digits stop being useful to a reader. C(200, 100) is a 59 digit number close to 9.05 x 10^58, so the calculator also reports the digit count, the row sum 2^n and the share of the row that one coefficient takes. If you need the coefficient inside a probability rather than on its own, logarithms keep the arithmetic in range and the binomial distribution calculator applies it to p^k and (1 - p)^(n - k) for you.

Where the numbers show up

Lotteries are the example most people meet first. A 6 number ticket drawn from 49 numbers has C(49, 6) = 13,983,816 possible rows, and that count is the denominator in the jackpot odds. Poker runs on C(52, 5) = 2,598,960, and the poker odds calculator uses the same coefficients to price each hand.

Paths on a grid work the same way. A walk across a 6 by 4 grid takes 10 steps, 6 in one direction and 4 in the other, in some order, so there are C(10, 4) = 210 routes. Coin flips: exactly 5 heads in 10 flips happens in C(10, 5) = 252 of the 1,024 possible sequences, and 252 / 1,024 = 0.2461, or about 24.61 percent. Quality control: pulling 3 parts from a batch of 20 gives C(20, 3) = 1,140 possible samples, which sets how many different inspections a sampling plan can see.

Two neighbouring tools take the next step. The factorial calculator handles the raw products, and the binomial distribution calculator turns a count of arrangements into a probability once you know the chance of success on a single trial.

Common slips and quick checks

The most common slip is order. A combination ignores it and a permutation does not, and the two differ by k!. P(10, 3) = 120 x 6 = 720, so passcodes, podium finishes and batting orders are permutations, while committees, hands and pizza toppings are combinations.

The second slip is a k larger than n, which gives 0 rather than an error: there are no ways to choose 7 items from a pool of 5. Feeding a percent, a decimal or a negative number where a whole count belongs is the third, since n and k are always whole numbers and both are 0 or more.

Three checks catch most of the rest. Symmetry: the answer must not change when you swap k for n - k. Row sum: every C(n, k) at a fixed n adds to 2^n, so no single entry in a row can exceed that total. Small cases: C(n, 0) = 1 and C(n, 1) = n for every n, and a formula that disagrees with either one has been misread. For a hand check on a larger value, use the multiplicative form and divide at each step, because the running value then never leaves the integers. That is the same route the calculator above takes, and it is the reason a 30 digit answer arrives without a rounding warning.

Frequently asked questions

What is the binomial coefficient formula?

C(n, k) = n! / (k! x (n - k)!). It counts the ways to pick k items from n when order does not matter. For C(10, 3): 3,628,800 / (6 x 5,040) = 120.

How many ways are there to choose 3 from 10?

120. The ordered count is 10 x 9 x 8 = 720, and each group of 3 appears 6 times in that count, so 720 / 6 = 120.

How many 5 card hands can be dealt from 52 cards?

2,598,960. That is C(52, 5) = (52 x 51 x 50 x 49 x 48) / 120, since the top five factors multiply to 311,875,200 and 311,875,200 / 120 = 2,598,960.

Why does C(n, k) equal C(n, n - k)?

Because picking k items to keep also picks n - k items to leave. C(52, 5) and C(52, 47) both come to 2,598,960, and the calculator uses the smaller of the two as its loop length.

What is the largest n the calculator accepts?

2,000. C(2,000, 1,000) is a number of roughly 600 digits, near 10^600, and the exact integer arithmetic returns every one of them.

Why does my spreadsheet fail on large factorials?

The factorial of 171 passes the 1.8 x 10^308 limit of a double precision float, so FACT(171) returns an error even though C(171, 85) is an ordinary integer. Multiply and divide one term at a time instead of building the factorials.

What does a whole row of Pascal's triangle add up to?

2^n. Row 6 sums to 1 + 6 + 15 + 20 + 15 + 6 + 1 = 64, and 2^6 = 64, because each entry counts a subset and a 6 item set has 64 subsets.

What is Pascal's rule?

C(n, k) = C(n - 1, k - 1) + C(n - 1, k). For C(10, 4): C(9, 3) + C(9, 4) = 84 + 126 = 210, splitting the groups by whether one particular item is in or out.

How many lottery rows are there in a 6 from 49 game?

13,983,816, which is C(49, 6). That count is the denominator of the jackpot odds, so a single ticket covers one of those rows.

What is the difference between a permutation and a combination?

Order. P(10, 3) = 120 x 6 = 720 ordered arrangements against 120 unordered groups, because P(n, k) = C(n, k) x k!.

What is the chance of exactly 5 heads in 10 coin flips?

252 / 1,024 = 0.2461, about 24.61 percent. There are C(10, 5) = 252 sequences with 5 heads out of 1,024 sequences in total.

Can the binomial coefficient be zero?

Yes, whenever k is larger than n or negative. C(5, 7) = 0 because you cannot pick 7 items from a pool of 5. For every k from 0 to n the value is a positive whole number.

How do I compute C(n, k) by hand for a large value?

Cancel the factorials, then multiply and divide in steps: C(52, 5) works out as 52 x 51 x 50 x 49 x 48 / 120 = 311,875,200 / 120 = 2,598,960. Divide at each step so the running value stays exact.

Spotted a wrong number or a broken result?

More Math tools

See all Math tools

Fee schedules, rates and rules change without notice. Always confirm important figures with the official source before you rely on them.