Maths Probability

Combination calculator

Items to choose from (n)
Items chosen (r)
Combinations (nCr) 2,598,960
C(52,5) = n! ÷ (r!(n−r)!)
Permutations (nPr) 311,875,200
With repetition, order matters 380,204,032
With repetition, order does not 3,819,816
n factorial 80,658,175,170,943,880,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000
nPr = nCr × r!

Choosing five cards from fifty-two where order does not matter gives 2,598,960 possible hands. If order did matter it would be 311,875,200. Exactly 120 times more, because five cards can be arranged in 5! = 120 ways. That factor of r! is the entire difference between a combination and a permutation, and it is why nCr is always the smaller number.

A combination counts selections where order does not matter: C(52,5) = 2,598,960 possible poker hands. A permutation counts arrangements where it does: P(52,5) = 311,875,200, exactly 5! times more. The same panel gives factorials to 170, and the with-repetition counts for when an item can be picked twice.

How to count combinations

1 Pick what you are counting: combinations, permutations or a factorial.
2 Enter n, the number of items available.
3 Enter r, how many you are choosing or arranging.
4 Read combinations if order does not matter, permutations if it does.
5 Use the repetition rows if items can be picked more than once.

The four numbers here cover every counting situation, and picking the right one comes down to two questions. Does order matter? And can an item be chosen more than once? A lottery draw is combinations without repetition. A four-digit PIN is arrangements with repetition, which is why there are 10,000 of them and not 5,040. A podium finish is permutations without repetition. Getting the wrong one is by far the most common error in counting problems.

A podium is not a padlock

Three medals among ten runners is 720, because nobody wins twice. A three-wheel padlock with ten digits on each is 1,000, because the wheels are independent. Same n, same r, larger answer. It is also why a combination lock is named misleadingly: order matters very much, so it is a permutation lock.

The two counts are directly related. nPr equals nCr times r!, because every unordered selection of r items can itself be ordered r! ways. That is the quickest sanity check on either figure, and it explains why nCr is always the smaller of the two. nCr is also symmetric: choosing 3 of 10 to include is the same act as choosing 7 to leave out, so C(10,3) and C(10,7) are both 120.

Factorials get out of hand quickly

Underneath all four counts is the factorial, which earns its own tab because the numbers run away so fast. 10! is 3,628,800; 20! is 2,432,902,008,176,640,000; 52! is about 8 × 10⁶⁷, more than the estimated number of atoms in the Milky Way. Zero factorial is defined as one, which looks arbitrary and is not: n! = n × (n−1)! applied at n = 1 gives 1! = 1 × 0!, so 0! has to be 1. The same definition makes C(n,n) come out as one way to choose everything, which is the only answer it could have.

Past about 20 the exact digits stop being the interesting part and the size takes over. Stirling’s approximation, n! ≈ √(2πn) × (n∕e)ⁿ, gives it directly: at n = 10 it returns 3,598,696 against a true 3,628,800, low by 0.83 per cent, and the relative error shrinks as n grows. It is why serious code almost never holds n! itself but log(n!), which stays a modest number long after n! has stopped fitting into anything.

What people use it for

  • Lottery and card odds
  • Counting possible passwords or PINs
  • Committee or team selection problems
  • Counting race, podium or ranking outcomes
  • Seating and ordering problems
  • Estimating the size of a search space
  • Seeing how fast factorial growth really is
  • Probability coursework

Questions

Order. Combinations treat ABC and CBA as the same selection; permutations count them separately, so nPr is nCr times r!.

Was this tool any good?
Internal signal only · I use it to find the tools worth rebuilding