Math paradoxes

The secretary problemThe 37% rule: the secretary problem 100 candidates. One choice. What chance of the best?A 37% chance of the best.

Candidates arrive one at a time, and you must decide on the spot: hire now or turn them away for good. What chance do you have of hiring the best of 100? Lock in your answer, then check it with a game, a simulation and five explanations.

Candidates arrive one at a time, and you must decide on the spot: hire now or turn them away for good. It seems you could only pick the best of 100 with about a 1% chance. In fact, a simple optimal stopping rule gives 37%: let the first 37 go, then take the first one who beats everyone so far. Check it with a game, a simulation and five explanations.

Make a guess
1%at random
37%with the 37% rule
The puzzle

Picture this: you are hiring a secretary

This is the classic optimal stopping problem. It is known as the secretary problem, the marriage problem or the game of googol. The core is the same: options appear one by one, you can't go back to one you turned down, and you must decide when to stop.

  1. 1

    The candidates

    There are n candidates for one job. You know how many there are, but they come to the interview in random order.

  2. 2

    The interview

    After each interview you know only one thing: how this candidate compares with the ones you have already seen. You know nothing about those still to come.

  3. 3

    Decide on the spot

    You can hire the candidate, and the search is over. Or you can reject them, and they are gone for good. If you reach the last one, you have to take them.

  4. 4

    The goal

    There is only one way to win: hire the best of all n. The second best counts as a loss. Which strategy gives the highest chance, and how high is it with 100 candidates?

Intuition says

"The best is one in a hundred, so the chance is about 1%. It's a lottery"

In fact the 37% rule finds the best 37% of the time, and that chance barely depends on how many candidates there are. Even with a million candidates it stays at 36.8%.

Model assumptions

  • The number of candidates n is known in advance.
  • They arrive in random order.
  • Any two candidates can be compared, with no ties.
  • A rejected candidate can't be called back.
  • Only the very best counts.

Round 5 shows what happens when these rules change.

Round 1 · Guess

What chance of hiring the best of 100?

Imagine the smartest strategy anyone could come up with. How often would it find the best of 100 candidates? Lock in your answer before reading on.

Your answer will be compared with the right one here.

Hints

Hard to decide? Open the hints one at a time: the easy one first, then stronger ones.

Next: the solution

Next comes the explanation, with spoilers

The next rounds show the chance of hiring the best, and how: a game with 20 candidates, a simulation and the explanation. Answer round 1 first, or go on?

You chose to always show all rounds.

Round 2 · Hire

20 candidates, one decision

Candidates arrive one at a time. The height of a bar shows how a candidate compares with those seen so far. Magenta means the candidate beats everyone so far. You see the true scores only at the end. Play a few times: the panel on the right shows how the 37% rule would have done on the same lineups. The rule lets the first 37% of candidates go, here 7 of 20, just to learn the level, then hires the first one who beats everyone so far.

Candidate1 / 20
Among those seen1

Your score

You0 / 0
The 37% rule0 / 0

Round 3 · Simulation

How many candidates to skip

A strategy with cutoff r: skip the first r candidates, then hire the first one who beats everyone so far. The computer plays thousands of lineups for each r. The line is the exact formula; the dots are the simulation. For 100 candidates the peak is at r = 37.

exact formula simulation
–
–
Round 4 · Five explanations

Why 37% exactly

The first batch of candidates is not for choosing. It is for learning what counts as good. The only question is how long to spend on it.

In plain wordspictures, analogies, small numbers

“In plain words” is hidden on all puzzles.

Look, then leap

The first 37 set the bar

With no information you can't tell whether a candidate is good. So you only assess the first 37 and remember the best of them. That person becomes the bar. After that you take the first candidate who clears it.

The skipped candidates are not wasted: they are what tells you the level. The price of that knowledge is that the best might be among them.

Too early and too late

Both mistakes are costly

Skip only 5 of 100the bar is low, you settle too soon
Skip 80 of 100in 80% of lineups the best is already gone

Stop looking too early and the bar is weak, so an candidate clears it. Look for too long and the best was probably among those you skipped, so nobody later beats the bar. A cutoff of 37 balances the two risks.

Why the balance falls at 37 and not at 30 or 45 can't be seen in plain words. The peak of the chart in round 3 shows it, and the formula card below does the exact count.

A tiny example

Three candidates, six orders

The number is the candidate's true place: 1 is the best. Faded means skipped; dark means hired.

Where the other 63% go

Even the best strategy loses more often

With a cutoff of 37 there are three outcomes. In 37.1% of lineups you hire the best. In another 37% the best was among those skipped: nobody clears that bar, and you reach the end. In the remaining 25.9% someone other than the best clears the bar first.

Rigoroustables, charts, formulas

“Rigorous” is hidden on all puzzles.

For formula lovers

The exact formula and where 1/e comes from

Say the best stands at place i, with i greater than r. That happens with probability 1/n. You hire them if nobody cleared the bar before, that is, if the best of the first i−1 candidates was among the first r. The chance of that is r/(i−1). Add it up over all i:

The exact chance of hiring the best if you skip the first r of n candidates.

P(r)=rn·(1r+1r+1+…+1n−1)

In terms of the skipped share x = r/n the sum becomes a simple function of x.

x=rn:P≈x·ln1x=−x·lnx

The best share is where the derivative is zero. At that point the chance is also 1/e.

(−x·lnx)′=−lnx−1=0 x=1e≈0.368,P=1e≈36.8%

The exact formula for 100 candidates.

n=100:r=37,P(37)=37.1%

The sum of reciprocals from r to n−1 is about ln(n/r). So the chance depends only on the share x = r/n, not on n itself. The function −x · ln x peaks at x = 1/e, and its value there is also 1/e. That gives both numbers: skip 37% and win 37% of the time.

Round 5 · Changing the rules

Other n, other goals, a second chance

The 37% figure doesn't care how many candidates there are, but it does care about the goal. If anyone from the top three will do, or you can go back to someone you rejected, the share to skip is quite different.

The best cutoff for different n

Skip the first
Chance of the best
n/e ≈

Share and chance both tend to 1/e

best chance share skipped r/n 1/e

The n axis is , from 3 to 10,000. Both lines converge onto the dashed line 1/e ≈ 36.8% and merge with it for large n. For small n the chance is even higher: 50% with three candidates.

You may go back to someone you rejected

Suppose that at the end, if you hired nobody, you may call back the best person you saw. They say yes with probability q. 100 candidates.

with a call-back classic problem
Skip the first
Chance of the best

When scores are known

So far you only saw who beats whom. Now let each candidate come with a test score, and suppose you know how scores are spread across everyone: a score tells you at once that a candidate beats, say, 90% of people. Then you need no look-only phase. Take a candidate who beats everyone so far and whose score is above a threshold. The threshold drops as fewer candidates remain. John Gilbert and Frederick Mosteller solved this version in 1966.

Still to come after themMust beat
Comparisons only
Known scores

100 candidates. Knowing the scale lifts the chance of the best from 37% to 58.3%, and for a very large number of candidates it tends to 58.0%. So in a real search even a rough scale pays: a score you can compare not only with the earlier candidates but with the market.

People stop too early

Darryl Seale and Amnon Rapoport tested the problem in the lab (Organizational Behavior and Human Decision Processes, 1997). Like you in round 2, the participants saw only each candidate's place among those seen so far. Their choices were best described by a cutoff rule, but the cutoff was lower than the optimal one: people hired earlier than the maths advises. The authors explain it by a hidden cost of searching: every extra candidate costs time and patience, even when nobody charges for it. Think back to your game: how many candidates did you let go before hiring?

Other goals and an unknown number of candidates

Same rule everywhere: skip the first r, then take the first one who beats everyone so far, and if nobody does, take the last. The best cutoffs were found by computer. Press "Check" to rerun 10,000 simulated lineups.

Goal (100 candidates)Best cutoffResult

The last row is about a search with a time limit, when you don't know how many candidates will come. Then you count time instead of people: you only look during the first 37% of the period. The chance stays at least 1/e for any number of candidates.

Here a candidate you let go is gone for good. When you can try again and again, as with two slot machines, you get a different puzzle about the same choice between exploring and exploiting: the multi-armed bandit.

Bonus · At work

Where this shows up at work

Real situations from marketing, analytics, product and business where the same maths applies. Only known data, research and plain calculations you can check.

HR · hiring

A strong candidate won't wait

The situation
A vacancy is open for a month, and about 20 candidates come in that time. A strong candidate won't wait: without an offer within a few days they accept another one. Going back to someone you let go almost never works.
The trap
The pull is to stop early: the first decent candidate feels like a find. In lab experiments with the secretary problem people hired earlier than the optimal rule advises. The second trap is the goal "the best or nobody": a business is usually fine with someone from the top three, and that goal needs a different cutoff.
How to plan for it
Count time, not people: in the first 37% of the period, 11 days out of 30, only interview and make no offers, then make an offer to the first one who beats everyone so far. If anyone from the top three will do, skip fewer: with 20 candidates 5 are enough, and you get someone from the top three 65% of the time. And give the interview a scale: a score you can compare with past hires moves you towards the version with known scores, where the best is found 58% of the time instead of 37%.

Source: Darryl A. Seale, Amnon Rapoport, "Sequential Decision Making with Relative Ranks: An Experimental Investigation of the Secretary Problem", Organizational Behavior and Human Decision Processes 69(3), 1997; John P. Gilbert, Frederick Mosteller, "Recognizing the Maximum of a Sequence", Journal of the American Statistical Association 61(313), 1966. The figures for 20 candidates were computed for this site.

Business · selling

Selling a flat

The situation
You are selling a flat. Over two months buyers bring, say, 10 offers, one at a time. Each buyer waits a few days for an answer, and one you turn down buys something else.
The trap
If you don't know the market, all you can do is compare offers with each other. Then the best you can do is turn down the first three and take the first offer above them. That gets the highest of the ten only 40% of the time: a good early offer is lost, and at the end you take whatever is left.
How to plan for it
Study the market before the first viewing: prices of similar deals give you a scale, and the problem becomes the version with known scores. Then there is no need to turn offers down blind. Take an offer that beats the earlier ones and also clears a threshold that falls towards the end: accept the first of ten only if it beats 92% of similar deals, the second to last if it beats half. That gets the highest offer 61% of the time instead of 40%.

Source: John P. Gilbert, Frederick Mosteller, "Recognizing the Maximum of a Sequence", Journal of the American Statistical Association 61(313), 1966. The figures for 10 offers were computed for this site and checked by simulation.

Product · online auctions

Bids arrive one at a time

The situation
A site sells ad impressions, tickets or seats on a plane. Buyers' bids arrive one at a time, and each needs an answer at once: the buyer won't wait until all the bids are in. How many there will be, and how high, is unknown in advance.
The trap
It seems that without knowing future bids nothing can be guaranteed. For the worst possible order of bids that is true: no algorithm guarantees more than about 1/n of the best revenue. But bids usually arrive in random order, and then the logic of the secretary problem applies.
How to plan for it
Moshe Babaioff, Nicole Immorlica, David Kempe and Robert Kleinberg showed that many online auctions are generalized secretary problems. The recipe is the same: first "get a feel for the market" on an initial share of the bids, then accept those that beat the best solution from that share. For a single item this gives on average at least 1/e of the highest bid. For k identical items the matching rule keeps the same guarantee for any k, and with a better algorithm the loss shrinks to zero as k grows.

Source: Moshe Babaioff, Nicole Immorlica, David Kempe, Robert Kleinberg, "Online Auctions and Generalized Secretary Problems", ACM SIGecom Exchanges 7(2), 2008.

Bonus · Fun facts

Things to tell your friends

11

Kepler looks for a wife

After his first wife died in 1611, the astronomer Johannes Kepler considered 11 possible brides. In the end he married the fifth, Susanna Reuttinger. The story is often told as an example of the secretary problem, including in the book Algorithms to Live By.

1960

The game of googol

Martin Gardner brought the problem to a wide audience in his Mathematical Games column in Scientific American in 1960. In his version, people write any numbers on slips of paper, as large as a googol, and you have to stop at the largest.

1% → 37%

37 times better than guessing

Pick one of 100 candidates at random and the chance of the best is 1%. The 37% rule gives 37.1%. With 1,000 candidates a random pick gives 0.1%, and the rule still gives 36.8%.

2016

Flats and dating

Algorithms to Live By (2016) by Brian Christian and Tom Griffiths opens with the 37% rule and applies it to flat hunting and dating. If you search from age 18 to 40, the first 37% of that span ends at about 26.

e ≈ 2,718

The same number elsewhere

The number 1/e ≈ 36.8% also turns up in the Secret Santa problem: when many people draw names at random, the chance that nobody draws their own name also tends to 1/e.

3.87

An average rank below 4

If the goal is not "the best or nothing" but the best average rank, there is a cleverer strategy with several thresholds. Even for a huge number of candidates it gives an average rank of about 3.87. The result was published in 1964.

All posts →

Algorithms to Live By

Brian Christian, Tom Griffiths

2016 · chapter 1

The Mathematics of Love

Hannah Fry

2015 · chapter 7

All books →
Discussion

What do you think?

Share your own explanation, an objection or a variant of the puzzle. You need a GitHub account to comment.

Is “School maths” the right level for this puzzle?

Thank you! This helps set the levels right.

Newsletter

New puzzles, explanations and discussions

I keep adding new puzzles, new ways to explain them and write-ups of the discussions they start. Leave your email and I'll write when something new is out. No spam, one-click unsubscribe.

The sign-up form will appear here soon.