Last night I remembered something I hadn’t thought about in a long time. During my freshman year, a math professor showed me a novel solution to an interesting problem: dating. And he did so with the help of Calculus.

First off, let’s assume that I am capable of comfortably dating and knowing N girls in my life. Not that I will date N girls, but that if I didn’t ever get married and continued to date for the rest of my life, I could reasonably expect to date N girls.

I can only date one girl at a time (it’s me), and the problem isn’t as interesting if you’re allowed to go back to one you’ve already dated. You could just date all N and pick the best one. How can I pick the best girl to marry if I can’t go back in time? Or even more generally, how can make sure I pick from the top of the list, the top A girls? Let’s formalize:

N := number of girls I can reasonably expect to date

A := number of girls who’d make me happy (A < N )
I can compare any girl I am with to any girl I've been with in the past.

Let’s say I could date 10 girls, and that I could be happy with the top 3. If I pick the first girl I date, I’ll only have a 3/10’s chance of happiness. What should I do?

My professor’s answer was to date P girls initially without considering any of them for marriage. These were to provide a baseline, a sort of control group for how crazy or wonderful women you could date would be. Then, after you had accomplished that, you should marry the first woman who is better than anyone else you have ever dated. Simple enough, but how to solve for P?

He used integrals, but for the life of me I couldn’t remember how he did it. I started writing out axiomatic rules (like I did just now) and tried to solve it using statistics and set theory, to no avail. Finally I gave in, started up Visual Studio C++ and wrote in one furious sitting a complete Monte Carlo simulation to solve the problem. It spat out the following table (N=10, A=3) of values for P and their expected success percentage:

`0: 0.309 1: 0.602 2: 0.670 3: 0.615 4: 0.581 5: 0.518 6: 0.401 7: 0.283 8: 0.209 9: 0.088`

According to my program, the optimal solution if you can date 10 girls and 3 of them would make you happy is to date two girls, get a feel for them, then marry the first girl that beats the rest. Although looking at the numbers, it sways a little to the right, maybe I should take a more finely grained data set, get another decimal point.

My professor might have solved the problem correctly, but I get the feeling there’s a little more to dating than C++.

**Update 7/23/06**: I found the solution my professor used in solving the problem. Enjoy.