Counting & combinatorics · 04 · The bridge to probability · 8 min
MediumRepetition, identical items & probability
Two twists complete your counting toolkit: arrangements where items can repeat, and arrangements where some items are identical. With these, you can count the outcomes that probability and statistics are built on — and that's exactly where this section delivers you.
Build the intuition
Arrangements with repetition
When choices can repeat — each independent and from the same pool — you simply multiply: a 4-digit PIN allows 10⁴ = 10,000 codes because each digit independently has all 10 options. No factorial discount, because nothing gets 'used up'. Repetition-allowed counting is the pure fundamental counting principle: pool size raised to the number of slots.
Arrangements with identical items
Spell MISSISSIPPI: 11 letters, but with repeats (4 S's, 4 I's, 2 P's). If all were distinct there'd be 11! orderings — but swapping two identical S's changes nothing, so we divide by the factorials of each repeat group. The result, 11!/(4!4!2!) = 34,650, is far less than 11!. Identical items collapse arrangements, just as unordered selection did for combinations.
Counting becomes probability
Here's the handoff. Probability of an event = (favorable outcomes) ÷ (total outcomes) — both counted with the tools you now have. The chance of a specific 5-card poker hand? Count the favorable hands, divide by C(52, 5). The binomial distribution's coefficients are literally C(n, k) — the number of ways to get k successes. Every probability you'll meet next rests on counting done right.
See it move
number of heads k
Combinations become a distribution: each bar is C(n, k) — the number of ways to get k heads in n flips. Counting, plotted, is already the shape of probability.
A worked example
From a count to a probability
Flip a fair coin 4 times. What's the probability of exactly 2 heads?
Total ordered outcomes: 2⁴ = 16 (repetition allowed: H or T each flip).
Favorable — which 2 of the 4 flips are heads:
Probability:
Counting gave both numbers. That ratio is the binomial distribution at work — your first step into probability.
Out in the world
Counting under the hood of ML
Probabilities in classifiers, the binomial and multinomial distributions in language models, sampling schemes in data science — all rest on counting outcomes correctly. The combinatorics here is quiet but foundational: get the counts wrong and every probability built on them is wrong too.
Common confusion, cleared
“Counting and probability are separate topics.”
Probability is counting, normalized: favorable ÷ total. Combinations and permutations are the machinery that produces both numbers. Counting is the foundation probability stands on.
“Identical items can be arranged like distinct ones.”
Swapping two identical letters creates no new arrangement, so you must divide by each repeat group's factorial. Treating identical items as distinct over-counts every time.
Check yourself
PracticeQuick check
How many distinct arrangements of the letters in 'LEVEL'?
Flipping a coin 3 times, P(exactly 1 head) is…
Recap
- Repeats allowed: nᵏ (no factorial discount — nothing is used up).
- Identical items: divide n! by the factorial of each repeat group.
- Probability = favorable ÷ total — both counted with these tools. Next: probability.
Progress saves in this browser.