# Permutations vs combinations: when order matters, and why a combination lock is misnamed

> Counting arrangements and selections sounds like school maths, but it decides lottery odds, password strength and how many handshakes happen in a room. This guide builds both formulas from scratch and shows the numbers in pictures.

Published 2026-10-08 by Toolcloak. 4 minute read. Original: https://toolcloak.pages.dev/articles/permutations-vs-combinations-when-order-matters-and-why-a-combination-lock-is-misnamed
Related free tool: [Permutation & Combination Calculator](https://toolcloak.pages.dev/tools/permutation-combination-calculator)

How many ways can five people sit in a row? How many different teams of three can be chosen from the same five? The numbers are 120 and 10. They sound like the same problem, but one of them cares about **order** and the other does not. That one question, “does order matter?”, is the whole difference between permutations and combinations.

> **In short**
> - **Permutation** = an arrangement where order matters. **Combination** = a selection where it does not.
> - Picking r from n: **nPr = n! ÷ (n−r)!** and **nCr = n! ÷ (r! × (n−r)!)**. Every combination has r! orderings, so nPr = nCr × r!.
> - A lottery that asks for 6 numbers from 49 has **1,39,83,816** combinations. A 4-digit PIN has **10,000**.
> - A “combination lock” is really a **permutation** lock, because 1-2-3 and 3-2-1 are different codes.

## Factorials: the building block

The factorial of n, written n!, is n × (n−1) × (n−2) × … × 1. It counts how many ways n different things can be lined up. With three letters A, B, C there are 3 × 2 × 1 = 6 lineups, because you have 3 choices for the first spot, 2 left for the second and 1 for the last.

**How fast n! grows**

|  | Value |
| --- | --- |
| 1! | 1 |
| 2! | 2 |
| 3! | 6 |
| 4! | 24 |
| 5! | 120 |
| 6! | 720 |
| 7! | 5040 |

*1, 2, 6, 24, 120, 720, 5,040. By 10! the number is already 3,628,800 and by 20! it passes two quintillion.*

**Factorials get big very fast**

|  | Value | Note |
| --- | --- | --- |
| 10! | 3,628,800 | Ways to order ten items |
| 25! | 1.6 × 10²⁵ | About 15 trillion trillion orderings |
| 52! | 8 × 10⁶⁷ | Orderings of a shuffled deck: almost certainly never repeated |

*Any properly shuffled deck of cards is very likely to be in an order that has never existed before in history.*

Try it: [Permutation & Combination Calculator](https://toolcloak.pages.dev/tools/permutation-combination-calculator). Enter n and r and get nPr and nCr, including the factorial steps.

## Permutations: order matters

Imagine a race with 5 runners where gold, silver and bronze go to different people. The first medal can go to 5 runners, the second to the 4 left and the third to the remaining 3: 5 × 4 × 3 = 60 ways. That is 5P3.

**Awarding 3 medals among 5 runners**

1. **Gold: 5 choices.** Any of the five runners can win.
2. **Silver: 4 choices.** The gold winner is out, four are left.
3. **Bronze: 3 choices.** 5 × 4 × 3 = 60 different podiums.

> **nPr = n! ÷ (n − r)!:** For 5P3: 5! ÷ 2! = 120 ÷ 2 = 60. Dividing by (n−r)! cancels the part of the factorial you did not use, here the last two runners.

## Combinations: order does not matter

Now pick a team of 3 from 5 people. The team {Asha, Ben, Chitra} is the same team no matter who was picked first. Each team appears in 3! = 6 different orders inside the 60 podium-style lists, so we divide by 6: 60 ÷ 6 = 10 teams.

**Same five people, three places**

| Permutations (5P3) | Combinations (5C3) |
| --- | --- |
| 60 | 10 |
| Gold, silver, bronze are different roles | Just a team of three, no roles |
| ABC and CBA count as different | ABC and CBA are the same team |
| Use when order or position matters | Use when you only choose a group |

*Every team of three can be arranged in 3! = 6 ways, so 60 ÷ 6 = 10.*

The formula is nCr = n! ÷ (r! × (n − r)!). A useful symmetry: choosing r items to take is the same as choosing n − r items to leave behind, so nCr = nC(n−r). That is why 5C3 = 5C2 = 10.

**Ways to choose k people from 20 (20Ck)**

|  | Value |
| --- | --- |
| 0 | 1 |
| 2 | 190 |
| 4 | 4845 |
| 6 | 38760 |
| 8 | 125970 |
| 10 | 184756 |
| 12 | 125970 |
| 14 | 38760 |
| 16 | 4845 |
| 18 | 190 |
| 20 | 1 |

*The counts rise to a peak at k = 10 (1,84,756) and fall symmetrically. The same shape appears in Pascal’s triangle and in the bell curve.*

| Situation | Order matters? | Formula | Example answer |
| --- | --- | --- | --- |
| Podium of 3 from 5 runners | Yes | 5P3 | 60 |
| Team of 3 from 5 people | No | 5C3 | 10 |
| 4-digit PIN, digits can repeat | Yes | 10⁴ | 10,000 |
| 4-digit code, no repeated digit | Yes | 10P4 | 5,040 |
| 5-card poker hand from 52 | No | 52C5 | 25,98,960 |
| Lottery, 6 numbers from 49 | No | 49C6 | 1,39,83,816 |

*Four quick questions to ask: does order matter, can items repeat, how many are available, and how many are chosen.*

## Four kinds of counting

**Which counting rule to use**

| Box | What it means |
| --- | --- |
| Order matters, no repeats | nPr = n! ÷ (n − r)!. Podiums, seating, racing positions. |
| Order matters, repeats allowed | nʳ. PINs, plates, passwords made from a small set of characters. |
| Order does not matter, no repeats | nCr = n! ÷ (r! (n − r)!). Teams, lotteries, card hands. |
| Order does not matter, repeats allowed | (n + r − 1)Cr. Choosing 3 scoops from 5 flavours when flavours can repeat. |

*Most real problems fall into the first three. The last is rarer but useful for “with replacement” selections.*

## Locks, lotteries and handshakes

A “combination lock” asks for an ordered code, so it is a permutation lock. With four wheels of ten digits and repeats allowed, there are 10 × 10 × 10 × 10 = 10,000 codes. A lottery really is a combination: only the set of numbers counts, not the order in which the balls come out.

**Choosing 6 numbers from 49**

|  | Value | Note |
| --- | --- | --- |
| Possible tickets | 1,39,83,816 | 49C6, order does not matter |
| Your chance with one ticket | 1 in 14 million | About 0.000007% |
| Orders of the same six balls | 720 | 6! orderings that all count as one ticket |

*If order mattered, there would be 49P6 = 10,068,347,520 tickets, which is 720 times more.*

Handshakes are combinations, because a handshake between A and B is the same handshake as between B and A. For n people the number of handshakes is nC2 = n × (n − 1) ÷ 2, which grows much faster than the head count.

**Handshakes if everyone shakes hands once**

|  | Handshakes |
| --- | --- |
| 5 people | 10 |
| 10 people | 45 |
| 20 people | 190 |
| 50 people | 1,225 |
| 100 people | 4,950 |

*Doubling the people from 50 to 100 does not double the handshakes. It multiplies them by about four, from 1,225 to 4,950.*

> **Why this matters for passwords:** An 8-character password using only lowercase letters has 26⁸ = 2,08,82,70,64,576 possibilities. Each extra character multiplies the count by 26, which is why length matters so much. See [password entropy](https://toolcloak.pages.dev/articles/password-entropy-bits-guesses-and-why-length-beats-symbols) for how that becomes “bits”.

## Quick practice

1. How many ways can 4 books be lined on a shelf? 4! = **24**.
2. How many 2-person committees from 6 people? 6C2 = 15, so **15**.
3. How many 3-letter codes from A–Z with no repeated letter? 26P3 = **15,600**.
4. How many ways to pick 4 from 4? 4C4 = **1**, because there is only one group.

Once you can tell whether order matters, the formula follows. Try several n and r values in the calculator and watch how quickly the numbers grow.

## Frequently asked questions

### What is the difference between a permutation and a combination?

In a permutation order matters (ABC differs from CBA). In a combination it does not (ABC and CBA are the same group).

### What is the nCr formula?

nCr = n! ÷ (r! × (n − r)!), the number of ways to choose r items from n when order does not matter.

### What is 0! equal to?

1. There is exactly one way to arrange nothing, and defining 0! = 1 keeps the formulas working.

### How many combinations in a 6/49 lottery?

1,39,83,816, which is 49C6. A single ticket has a 1 in 1,39,83,816 chance.

### Is a combination lock a permutation or a combination?

A permutation. The order of the digits matters, so 1-2-3 and 3-2-1 are different codes.

### How many ways can a deck of 52 cards be shuffled?

52!, about 8 × 10⁶⁷. That is so large that a thoroughly shuffled deck has almost certainly never occurred before.

