PERMUTATION AND COMBINATION CALCULATOR

Permutation and combination calculator

Enter n and r, get the permutations and combinations.

What is the difference between a permutation and a combination?

Order matters in a permutation and not in a combination. Choosing 3 of 10 people for gold, silver and bronze is a permutation (720 ways); choosing 3 of 10 for a committee is a combination (120 ways). Each committee of 3 can be put in order in 3! = 6 ways, which is why 720 ÷ 6 = 120.

What is the formula for combinations?

nCr = n! ÷ (r! × (n − r)!). The number of 5-card poker hands from 52 cards is 52! ÷ (5! × 47!) = 2,598,960.

What is the formula for permutations?

nPr = n! ÷ (n − r)!: 10 × 9 × 8 = 720 ordered ways to pick 3 of 10.

What if items can repeat?

Permutations with repetition are nʳ — a 4-digit PIN has 10⁴ = 10,000 possibilities. Combinations with repetition are C(n + r − 1, r): 3 scoops from 10 flavors, repeats allowed, is 220.

How large can n be?

Up to 5,000 — the calculator works with exact whole numbers, so even very long answers are exact.

Worked example: nine swimmers and a lottery

OpenStax Precalculus (section 11.5) lines up 9 swimmers. Awarding first, second and third place is a permutation, 9 × 8 × 7 = 504 ways, which is nPr with n = 9 and r = 3. Putting all 9 in a race order is 9! = 362,880. Choosing 2 of 5 side dishes, where order does not matter, is a combination: 10 ways, and choosing 3 also gives 10, because picking 2 to take is the same as picking 3 to leave. In general C(n, r) = C(n, n − r). For a 6-number lottery drawn from 49, order does not matter, so there are C(49, 6) = 13,983,816 possible tickets; one ticket has a 1 in 13,983,816 chance. Arranging 9 of 12 exam questions in order gives P(12, 9) = 79,833,600 ways, while merely choosing which 9 to use gives C(12, 9) = 220.

How do I decide whether order matters?

Ask whether swapping two chosen items gives a different outcome. Gold–silver–bronze, passwords, seating charts and race results do; committees, card hands, pizza toppings and lottery picks do not. A combination lock is a misnomer, since 1-2-3 and 3-2-1 open different locks.

Common mistakes with counting

First, using a permutation when order is irrelevant, which overcounts by a factor of r!. Second, entering r larger than n without repetition; there are no ways to choose 5 distinct items from 3, and the answer is 0. Third, forgetting that “repetition allowed” changes the formulas: nʳ for ordered lists and C(n + r − 1, r) for unordered ones. Fourth, applying nPr to arrangements of items that are not all different, such as the letters in a word with repeats. Then divide by the factorial of each repeat count: OpenStax counts the arrangements of a word with 8 letters in which two letters appear twice as 8! ÷ (2! × 2!) = 10,080. This calculator does not do that last variant.

Worked example: combining choices with the multiplication principle

A committee of 5 is chosen from 6 men and 5 women. To get exactly 2 men and 3 women, choose the men and the women separately and multiply: C(6, 2) × C(5, 3) = 15 × 10 = 150. All possible committees of 5 from the 11 people number C(11, 5) = 462. For "at least one woman", count the opposite case and subtract it: committees with no women are C(6, 5) = 6, so 462 − 6 = 456. Counting the complement is nearly always easier than adding up every case with one, two, three, four or five women.

Arrangements when some items are identical

The formula n! counts orderings of n different things. If some are identical, divide by the factorial of each repeat count. The 11 letters of MISSISSIPPI include 4 I's, 4 S's and 2 P's, so the distinct arrangements are 11! ÷ (4! × 4! × 2!) = 34,650, where 11! alone would be 39,916,800. Without the division, every arrangement would be counted once for each way of swapping identical letters among themselves.

Reading the large numbers

Factorials grow faster than any exponential. 10! is 3,628,800 and 20! is 2,432,902,008,176,640,000, so a calculator that stores numbers as ordinary floating-point values can no longer hold every digit exactly after about 18! (whole numbers above 9,007,199,254,740,992 do not all fit in a double). This one works with exact whole numbers, which is why the digits at the end of a very long answer can be trusted. For probabilities, divide a count of favorable outcomes by the count of all outcomes, as long as every outcome is equally likely; for a shuffled deck, that holds for every one of the 52! orderings.

Sources: OpenStax, Precalculus 2e, section 11.5 (Counting Principles: multiplication principle, permutations and combinations). Related: factorial calculator, probability calculator, binomial probability calculator, hypergeometric calculator and lottery odds calculator.