🧮Permutations and Combinations: Counting the Possibilities
Permutations and combinations are the mathematics of counting: working out how many possible outcomes there are without listing them one by one. They underpin probability, and they help you judge how rare an outcome really is. This guide uses a 60-second animation and a few small examples to explain the multiplication rule, permutations, combinations, and how they connect to probability.
Two rules and one notation
Multiplication rule (steps)
If a task has several steps, multiply the number of choices at each step. With 3 shirts and 2 pairs of pants, there are 3 × 2 = 6 outfits.
Addition rule (cases)
If a task can be done in several non-overlapping ways, add the counts. A commute by 3 bus routes or 2 subway lines gives 3 + 2 = 5 options.
Factorial
n! means n × (n−1) × … × 2 × 1. Three people can line up in 3! = 6 ways, and 5! = 120.
Permutations: choose, then arrange
Choosing k items from n distinct items and arranging them in order is a permutation, written A(n,k) or P(n,k). Each pick leaves one fewer item to choose from, so A(n,k) multiplies k numbers starting from n.
Formula
A(n,k) = n × (n−1) × … × (n−k+1) = n! ÷ (n−k)!
Example
Pick 3 of 5 people to be captain, vice captain and study lead. There are 5 choices for the first role, 4 for the second and 3 for the third, so 5 × 4 × 3 = 60.
Combinations: choose, no arranging
Choosing k items from n distinct items when order does not matter is a combination, written C(n,k). The same group of k items is counted k! times among permutations, so the number of combinations is the number of permutations divided by k!.
Formula
C(n,k) = A(n,k) ÷ k! = n! ÷ (k! × (n−k)!)
Example
Again pick 3 of 5 people, but as a team with no roles. The same 3 people can be ordered in 3! = 6 ways, so 60 ÷ 6 = 10.
How to tell them apart
| Aspect | Permutation A(n,k) | Combination C(n,k) |
|---|---|---|
| Order | Matters | Does not matter |
| How to check | A different order is a different result | A different order is the same result |
| Formula | n! ÷ (n−k)! | n! ÷ (k! × (n−k)!) |
| Example | Captain, vice captain, study lead | A team of 3 |
| Count | Larger | Smaller, 1 ÷ k! of the permutations |
Numbers grow fast
The number of outcomes often exceeds intuition. A slightly larger problem can multiply the possibilities enormously.
4-digit PIN
Each digit can repeat, so 10 × 10 × 10 × 10 = 10,000.
5 cards from 52
Order ignored, C(52,5) = 2,598,960.
Shuffling a deck
52! is about 8 × 10^67 orderings, a number almost impossible to picture.
Link to probability
When every outcome is equally likely, probability = favorable outcomes ÷ all outcomes. For example, drawing 5 cards from 52, the number of all-heart hands is C(13,5) = 1,287, so the probability is 1,287 ÷ 2,598,960, about 0.05%.
Common mistakes
| Issue | Why it happens | How to avoid it |
|---|---|---|
| Unsure whether order matters | Treating a permutation as a combination, or the reverse | Ask: does a different order count as a different result? |
| Forgetting whether repeats are allowed | A PIN digit can repeat, but a drawn card cannot be put back | Check whether it is with or without replacement |
| Double counting | When cases overlap, adding them counts some outcomes twice | Make the cases non-overlapping, or subtract the overlap with inclusion-exclusion |
| Treating many outcomes as high probability | More possible outcomes does not make any one of them more likely | When outcomes are equally likely, each has the same probability |
How this relates to sequence models
Sequence models work on ordered data, where order itself is information, which matches the idea of permutations. In random sampling, order often does not matter, which matches combinations. When every outcome is equally likely, history contains no structure to learn, and a model cannot predict out of thin air. Understanding the scale of the counts helps you judge how rare an outcome is.
Note
This guide covers finite, discrete counting only. It does not go into permutations with repeated items, circular permutations or the details of inclusion-exclusion. Check the conditions of any specific problem, and verify important conclusions yourself.