Unordered selections. nCr (binomial coefficients).
Deep-dive lesson - accessible entry point but dense material. Use worked examples and spaced repetition.
How many different 3-person teams can you make from 10 people? If you list “A, B, C” and later list “C, B, A”, did you count a new team—or the same team again? Combinations are the math of “teams, not lineups.”
A combination counts unordered selections of k distinct items from n distinct items. The binomial coefficient is
C(n,k) = n! / (k!(n−k)!).
It connects directly to permutations by “divide out the internal order”: C(n,k) = nP k / k!. Also, C(n,k) = C(n,n−k).
In permutations, order matters. If you arrange books on a shelf, “A then B” is different from “B then A.” But many real questions aren’t about order:
In these situations, the selection is what matters, not the sequence.
A classic symptom that you need combinations: you can easily list multiple “different” answers that are actually the same outcome because they contain the same elements.
A combination is an unordered selection of k distinct elements from a set of n distinct elements.
We denote the number of such selections by the binomial coefficient:
Read as: “n choose k.”
If S is a set with |S| = n, then a combination corresponds to picking a k-subset T ⊂ S such that |T| = k.
So the counting question becomes:
How many k-subsets does an n-element set have?
That number is C(n,k).
These help you detect mistakes later.
These are not special tricks—they fall naturally out of the definition.
You already know permutations: the number of ordered selections of k distinct items from n is
But for combinations, order is irrelevant. A single team of k people can be arranged internally in k! different orders.
So if you:
1) count ordered selections (permutations)
2) then collapse all sequences that represent the same set
…you should divide by the number of internal reorderings, which is k!.
That’s the whole bridge:
combinations = permutations ÷ (ways to reorder the chosen items)
Start with permutations:
nP k = n! / (n−k)!
Each unique k-element set corresponds to exactly k! permutations (all possible orderings of those k items). Therefore:
C(n,k) = (nP k) / k!
Now substitute the formula for nP k:
C(n,k) = (n! / (n−k)!) / k!
Rewrite as a single fraction:
C(n,k) = n! / (k!(n−k)!)
This is the standard closed form.
It’s easy to memorize the formula and still misunderstand it. Here’s the meaning:
| Question type | Sample question | Order matters? | Repetition allowed? | Formula |
|---|---|---|---|---|
| Permutation (k from n) | “Who gets gold/silver/bronze?” | Yes | No | nP k = n!/(n−k)! |
| Combination (k from n) | “Which 3 people are on the team?” | No | No | C(n,k) = n!/(k!(n−k)!) |
This node is about selection without repetition (each item used at most once). If repetition is allowed (“choose 3 scoops, flavors may repeat”), that’s a different tool (often called combinations with repetition / stars and bars).
Staying disciplined about the assumptions is half of discrete math.
Even if you can compute C(n,k) with a calculator, properties help you:
We’ll focus on three high-value properties.
Choosing k items to include is equivalent to choosing n−k items to exclude.
Example: “Choose 2 students to be captains” out of 10 is the same as “choose 8 students to not be captains.”
Start with the formula:
C(n,k) = n! / (k!(n−k)!)
Swap k with n−k:
C(n,n−k) = n! / ((n−k)! (n−(n−k))!)
Simplify the last factorial:
n−(n−k) = k
So:
C(n,n−k) = n! / ((n−k)! k!)
That equals C(n,k) since multiplication is commutative:
C(n,k) = C(n,n−k)
A very practical identity is:
C(n,k) = n(n−1)…(n−k+1) / k!
This comes from expanding n!/(n−k)!:
n!/(n−k)! = n(n−1)(n−2)…(n−k+1)
So:
C(n,k) = [n(n−1)…(n−k+1)] / k!
Why you care: it avoids gigantic factorials and makes cancellation easier.
Example pattern: compute C(100,3) without writing 100!.
Take an n-element set and pick a particular “special” element x.
Count k-subsets in two disjoint cases:
1) subsets that do not include x
2) subsets that do include x
Add the cases:
C(n,k) = C(n−1,k) + C(n−1,k−1)
This identity generates Pascal’s Triangle and is the backbone of many proofs in probability and algebra.
These are quick “unit tests” for your counting.
In CS, combinations appear whenever you have to consider subsets:
The number of possibilities often grows quickly. Knowing that the count is C(n,k) helps you reason about feasibility.
Example: even with moderate n, C(n,k) can be huge, which hints that brute force might be impossible.
Many probabilities are “favorable combinations ÷ total combinations.”
For instance, in card problems, the order of the hand doesn’t matter, so combinations are the natural denominator.
You’ll later see expressions like:
P(event) = C(favorable, k) / C(total, k)
The name “binomial coefficient” comes from the Binomial Theorem, where coefficients are combinations:
(x + y)ⁿ = ∑ₖ₌₀ⁿ C(n,k) xᵏ yⁿ⁻ᵏ
You don’t need to master this now, but it explains why C(n,k) is so central: it connects counting to polynomial expansion.
In linear algebra and ML, you’ll sometimes represent a chosen subset using a 0–1 indicator vector v ∈ {0,1}ⁿ with exactly k ones.
Each such v corresponds to a k-subset, and the number of these vectors is exactly C(n,k).
This is a quiet but powerful bridge: combinations count the number of “k-hot” binary vectors.
Before you compute anything, ask:
1) Am I selecting items or arranging them?
2) Does order matter in the final outcome?
3) Is repetition allowed?
Getting these questions right is more important than memorizing the formula.
A club has 10 members. How many distinct 3-person committees can be formed (no roles, just a set of people)?
Recognize this is a selection problem, not an arrangement: committee membership is unordered.
Identify n = 10 and k = 3.
Use the combinations formula:
C(10,3) = 10! / (3!(10−3)!)
Compute step by step:
10!/(7!) = 10·9·8
So C(10,3) = (10·9·8) / 3!
Compute 3! = 6.
Divide:
(10·9·8)/6 = 720/6 = 120
Final answer: 120 committees.
Insight: If you mistakenly used permutations 10P3 = 720, you’d be counting each committee 3! = 6 times (all internal reorderings). Dividing by 6 fixes it.
How many ways are there to choose 8 distinct items from 10 distinct items?
Direct computation would be:
C(10,8) = 10! / (8!2!)
Use symmetry:
C(10,8) = C(10,10−8) = C(10,2)
Now compute the smaller one:
C(10,2) = 10! / (2!8!)
Simplify:
10!/8! = 10·9
So:
C(10,2) = (10·9)/2 = 90/2 = 45
Final answer: 45 ways.
Insight: When k is close to n, symmetry turns a hard-looking factorial into a small calculation. Always check whether k or n−k is smaller.
How many distinct 5-card hands can be dealt from a standard 52-card deck (order irrelevant)?
A hand is an unordered set of cards, so use combinations with n = 52, k = 5.
Write the formula:
C(52,5) = 52! / (5!47!)
Avoid huge factorials by canceling:
52!/47! = 52·51·50·49·48
So:
C(52,5) = (52·51·50·49·48) / 5!
Compute 5! = 120.
Compute numerator in manageable steps:
52·51 = 2652
50·49·48 = 50·2352 = 117600
So numerator = 2652·117600
Multiply:
2652·117600 = 311,875,200
Divide by 120:
311,875,200 / 120 = 2,598,960
Final answer: 2,598,960 distinct 5-card hands.
Insight: This number becomes the denominator in many card probabilities. The combination is the natural count because the order of cards in a hand doesn’t matter.
Combinations count unordered selections of k distinct items from n distinct items: k-subsets of an n-element set.
Main formula: C(n,k) = n! / (k!(n−k)!).
Connection to permutations: C(n,k) = (nP k) / k! (divide out internal order).
Symmetry: C(n,k) = C(n,n−k) often makes calculations easier.
Pascal’s identity: C(n,k) = C(n−1,k) + C(n−1,k−1) comes from splitting by whether a special element is included.
Boundary checks help prevent errors: C(n,0)=1, C(n,n)=1, and C(n,k)=0 for k>n.
In CS and probability, combinations often measure the size of subset search spaces and appear as “favorable ÷ total” counts.
Using permutations when order doesn’t matter (forgetting to divide by k!).
Mixing up k and n−k, especially when k is close to n; failing to use symmetry.
Applying C(n,k) when repetition is allowed (this node assumes no repetition).
Computing gigantic factorials directly instead of canceling (e.g., expanding 52!); this increases arithmetic errors.
A class has 18 students. How many ways can you choose 4 students to present (order irrelevant)?
Hint: This is C(18,4). Use cancellation: 18!/14! = 18·17·16·15, then divide by 4!.
C(18,4) = 18!/(4!14!) = (18·17·16·15)/24.
Compute numerator: 18·17=306, 16·15=240, so 306·240=73440.
73440/24 = 3060.
Answer: 3060.
Compute C(12,9) without large factorials.
Hint: Use symmetry: C(12,9) = C(12,3). Then use (12·11·10)/3!.
C(12,9) = C(12,3) = 12!/(3!9!) = (12·11·10)/6 = 1320/6 = 220.
Show that C(n,k) = C(n,k−1) · (n−k+1)/k for 1 ≤ k ≤ n, and use it to compute C(20,5) from C(20,4).
Hint: Write both C(n,k) and C(n,k−1) using factorials and divide them. For the numeric part, compute C(20,4) first, then multiply by (20−5+1)/5 = 16/5.
Derivation:
C(n,k) / C(n,k−1)
= [n!/(k!(n−k)!)] / [n!/((k−1)!(n−(k−1))!)]
= [n!/(k!(n−k)!)] · [((k−1)!(n−k+1)!)/n!]
= (k−1)!/k! · (n−k+1)!/(n−k)!
= (1/k) · (n−k+1)
So C(n,k) = C(n,k−1) · (n−k+1)/k.
Now compute:
C(20,4) = (20·19·18·17)/4! = (20·19·18·17)/24.
Compute 20·19=380, 18·17=306, product 380·306=116280.
116280/24 = 4845.
Then:
C(20,5) = C(20,4) · 16/5 = 4845·16/5.
4845/5 = 969, so 969·16 = 15504.
Answer: C(20,5) = 15504.