Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Appendix: Order Statistics

Motivating Example: When Does the Meeting Start?

Five colleagues agree to meet during a one hour window. Each arrives at a time chosen independently and uniformly at random within the window. The room is unlocked as soon as the first person arrives, and the meeting starts only when the last person arrives.

Two natural questions follow. On average, how long does the room sit unlocked before the meeting starts? More precisely:

  1. What is the expected arrival time of the first person?

  2. What is the expected arrival time of the last person?

Both questions ask for the expected value of a ranked member of a random sample: the smallest arrival time and the largest. Quantities of this kind are called order statistics, and they can be computed exactly. This appendix develops the tools needed to do so, in particular for values drawn uniformly at random from an interval, which is the setting used in the Auction Games chapter.

Theory

Definition: Probability Density and Cumulative Distribution Functions


A continuous random variable XX has a probability density function (pdf) ff if for all aba \leq b:

P(aXb)=abf(x)dx\mathbb{P}(a \leq X \leq b) = \int_a^b f(x)\, dx

The cumulative distribution function (cdf) of XX is:

F(x)=P(Xx)=xf(t)dtF(x) = \mathbb{P}(X \leq x) = \int_{-\infty}^x f(t)\, dt

The two functions carry the same information: the cdf is the integral of the pdf, and wherever FF is differentiable, F(x)=f(x)F'(x) = f(x). The expected value of XX is:

E[X]=xf(x)dx\mathbb{E}[X] = \int_{-\infty}^{\infty} x f(x)\, dx

Definition: The Uniform Distribution


A random variable XX is uniform on [0,1][0, 1] if its pdf is f(x)=1f(x) = 1 for x[0,1]x \in [0, 1] and 0 otherwise. Its cdf is:

F(x)=P(Xx)=xfor x[0,1]F(x) = \mathbb{P}(X \leq x) = x \qquad \text{for } x \in [0, 1]

Every value in [0,1][0, 1] is equally likely, and the expected value is:

E[X]=01x1dx=12\mathbb{E}[X] = \int_0^1 x \cdot 1\, dx = \frac{1}{2}

Theorem: Expectation via the Survival Function


If XX takes values in [0,1][0, 1] with cdf FF then:

E[X]=01(1F(x))dx\mathbb{E}[X] = \int_0^1 \left(1 - F(x)\right) dx

This follows from integration by parts:

01xf(x)dx=[x(F(x)1)]01+01(1F(x))dx=01(1F(x))dx\int_0^1 x f(x)\, dx = \Bigl[x \bigl(F(x) - 1\bigr)\Bigr]_0^1 + \int_0^1 \left(1 - F(x)\right) dx = \int_0^1 \left(1 - F(x)\right) dx

since F(1)=1F(1) = 1 makes the boundary term vanish. The function 1F(x)=P(X>x)1 - F(x) = \mathbb{P}(X > x) is called the survival function, and this form of the expectation is often the quickest route to expected minima, as the next results show.

Definition: Order Statistics


Let X1,X2,,XNX_1, X_2, \dots, X_N be independent random variables, each with cdf FF. The order statistics X(1)X(2)X(N)X_{(1)} \leq X_{(2)} \leq \dots \leq X_{(N)} are the same values sorted into increasing order: X(k)X_{(k)} is the kk-th smallest of the sample. In particular:

X(1)=miniXiandX(N)=maxiXiX_{(1)} = \min_i X_i \qquad \text{and} \qquad X_{(N)} = \max_i X_i

Theorem: CDF of the Maximum and the Minimum


Let X1,,XNX_1, \dots, X_N be independent, each with cdf FF. Then:

F(N)(x)=P(maxiXix)=F(x)NF_{(N)}(x) = \mathbb{P}\left(\max_i X_i \leq x\right) = F(x)^N
F(1)(x)=P(miniXix)=1(1F(x))NF_{(1)}(x) = \mathbb{P}\left(\min_i X_i \leq x\right) = 1 - (1 - F(x))^N

The first statement holds because the maximum is at most xx precisely when every XiX_i is at most xx, and by independence these NN events have probability F(x)NF(x)^N jointly. Similarly the minimum exceeds xx precisely when every XiX_i exceeds xx, so P(miniXi>x)=(1F(x))N\mathbb{P}(\min_i X_i > x) = (1 - F(x))^N, and the cdf of the minimum is the complement.

Example: Two Uniform Values

Let v1v_1 and v2v_2 be independent and uniform on [0,1][0, 1]. This is the setting of a two bidder auction with uniform valuations. We compute the expected values of max(v1,v2)\max(v_1, v_2) and min(v1,v2)\min(v_1, v_2).

The maximum. With F(x)=xF(x) = x and N=2N = 2 the cdf of the maximum is F(2)(x)=x2F_{(2)}(x) = x^2, so its pdf is f(2)(x)=2xf_{(2)}(x) = 2x and:

E[max(v1,v2)]=01x2xdx=23\mathbb{E}[\max(v_1, v_2)] = \int_0^1 x \cdot 2x\, dx = \frac{2}{3}

The minimum. The survival function of the minimum is P(min(v1,v2)>x)=(1x)2\mathbb{P}(\min(v_1, v_2) > x) = (1 - x)^2, so by expectation via the survival function:

E[min(v1,v2)]=01(1x)2dx=13\mathbb{E}[\min(v_1, v_2)] = \int_0^1 (1 - x)^2\, dx = \frac{1}{3}

As a check, min(v1,v2)+max(v1,v2)=v1+v2\min(v_1, v_2) + \max(v_1, v_2) = v_1 + v_2, so the two expectations must sum to E[v1]+E[v2]=1\mathbb{E}[v_1] + \mathbb{E}[v_2] = 1, and indeed 13+23=1\frac{1}{3} + \frac{2}{3} = 1. A further consequence, by linearity of expectation, is the expected gap between the two values:

Ev1v2=E[max(v1,v2)]E[min(v1,v2)]=13\mathbb{E}\left|v_1 - v_2\right| = \mathbb{E}[\max(v_1, v_2)] - \mathbb{E}[\min(v_1, v_2)] = \frac{1}{3}

Theorem: Expected Order Statistics of the Uniform Distribution


Let X1,,XNX_1, \dots, X_N be independent and uniform on [0,1][0, 1]. The kk-th order statistic has pdf:

f(k)(x)=N(N1k1)xk1(1x)Nkf_{(k)}(x) = N \binom{N - 1}{k - 1} x^{k - 1} (1 - x)^{N - k}

and expected value:

E[X(k)]=kN+1\mathbb{E}\left[X_{(k)}\right] = \frac{k}{N + 1}

The form of the pdf can be read off directly: for X(k)X_{(k)} to sit at xx, one of the NN values must land at xx (a factor of Nf(x)=NN f(x) = N), and of the remaining N1N - 1 values, some k1k - 1 must fall below xx (each with probability xx) and the other NkN - k above (each with probability 1x1 - x), with (N1k1)\binom{N - 1}{k - 1} ways to choose which. The expectation then follows from the Beta integral:

01xa(1x)bdx=a!b!(a+b+1)!\int_0^1 x^a (1 - x)^b\, dx = \frac{a!\, b!}{(a + b + 1)!}

applied with a=ka = k and b=Nkb = N - k:

E[X(k)]=N(N1k1)01xk(1x)Nkdx=N(N1k1)k!(Nk)!(N+1)!=kN+1\mathbb{E}\left[X_{(k)}\right] = N \binom{N - 1}{k - 1} \int_0^1 x^{k} (1 - x)^{N - k}\, dx = N \binom{N - 1}{k - 1} \frac{k!\,(N - k)!}{(N + 1)!} = \frac{k}{N + 1}

The result has a pleasing interpretation: NN uniform points split [0,1][0, 1] into N+1N + 1 gaps, and by symmetry each gap has expected length 1N+1\frac{1}{N + 1}. The expected order statistics are therefore evenly spaced: 1N+1,2N+1,,NN+1\frac{1}{N + 1}, \frac{2}{N + 1}, \dots, \frac{N}{N + 1}. Setting k=1k = 1 and k=Nk = N recovers the expected minimum and maximum:

E[miniXi]=1N+1andE[maxiXi]=NN+1\mathbb{E}\left[\min_i X_i\right] = \frac{1}{N + 1} \qquad \text{and} \qquad \mathbb{E}\left[\max_i X_i\right] = \frac{N}{N + 1}

This answers the questions of Motivating Example: When Does the Meeting Start?: with N=5N = 5 colleagues, the room is unlocked at 16\frac{1}{6} of the window on average (10 minutes in), and the meeting starts at 56\frac{5}{6} (50 minutes in), so the room sits unlocked for an expected 40 minutes before the meeting begins.

Exercises

Programming

The expectations in this appendix are integrals that Sympy can evaluate symbolically. Here is the expected maximum and minimum of two uniform values, using the pdf of the maximum and the survival function of the minimum:

import sympy as sym

x = sym.Symbol("x", positive=True)

expected_max = sym.integrate(x * 2 * x, (x, 0, 1))
expected_min = sym.integrate((1 - x) ** 2, (x, 0, 1))
expected_max, expected_min
(2/3, 1/3)

The general formula for the kk-th order statistic of NN uniform values can be checked in the same way:

N, k = sym.symbols("N k", positive=True, integer=True)

pdf_k = N * sym.binomial(N - 1, k - 1) * x ** (k - 1) * (1 - x) ** (N - k)
expected_k = sym.simplify(sym.integrate(x * pdf_k, (x, 0, 1)))
expected_k
Loading...

Numerical simulation gives an independent confirmation. Numpy’s sort sorts each sample, so column k1k - 1 of the sorted array holds the kk-th order statistic:

import numpy as np

rng = np.random.default_rng(seed=0)
number_of_samples = 100_000
sample_size = 5

samples = rng.uniform(size=(number_of_samples, sample_size))
sorted_samples = np.sort(samples, axis=1)

for k in range(1, sample_size + 1):
    estimate = sorted_samples[:, k - 1].mean()
    exact = k / (sample_size + 1)
    print(f"k = {k}:  simulated {estimate:.4f},  exact {exact:.4f}")
k = 1:  simulated 0.1663,  exact 0.1667
k = 2:  simulated 0.3334,  exact 0.3333
k = 3:  simulated 0.5002,  exact 0.5000
k = 4:  simulated 0.6672,  exact 0.6667
k = 5:  simulated 0.8335,  exact 0.8333

Notable Research

The systematic study of order statistics grew out of early twentieth century work on extremes. Fisher and Tippett Fisher & Tippett, 1928 characterised the possible limiting distributions of the maximum of a large sample, a result completed by Gnedenko Gnedenko, 1943; together these form the foundation of extreme value theory, which underpins modern models of floods, heatwaves, and financial risk.

Rényi Rényi, 1953 gave an elegant representation of the order statistics of an exponential sample as a sum of independent scaled exponentials. This representation remains a standard tool for deriving the joint behaviour of order statistics.

The standard modern references are the monograph of David and Nagaraja David & Nagaraja, 2003, which surveys the field, and the more introductory treatment of Arnold, Balakrishnan and Nagaraja Arnold et al., 2008.

In game theory, expected order statistics of uniform samples are exactly what is needed to compute expected revenue in auctions: the winner’s payment in a second-price auction is the second highest valuation. This connection goes back to Vickrey Vickrey, 1961, whose analysis of sealed bid auctions is discussed in the Auction Games chapter.

Conclusion

For independent values with a common cdf FF, the maximum has cdf F(x)NF(x)^N and the minimum has survival function (1F(x))N(1 - F(x))^N; expectations then follow by integrating the pdf, or the survival function directly. Table A6.1 collects the key facts for the uniform distribution on [0,1][0, 1].

Table A6.1:Order statistics of NN independent uniform values on [0,1][0, 1].

QuantityValue
cdf of maxiXi\max_i X_ixNx^N
cdf of miniXi\min_i X_i1(1x)N1 - (1 - x)^N
E[X(k)]\mathbb{E}[X_{(k)}]kN+1\frac{k}{N + 1}
E[maxiXi]\mathbb{E}[\max_i X_i]NN+1\frac{N}{N + 1}
E[miniXi]\mathbb{E}[\min_i X_i]1N+1\frac{1}{N + 1}
$\mathbb{E}\leftX_1 - X_2\right

Solutions

References
  1. Fisher, R. A., & Tippett, L. H. C. (1928). Limiting forms of the frequency distribution of the largest or smallest member of a sample. Mathematical Proceedings of the Cambridge Philosophical Society, 24(2), 180–190.
  2. Gnedenko, B. (1943). Sur la distribution limite du terme maximum d’une série aléatoire. Annals of Mathematics, 44(3), 423–453.
  3. Rényi, A. (1953). On the theory of order statistics. Acta Mathematica Academiae Scientiarum Hungaricae, 4(3–4), 191–231.
  4. David, H. A., & Nagaraja, H. N. (2003). Order Statistics (3rd ed.). John Wiley & Sons.
  5. Arnold, B. C., Balakrishnan, N., & Nagaraja, H. N. (2008). A First Course in Order Statistics. SIAM.
  6. Vickrey, W. (1961). Counterspeculation, auctions, and competitive sealed tenders. The Journal of Finance, 16(1), 8–37.