StatGardenREF. DESK
Calculators/Maths/Permutations & combinations
Maths

Permutations & combinations calculator

Ordered and unordered selections from a set.

What this calculator does

Counting arrangements divides into two questions: does order matter, and can items repeat? Those two choices give four formulas, and choosing the wrong one is the most common error in probability problems.

Permutations count ordered arrangements: first, second and third place in a race are different outcomes. Combinations count unordered selections: a committee of three is the same committee whichever order you name them in. Combinations are always the smaller number, by exactly a factor of r factorial.

The formula

FormulaP(n,r) = n!/(n−r)! · C(n,r) = n!/(r!(n−r)!) · with repetition: nʳ and C(n+r−1, r)

Permutations count the choices at each step: n options for the first, n−1 for the second, and so on. Combinations divide that by r factorial to remove the duplicate counting of the same selection in different orders. Allowing repetition changes the counting to nʳ for ordered selections.

TermMeaning
C(n,r)Combinations: order does not matter.
P(n,r)Permutations: order matters.
n!Factorial: n × (n−1) × … × 1.
With repetitionItems may be chosen more than once.

The inputs explained

FieldWhat to enter
Total items (n)The total number of items available to choose from.
Chosen (r)How many you are choosing. Must not exceed n for the without-repetition cases.

When to use it

Calculating lottery odds

Choosing 6 numbers from 45 without order is a combination: 8,145,060 possibilities. One ticket therefore has that chance of matching, which is the arithmetic behind the whole enterprise.

Counting committees or teams

Selecting 3 people from 10 for a committee is C(10,3) = 120. Assigning them to distinct roles instead makes it P(10,3) = 720, six times as many because the three can be ordered six ways.

Working out password space

Characters can repeat and order matters, so the count is nʳ. That is why length affects security far more sharply than character variety.

Setting up a probability problem

Most discrete probability reduces to dividing favourable arrangements by total arrangements. Getting the counting method right is nearly the whole task.

Worked examples

Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.

Choosing 3 from different pool sizes

Selecting three items from a growing pool.

r = 3
Pool size (n)Combinations C(n,r)Permutations P(n,r)Permutations with repetition
51060125
101207201,000
201,1406,8408,000
4514,19085,14091,125
5222,100132,600140,608
100161,700970,2001,000,000
Permutations are always exactly six times the combinations here, because three items can be ordered in 3! = 6 ways. That ratio holds for any n at r = 3.

Choosing more from a fixed pool of 10

Taking increasingly many items from ten.

n = 10
Choosing (r)Combinations C(n,r)Permutations P(n,r)Combinations with repetition
1101010
2459055
3120720220
525230,2402,002
7120604,80011,440
1013,628,80092,378
Combinations peak in the middle at r = 5 and fall away symmetrically, since choosing 7 from 10 is equivalent to choosing which 3 to leave out.

Questions

What is the difference between a permutation and a combination?

Permutations count ordered arrangements; combinations count unordered selections. A podium finish is a permutation, a committee is a combination. Permutations are always larger, by a factor of r factorial.

When does repetition apply?

When an item can be chosen more than once: dice rolls, password characters, or drawing with replacement. Lottery balls and committee members cannot repeat, so the standard formulas apply.

What is a factorial?

The product of all whole numbers from 1 up to n. 5! is 120. Factorials grow extremely fast, 20! already exceeds 2 × 10¹⁸, which is why this calculator reports large factorials in scientific notation.

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

Because choosing which r items to include is the same as choosing which n−r to exclude. That symmetry is why the values rise to a peak in the middle and mirror on either side.

What is 0! and why is it 1?

There is exactly one way to arrange nothing: the empty arrangement. Defining 0! as 1 also keeps the combination formula working correctly at its boundaries.

For the probability that follows from these counts, see the probability calculator or binomial probability.