📚 Trusted by students, educators & researchers since 2017.
The easiest way to understand the difference between permutations and combinations is to realize that the inventor of the “combination lock” named it completely wrong.
If your gym locker code is 1-2-3, entering 3-2-1 won’t open it. The order of the numbers matters entirely. Therefore, it is actually a permutation lock.
Here is the golden rule of counting in statistics:
- Combination: Order does not matter. (Making a fruit salad with apples, bananas, and grapes is the exact same salad as grapes, bananas, and apples).
- Permutation: Order does matter. (A PIN code of 1-2-3 is completely different from 3-2-1).
Because permutations care about the specific arrangement of every single item, the number of possible permutations will always be massively larger than the number of combinations.
The Math Behind the Magic
In probability, you will usually see these written with $n$ representing the total number of items available, and $r$ (or $k$) representing the number of items you are actually choosing.
Combinations (Order Doesn’t Matter)
How many ways can you choose $r$ items from a pool of $n$ items?
$$C(n, r) = \frac{n!}{r!(n – r)!}$$
Permutations (Order Matters)
How many ways can you arrange $r$ items from a pool of $n$ items?
$$P(n, r) = \frac{n!}{(n – r)!}$$
(Note: The exclamation point is a factorial. $5!$ simply means $5 \times 4 \times 3 \times 2 \times 1$.)
How to Calculate in Excel, Python, and R
You rarely have to calculate these by hand. Here is how to compute them instantly across your favorite tools. Let’s assume you have a total pool of 10 items ($n = 10$) and you want to choose 3 of them ($r = 3$).
1. Excel
Excel has built-in functions specifically for this. They are straightforward and handle the factorial math behind the scenes.
- Combinations:
=COMBIN(10, 3) - Permutations:
=PERMUT(10, 3)
2. Python
Python’s native math module makes this incredibly easy. It returns exact integers, so it won’t crash or round off even with massive inputs.
import math
n = 10
r = 3
# Calculate Combinations
combinations = math.comb(n, r)
print(f"Combinations: {combinations}")
# Calculate Permutations
permutations = math.perm(n, r)
print(f"Permutations: {permutations}")
3. R
R handles combinations natively via the choose() function. For permutations, you can either do the factorial math yourself or use a dedicated package.
n <- 10
r <- 3
# Calculate Combinations
combinations <- choose(n, r)
print(paste("Combinations:", combinations))
# Calculate Permutations (Using base R factorials)
permutations <- factorial(n) / factorial(n - r)
print(paste("Permutations:", permutations))
The Permutation vs. Combination Visualiser
To really grasp how much faster permutations grow compared to combinations, drop this HTML visualizer into your post. It calculates both metrics side-by-side using BigInt precision, so users can enter large numbers (like a standard 52-card deck) and see the staggering difference.
Combinations vs. Permutations
Calculate the possible arrangements of a dataset.
Combinations
0
Order does NOT matter.
(A, B, C is the same as C, B, A)
(A, B, C is the same as C, B, A)
Permutations
0
Order DOES matter.
(A, B, C is different from C, B, A)
(A, B, C is different from C, B, A)
