Math
Permutation and combination calculator
Count selections and arrangements exactly. Pick what you are counting, enter n and r (or a word), and the calculator gives the count, the other three standard counts for the same n and r, and the formula with your numbers substituted.
For a full circle, set r equal to n.
Upper and lower case count as the same letter; spaces are ignored.
| Order matters? | Repeats allowed? | Formula | Name |
|---|---|---|---|
| Yes | No | n! / (n − r)! | Permutation nPr |
| No | No | n! / (r!(n − r)!) | Combination nCr |
| Yes | Yes | nʳ | Permutation with repetition |
| No | Yes | (n + r − 1)! / (r!(n − 1)!) | Combination with repetition |
| All n arranged, some alike | — | n! / (k₁! k₂! … kₘ!) | Multiset permutation |
| Around a circle | No | (n − 1)!, or ÷ 2 if it can flip | Circular permutation |
Show the working, step by step
Combinations count selections where order does not matter.
C(n, r) = n! / (r! (n − r)!) = 10! / (3! × 7!)
Cancel the larger factorial in the denominator, leaving 3 factors on top and 3! underneath.
= (10 × 9 × 8) / (3 × 2 × 1)
Work it out.
= 720 / 6 = 120
Each combination can be ordered in 3! ways, which links the two counts.
nPr = nCr × r! = 120 × 6 = 720
The formulas
nPr = n! / (n − r)! order matters, no repeats nCr = n! / (r! (n − r)!) order does not matter, no repeats nʳ order matters, repeats allowed C(n + r − 1, r) order does not matter, repeats allowed n! / (k₁! k₂! … kₘ!) arrange n items, kᵢ of them alike (n − 1)! arrange n items round a circle
Two questions pick the formula. Does the order of the chosen items matter? Can the same item be chosen more than once? A PIN is ordered with repeats (10⁴ = 10,000 four-digit PINs). A lottery draw is unordered without repeats (49C6 = 13,983,816). A bag of 3 doughnuts from 10 flavours is unordered with repeats (C(12, 3) = 220).
A worked example
The calculator opens with n = 10 and r = 3.
- Combinations: 10C3 = 10! / (3! × 7!). Cancel 7! from top and bottom to leave (10 × 9 × 8) / (3 × 2 × 1) = 720 / 6 = 120.
- Permutations: 10P3 = 10 × 9 × 8 = 720. Each of the 120 combinations can be ordered in 3! = 6 ways, and 120 × 6 = 720.
- With repetition, ordered: 10³ = 1,000.
- With repetition, unordered: C(10 + 3 − 1, 3) = C(12, 3) = 220.
Cancelling before multiplying is the way to do nCr by hand: never work out 10! in full. Only r factors survive on top, and r! stays underneath.
Arrangements of a word
When some of the items are identical, divide n! by the factorial of each repeat count. For MISSISSIPPI: 11! ÷ (1! × 4! × 4! × 2!) = 39,916,800 ÷ 1,152 = 34,650. The same rule counts arrangements of coloured balls, or of the letters in BANANA (6! ÷ (3! × 2! × 1!) = 60).
Circular permutations
Rotations of a circle count as the same arrangement, so divide the number of lines by the number of seats: (n − 1)! for n people round a table, or P(n, r) ÷ r when only r of the n are seated. If the circle can be turned over, as with a necklace or a keyring, a clockwise order and its mirror image are also the same, so halve the answer (for 3 or more items).
Common mistakes
- Using nPr when order does not matter. A team of 3 picked from 10 is 120 teams, not 720.
- Choosing more than there are without repeats. 5 from 3 without repetition is impossible, and nCr is 0. With repetition it is allowed.
- Forgetting the repeated letters. 11! counts each MISSISSIPPI arrangement 1,152 times.
- Treating a round table like a row. 8 people in a row can sit in 40,320 ways, but round a table only 5,040.
Common questions
What is the difference between a permutation and a combination?
In a permutation the order matters; in a combination it does not. Choosing a president, secretary and treasurer from 10 people is a permutation, 10P3 = 720, because the same three people in different jobs is a different outcome. Choosing a committee of 3 from 10 is a combination, 10C3 = 120. Each committee can be put in 3! = 6 orders, and 720 ÷ 6 = 120.
How many ways can the letters of MISSISSIPPI be arranged?
34,650. The word has 11 letters: one M, four I, four S and two P. If they were all different there would be 11! = 39,916,800 orders, but swapping identical letters changes nothing, so divide by 1! × 4! × 4! × 2! = 1,152. 39,916,800 ÷ 1,152 = 34,650.
How many ways can 8 people sit around a round table?
(8 − 1)! = 5,040. In a row it would be 8! = 40,320, but rotating everyone one seat round gives the same seating, and each seating has 8 rotations. If the arrangement can also be turned over, as with beads on a necklace, mirror images count as the same too, giving 5,040 ÷ 2 = 2,520.
What is nCr when r is 0 or equal to n?
Both are 1. There is exactly one way to choose nothing and one way to choose everything. That is why 0! is defined as 1: nC0 = n! ÷ (0! × n!) = 1. The formula is also symmetric, nCr = nC(n − r), because choosing r items to take is the same as choosing n − r to leave.
How many 5-card poker hands are there?
52C5 = 2,598,960. Order does not matter in a hand, and a card cannot be dealt twice, so it is a combination without repetition: 52 × 51 × 50 × 49 × 48 ÷ (5 × 4 × 3 × 2 × 1).
Why does the calculator show exact results for huge numbers?
Factorials grow faster than ordinary floating-point numbers can hold exactly: 23! already has more digits than a double can store without rounding. The calculator uses whole-number (BigInt) arithmetic, so 1000C500 comes out with all 300 of its digits, and the headline shows a rounded scientific form of the same number.
Related calculators
-
Binomial theorem
Expand (a + b)ⁿ using the nCr coefficients.
-
Binomial distribution
Probabilities built on nCr · pʳ · (1 − p)ⁿ⁻ʳ.
-
Probability calculator
Turn counts of outcomes into probabilities.
-
Discrete math calculator
Inclusion–exclusion and the pigeonhole principle.