Probability Basics
The problem
Real systems are full of uncertainty — request latencies vary, hash collisions happen, servers fail at some rate, users convert at some percentage. Probability quantifies that uncertainty instead of pretending systems are deterministic.
Why now
Sets and logic let us describe events precisely — an event is a subset of possible outcomes — and combinatorics lets us count how many ways something can happen. Probability adds the missing piece: a measure that turns 'how many ways' into 'how likely,' which requires both as prerequisites.
Mental model
Probability is counting, normalized: the chance of an event is the fraction of the total possibility-space it occupies. Once outcomes are equally likely, 'probability' and 'combinatorics problem' are the same question asked two ways — which is why the birthday paradox, hash collisions, and load-balancing fairness all reduce to the same calculation.
Requires
- Sets & LogicMathematical Thinking
An event is formally a subset of the sample space, and the probability axioms (union, intersection, complement) are direct restatements of set operations.
- Combinatorics & CountingMathematical Thinking
Computing probability in the equally-likely case requires counting favorable outcomes and total outcomes — exactly what combinatorics provides.
Unlocks
Used in
- Hash collision probability (birthday bound) in hash tables and hashing schemes
- A/B testing and statistical significance
- Load balancing and request-distribution fairness
- Reliability engineering — failure rates, MTBF, error budgets
- Randomized algorithms (quicksort pivot choice, skip lists)
Projects
- Simulate the birthday paradox for hash collisions and compare empirical results to the calculated probability
- Given a service's per-request failure rate, calculate the probability of at least one failure in a batch of N requests
Examples
- A hash function with a 32-bit output has a >50% chance of a collision after only ~77,000 keys (birthday bound)
- If p99 latency is 100ms, roughly 1 in 100 requests takes longer — that's a probability statement about your system
Resources
Mastery checklist
- I can compute the probability of an event in an equally-likely sample space using counting
- I can explain the birthday paradox and why hash collision probability grows faster than intuition suggests
- I can compute the probability of at least one failure across N independent trials given a per-trial failure rate
- I can explain what a p99 latency figure actually says probabilistically about a system