Calcolio
EN

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.

C(n, r)
P(n, r)
C(n, r) — combinations
P(n, r) — permutations
n!
r!
(n − r)!

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

    1. Enter n, the total number of items (a whole number from 0 to 1,000).
    2. Enter r, how many you choose (from 0 to n).
    3. Read C(n, r), nPr and the factorials. Long numbers can be copied with the Copy button.
    4. 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).

    1. Multiply the top five factors: 52 × 51 × 50 × 49 × 48 = 311,875,200. This is also P(52, 5), the number of ordered deals.
    2. Divide by 5! = 120 to remove the orderings of the five cards.
    3. 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?

    1. Top factors: 49 × 48 × 47 × 46 × 45 × 44 = 10,068,347,520.
    2. Divide by 6! = 720: 10,068,347,520 / 720 = 13,983,816.
    3. 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

    When it does not apply

    Common mistakes

    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.

    Related calculators