# This mathematical principle reveals the best way to get anything you want in life

The Mathematics of LoveIllustration by Christine Rösch for ‘The Mathematics of Love’ published by TEDBooks.

Whether it’s landing your dream job or getting the girl, a basic mathematical principle can help you in almost any situation.

That’s according to Hannah Fry, a mathematician at the UCL Centre for Advanced Spatial Analysis in London and author of new book, “The Mathematics of Love.”

She describes the “stable marriage problem,” or the challenge of matching two entities so that neither would be better off in another match, and explains the Gale-Shapley matching algorithm often used to solve it. Exploiting this algorithm can be a great strategy for getting what you want.

Here’s how it works: Fry uses the example of three boys talking to three girls at a party. Each has their own ordered list of who they’d prefer to go home with.

If this was a 1950s-style dating scenario and the boys approached the girls, each boy would hit on his top-choice girl, Fry explains. If a girl has multiple offers, she’d choose the boy she preferred most, and if a boy were rejected, he’d approach his second-choice girl.

The result is pretty great for the boys. They each get their first or second-choice partners, and there’s no way they could improve, since the top choice has said yes or already rejected them.

The girls fare relatively worse, however, having paired up with their second and third-choice partners.

Fry writes:

Regardless of how many boys and girls there are, it turns out that whenever the boys do the approaching, there are four outcomes that will be true:

1. Everyone will find a partner.

2. Once all partners are determined, no man and woman in different couples could both improve their happiness by running off together.

3. Once all partners are determined, every man will have the best partner available to him.

4. Once all partners are determined, every woman will end up with the least bad of all the men who approach her.

Essentially, whoever does the asking (and is willing to face rejection until achieving the best option available to them) is better off. Meanwhile, the person who sits back and waits for advances settles for the least bad option on the table.

The Gale-Shapley matching algorithm applies to plenty of situations beyond weekend hook ups — like, say, hiring.

For example, a hiring manager who posts a job listing and lets the résumés roll in ultimately hires the best of the candidates who applied. But of course, that’s a limited pool. On the other hand, a hiring manager who reaches out to the best professionals in the field and ends up with her third choice is still more likely to have a better candidate than those who responded to the listing.

By the same token, a job seeker who approaches all the companies he wants to work for, starting at the top of his list, ends up with the best employer available to him.

The US National Resident Matching Program uses this strategy to match doctors with hospitals so that everyone is happy. Prior to the ’50s, Fry says hospitals reached out to the students they wanted, and the students accepted the least bad offers. But the organisers realised that doctors often had to relocate and weren’t always happy with their options. To create a better system, they decided to flip the scenario and let doctors approach the hospitals they liked best.

Fry says the algorithm has been similarly applied to the assignments of dental residents, Canadian lawyers, and high-school students.

“Regardless of the type of relationship you’re after,” concludes Fry, “it pays to take the initiative.”

Watch Fry’s TED Talk on the mathematics of love: