standarddeviationcalculator.net

Updated Free · runs in your browser

Statistics

Combination calculator (nCr)

Count the ways to choose r items from n when order does not matter. Type n and r, or type the items themselves to see every combination listed.

Ignored when you type the items below.

Separate with commas. Leave blank to use A, B, C, …

5C3 = C(5, 3) 10
n (items)5
r (chosen)3
Without repetition, C(n, r)10
With repetition, C(n + r − 1, r)35
If order mattered, P(n, r)60

All 10 combinations:

  1. {cheese, ham, mushroom}
  2. {cheese, ham, olive}
  3. {cheese, ham, pepper}
  4. {cheese, mushroom, olive}
  5. {cheese, mushroom, pepper}
  6. {cheese, olive, pepper}
  7. {ham, mushroom, olive}
  8. {ham, mushroom, pepper}
  9. {ham, olive, pepper}
  10. {mushroom, olive, pepper}
1101001000Combinations C(5, 3)10With repetition35Permutations P(5, 3)60count, log scale (each gridline is ×10)
The same n and r counted three ways
Order matters?Repeats?Count
NoNoC(5, 3) = 10
NoYesC(7, 3) = 35
YesNoP(5, 3) = 60
Show the working, step by step
  1. Order does not matter and nothing repeats, so use the combination formula.

    C(n, r) = n! / (r! (n − r)!) = 5! / (3! × 2!)

  2. Cancel the larger factorial, leaving 2 factors on top and 2! underneath.

    = (5 × 4) / (2 × 1)

  3. Divide.

    = 10

  4. Each group of 3 can be put in 3! = 6 orders, which is why the ordered count (permutations) is bigger.

    nPr = nCr × r! = 10 × 6 = 60

The formula

C(n, r) = n! ÷ (r! (n − r)!) With repetition: C(n + r − 1, r)

Here n is the number of different items available and r is how many you choose. The factorial n! means n × (n − 1) × … × 1. The r! in the denominator removes the orderings of each group, because a combination does not care whether you picked cheese before ham or ham before cheese.

A worked example

The default is a pizza with 3 toppings chosen from 5: cheese, ham, mushroom, olive and pepper. Order does not matter and you cannot choose the same topping twice.

C(5, 3) = 5! ÷ (3! × 2!) = (5 × 4) ÷ (2 × 1) = 10

The calculator lists all 10, from {cheese, ham, mushroom} to {mushroom, olive, pepper}. Cancelling the 3! against the top of 5! leaves only two factors above and 2! below, which is why the arithmetic is short. You can always cancel the larger of r! and (n − r)!.

Now allow repeats, so a double-cheese pizza counts. Switch the first box to “with repetition”:

C(5 + 3 − 1, 3) = C(7, 3) = 35

The extra 25 groups are the ones with a topping used twice or three times. And if order did matter (first, second and third topping on a menu), there would be P(5, 3) = 5 × 4 × 3 = 60 arrangements, which is 10 groups × 3! orders each.

How to read the result

The headline is the number of distinct groups. If you divide 1 by it, you get the chance that one particular group is picked when every group is equally likely. A lottery that draws 6 numbers from 49 has C(49, 6) = 13,983,816 combinations, so a single ticket has a 1 in 13,983,816 chance of the jackpot.

Combinations also sit inside other formulas. In the binomial distribution, C(n, k) counts the number of orders in which k successes can occur among n trials. In a card game, C(52, 5) = 2,598,960 is the number of five-card poker hands.

For small sets the list is useful for checking your own enumeration by hand. When the count runs past 300, the calculator lists the first 20 in dictionary order so you can see the pattern, and gives the exact total. It uses whole-number arithmetic throughout, so answers with hundreds of digits are exact rather than rounded.

Common mistakes

  • Using a combination when order matters. Passwords, race finishes and seat assignments are permutations.
  • Forgetting repetition. Choosing 3 donuts from 5 kinds, where you may take two of the same, needs C(n + r − 1, r), not C(n, r).
  • Choosing more than you have. Without repetition r cannot exceed n; C(3, 5) is 0, and the calculator flags it.
  • Multiplying instead of dividing. 5 × 4 × 3 = 60 counts ordered picks; divide by 3! = 6 to get the 10 unordered groups.
Combination calculator: the worked example on this page, with its result and chart
Combination calculator: the worked example above, at a glance.

Common questions

What does nCr mean?

nCr, also written C(n, r) or “n choose r”, is the number of ways to choose r items from n different items when the order of the chosen items does not matter and no item can be chosen twice. It equals n! ÷ (r! (n − r)!). For example, 5C3 = 10.

What is the difference between a combination and a permutation?

A permutation counts ordered arrangements; a combination counts unordered groups. Choosing 3 pizza toppings from 5 is a combination (10 ways). Awarding gold, silver and bronze to 3 of 5 runners is a permutation (60 ways). Each group of 3 can be ordered in 3! = 6 ways, which is why 60 = 10 × 6.

How do I count combinations with repetition?

When an item can be picked more than once (three scoops of ice cream from five flavours, say), use C(n + r − 1, r). With n = 5 and r = 3 that is C(7, 3) = 35. The formula comes from the stars-and-bars argument: arrange r stars and n − 1 bars in a row.

Why is C(n, r) the same as C(n, n − r)?

Choosing which r items to take is the same as choosing which n − r items to leave behind. So C(10, 7) = C(10, 3) = 120. The calculator uses the smaller of r and n − r to keep the working short.

What are C(n, 0) and C(n, n)?

Both are 1. There is exactly one way to choose nothing, and exactly one way to choose everything. By convention 0! = 1, which makes the formula give these answers too.