brainwagon "There is much pleasure in useless knowledge." — Bertrand Russell


The Marriage (or Secretary) Problem

Over on Facebook, fellow Pixarian Arun pointed out this story on a problem I encountered in my undergraduate schooling as "The Marriage Problem", which I also heard of as "The Secretary Problem". The idea is that you are supposed to find a wife (or secretary) out of a list of $n$ possibles. Each one is assigned a score, but are presented to you in random order. You look at each possible spouse (I'm gonna stick with the Marriage formulation from now on) and can see what her score is. You then have a choice: either propose, or lose her forever and go on to the next applicant. The goal is to maximize the odds that you will find the best spouse.

This was presented to me as part of a programming assignment when I was an undergraduate. Luckily, I recalled that Martin Gardner had covered this topic in one of his Mathematical Games columns for Scientific American as The Game of Googol. He described the problem thusly:

The numbers may range from small fractions of 1 to a number the size of a "googol" (1 followed by a hundred 0's) or even larger. These slips are turned face down and shuffled over the top of a table. One at a time you turn the slips face up. The aim is to stop turning when you come to the number that; you guess to be the largest of the series. You cannot go back and pick a previously turned slip. If you turn over all the slips, then of course you must pick the last one turned.

I've given you some pointers, you can either work on the problem or go find the answers with Google. But the basic idea is that you can solve the problem thusly: find the maximum score for the first $n/e$ items in the list, then propose to the next applicant whose score exceeds that value. A little bit of tricky (but not impenetrable) math will show that this is the optimal rule, and that the odds of selecting the best spouse is $1/e$. Rather than do harder math, I wrote simpler simulations, and graphed all potential cutoffs, running 10,000 trials, and graphing the number of times the best mate was selected for each threshold. Voila:


But Arun was confused, and so was I. After all, if the best spouse was in the first $n/e$ items, you can't win. And if the second best is in the first $n/e$ items, you can't get the second best, and so on. So what was the average performance? After all, perhaps you are one of those people who don't believe that there is one best person for you. Twisted as that is (I can say so, since I found my optimal mate) maybe your goal would be to pick the threshold to select the best average mate. If you run the same calculations, but instead graph average score, you get something like this:


In other words, if you want to get the best wife on average, you should come to your conclusion much faster. It isn't quite clear to me what the optimal setting for this parameter is, but I'm too tired to do the math right now. But perhaps I'll follow up.

Filed under: Math 1 Comment