How many ways can 5 runners finish in 1st, 2nd, and 3rd place? How many different 4-digit PIN codes are possible? How many ways can you arrange the letters in your name? All of these are permutation problems — and once you understand the formula, they become straightforward to solve.

What Is a Permutation?

A permutation is an ordered arrangement of items selected from a set. The key word is ordered — in permutations, the sequence matters. Arranging A, B, C as "ABC" is a different permutation from "BAC" or "CAB," even though they contain the same three letters.

Permutations answer the question: "In how many ways can I arrange r items chosen from a group of n items, where order matters?"

🔑 The Core Rule

Order matters → use permutation
Order does NOT matter → use combination

Example: The 3-digit PIN "1-2-3" is different from "3-2-1" → permutation
Example: A pizza with toppings A, B, C is the same regardless of order → combination

Understanding Factorials First

The permutation formula uses factorials. The factorial of a number n, written n!, is the product of all positive integers from 1 to n.

n! = n × (n−1) × (n−2) × … × 2 × 1
Read as "n factorial"
Special case: 0! = 1 (by mathematical convention)

Here are the factorial values you will encounter most often:

0!
1
1!
1
2!
2
3!
6
4!
24
5!
120
6!
720
7!
5,040
8!
40,320
10!
3,628,800

Notice how quickly factorials grow — 10! is already over 3.6 million. This is why the number of possible arrangements grows explosively as n increases.

📝 Example: Compute 5!
5
×
4
×
3
×
2
×
1
= 120

The Permutation Formula

Permutation Formula — Without Repetition
P(n, r) = n! ÷ (n − r)!
n = total number of items in the set
r = number of items being arranged (chosen)
Order matters, no item is used more than once
Find Arrangements P(n, r) = n! ÷ (n−r)!
All Items Arranged P(n, n) = n!
With Repetition P = nʳ
💡 When r = n (Arranging All Items)

If you are arranging ALL items in the set (not just a selection), the formula simplifies to just n! — because (n − n)! = 0! = 1, so the denominator becomes 1.

Example: How many ways can 5 people sit in 5 chairs? P(5,5) = 5! = 120

Step-by-Step Computation

Step 1

Identify n and r

n is the total number of distinct items available. r is the number of items you are selecting and arranging. Make sure order matters — if not, you need combinations instead.

Step 2

Compute n! and (n − r)!

Calculate the factorial of n. Then calculate the factorial of (n − r). If r = n, then (n − r)! = 0! = 1.

Step 3

Divide n! by (n − r)!

Divide your two factorial values. You can simplify by cancelling common factors before multiplying — this avoids computing very large numbers unnecessarily.

Step 4

State the answer

The result is the number of distinct ordered arrangements possible. Always double-check your n and r values — swapping them gives a very different answer.

Worked Examples

Example 1: Arranging All Items

📝 In how many ways can 4 books be arranged on a shelf?
Total items (n)4 books
Items to arrange (r)4 (all of them)
Formula: P(4, 4) = 4!4 × 3 × 2 × 1
Result24 arrangements
✅ There are 24 different ways to arrange 4 books on a shelf

Example 2: Selecting and Arranging a Subset

📝 From 8 runners, how many ways can 1st, 2nd, and 3rd place be awarded?
Total runners (n)8
Places to fill (r)3
n! = 8!40,320
(n − r)! = (8 − 3)! = 5!120
P(8, 3) = 40,320 ÷ 120336
Result336 arrangements
✅ There are 336 ways to award 1st, 2nd, and 3rd place among 8 runners

Example 3: Letter Arrangements

📝 How many 3-letter arrangements can be made from the letters A, B, C, D, E?
Total letters (n)5
Letters to arrange (r)3
n! = 5!120
(n − r)! = 2!2
P(5, 3) = 120 ÷ 260
Result60 arrangements
✅ There are 60 possible 3-letter arrangements from {A, B, C, D, E}

Example 4: Using the Shortcut (Cancellation)

📝 P(10, 3) — compute using cancellation shortcut
P(10, 3) = 10! ÷ (10−3)! = 10! ÷ 7!
Cancel matching terms in numerator and denominator10 × 9 × 8 × 7! ÷ 7!
Only multiply the top r terms10 × 9 × 8
Result720
✅ Shortcut: P(n, r) = n × (n−1) × (n−2) × … for r terms — multiply from n downward, r times
⚡ The Multiplication Shortcut

Instead of computing full factorials, multiply downward from n for exactly r terms:

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

P(10, 4) = 10 × 9 × 8 × 7 = 5,040 — no need to compute 10! or 6! separately.

Permutations WITH Repetition

In the standard formula, each item can only be used once. But sometimes items can be reused — like digits in a PIN where the same digit can appear multiple times.

Permutation Formula — With Repetition
P = nʳ
n = number of options available at each position
r = number of positions to fill
Each item can be reused — order still matters
📝 How many 4-digit PIN codes are possible using digits 0–9?
Options per digit (n)10 (digits 0–9)
Number of digits (r)4
Formula: P = nʳ = 10⁴10 × 10 × 10 × 10
Result10,000 possible PINs
✅ There are 10,000 possible 4-digit PIN codes when digits can repeat
📝 How many 3-letter codes using A–Z are possible (repetition allowed)?
Options per position (n)26 letters
Number of positions (r)3
Formula: P = 26³26 × 26 × 26
Result17,576 possible codes
✅ There are 17,576 possible 3-letter codes when letters can repeat

🧮 Permutation Calculator

Enter n and r to compute permutations with or without repetition.

Permutation vs Combination

Permutation
P(n,r) = n! ÷ (n−r)!

Order matters. ABC ≠ BAC.
Use for rankings, sequences, arrangements, passwords, schedules.

Combination
C(n,r) = n! ÷ (r! × (n−r)!)

Order does NOT matter. ABC = BAC.
Use for selections, groups, committees, lottery numbers.

ScenarioOrder Matters?Use
Awarding 1st, 2nd, 3rd place✅ YesPermutation
Choosing 3 team members from 10❌ NoCombination
Creating a 4-digit PIN✅ YesPermutation
Selecting 5 lottery numbers❌ NoCombination
Arranging books on a shelf✅ YesPermutation
Choosing pizza toppings❌ NoCombination
Seating people in numbered chairs✅ YesPermutation

Practice Problems

ProblemFormulaAnswer
How many ways can 6 people stand in a line? P(6,6) = 6! 720
How many 2-digit arrangements from {1,2,3,4,5}? P(5,2) 20
Top 3 finishers from 10 athletes P(10,3) 720
4-letter codes from A–Z, no repeats P(26,4) 358,800
3-digit codes, digits 1–9, repetition allowed 729
How many ways can the letters of "MATH" be arranged? P(4,4) = 4! 24

Special Cases

P(n, 0) — Choosing Zero Items

P(n, 0) = n! ÷ n! = 1 for any value of n. There is exactly one way to arrange zero items — the empty arrangement. This is why 0! = 1 by convention.

P(n, 1) — Choosing One Item

P(n, 1) = n! ÷ (n−1)! = n. There are exactly n ways to choose and arrange a single item from n — you simply pick one of them.

Large Numbers and BigInt

Factorials grow extremely fast. 20! = 2,432,902,008,176,640,000 — more than 2 quintillion. Our Permutation Calculator uses JavaScript BigInt to handle arbitrarily large permutation values accurately without rounding errors.

✅ Key Takeaways

1. Permutation = ordered arrangement — order matters
2. Without repetition: P(n,r) = n! ÷ (n−r)!
3. With repetition: P = nʳ
4. Shortcut: multiply downward from n for r terms: P(n,r) = n × (n−1) × … (r times)
5. P(n,n) = n! — arranging all items
6. P(n,0) = 1 — one way to arrange nothing
7. Use permutation when order matters; use combination when it does not


🧮 Try the Permutation Calculator

Calculate nPr instantly — with and without repetition, plus BigInt support for very large values.

Try the Permutation Calculator →