ThisCalculator

Technology

Combination Formula: Calculate nCr Step by Step

Updated · Standard formula, shown below

The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.

Combination Formula: Calculate nCr Step by Step

This calculator works out the number of ways to choose r items from a set of n distinct items, where the order of selection does not matter. You enter the total number of items (n) and the number you want to pick (r), and it returns the combination count (often written as nCr or C(n,r)). The result tells you how many different groups of that size are possible.

Formula

The combination formula counts subsets without regard to order. In symbols:

C(n, r) = n! / [r! × (n − r)!]

  • n = total number of distinct items (a positive integer)
  • r = number of items chosen (an integer between 0 and n)
  • ! = factorial, meaning the product of all positive integers up to that number (e.g., 5! = 5 × 4 × 3 × 2 × 1 = 120)

Because order does not matter, this formula divides the number of ordered arrangements (permutations) by the number of ways the chosen items can be reordered (r!). For example, picking {A, B, C} is the same as {C, B, A} – they are one combination, not six.

Worked Example

Using the default values from the calculator: n = 10, r = 3.

  1. Compute n! = 10! = 10 × 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 3,628,800
  2. Compute r! = 3! = 3 × 2 × 1 = 6
  3. Compute (n − r)! = 7! = 7 × 6 × 5 × 4 × 3 × 2 × 1 = 5,040
  4. Multiply r! × (n − r)! = 6 × 5,040 = 30,240
  5. Divide: 3,628,800 ÷ 30,240 = 120

So C(10, 3) = 120. There are 120 different ways to choose 3 items from a set of 10. The calculator gives the same result.

When to Use Combinations vs. Permutations

The key question: does order matter?

  • Combinations (nCr) – order does not matter. Example: picking 3 members for a committee from 10 people. The committee {Alice, Bob, Carol} is identical to {Carol, Alice, Bob}.
  • Permutations (nPr) – order matters. Example: assigning 3 distinct roles (president, treasurer, secretary) from 10 people. Alice as president is different from Alice as treasurer.

Many real-world problems are combinations: lottery numbers (the order drawn doesn’t matter), choosing a subset of items for a sample, forming teams, or selecting multiple-choice answers. If the problem involves arranging, ranking, or sequencing, use permutations instead.

Common Mistakes and How to Avoid Them

  • Using r > n – The formula is undefined when r exceeds n. The calculator enforces this by returning an error. Always check that you are not choosing more items than exist.
  • Forgetting that C(n, r) = C(n, n − r) – Choosing 3 out of 10 gives the same count as choosing 7 out of 10 (the ones you leave out). This symmetry is a quick sanity check.
  • Mixing up n and r – Swapping them usually gives a different result. C(10, 3) = 120, but C(3, 10) is invalid. Keep the total first.
  • Using the permutation formula instead – If you accidentally compute n! / (n − r)! you get 720 for 10P3, which is 6 times larger than the combination. The extra factor of r! is exactly what removes the order.
  • Rounding errors with large numbers – Factorials grow extremely fast (20! ≈ 2.43 × 10^18). For n above about 170, direct factorial computation exceeds the range of most calculators. In such cases, use a logarithmic form or a specialized tool.

Limits of the Formula

The standard combination formula assumes distinct items and selection without replacement. It does not apply when:

  • Items are identical (e.g., choosing 3 red balls from a set of identical red balls – there is only 1 way).
  • You allow repetition (e.g., choosing 3 scoops of ice cream from 5 flavors, where you can pick the same flavor twice). That uses the “combinations with repetitionâ€� formula: C(n + r − 1, r).
  • The order matters – then you need permutations.

Also, the formula gives the number of ways, not the probability. If each combination is equally likely, the probability of a specific combination is 1 / C(n, r). For example, the chance of holding the exact 3-item subset you want out of 10 is 1/120 ≈ 0.83%.

Real-World Applications

  • Lotteries – The number of possible ticket combinations is C(total numbers, numbers drawn). For a 6/49 lottery, it’s C(49, 6) = 13,983,816.
  • Card games – The number of possible 5-card poker hands from a 52-card deck is C(52, 5) = 2,598,960.
  • Sampling – How many different samples of size r can be drawn from a population of n? This is the basis for many statistical formulas.
  • Team selection – Choosing a project group of 4 from 12 employees gives C(12, 4) = 495 possible teams.
  • Binary choices – The number of ways to get exactly r heads in n coin flips is C(n, r). For 10 flips, the number of ways to get exactly 3 heads is C(10, 3) = 120.

Frequently Asked Questions

What is the difference between nCr and nPr?

nCr (combinations) counts selections where order does not matter. nPr (permutations) counts arrangements where order matters. For the same n and r, nPr = nCr × r!. For example, 10P3 = 720, while 10C3 = 120.

Can r be 0?

Yes. C(n, 0) = 1 for any n, because there is exactly one way to choose nothing. This matches the formula: n! / (0! × n!) = 1, since 0! is defined as 1.

What happens if n or r is not an integer?

The standard combination formula is defined for non-negative integers. If you enter a decimal, the calculator will round it to the nearest integer or give an error, depending on the implementation. In mathematics, there is a generalized binomial coefficient that works for real numbers, but it is beyond the scope of this simple calculator.

How do I calculate combinations with repetition?

When you can choose the same item more than once and order does not matter, use the formula C(n + r − 1, r). For example, choosing 3 scoops from 5 flavors with repetition allowed gives C(5 + 3 − 1, 3) = C(7, 3) = 35.

Why does the calculator show a result of 1 when r = n?

Because there is exactly one way to choose all n items from a set of n – you take everything. The formula gives n! / (n! × 0!) = 1. Similarly, C(n, 0) = 1.

Can I use this for probability calculations?

Yes. If all combinations are equally likely, the probability of a specific combination is 1 / C(n, r). For more complex probabilities, you often need to count favorable combinations and divide by the total number of combinations. For example, the probability of getting exactly 3 heads in 10 coin flips is C(10, 3) / 2^10 = 120 / 1024 ≈ 0.117.

Related

Formula used
in n | Total items (n) | - | 10 | 0
in r | Items chosen (r) | - | 3 | 0
out ncr | Combinations (nCr) | - | fact(n) / (fact(r) * fact(n - r)) | 0

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.