What a permutation counts
A permutation is an arrangement in which position carries meaning. Swap two items and you have a different outcome. That single test decides whether this calculator or the combination calculator is the right tool, and it is worth applying deliberately rather than by feel.
Ordering matters in more places than people expect. A race result, a batting order, a PIN, a password, a seating plan, a playlist, the order in which servers are patched, the sequence of a DNA fragment, the schedule of jobs on a machine — all of these are permutations. Ordering does not matter for a committee, a hand of cards, a lottery ticket, a pizza's toppings or a set of test cases.
The relationship between the two counts is exact rather than approximate. Any set of r distinct items can be written down in r! orders, so P(n, r) = C(n, r) × r!. With r = 1 the two counts are equal; for every r of 2 or more the permutation count is the larger, and the gap widens fast — at r = 5 it is a factor of 120. This calculator prints both figures and their ratio so the relationship is visible in your own numbers.
The three formulas, and how to tell which one you need
Ordered, no repeats: P(n, r) = n! ÷ (n − r)!. You have n options for the first position, n − 1 for the second because one item is now used, and so on down to n − r + 1 for the last. Multiplying that falling chain gives the answer; writing it as a ratio of factorials is just shorthand for the same product with the unused tail cancelled. This is the case for race placings, seat assignments and any draw without replacement.
Ordered, repeats allowed: nr. Now every position is filled independently, so each of the r slots has the full n choices. A four-digit PIN is 104 = 10,000; an eight-character password from 62 alphanumerics is 628 ≈ 2.18 × 1014. Notice that r may exceed n here without any difficulty.
Arranging a multiset: n! ÷ (n₁! n₂! … nk!). Use this when the pool itself contains duplicates and you are arranging all of it. Pretend the duplicates are distinguishable and you get n! arrangements, but each genuine arrangement has been counted once for every way of permuting the identical copies among themselves — n₁! ways for the first repeated character, n₂! for the second, and so on. Dividing removes the double counting. This is the anagram formula, and it is also how you count paths on a grid: the number of shortest routes across a 4-by-3 block is 7!/(4!3!) = 35.
All three are the same idea seen from different angles: count as if everything were distinguishable, then divide out whatever you over-counted. The factorial calculator handles the raw factorials if you want to see them, though this page never computes n! directly — it multiplies the falling chain, which stays exact much longer.
Worked example: a podium, a PIN, and MISSISSIPPI
1. Eight runners, three medals. The gold, silver and bronze positions are distinct, and no runner takes two medals, so this is P(8, 3).
- Eight candidates for gold.
- Seven remain for silver.
- Six remain for bronze.
- 8 × 7 × 6 = 336 possible podiums.
The unordered count is C(8, 3) = 56, and 336 ÷ 56 = 6 = 3! — the six ways to shuffle any three medallists between the three steps.
2. A three-digit PIN. Each of the three positions may be any of the ten digits, independently, so the count is 10 × 10 × 10 = 1,000, from 000 to 999. Guessing one specific PIN at random succeeds with probability 1 ÷ 1000 = 0.1%.
3. The letters of MISSISSIPPI. There are 11 letters: one M, four I's, four S's and two P's.
- Total if every letter were distinct. 11! = 39,916,800.
- Divide out the repeats. 1! × 4! × 4! × 2! = 1 × 24 × 24 × 2 = 1,152.
- Divide. 39,916,800 ÷ 1,152 = 34,650 distinct arrangements.
Check the size: 34,650 is only about one arrangement in 1,152 of the naive total, which is exactly the factor you divided by. Type any word into the multiset mode and the calculator lists each repeated character and the factorial it contributes.
How to read the result
Turn the count into a probability when what you care about is a guess. One named arrangement out of P has probability 1 ÷ P, which is the percentage this calculator reports. A three-digit PIN gives 0.1% per guess; a six-digit PIN gives 0.0001%; an eight-character password drawn from 62 symbols gives about 4.6 × 10−13%. Those numbers are why length beats complexity in password policy: adding one character multiplies the space by the alphabet size, while enlarging the alphabet only raises a fixed exponent.
Read the ordered-per-unordered ratio when you are checking your own reasoning. If you expected order not to matter and the ratio comes back as 120, you have chosen the wrong mode — that factor of 120 is 5! and it means the calculator counted five positions as distinguishable. This is the single most common error in counting problems, and the ratio makes it visible.
Watch the scale. P(n, r) grows enormously in r and modestly in n: going from 10 items to 20 at r = 3 multiplies the count by about nine and a half, from 720 to 6,840, while going from r = 3 to r = 6 with n = 20 multiplies it by nearly eight thousand. When a count passes roughly 1015 the calculator switches to scientific notation, because no exact integer of that size fits in a browser number.
Finally, be clear about what the count includes. P(n, r) treats every item as distinguishable and every position as labelled. If your positions are actually interchangeable — dealing hands rather than seating guests — divide by the arrangements of the positions too, or ask the combination calculator instead.
Ordered arrangements P(n, r) for common sizes
| n | r = 2 | r = 3 | r = 4 | r = 5 |
|---|---|---|---|---|
| 5 | 20 | 60 | 120 | 120 |
| 6 | 30 | 120 | 360 | 720 |
| 8 | 56 | 336 | 1,680 | 6,720 |
| 10 | 90 | 720 | 5,040 | 30,240 |
| 12 | 132 | 1,320 | 11,880 | 95,040 |
| 20 | 380 | 6,840 | 116,280 | 1,860,480 |
The n = 5 row shows why P(n, n) = P(n, n−1): once four of five positions are filled, the fifth is forced, so no new arrangements appear.
Mistakes that give the wrong arrangement count
- Using a permutation for an unordered problem. A five-card hand is C(52, 5) = 2,598,960, not P(52, 5) = 311,875,200. The permutation count is 120 times too large because it counts every deal order separately.
- Forgetting to divide out repeated items. LEVEL has 5 letters but only 5!/(2!·2!) = 30 distinct arrangements, not 120. Any pool with duplicates needs the multiset formula.
- Applying P(n, r) when items can repeat. A three-letter code from 26 letters is 26³ = 17,576 if letters may repeat, and P(26, 3) = 15,600 if they may not. Read the problem for the words "may repeat" or "without replacement".
- Treating circular arrangements as linear. Seating n people around a round table gives (n − 1)! arrangements, not n!, because rotating everyone one seat produces the same seating. Divide by n when only the relative order matters.
- Mixing up positions and items. In P(n, r), n is the pool and r is the number of slots. Entering them the wrong way round gives an answer that is often plausible but always wrong.
- Ignoring that r may exceed n only with repetition. Ten ordered draws from six items is 0 without repeats and 610 = 60,466,176 with them.
- Assuming every arrangement is equally likely. The count is correct regardless, but the probability reading assumes uniformity. A shuffle that is not truly random invalidates the odds without changing the count.
Circular, partial and restricted arrangements
Several variations come up so often that they deserve their own formulas, all of them adjustments to the counts above.
Circular permutations. Around a table only relative order matters, so fix one person and arrange the rest: (n − 1)! arrangements. If the table can also be flipped over — a bracelet rather than a dinner — divide again by 2 to get (n − 1)!/2.
Arrangements with items kept together. Glue the block together and treat it as one item. Six books with three specific volumes side by side gives 4! arrangements of the blocks times 3! internal orders = 144.
Derangements. Arrangements in which nothing sits in its own place. The count is n! multiplied by the alternating sum 1 − 1/1! + 1/2! − 1/3! + …, which converges so quickly that the answer is the nearest whole number to n!/e for every n above 2. For n = 5 the derangement count is 44.
Sampling and probability. Once you have a count, the probability work usually moves elsewhere. For the chance of a specific outcome in repeated independent trials use the binomial distribution calculator; for the chance that at least one of several attempts succeeds — the birthday problem is exactly this — use the at-least-one probability calculator; and for general event arithmetic the probability calculator covers unions, intersections and complements.
Key terms
- Permutation
- An ordered arrangement of items. P(n, r), nPr, or (n)ᵣ all mean the number of ways to fill r ordered positions from n distinct items.
- Multiset
- A collection in which an item may appear more than once. Arranging one uses n! divided by the factorial of each repeat count.
- With replacement
- Each draw is returned before the next, so items can repeat and the count is n^r. Without replacement gives P(n, r).
- Falling factorial
- The product n(n−1)…(n−r+1). It is P(n, r) written without factorials, and it is how this calculator actually computes the result.
- Circular permutation
- An arrangement around a closed loop, where rotations are considered identical. There are (n − 1)! of them.
- Derangement
- A permutation that leaves no item in its original position. The count is the nearest whole number to n!/e for n ≥ 3.
