Robert Krulwich/NPR

Poor Johannes Kepler. One of the greatest astronomers ever, the man who figured out the laws of planetary motion, a genius, scholar and mathematician — in 1611, he needed a wife. The previous Mrs. Kepler had died of Hungarian spotted fever, so, with kids to raise and a household to manage, he decided to line up some candidates — but it wasn't going very well.

Being an orderly man, he decided to interview 11 women. As Alex Bellos describes it in his new book** ***The Grapes of Math*, Kepler kept notes as he wooed. It's a catalog of small disappointments. The first candidate, he wrote, had "stinking breath."

Robert Krulwich/NPR

The second "had been brought up in luxury that was above her station" — she had expensive tastes. Not promising.

Robert Krulwich/NPR

The third was engaged to a man — definitely a problem. Plus, that man had sired a child with a prostitute. So … complicated.

Robert Krulwich/NPR

The fourth woman was nice to look at — of "tall stature and athletic build" …

Robert Krulwich/NPR

… but Kepler wanted to check out the next one (the fifth), who, he'd been told, was "modest, thrifty, diligent and [said] to love her stepchildren," so he hesitated. He hesitated so long, that both No. 4 and No. 5 got impatient and took themselves out of the running (bummer), leaving him with No. 6, who scared him. She was a grand lady, and he "feared the expense of a sumptuous wedding … "

Robert Krulwich/NPR

The seventh was very fetching. He liked her. But he hadn't yet completed his list, so he kept her waiting, and she wasn't the waiting type. She rejected him.

The eighth he didn't much care for, though he thought her mother "was a mostly worthy person … "

Robert Krulwich/NPR

The ninth was sickly, the 10th had a shape not suitable "even for a man of simple tastes," and the last one, the 11th, was too young. What to do? Having run through all his candidates, totally wooed-out, he decided that maybe he'd done this all wrong.

"Was it Divine Providence or my own moral guilt," he wrote, "which, for two years or longer, tore me in so many different directions and made me consider the possibility of such different unions?"

**Game On**

What Kepler needed, Alex Bellos writes, was an optimal strategy — a way, not to guarantee success, but to maximize the likelihood of satisfaction. And, as it turns out, mathematicians think they have such a formula.

It works any time you have a list of potential wives, husbands, prom dates, job applicants, garage mechanics. The rules are simple: You start with a situation where you have a fixed number of options (if, say, you live in a small town and there aren't unlimited men to date, garages to go to), so you make a list — that's your final list — and you interview each candidate one by one. Again, what I'm about to describe doesn't always produce a happy result, but it does so more often than would occur randomly. For mathematicians, that's enough.

They even have a name for it. In the 1960s it was called (a la Kepler) "The Marriage Problem." Later, it was dubbed The Secretary Problem.

Robert Krulwich/NPR

**How To Do It**

Alex writes: "Imagine that you are interviewing 20 people to be your secretary [or your spouse or your garage mechanic] with the rule that you must decide at the end of each interview whether or not to give that applicant the job." If you offer the job to somebody, game's up. You can't go on and meet the others. "If you haven't chosen anyone by the time you see the last candidate, you must offer the job to her," Alex writes (not assuming that all secretaries are female — he's just adapting the attitudes of the early '60s).

So remember: At the end of each interview, you either make an offer or you move on.

If you don't make an offer, no going back. Once you make an offer, the game stops.

According to Martin Gardner, who in 1960 described the formula (partly worked out earlier by others), the best way to proceed is to interview (or date) the first 36.8 percent of the candidates. Don't hire (or marry) any of them, but as soon as you meet a candidate who's better than the best of that first group — that's the one you choose! Yes, the Very Best Candidate might show up in that first 36.8 percent — in which case you'll be stuck with second best, but still, if you like favorable odds, this is the best way to go.

Why 36.8 percent? The answer involves a number mathematicians call "e" – which, reduced to a fraction 1/e = 0.368 or 36.8 percent. For the specific details, check here, or Alex's book, but apparently this formula has proved itself over and over in all kinds of controlled situations. While it doesn't guarantee happiness or satisfaction, it does give you a 36.8 percent chance — which, in a field of 11 possible wives — is a pretty good success rate.

**Try It, Johannes …**

What would have happened if Johannes Kepler had used this formula? Well, he would have interviewed but made no offers to the first 36.8 percent of his sample, which in a group of 11 ladies means he'd skip past the first four candidates. But the moment he'd met somebody (starting with lady No. 5) that he liked better than anyone in the first group, he'd have said, "Will you marry me?"

In real life, after a period of reflection, Johannes Kepler re-wooed and then married the fifth woman.

The way Alex figures it, if Kepler had known about this formula (which today is an example of what mathematicians call optimal stopping), he could have skipped the last batch of ladies — the sickly one, the unshapely one, the too-young one, the lung-disease one — and, all in all, "Kepler would have saved himself six bad dates."

Instead, he just followed his heart (which, of course, is another tolerable option, even for great mathematicians). His marriage to No. 5, by the way, turned out to be a very happy one.