skip to content

How do you find the distribution of the maximum of n i.i.d. random variables?

level: juniorimportance: should knowfreq 48%

answer

  1. work with the CDF, not the density
  2. max at most x means all are
  3. independence turns it into a product
  4. F(x)^n for the maximum
  5. minimum multiplies survival functions

basics

~20 s

Go through the CDF. The maximum is at most x exactly when every draw is at most x, so F_max(x) = F(x)^n for n independent draws with CDF F. The minimum instead gives F_min(x) = 1 - (1 - F(x))^n.

solid answer

~50 s

Extremes are easiest through the CDF, not the density. For i.i.d. `X1, ..., Xn` with CDF `F`, the event `max <= x` is the event that every draw is at most `x`, and independence turns that into a product: `F_max(x) = F(x)^n`. Differentiating gives the density `n * F(x)^(n-1) * f(x)` — one draw sits at `x` and the other `n - 1` sit below it. For the minimum I flip to the survival function: `P(min > x) = (1 - F(x))^n`, so `F_min(x) = 1 - (1 - F(x))^n`. A concrete case: if k independent replicas answer with exponential times of rates `r1, ..., rk`, the survival functions multiply to `exp(-(r1 + ... + rk) * x)`, so the first answer arrives on an exponential clock with the rates summed. The maximum of those same exponentials is not exponential.

go deeper

for a junior

Recall the two formulas and the one-line reason: F_max(x) = F(x)^n because every draw must be at most x, and F_min(x) = 1 - (1 - F(x))^n because every draw must exceed x for the minimum to.

for a middle

Be ready to differentiate to the densities and explain the n * F(x)^(n-1) * f(x) form in words, and to show the minimum of independent exponentials is exponential with the rates summed.

for a senior

Expect to connect this to tail behaviour you have measured: waiting for the last of many parallel calls grows roughly like log k, while waiting for the first shrinks like 1/k, which is why fan-out hurts and hedging helps.

for a principal

Own the assumption. The product step assumes independence, and correlated slowdowns break it; be able to say how you would sanity-check that assumption before a latency or reliability model built on it is trusted.

## The trick: extremes are CDF events A density tells you about a point; a maximum is naturally about a whole interval. That is why every derivation here starts from the cumulative distribution function `F(x) = P(X <= x)` rather than from the density. Let `X1, ..., Xn` be independent draws from the same distribution, with common CDF `F` and density `f`. Write `M = max(X1, ..., Xn)` and `L = min(X1, ..., Xn)`. ## The maximum The key observation is a logical equivalence, not a calculation: `M <= x` if and only if `X1 <= x AND X2 <= x AND ... AND Xn <= x`. If the largest of the draws is below `x`, every draw is below `x`, and conversely. Now use independence to factor the probability of the conjunction: `F_M(x) = P(M <= x) = P(X1 <= x) * ... * P(Xn <= x) = F(x)^n`. That is the whole answer for the maximum. If you want the density, differentiate with the chain rule: `f_M(x) = n * F(x)^(n-1) * f(x)`. Read that expression as a story: pick which of the `n` draws lands at `x` (the factor `n`), give it density `f(x)`, and require the remaining `n - 1` draws to fall below `x` (the factor `F(x)^(n-1)`). ## The minimum The minimum needs the mirror-image event. `L <= x` is not a conjunction — it says *at least one* draw is small, which does not factor. But its complement does: `L > x` if and only if every draw exceeds `x`. So `P(L > x) = (1 - F(x))^n`, and therefore `F_L(x) = 1 - (1 - F(x))^n`, with density `f_L(x) = n * (1 - F(x))^(n-1) * f(x)`. The quantity `1 - F(x) = P(X > x)` is called the survival function; the rule of thumb is that maxima multiply CDFs and minima multiply survival functions. ## Worked example: the first replica to answer Suppose a request is sent to `k` independent replicas, and replica `i` answers after a time that is exponential with rate `r_i`, so its survival function is `P(T_i > x) = exp(-r_i * x)`. The time until the *first* answer is `L = min(T_1, ..., T_k)`, and `P(L > x) = exp(-r_1 * x) * ... * exp(-r_k * x) = exp(-(r_1 + ... + r_k) * x)`. That is exactly the survival function of an exponential variable with rate `r_1 + ... + r_k`, so the minimum is exponential with the rates added, and its mean wait is `1 / (r_1 + ... + r_k)`. Ten identical replicas with rate `r` each answer, as a group, ten times faster in expectation. This is the cleanest example of a minimum staying inside its own family — and note that it did not need the draws to be identically distributed, only independent. The maximum of those same exponentials — the time until the *last* replica answers — is a different animal. For `k` i.i.d. exponentials of rate `r`, `F_M(x) = (1 - exp(-r * x))^k`, which is not an exponential CDF, and its mean is `(1/r) * (1 + 1/2 + ... + 1/k)`, growing slowly like the logarithm of `k`. Waiting for everyone is much more expensive than waiting for anyone. ## Where the argument breaks Everything above rests on independence: the product step is exactly where it is used. With dependent draws you need the joint distribution. The extreme case makes it obvious — if all `n` "draws" are the same variable copied, the maximum is that single variable and `F(x)^n` is badly wrong. Positive dependence generally makes extremes less extreme than the independent formula predicts, which is why the formula is optimistic for correlated failures. A second caution: for continuous variables ties have probability zero, so `max` and `min` are well defined without fuss. For discrete variables the same formulas hold for the CDF, but you recover probabilities by differencing, `P(M = x) = F(x)^n - F(x-)^n`, rather than by differentiating. ## Why interviewers ask It is a two-line derivation that separates candidates who reach for the definition from those who pattern-match. It also has an immediate practical reading: tail latency, the last of many parallel calls, the largest of many measurements, and the first of several competing clocks are all order-statistic questions in disguise.

  • Why is the minimum of independent exponential times exponential, and with what rate?
    Survival functions multiply under independence: P(min > x) = exp(-r1*x) * ... * exp(-rk*x) = exp(-(r1+...+rk)*x), which is the survival function of an exponential with rate r1+...+rk. So the rates add and the expected wait for the first of k replicas is 1/(r1+...+rk). It needs independence but not identical rates.
  • How do you get the density of the maximum from F(x)^n?
    Differentiate: f_max(x) = n * F(x)^(n-1) * f(x). Read it combinatorially — choose which of the n draws lands at x (factor n), give it density f(x), and force the other n-1 draws below x (factor F(x)^(n-1)). The minimum's density is the mirror image, n * (1-F(x))^(n-1) * f(x).
  • Does the same product rule hold if the draws are dependent?
    No. The step P(all <= x) = F(x)^n is exactly where independence is used. With dependence you need the joint distribution; in the extreme case where all n values are the same variable repeated, the maximum is just that variable and F(x)^n is wildly wrong. Positive dependence usually makes extremes milder than the independent formula suggests.

A group of independent runners is all finished by 10 minutes only if the slowest one is; someone has finished by 10 minutes as soon as the fastest one has.

saying these in an interview costs you the question

  • Multiplies densities instead of CDFs
  • Says the maximum of n draws has the same distribution as one draw
  • Assumes the maximum of exponentials is again exponential
  • Forgets that independence is what licenses the product
  • Uses 1 - F(x)^n for the minimum instead of 1 - (1 - F(x))^n

context