Mathwords logoMathwords

Secretary Problem — Definition, Formula & Example

The secretary problem is a puzzle about choosing the best option when options arrive one at a time and each must be accepted or rejected on the spot. The best known strategy is to reject a first batch, then take the first option that beats everything seen so far.

Let nn candidates with distinct ranks arrive in uniformly random order. After seeing each one, you learn only its rank relative to those already seen, and you must irrevocably accept or reject it. You succeed only if you accept the overall best. Among cutoff rules (reject candidates 11 to r−1r-1, then accept the first candidate better than all before it), the success probability is maximized at r≈n/er \approx n/e, and as n→∞n \to \infty the maximum probability approaches 1/e≈0.3681/e \approx 0.368.

Key Formula

Pn(r)=r−1n∑i=rn1i−1,2≤r≤nP_n(r) = \frac{r-1}{n}\sum_{i=r}^{n}\frac{1}{i-1}, \quad 2 \le r \le n
Where:
  • nn = total number of candidates
  • rr = position of the first candidate you are allowed to accept (you reject the first r - 1)
  • Pn(r)P_n(r) = probability that the cutoff rule selects the overall best candidate
  • ii = position where the overall best candidate appears

Worked Example

Problem: You will tour 4 apartments in random order. After each tour you must sign or walk away for good. You want the single best apartment. How many should you reject before you start accepting?
Step 1: Try rejecting the first apartment (r=2r = 2), then taking the first one better than all before it.
P4(2)=14(1+12+13)=1124P_4(2) = \frac{1}{4}\left(1 + \frac{1}{2} + \frac{1}{3}\right) = \frac{11}{24}
Step 2: Try rejecting the first two apartments (r=3r = 3).
P4(3)=24(12+13)=512=1024P_4(3) = \frac{2}{4}\left(\frac{1}{2} + \frac{1}{3}\right) = \frac{5}{12} = \frac{10}{24}
Step 3: Rejecting three (r=4r = 4) forces you to take the last one. Taking the very first apartment (r=1r = 1) gives the same odds.
P4(4)=34⋅13=14=624,P4(1)=14P_4(4) = \frac{3}{4}\cdot\frac{1}{3} = \frac{1}{4} = \frac{6}{24}, \quad P_4(1) = \frac{1}{4}
Answer: Reject the first apartment, then sign the first one that beats everything you have seen. You get the best apartment with probability 1124≈0.458\frac{11}{24} \approx 0.458, about 45.8%.

Why It Matters

The secretary problem is the standard first example in optimal stopping theory, a topic in upper-level probability and operations research courses. Its 37% rule shows up in analyses of hiring, online auctions, and algorithms that must decide before seeing all the data.

Common Mistakes

Mistake: Believing the 37% rule finds the best candidate about 63% of the time, or nearly always.
Correction: For large nn the rule succeeds with probability close to 1/e≈0.3681/e \approx 0.368. It fails about 63% of the time. What makes it notable is that no other strategy does better, and its success rate does not shrink toward 0 as nn grows.

Related Terms