Secretary Problem: The Optimal Stopping Strategy

simulator intermediate ~8 min
Loading simulation...
Success ≈ 37% — the 1/e rule

The optimal strategy (reject the first 37% then select the next best-so-far) picks the absolute best candidate about 37% of the time — the best possible with no recall.

Formula

P(success) = (r/N) × ∑(i=r+1 to N) 1/(i-1), where r = ⌊N/e⌋
lim(N→∞) P(success) = 1/e ≈ 0.3679

The Art of Knowing When to Stop

Imagine you're hiring a secretary from a pool of N candidates. You interview them one at a time, and after each interview you must immediately accept or reject — no going back. How do you maximize your chances of hiring the very best? This deceptively simple question, known as the secretary problem, has one of the most elegant solutions in all of mathematics: reject the first 37% of candidates, then hire the next one who is the best you've seen so far.

The 1/e Rule

The magic number is 1/e ≈ 0.3679, where e is Euler's number. You use the first ⌊N/e⌋ candidates as a calibration sample — observing their quality but never hiring them. Then you enter the selection phase: hire the first candidate who exceeds the maximum quality seen during calibration. This strategy selects the absolute best candidate approximately 1/e ≈ 36.8% of the time, regardless of N.

Visualizing the Strategy

The simulation shows candidates as bars of varying height representing their quality. The gray exploration phase (first 37%) establishes a benchmark. In the cyan exploitation phase, the algorithm selects the first candidate who surpasses this benchmark. The highlighted candidate is the one selected. Below, the success rate curve shows how performance varies with the stopping fraction — peaking sharply at 1/e.

Beyond Hiring

The secretary problem is the foundation of optimal stopping theory, which applies whenever you must make irreversible decisions with incomplete information. Should you accept this apartment or keep looking? When should you sell your stocks? The 37% rule provides a mathematically optimal framework for these everyday decisions. Variants of the problem relax assumptions about recall, information, and objectives.

FAQ

What is the secretary problem?

The secretary problem is a famous optimal stopping problem: you interview N candidates sequentially, and after each interview you must accept or reject them immediately — no callbacks. The goal is to maximize the probability of hiring the single best candidate. The optimal strategy is to reject the first N/e candidates and then hire the next one who is better than all previous.

Why is 1/e the optimal threshold?

The fraction 1/e ≈ 0.368 emerges from maximizing the success probability P(r) = (r/N)∑(1/(i-1)) for i from r+1 to N, where r is the number rejected. As N → ∞, this sum converges to -(r/N)ln(r/N), which is maximized at r/N = 1/e.

What real-world problems does the secretary problem model?

The secretary problem applies to any sequential decision where you can't go back: choosing an apartment, selling a house, picking a parking spot, deciding when to stop dating and commit, or timing a market exit. The 37% rule provides a practical heuristic for all these situations.

What happens if you can recall previous candidates?

If you can recall (go back to) previously rejected candidates with some probability, the optimal strategy changes. Full recall makes the problem trivial — just interview everyone and pick the best. Partial recall shifts the optimal stopping point later since there's less cost to rejecting good candidates.

Sources

Embed

<iframe src="https://homo-deus.com/lab/probability/secretary-problem/embed" width="100%" height="400" frameborder="0"></iframe>
View source on GitHub