Most interview problems are a familiar distribution in disguise. Recognise it, and the mean and variance come for free. Here are the seven to know cold, with what each one counts and where it shows up on a desk.
Discrete: counting things
| Variable | What it counts | PMF | Mean | Variance |
|---|---|---|---|---|
| Bernoulli | one yes/no trial | |||
| Binomial | successes in trials | |||
| Poisson | events in a fixed window | |||
| Geometric | trials until first success |
Continuous: measuring things
| Variable | What it measures | Mean | Variance | |
|---|---|---|---|---|
| Uniform | a value equally likely anywhere in | |||
| Normal | sums and averages of many small effects | |||
| Exponential | waiting time for the next Poisson event |
For a continuous variable, probabilities come from the cumulative distribution function, . The density is not itself a probability; areas under it are.
How they connect
- Binomial → Poisson. With huge and tiny so that stays fixed, the binomial becomes Poisson. Rare events in a big population (defaults in a loan book, large orders in a second) are Poisson.
- Poisson ↔ exponential. If events arrive as a Poisson process with rate , the gaps between them are exponential with mean . Counts and waiting times are two views of the same process.
- Memorylessness. The geometric and exponential are the only memoryless distributions: . If you’ve waited 5 minutes for a trade, the expected further wait is unchanged.
- Sums → normal. Add up many independent pieces and you approach a normal distribution, whatever the pieces look like. That is the central limit theorem, in lesson 6.
Functions of a random variable
If you know the distribution of and with strictly increasing, then ; differentiate for the density. Example: if is normal, is lognormal, the standard model for prices that can’t go negative (and for house sizes in lesson 14).
In code
from scipy import stats
print(stats.binom(n=20, p=0.3).mean(), stats.binom(n=20, p=0.3).var()) # 6.0 4.2
print(stats.poisson(mu=4).pmf(2)) # P(exactly 2 events) ≈ 0.147
print(stats.geom(p=0.2).mean()) # 5 trials on average
print(stats.expon(scale=1 / 2).cdf(1)) # P(wait < 1) at rate 2 ≈ 0.865
print(stats.norm(0, 1).ppf(0.975)) # 1.96, the 95% two-sided z-score
# Binomial -> Poisson: n = 1000, p = 0.004 against Poisson(4)
print(stats.binom(1000, 0.004).pmf(3), stats.poisson(4).pmf(3))
Check yourself
Trades print as a Poisson process at 3 per minute. You have already waited 40 seconds without a trade. What is the expected additional wait?