A permutation is an ordered arrangement of some or all of the items in a set, where swapping two items into different positions produces a different, distinct outcome. The permutation formula, P(n, r) = n! / (n − r)!, counts exactly how many such arrangements exist when you select r items from a pool of n distinct items and place each one into its own position, with no item reused. It shows up anywhere a sequence, a rank, or a slot assignment carries meaning — a podium finish, a lockout code, a leaderboard — and it gets the wrong answer fast if you apply it to a repeated item or a circular seat without adjusting first.
Key takeaways
| Point | Details |
|---|---|
| What a permutation counts | An ordered arrangement of r items chosen from n distinct items, where swapping any two positions changes the outcome. |
| The formula falls out of the counting principle | P(n, r) = n! / (n − r)! comes from filling r positions one at a time with n, then n − 1, then n − 2 choices, down to n − r + 1. |
| 0! = 1 keeps the formula consistent | When r = n, the denominator (n − n)! = 0! = 1, so P(n, n) = n!, matching a direct factorial count of every item. |
| Repetition changes the formula entirely | If an item can fill more than one position, the count becomes n^r instead of n! / (n − r)!, and the two grow very differently as n and r increase. |
| Repeated items and circular seating both overcount the plain formula | Dividing by n₁!n₂!…nₖ! for repeated items, or using (n − 1)! instead of n! for a circular arrangement, removes duplicates the plain formula does not know about. |
Quick Checklist: Setting Up a Permutation Problem
Most wrong answers trace back to skipping one of these checks before touching the formula, not to a slip in the arithmetic itself.
Quick checklist: setting up a permutation problem
- Identify n and r Write down the pool size n and how many positions r need to be filled, before writing a single factorial.
- Confirm order actually matters Ask whether swapping two chosen items changes the outcome. If it does not, you want a combination instead.
- Check whether repetition is allowed Decide if an item can fill more than one position — that switches the count from n! / (n − r)! to n^r.
- Check for repeated items in the full set If you're arranging every item in a set that has duplicates (like the letters in LEVEL), divide by n₁!n₂!…nₖ! for each repeated item.
- Check for a circular arrangement If the positions wrap around, like seats at a round table, use (n − 1)! instead of n!, since rotating everyone does not create a new arrangement.
- Use the cancellation shortcut Compute P(n, r) as the product of the top r descending integers starting at n, rather than dividing two large factorials.
For the order-matters question specifically, permutations vs. combinations builds out the full decision framework with side-by-side formulas.
What Does the Permutation Formula Count?
The permutation formula counts ordered arrangements: the number of distinct ways to place r items, selected from a pool of n distinct items, into r positions where the position each item lands in is part of the answer.
Take three books labeled A, B, and C, and arrange any two of them side by side on a shelf. Position matters here, so A on the left and B on the right is a different outcome from B on the left and A on the right. Listing every possibility gives:
AB, AC, BA, BC, CA, CB
Six distinct arrangements from 3 objects taken 2 at a time. Ask a different question instead — “which two books did you pick?”, without caring which side each sits on — and only three answers remain: the pairs (A, B), (A, C), and (B, C). That unordered count is a combination rather than a permutation, and the distinction is worth fixing early: the fastest way to tell the two apart is to ask whether swapping two chosen elements changes the answer to the actual question being asked.
The same order-matters jump shows up with roles instead of shelf positions. Suppose four people — Ana, Bo, Cam, and Dee — need to fill three distinct roles: president, treasurer, and secretary. Selecting three of the four while ignoring which role each person gets leaves four possible groups: (Ana, Bo, Cam), (Ana, Bo, Dee), (Ana, Cam, Dee), and (Bo, Cam, Dee). Assign each trio to the three distinct roles, though, and every group splits into 3! = 6 distinct role assignments, since three people can fill three roles in six different orders — so the ordered total climbs to 4 × 6 = 24, matching P(4, 3) = 4 × 3 × 2 = 24 directly, which is exactly the r! relationship behind C(n, r) = P(n, r) / r!.
Wolfram MathWorld’s definition of a permutation — a rearrangement of the elements of an ordered list into a one-to-one correspondence with itself — states the same idea formally, and Math Is Fun’s walkthrough of combinations and permutations works through the identical order-matters test in plainer language.
NIST Digital Library of Mathematical Functions — §26.2 Basic DefinitionsA permutation is a one-to-one and onto function from a non-empty set to itself.
That formal definition is the same idea in different language: a permutation reassigns every item in a set to a position, one item per position, with none left over and none repeated. The everyday combinatorics meaning used throughout this guide — an ordered selection of r items from a larger pool of n — is the applied version of that same reassignment idea, restricted to r of the n positions instead of all of them. The Latin root permutare, “to change thoroughly,” fits either reading.
How Do You Derive P(n, r) = n! / (n − r)!?
The permutation formula comes directly from filling positions one at a time and multiplying the choices available at each step, which is the fundamental counting principle applied to a shrinking pool.
To fill r positions from a pool of n distinct items, the first position has n choices, the second has n − 1 choices (one item is already placed), the third has n − 2, and so on down to the r-th position, which has n − r + 1 choices left:
| Position filled | Choices available (general) | Example: n = 8, r = 3 |
|---|---|---|
| 1st | n | 8 |
| 2nd | n − 1 | 7 |
| 3rd | n − 2 … down to n − r + 1 | 6 |
Multiplying the choices gives the product form of the formula:
P(n, r) = n × (n − 1) × (n − 2) × … × (n − r + 1)
The Factorial Function
The factorial of a non-negative integer n, written n!, is the product of every positive integer from 1 up through n:
n! = n × (n − 1) × (n − 2) × … × 2 × 1
Values worth keeping in mind:
5! = 120
4! = 24
3! = 6
2! = 2
1! = 1
0! = 1 (the empty product, not zero)
0! = 1 by definition, not a rounding convention. Wolfram MathWorld’s entry on the factorial notes that this special case is defined to have value 1, consistent with there being exactly one way to arrange zero objects — the single, empty permutation of an empty set. That convention is what keeps the permutation formula below well-defined once every item in a set gets placed.
That product has exactly r descending terms. NIST’s Digital Library of Mathematical Functions calls this kind of descending product a falling factorial and defines it generally as a variable x times (x − 1), (x − 2), and so on for a fixed number of descending terms, in its chapter on combinatorial analysis — substituting x = n (the pool size) and stopping after r terms reproduces the permutation product exactly (see the NIST DLMF, §26.1 Special Notation). The full factorial n! extends the same product all the way down to 1, and (n − r)! is precisely the leftover tail from (n − r) down to 1. Dividing the full factorial by that tail cancels it out and leaves the same r-term product:
P(n, r) = n! / (n − r)!
This is the standard closed-form version of the formula. Different textbooks write it as P(n, r), nPr, or ₙPᵣ — all the same calculation under different notation, and OpenStax’s Precalculus 2e derives it the same position-by-position way in its chapter on counting principles.
The same logic scales to a security example. A distribution center that assigns each forklift a 4-digit lockout code drawn from the digits 1 through 9, with no digit repeated, is filling 4 positions from a pool of 9: P(9, 4) = 9 × 8 × 7 × 6 = 3,024 possible codes.
What Happens at the Special Cases r = n, r = 0, and r = 1?
Three edge cases of P(n, r) are worth knowing on sight, because each one tests whether the 0! = 1 convention is being applied correctly.
r = n: using every item. When every item in the set gets placed, the denominator becomes (n − n)! = 0! = 1:
P(n, n) = n! / 0! = n! / 1 = n!
Arranging 5 distinct books on a shelf gives 5! = 120 orderings — the formula and a direct factorial count agree, which is exactly the consistency check that makes 0! = 1 non-negotiable rather than an arbitrary convention. Factorial-based formulas elsewhere in statistics need that same convention to stay defined at their boundary: the NIST/SEMATECH e-Handbook’s binomial distribution formula requires 0! = 1 to stay well-defined when the number of successes is 0 or equals the number of trials.
r = 0: selecting nothing.
P(n, 0) = n! / n! = 1
There is exactly one way to select and arrange zero items: the empty selection. It looks trivial, but it is load-bearing in proofs involving the binomial theorem and generating functions — see binomial theorem and Pascal’s triangle for where that same C(n, 0) = 1 boundary case reappears.
r = 1: selecting one item.
P(n, 1) = n! / (n − 1)! = n
There are exactly n ways to choose and place one item, a result direct counting confirms immediately: with n candidates for a single open slot, each candidate is one possible outcome.
How Do You Count Permutations When Items Can Repeat?
Everything above assumes no repetition — once an item fills a position, it is unavailable for the rest. When repetition is allowed instead, so each position can hold any of the n items regardless of what came before, the count becomes a power rather than a falling factorial:
Arrangements with repetition = n^r
A 4-digit PIN drawn from digits 0 through 9, with repetition allowed, can place any of 10 digits in each of 4 positions:
10^4 = 10,000
Compare that to the same 4 positions without repetition: P(10, 4) = 10 × 9 × 8 × 7 = 5,040. Allowing repetition nearly doubles the count here, because every position keeps the full pool of 10 options instead of a shrinking one.
The gap widens further with longer strings. A 6-character password built from the 26 lowercase letters, with no letter repeated, gives P(26, 6) = 26 × 25 × 24 × 23 × 22 × 21 = 165,765,600 possible passwords. Allow repeated letters instead and the count is 26⁶ = 308,915,776 — nearly double, because a repeated-letter password keeps drawing from the full 26-letter alphabet at every position instead of a pool that shrinks by one each time.
The question to ask is simple: can the same item fill more than one position? A lock digit can repeat; a race finisher cannot occupy two places on the same podium. When a problem is ambiguous, phrases like “without replacement,” “no digit may repeat,” or “once chosen, an item can’t be selected again” all signal the standard n! / (n − r)! formula rather than n^r.
How Do You Handle Repeated Items or a Circular Arrangement?
P(n, r) = n! / (n − r)! assumes every object is distinguishable and every position sits on a line. Two common situations violate that assumption, and both cause overcounting if the plain formula gets applied without adjustment.
Repeated (indistinguishable) items. Arranging the 4 distinct letters of STAR gives P(4, 4) = 4! = 24 orderings, since all 4 letters differ. Arrange the 5 letters of LEVEL instead, and the two L’s are identical to each other, as are the two E’s — swapping the two L’s produces a sequence that looks exactly the same on paper. Treating all 5 letters as distinct would count every real arrangement multiple times over. The fix divides out that redundancy:
Arrangements of a multiset = n! / (n₁! × n₂! × … × nₖ!)
where n₁, n₂, … are the counts of each repeated item. For LEVEL: n = 5, with L appearing twice and E appearing twice:
5! / (2! × 2!) = 120 / 4 = 30
Only 30 distinguishable arrangements exist, not 120. This is the same formula combinatorics calls a multinomial coefficient — NIST’s handbook defines it as the number of ways to place n distinct objects into k labeled groups of fixed sizes n₁, n₂, …, nₖ, which is numerically identical to the number of distinguishable orderings of a multiset with those same group sizes (see the NIST DLMF, §26.4 Lattice Paths: Multinomial Coefficients). Miss this adjustment and a word-arrangement or password-entropy calculation that involves any repeated character comes out several times too high.
Circular arrangements. Seat 6 dinner guests around a round table, and a straight application of P(6, 6) = 720 overcounts, because a round table has no fixed starting position — rotating everyone one seat to the right produces the same relative seating, not a new one. Wolfram MathWorld’s entry on circular permutations notes that all n of the cyclic rotations of a given seating are equivalent for exactly this reason, which is why fixing one person’s seat as a reference point and arranging the rest linearly gives the right count:
Circular permutations of n items = (n − 1)!
For 6 guests: 5! = 120, not 720 — six times fewer than the naive linear count, because each circular seating corresponds to exactly 6 equivalent linear ones, one per rotation.
| Situation | Formula | Worked result |
|---|---|---|
| Distinct items, no repeats, linear order | n! / (n − r)! | P(8,3) = 336 |
| Repetition allowed in each position | n^r | 10⁴ = 10,000 |
| Repeated items in the full set | n! / (n₁!n₂!…) | LEVEL: 5!/(2!2!) = 30 |
| Circular arrangement, all items used | (n − 1)! | 6 guests: 5! = 120 |
Before reaching for P(n, r), check whether any items repeat and whether the arrangement is linear or circular — skipping that check is the single most common source of a wrong count once problems move past textbook examples.
Where Does the Permutation Formula Show Up in Practice?
This kind of ordered counting turns up anywhere the position an item lands in changes the outcome.
- Cryptography and passwords. The size of the password space sets a floor on how long a brute-force attack takes, which is why the no-repeats-versus-repeats comparison above matters for real security estimates.
- Sports and ranking. A quarterly leaderboard that ranks the top 3 of 12 regional offices by improvement is P(12, 3) = 12 × 11 × 10 = 1,320 distinct leaderboards — batting orders, tournament seeding, and medal ceremonies are all order-sensitive the same way.
- Scheduling. Deciding the order to run several tasks across time slots, where an earlier task’s finish time affects a later one, means counting orderings to search for the best sequence.
- Genetics. The order of nucleotides along a strand determines which protein it encodes, so counting the possible orderings of a given set of nucleotides bounds how many distinct proteins that set could theoretically produce.
- Logistics. Routing problems that visit r stops out of a network of n enumerate orderings of candidate routes to evaluate which is shortest.
A Worked Example: Assigning Rush Slots at a Water-Testing Lab
A municipal lab receives 8 water samples flagged for elevated turbidity after a storm. Only 3 rush-analysis slots are open this week — Monday 8 a.m., Monday 1 p.m., and Wednesday 8 a.m. — each staffed by a different technician on a different instrument, so which sample lands in which slot matters for the chain-of-custody log. How many ways can 3 of the 8 samples be assigned to fill those slots?
- Identify n and r. Samples available: n = 8. Slots to fill: r = 3. Slot identity matters (Monday 8 a.m. is not the same as Wednesday 8 a.m.), so this is order-sensitive and calls for a permutation, not a combination.
- Write the formula.
P(8, 3) = 8! / (8 − 3)! = 8! / 5!
- Cancel the factorial tail. The 5! in the denominator cancels the lower portion of 8!, leaving only the top three descending factors:
P(8, 3) = 8 × 7 × 6 = 336
- Verify with full factorials. 8! = 40,320; 5! = 120; 40,320 ÷ 120 = 336. The two methods agree.
Decision: there are 336 distinct ways to assign 3 of the 8 flagged samples to the three rush slots, confirming the lab’s chain-of-custody log needs to track which specific slot each sample was routed to — not just which 3 samples were chosen.
Common Mistakes With the Permutation Formula
- Mixing up order and selection. The most common error is applying P(n, r) when order does not actually matter. If a problem asks how many teams of 3 can be formed from 10 people with no roles assigned, that is a combination, not a permutation. Fix: ask whether swapping two chosen elements changes the answer; if not, use C(n, r) = n! / (r! × (n − r)!) instead.
- Treating 0! as 0. Writing 0! = 0 and then dividing by zero produces a nonsensical result. Fix: 0! = 1, always, so when r = n the denominator (n − n)! = 0! = 1, not 0.
- Swapping n and r. n is the total pool size, r is the number of positions to fill, and r ≤ n is required. Fix: with 10 candidates for 3 roles, n = 10 and r = 3, not the reverse — writing P(3, 10) would require (3 − 10)! = (−7)!, which is undefined.
- Computing huge factorials directly. For P(20, 3), computing the full 20! and dividing by 17! is unnecessary work. Fix: expand only the top r descending terms from n — 20 × 19 × 18 = 6,840 — since the denominator factorial would cancel everything else anyway.
- Reaching for n^r when repetition is forbidden. n^r counts arrangements only when repetition is allowed. Fix: drawing cards from a deck, seating race finishers, or filling roles from a candidate pool all forbid repeats, so use n! / (n − r)! instead — using n^r overcounts badly: P(5, 3) = 60, while 5³ = 125.
Statohub’s Take on Permutations
Statohub’s position is that the single most valuable habit for this topic is running the checklist above before writing a single factorial — specifically the repetition check and the repeated-items check, since both are easy to forget under time pressure and both silently produce a plausible-looking but wrong number. Reach for the product form, n × (n − 1) × … × (n − r + 1), for quick hand calculations, and save the full factorial notation for symbolic work or proofs. Keep the order-matters test as the very first question on any new counting problem; it is the fastest way to avoid reaching for this formula when a combination was the right tool all along.
Put the Permutation Formula to Work With Statohub’s Tools
Reading the formula is the easy part; catching a repetition or repeated-item case before it skews the count is where most of the real risk sits. Statohub’s Combinatorics hub builds on the same counting ideas, starting with the fundamental counting principle and the full combination formula walkthrough for the unordered case. For the decision framework that separates the two concepts outright, see permutations vs. combinations. When you are ready to compute, the combination calculator runs the C(n, r) side of the comparison, and the factorial calculator handles the n! arithmetic behind any P(n, r) by hand. The full calculators hub lists every tool on the site.
Sources
Sources
- NIST Digital Library of Mathematical Functions — §26.1 Special Notation (falling and rising factorials), Chapter 26 Combinatorial Analysis NIST
- NIST Digital Library of Mathematical Functions — §26.2 Basic Definitions (formal definition of a permutation), Chapter 26 Combinatorial Analysis NIST
- NIST Digital Library of Mathematical Functions — §26.4 Lattice Paths: Multinomial Coefficients and Set Partitions NIST
- NIST/SEMATECH e-Handbook of Statistical Methods — 1.3.6.6.18. Binomial Distribution NIST
- OpenStax — "11.5 Counting Principles" (permutations and combinations formulas), Precalculus 2e OpenStax
- Permutation — Wolfram MathWorld Wolfram MathWorld
- Circular Permutation — Wolfram MathWorld Wolfram MathWorld
- Factorial — Wolfram MathWorld Wolfram MathWorld
- Combinations and Permutations — Math Is Fun Math Is Fun
FAQ
Frequently asked questions
- What Is a Permutation in Math?
- A permutation is an ordered arrangement of some or all of the items in a set, where the position each item occupies is part of what makes one arrangement different from another. Two permutations count as distinct if they differ in even a single position, regardless of which elements they otherwise share — (A, B, C) and (C, B, A) are two different orderings of the same three letters.
- What Is the Permutation Formula?
- For arranging r items chosen from a pool of n distinct items, the permutation formula is P(n, r) = n! / (n − r)!. Equivalently, P(n, r) equals the product n × (n − 1) × … × (n − r + 1), the top r descending integers starting at n, which is the faster way to compute it by hand without expanding two full factorials.
- What Is the Difference Between a Permutation and a Combination?
- A permutation counts ordered arrangements, where the sequence of items matters; a combination counts unordered groups, where only membership matters. They are related by C(n, r) = P(n, r) / r!, since any unordered group of r items corresponds to exactly r! ordered versions of itself. See permutations vs. combinations for the full side-by-side comparison and decision framework.
- How Do You Calculate Permutations With Repeated Items?
- Divide out the redundancy with n! / (n₁!n₂!…nₖ!), where each nᵢ is the count of one repeated item in the full set. Arranging the letters of LEVEL, which has two L's and two E's among its 5 letters, gives 5! / (2!2!) = 30 distinguishable arrangements, not the 120 you would get by treating every letter as unique.
- How Do You Count Permutations With Repetition Allowed?
- Use n^r instead of n! / (n − r)!, since each of the r positions can independently hold any of the n items. With 10 possible digits and 4 positions, repetition allowed, the count is 10⁴ = 10,000. Without repetition over the same pool and positions, it drops to P(10, 4) = 10 × 9 × 8 × 7 = 5,040.
- Can r Be Greater Than n in the Permutation Formula?
- Not in the standard no-repetition formula — selecting more items than the pool contains is impossible, and (n − r)! is undefined for a negative integer. If a problem implies r is greater than n, either repetition is actually allowed, which calls for n^r instead, or n and r have been assigned backward and need re-checking.