๐Ÿงฎ Brain Teaser

The Secretary Who Knows the Distribution

You interview candidates one by one. Their quality scores are drawn independently and uniformly from [0,1][0,1]. You must accept or reject each candidate immediately and irrevocably. You know the distribution (uniform on [0,1][0,1]) and want to maximize the probability of hiring the best candidate out of n=2n = 2.

With only 2 candidates, what is the optimal strategy, and what is your probability of success?

Now generalize: with nn candidates, the optimal threshold strategy (accept candidate kk if their score exceeds some threshold tkt_k) gives a success probability that approaches what limit as nโ†’โˆžn \to \infty?

optimal stoppingsecretary problemthreshold strategyuniform distribution1/e

Answer: The Secretary Who Knows the Distribution

Key Idea / Intuition

With two candidates, you can afford a pure threshold rule: if the first candidate scores above some cutoff tt, hire them immediately; otherwise, wait and take the second (regardless of their score, since it's your last chance). The surprising punchline is that as the number of candidates grows, the optimal threshold strategy guarantees you hire the best with probability approaching 1/eโ‰ˆ0.3681/e \approx 0.368 โ€” the same asymptotic as the classical secretary problem (where you know only ranks, not values). Knowing the distribution doesn't actually help asymptotically!


Formal Proof / Solution

Step 1: Optimal Strategy for n=2n = 2

Let the two scores be X1,X2โˆผUniform[0,1]X_1, X_2 \sim \text{Uniform}[0,1], independent.

Strategy: Choose threshold tโˆˆ[0,1]t \in [0,1]. Accept X1X_1 if X1>tX_1 > t; otherwise accept X2X_2.

Probability of hiring the best:

P(success)=P(X1>tย andย X1>X2)+P(X1โ‰คtย andย X2>X1)P(\text{success}) = P(X_1 > t \text{ and } X_1 > X_2) + P(X_1 \leq t \text{ and } X_2 > X_1)

Compute each term: P(X1>t,ย X1>X2)=โˆซt1P(X2<x)โ€‰dx=โˆซt1xโ€‰dx=1โˆ’t22P(X_1 > t,\ X_1 > X_2) = \int_t^1 P(X_2 < x)\,dx = \int_t^1 x\,dx = \frac{1-t^2}{2}

P(X1โ‰คt,ย X2>X1)=โˆซ0tP(X2>x)โ€‰dx=โˆซ0t(1โˆ’x)โ€‰dx=tโˆ’t22P(X_1 \leq t,\ X_2 > X_1) = \int_0^t P(X_2 > x)\,dx = \int_0^t (1-x)\,dx = t - \frac{t^2}{2}

So: P(success)=1โˆ’t22+tโˆ’t22=12+tโˆ’t2P(\text{success}) = \frac{1-t^2}{2} + t - \frac{t^2}{2} = \frac{1}{2} + t - t^2

Optimize over tt: ddt(12+tโˆ’t2)=1โˆ’2t=0โ€…โ€ŠโŸนโ€…โ€Štโˆ—=12\frac{d}{dt}\left(\frac{1}{2} + t - t^2\right) = 1 - 2t = 0 \implies t^* = \frac{1}{2}

P(success)=12+12โˆ’14=34P(\text{success}) = \frac{1}{2} + \frac{1}{2} - \frac{1}{4} = \boxed{\frac{3}{4}}

This is strictly better than the rank-based secretary problem with n=2n=2 (which gives 1/21/2), because knowing the distribution lets you make a smarter decision on the first candidate.


Step 2: The nn-Candidate Threshold Strategy

With nn candidates and scores X1,โ€ฆ,XnโˆผUniform[0,1]X_1, \ldots, X_n \sim \text{Uniform}[0,1], work backwards. With rr candidates remaining and the current candidate having score xx, the optimal policy sets an indifference threshold xrx_r satisfying:

(valueย ofย acceptingย xr)=(valueย ofย continuing)\text{(value of accepting } x_r\text{)} = \text{(value of continuing)}

From Mosteller's analysis: with rr draws remaining and candidate in hand with score xx, you should accept if x>xrx > x_r where xrx_r satisfies:

xrr=(r1)xrrโˆ’1(1โˆ’xr)โ‹…1+(r2)xrrโˆ’2(1โˆ’xr)2โ‹…12+โ‹ฏx_r^r = \binom{r}{1}x_r^{r-1}(1-x_r)\cdot 1 + \binom{r}{2}x_r^{r-2}(1-x_r)^2 \cdot \frac{1}{2} + \cdots

The right-hand side simplifies: it equals the probability that at least one of the remaining rr candidates exceeds xrx_r and you successfully pick the largest.


Step 3: The Asymptotic Surprise

As nโ†’โˆžn \to \infty, the optimal success probability satisfies:

Pn(success)โ†’1eP_n(\text{success}) \to \frac{1}{e}

Why? The threshold tt for the first candidate you'd accept, as nn grows, converges to eโˆ’1/nโ‹…ne^{-1/n} \cdot n-th power scaling. One can show the optimal thresholds xrโ‰ˆ1โˆ’1rx_r \approx 1 - \frac{1}{r} for large rr, and the probability of winning under the optimal policy satisfies the recursion whose solution converges to 1/e1/e.

Concretely, compare:

| nn | Optimal (known distribution) | Classical secretary (rank only) | |-----|-----------------------------|---------------------------------| | 1 | 1 | 1 | | 2 | 3/4 | 1/2 | | 3 | ~0.618 | ~0.500 | | โˆž\infty | 1/eโ‰ˆ0.3681/e \approx 0.368 | 1/eโ‰ˆ0.3681/e \approx 0.368 |

The deep insight: For small nn, knowing the distribution helps substantially. But as nโ†’โˆžn \to \infty, the problem becomes so hard (you're increasingly likely to miss the best by a wrong decision early on) that both strategies converge to 1/e1/e. The extra information from knowing the distribution is asymptotically useless.


Summary

  • With n=2n=2: threshold tโˆ—=1/2t^* = 1/2, success probability =3/4= 3/4.
  • With general nn: use decreasing thresholds xn<xnโˆ’1<โ‹ฏ<x1x_n < x_{n-1} < \cdots < x_1.
  • As nโ†’โˆžn \to \infty: P(success)โ†’1/eP(\text{success}) \to 1/e, matching the classical (rank-only) secretary problem.

Source: Fifty Challenging Problems in Probability with Solutions, Frederick Mosteller, Problem 48

Type: ProbabilitySource: Fifty Challenging Problems in Probability with Solutions, Frederick Mosteller, Problem 48Edit on GitHub โ†—