Probability, visually
Interactive notes on probability, statistics and puzzles for quant and ML interviews. Every idea comes with the intuition first, the formula second, and a widget you can play with until it clicks.
How to use these notes
- Read the yellow 💡 boxes first. They give the one-sentence intuition you should be able to say out loud in an interview.
- Play with every ▶ widget. Drag the sliders and predict what will happen before you look.
- Proofs are folded away under ▸ toggles. Open them on a second pass.
- 🧠 Quick checks test whether the idea actually stuck.
- Purple ✏️ boxes mark places where the original notes had a typo or error that has been corrected.
Pattern recognition: which tool do I reach for?
Most interview problems are solved the moment you recognize the pattern. This is the map:
| If the problem mentions… | …reach for |
|---|---|
| memoryless, waiting | geometric, exponential |
| trials with success & failure | Bernoulli, binomial |
| large sample, average | CLT → approximately Gaussian |
| bound given only mean / variance | Markov / Chebyshev inequalities |
| estimating a parameter from data | MLE, MAP, Bayesian update |
| update belief from evidence | Bayes' rule |
| a (convex/concave) function of a RV | Jensen's inequality |
| expected count of things | linearity + indicators |
| expected hitting time / return probability | first-step analysis, solve the recurrence |
| future depends only on the present | Markov chain + first-step analysis |
The five moves that solve most problems
1 · Linearity
$\E[\sum X_i]=\sum\E[X_i]$, even when the $X_i$ are dependent.
2 · Indicators
Count = sum of 0/1 variables; $\E[\1_A]=P(A)$.
3 · First step
Condition on the first move, then solve for the unknown.
4 · Complement
$P(\text{at least one})=1-P(\text{none})$.
5 · Symmetry
Equivalent things get equal probability, so divide evenly.