Swap the gold and bronze medalists in a three-runner podium and you get a completely different result — same three people, different outcome. That sensitivity to order is what a permutation counts: the number of distinct ordered arrangements you can build from a set of items. Whenever the position an item lands in changes the meaning of the outcome, this is the tool that tells you exactly how many outcomes exist, without listing every one by hand.

Below is the formula derived from first principles, four fully worked examples across different domains, the special cases that trip people up, and two edge cases — repeated items and circular seating — that the plain formula gets wrong if you apply it blindly.


What Is a Permutation?

A permutation is a specific ordering of a collection of distinct objects. Formally, an arrangement of r objects taken from a pool of n is a sequence of r of those objects placed into distinguishable, ordered positions, with no object occupying two positions at once.

Take three books labeled A, B, and C, and arrange any two of them side by side on a shelf. Position matters here: A on the left and B on the right differs from B on the left and A on the right. Working through every possibility gives:

AB, AC, BA, BC, CA, CB

Six distinct arrangements — from 3 objects taken 2 at a time. Ask a different question — “which two books did you pick?” without caring which side each sits on — and there are only three answers: the pairs (A, B), (A, C), and (B, C). That unordered count is a combination instead, and the two ideas are worth keeping separate in your head from the start.

The Latin root permutare means “to change thoroughly,” which fits: reassigning objects to positions and shuffling those assignments produces a genuinely new outcome each time.

The Core Test: Does Order Add Information?

The fastest way to classify a counting problem is to ask: would swapping two elements produce a meaningfully different result?

  • A podium finish (gold, silver, bronze) — yes, swapping first and third is a different outcome entirely. Order-sensitive.
  • A five-person team pulled from a larger squad — no, the team is identical regardless of which name got written down first. Order-free.
  • A 4-digit PIN — yes, 4-7-2-1 and 1-2-7-4 are different codes. Order-sensitive.
  • Numbers drawn in a lottery — no, the same winning set results no matter what order the balls emerge. Order-free.

When rank, position, or sequence carries meaning, you’re counting arrangements of this kind. When only membership counts, you want a combination instead.



Why Order Matters: An Intuitive Argument

Picture a three-digit combination lock — though, strictly, it should be called a permutation lock, since the working sequence is 4-7-2 and entering 2-7-4 won’t open it. The three digits are identical; only their order differs, and the order is the entire content of the information.

Suppose four people — Ana, Bo, Cam, and Dee — need to fill three distinct roles: president, treasurer, secretary. Simply selecting three of the four (ignoring roles) leaves four possible groups: (Ana, Bo, Cam), (Ana, Bo, Dee), (Ana, Cam, Dee), and (Bo, Cam, Dee).

Assign each trio to specific roles, though, and every group splits into 3! = 6 distinct role assignments, since three people can fill three roles in six different orders. The total climbs to 4 × 6 = 24 — six times the unordered count.

That ratio, r! for a selection size of r, holds generally: any unordered group of r items can be arranged in r! different orders. It’s the bridge between this formula and the combination formula, covered in full in permutations and combinations.


The Permutation Formula

Rather than listing every ordered arrangement by hand, the counting process compresses into a closed-form expression built from factorials.

The Factorial Function

The factorial of a non-negative integer n, written n!, is the product of every positive integer from 1 up to n:

n! = n × (n − 1) × (n − 2) × … × 2 × 1

Values worth memorizing:

5! = 120
4! = 24
3! = 6
2! = 2
1! = 1
0! = 1   (the empty product; not zero)

0! = 1 isn’t an arbitrary convention — it’s the standard definition of the empty product (multiplying together zero numbers yields the multiplicative identity, 1), and it’s what keeps the formula below consistent when every item in the set gets placed.

Deriving P(n, r)

To count ordered arrangements of r items drawn from n distinct items, fill each position one at a time:

  • First position: n choices available.
  • Second position: n − 1 choices (one item is already placed).
  • Third position: n − 2 choices.
  • … continuing until …
  • r-th position: n − r + 1 choices.

The fundamental counting principle says to multiply these independent choices together:

P(n, r) = n × (n − 1) × (n − 2) × … × (n − r + 1)

That’s a product of exactly r descending terms. n! extends the same product all the way down to 1, and (n − r)! is precisely the tail left over — the terms from (n − r) down to 1. Dividing removes that tail:

P(n, r) = n! / (n − r)!

This is the standard formula. Different textbooks write it as P(n, r), nPr, or ₙPᵣ — all the same calculation under different notation.



Step-by-Step Worked Examples

Example 1: Assigning Rush Slots at a Water-Testing Lab

Problem: 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?

Step 1 — Identify n and r. Samples available: n = 8. Slots to fill: r = 3. Slot identity matters (Monday-8am ≠ Wednesday-8am), so this is order-sensitive.

Step 2 — Write the formula.

P(8, 3) = 8! / (8 − 3)! = 8! / 5!

Step 3 — Cancel the factorial tail. The 5! in the denominator cancels the lower portion of 8!, leaving only the top three factors:

P(8, 3) = 8 × 7 × 6 = 336

There are 336 ways to fill the three slots.

Verify with full factorials: 8! = 40,320; 5! = 120; 40,320 ÷ 120 = 336. Confirmed.


Example 2: A Warehouse Forklift Lockout Code

Problem: A distribution center assigns each forklift a 4-digit lockout code drawn from the digits 1 through 9, with no digit repeated, so a code can’t be shortcut by frequency-guessing. How many distinct codes can the security team generate?

n = 9, r = 4.

P(9, 4) = 9 × 8 × 7 × 6 = 3,024

There are 3,024 possible codes.


Example 3: Arranging the Letters in STAR

Problem: In how many ways can the letters in the word STAR be arranged?

STAR has 4 distinct letters, and all 4 get used. n = 4, r = 4.

P(4, 4) = 4! / (4 − 4)! = 4! / 0! = 24 / 1 = 24

There are 24 distinct letter arrangements — but hold that thought; the section below on repeated letters changes this answer for a word like LEVEL.


Example 4: Publishing a Top-3 Depot Leaderboard

Problem: A logistics company tracked delivery-time improvement across 12 regional depots this quarter and wants to publish an ordered leaderboard — most improved, second, third — in its investor update. How many distinct leaderboards are possible?

n = 12, r = 3.

P(12, 3) = 12 × 11 × 10 = 1,320

There are 1,320 possible leaderboards.


Special Cases: r = n, r = 0, r = 1

r = n: Using Every Item

When every item in the set gets placed (r = n), 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 agree, which is the consistency check that makes 0! = 1 non-negotiable.

r = 0: Selecting Nothing

P(n, 0) = n! / n! = 1

There’s exactly one way to select and arrange zero items: the empty selection. It looks trivial, but it’s load-bearing in proofs involving the binomial theorem and generating functions.

r = 1: Selecting One Item

P(n, 1) = n! / (n − 1)! = n

There are exactly n ways to choose one item and place it — a result direct counting confirms immediately.


Where the Formula Breaks Down: Repeated Items and Circular Seating

P(n, r) = n!/(n − r)! assumes every object is distinguishable and every position sits on a line. Two common real situations violate that, and both cause practitioners to overcount if they reach for the plain formula anyway.

Repeated (indistinguishable) items. Go back to Example 3, but arrange the letters of LEVEL instead of STAR. LEVEL has 5 letters, but the two L’s are identical to each other, and so 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 each real arrangement multiple times over. The fix divides out the 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. Miss this adjustment and a word-arrangement or password-entropy calculation that involves any repeated character comes out four, six, or more 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. Fixing one person’s seat as a reference point removes the rotational duplicates, leaving (n − 1)! arrangements of the rest:

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).

SituationFormulaWorked result
Distinct items, no repeats, linear ordern! / (n − r)!P(8,3) = 336
Repetition allowed in each positionn^r10⁴ = 10,000
Repeated items in the full setn! / (n₁!n₂!…)LEVEL: 5!/(2!2!) = 30
Circular arrangement, all items used(n − 1)!6 guests: 5! = 120

The takeaway: 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.


When Items Can Repeat

Everything above assumes no repetition: once an item fills a position, it’s unavailable for the rest. That’s the default reading of the term in most statistics and probability courses.

When repetition is allowed instead — each position can hold any of the n items regardless of what came before — the count grows:

Arrangements with repetition = n^r

Example: a 4-digit PIN from digits 0–9, repetition allowed. Any of 10 digits can go in each of the 4 positions:

10^4 = 10,000

Compare without repetition:

P(10, 4) = 10 × 9 × 8 × 7 = 5,040

Allowing repetition roughly doubles the count here, because every position keeps a full pool of 10 options instead of a shrinking one.

The question to ask: 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, look for phrases like “without replacement,” “no digit may repeat,” or “once chosen, an item can’t be selected again” — all of them signal the standard n!/(n−r)! formula rather than n^r.


Where Ordered Counting Shows Up in Practice

This kind of counting turns up anywhere the order items get assigned to positions changes the outcome:

Cryptography and passwords. The number of possible passwords sets a floor on how long a brute-force attack takes. A 6-character password from 26 lowercase letters, no repeats, gives 26 × 25 × 24 × 23 × 22 × 21 = 165,765,600 possibilities; allowing repeats (26⁶ = 308,915,776) roughly doubles that space.

Sports and ranking. Batting-order assignments in baseball, tournament-bracket seeding, medal ceremonies — all order-sensitive, because each position carries distinct meaning.

Scheduling. Deciding the order to run five tasks across five 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. Counting the possible orderings of a given nucleotide set tells you how many distinct proteins that set could theoretically produce.

Logistics. Routing problems — visiting r stops out of a network of n in the fewest kilometers — enumerate orderings of candidate routes to evaluate them.



Common Mistakes and How to Avoid Them

Mixing Up Order and Selection

The most common error: applying P(n, r) when order doesn’t actually matter. If a problem asks how many teams of 3 can be formed from 10 people, with no roles assigned, that’s a combination, not this. Check first: does swapping two elements change the answer to the actual question being asked? If not, use C(n, r) = n! / (r! × (n−r)!) instead.

Treating 0! as 0

A frequent slip is writing 0! = 0, then dividing by zero and getting a nonsensical result or an outright error. 0! = 1, always. 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. 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. If you catch yourself with r > n, re-read the problem: either repetition is allowed (switch to n^r) or n and r got assigned backward.

Computing Huge Factorials Directly

For P(20, 3), computing the full 20! = 2,432,902,008,176,640,000 and dividing by 17! is unnecessary work. The cancellation shortcut lands on the same answer immediately:

P(20, 3) = 20 × 19 × 18 = 6,840

Expand only the top r descending factors from n; the denominator factorial cancels everything else.

Reaching for n^r When Repetition Is Forbidden

n^r counts arrangements only when repetition is allowed. 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.


Frequently Asked Questions

What is a permutation?

An ordered arrangement of items selected from a set. Two arrangements count as distinct if they differ in even one position, regardless of which elements they 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 n distinct items:

P(n, r) = n! / (n − r)!

Equivalently, P(n, r) = n × (n−1) × … × (n−r+1) — the product of the top r descending integers starting at n.

What is the difference between a permutation and a combination?

This counts ordered arrangements, where sequence matters; a combination counts unordered groups, where only membership matters. The combination formula is C(n, r) = n! / (r! × (n−r)!), and the two 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 and combinations for the full comparison, or combinations for the unordered case on its own.

How do you handle repeated items or a circular arrangement?

Divide out the redundancy. For a set with repeated items, use n!/(n₁!n₂!…nₖ!), where each nᵢ is the count of one repeated item — arranging LEVEL gives 5!/(2!2!) = 30, not 120. For a circular seating of n distinct people, use (n−1)! rather than n!, since rotating everyone one seat produces the same relative arrangement.

How do you calculate arrangements with repetition allowed?

Use n^r. With 10 possible digits and 4 positions, repetition allowed, the count is 10⁴ = 10,000. Without repetition it’s P(10, 4) = 10 × 9 × 8 × 7 = 5,040.

What does P(n, r) mean?

“The number of ordered arrangements of r items chosen from n distinct items.” n is the pool size; r is the selection size. P(8, 3) = 336 means there are 336 ordered ways to pick and place 3 items out of a set of 8.

Can r be greater than n?

Not in the standard no-repetition formula — choosing more items than the pool contains is impossible, and (n−r)! is undefined for negative integers. If a problem implies r > n, either repetition is allowed (switch to n^r) or n and r are assigned backward.

When should I multiply the descending terms instead of using the factorial formula?

They’re the same calculation written two ways. n × (n−1) × … × (n−r+1) is the product form; n!/(n−r)! is the compact algebraic form. Use the product form for a quick hand calculation with moderate n; use the factorial form when working symbolically or writing a proof.


Summary

This kind of count measures ordered selections from a larger set, where each distinct sequence is its own outcome:

P(n, r) = n! / (n − r)!

The formula follows directly from the fundamental counting principle: fill the first position with any of n items, the second with any of the remaining n − 1, and so on down to n − r + 1, then multiply.

Four rules to carry forward: order matters (swapping two elements yields a different outcome); 0! = 1, so P(n, n) = n!; repetition allowed changes the formula to n^r; and repeated items or a circular arrangement both require dividing out redundancy the plain formula ignores. With those in hand, most ordered-counting problems reduce to identifying n and r correctly and picking the right variant of the formula.

For a rigorous probability-theory treatment of counting techniques, see Penn State STAT 414 — Counting Techniques, Lesson 1.3, which covers this material alongside combinations as the foundational tools for classical probability. Math is Fun — Permutations and Combinations is a useful companion for building intuition across worked examples.