A little help goes a long way. Find a tool/

Math FIELD NOTES · 4 MIN READ

Permutations vs Combinations: When Order Matters

Factorials, P(n,r) and C(n,r): podiums and PINs versus teams and lottery draws, why combinations divide by r!, and where each counting formula applies.

A lottery draw and a race podium both involve picking from a pool, yet they answer to different mathematics. The difference is one word: order. When the arrangement matters — first, second, third — you count permutations. When only the chosen set matters — who made the team — you count combinations. Both rest on the same engine, the factorial.

The factorial: counting's building block

The factorial of n, written n!, is the number of ways to arrange n distinct items in order:

n! = n × (n − 1) × (n − 2) × … × 2 × 1
5! = 5 × 4 × 3 × 2 × 1 = 120

Five books can sit on a shelf 120 different ways. By convention 0! = 1 — there is exactly one way to arrange nothing — which is what keeps the formulas below working at the boundaries. Factorials grow violently: 10! = 3,628,800, 13! already exceeds 6 billion, and 52! (the orderings of a card deck) is about 8 × 10⁶⁷, many times the number of atoms on Earth. This growth has a practical edge: JavaScript's floating-point numbers give exact integer results only up to 170!, which is why the factorial calculator stops there rather than printing a silently rounded lie.

Permutations: order matters

A permutation is an ordered selection of r items from n. Pick them one at a time: n choices for the first slot, n − 1 for the second, and so on, which multiplies out to:

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

Worked example: eight runners, and you want the gold–silver–bronze podium (r = 3). That is 8 × 7 × 6 = 336 podiums. The formula's mechanics are visible: n!/(n−r)! = 40,320/120 = 336 — you keep the first three factors and the 5! below the line cancels the rest. The key question is whether swapping two selections changes the outcome. Swapping gold and silver produces a genuinely different podium, so every ordering counts separately.

Combinations: order doesn't

A combination is an unordered selection. If you only care which three runners make the team — not the sequence of announcement — the 336 podiums massively overcount, because each group of three can be arranged in 3! = 6 orders that are all the same team. Divide once to fix it:

C(n, r) = n! / (r! × (n − r)!)

So C(8,3) = 336/6 = 56 teams. Combinations are always fewer than permutations by exactly a factor of r! — the number of ways to shuffle the chosen items among themselves. Read C(n,r) aloud as "n choose r"; it is the single most reused quantity in probability, from binomial coin outcomes to hand counting.

Side by side: PINs and lotteries

The two formulas bracket everyday chance. A 4-digit PIN allows repeats, so order matters and each digit has 10 options: 10 × 10 × 10 × 10 = 10,000 codes (without repeats it would be P(10,4) = 5,040 — which is why "no repeated digits" PINs are weaker than they sound). A 6-from-49 lottery ignores draw order, so it is a combination:

C(49, 6) = 49! / (6! × 43!) = 13,983,816 possible tickets

Count the order anyway — P(49,6) = 49 × 48 × 47 × 46 × 45 × 44 = 10,068,347,520 — and you overstate your odds by 720×, the tidy factor of 6!. Every "1 in 13,983,816" jackpot quote in the world is a combination divided into one.

Counting as a probability engine

Combinations turn counting into probability directly: P = favorable combinations ÷ total combinations. That is exactly the machinery behind exactly-k-heads coin odds (as used in how probability works) and behind drawing marbles without replacement. Permutations show up wherever sequence is load-bearing — race results, seating charts, task ordering, key sequences. And randomization lives at the intersection: shuffling a list of n items produces one of its n! possible orderings, so a fair shuffle — typically a Fisher–Yates pass — must give every one of those orderings an equal chance. Sampling from a population, as covered in random sampling explained, is combination-counting in disguise: the number of possible samples of size r from n is C(n,r).

Try it yourself

The Permutation & Combination Calculator computes P(n,r) and C(n,r) from any n and r, so you can check whether order changes your answer by the factor r!. The Factorial Calculator evaluates n! up to the 170! precision limit — useful for the cancellation steps and for appreciating how fast the numbers explode. The Randomizer shuffles a list or picks entries at random, an unbiased Fisher–Yates shuffle: the practical, randomized twin of the counting formulas above.

Frequently asked questions

When do I use a permutation instead of a combination?
Ask whether swapping two of the chosen items changes the outcome. A gold-silver-bronze podium changes when you swap, so it is a permutation; a three-person team does not, so it is a combination. Ordered arrangements: P(n,r). Unordered groups: C(n,r).
Why does 0! equal 1?
By convention there is exactly one way to arrange nothing - the empty arrangement. The definition keeps formulas like C(n,0) = 1 and P(n,n) = n! consistent at the boundaries.
Why is a combination always smaller than the matching permutation?
C(n,r) divides P(n,r) by r!, the number of orderings of the r chosen items. Each unordered group was being counted r! times in the permutation count, and dividing collapses those duplicates into one.
How large can factorials get before calculators give up?
JavaScript numbers hold exact integers up to 170! (about 7.3 x 10^306); 171! exceeds the range and is why the factorial calculator stops at 170. Combinations like C(49,6) still compute fine because the formula cancels most factors first.