A mathematical approach to finding a companion, what math and data can teach us about relationships.

Image for post
Image for post

Finding a companion for love, can be difficult, but luckily there are methods and algorithms that you can use to optimize your chances of success. In this article I will mention a few of the algorithms you can use and questions you can ask to improve your chances of a long term successful relationship. These algorithms and questions come from mathematics, statistics and data sets that have been collected from successful relationships. Let us get started to optimizing your chances of finding that special someone.

Gale-Shapley Stable Marriage /Matching Algorithm

What this love algorithm is suggesting is that whoever does the asking (and is willing to face rejection until receiving the best available option) is better off. Meanwhile, the person who waits for advances settles for their last option. Let’s take a look at this algorithm in action below.

function stableMatching {
Initialize all m ∈ M and w ∈ W to free
whilefree man m who still has a woman w to propose to {
w = first woman on m's list to whom m has not yet proposed
if w is free
(m, w) become engaged
else some pair (m', w) already exists
if w prefers m to m'
m' becomes free
(m, w) become engaged
else
(m', w) remain engaged
}
}

Setup

We would like to match 4 pairs of boys and girls.

Boy List Of Preferred Girl:

Boy0 List : Girl0, Girl1, Girl2, Girl3
Boy1 List: Girl1, Girl2, Girl3, Girl0
Boy2 List: Girl2, Girl3, Girl0, Girl1
Boy3 List: Girl3, Girl0, Girl1, Girl2

Girl List Of Preferred Boy:

Girl0 List: Boy0, Boy1, Boy2, Boy3
Girl1 List: Boy1, Boy2, Boy3, Boy0
Girl2 List: Boy2, Boy3, Boy0, Boy1
Girl3 List: Boy3, Boy0, Boy1, Boy2

Verbose Results

1: Round 1
2: Boy0 prefers Girl0
3: Girl0 is previously unmatched
4: Boy0 becomes paired with Girl0
5: Boy1 prefers Girl1
6: Girl1 is previously unmatched
7: Boy1 becomes paired with Girl1
8: Boy2 prefers Girl2
9: Girl2 is previously unmatched
10: Boy2 becomes paired with Girl2
11: Boy3 prefers Girl3
12: Girl3 is previously unmatched
13: Boy3 becomes paired with Girl3

Results

14: Boy0 is paired with Girl0
15: Boy1 is paired with Girl1
16: Boy2 is paired with Girl2
17: Boy3 is paired with Girl3

Let’s change up the Boy list a little bit to show some conflict where the boys prefer the same girls and see the result.

Boy List Of Preferred Girl:

Boy0 List : Girl3, Girl1, Girl2, Girl0
Boy1 List: Girl2, Girl1, Girl3, Girl0
Boy2 List: Girl3, Girl1, Girl0, Girl2
Boy3 List: Girl0, Girl3, Girl1, Girl2

Girl List Of Preferred Boy:

Girl0 List: Boy0, Boy1, Boy2, Boy3
Girl1 List: Boy1, Boy2, Boy3, Boy0
Girl2 List: Boy2, Boy3, Boy0, Boy1
Girl3 List: Boy3, Boy0, Boy1, Boy2

Verbose Results

1: Round 1
2: Boy0 prefers Girl3
3: Girl3 is previously unmatched
4: Boy0 becomes paired with Girl3
5: Boy1 prefers Girl2
6: Girl2 is previously unmatched
7: Boy1 becomes paired with Girl2
8: Boy2 prefers Girl3
9: Girl3 is already paired to Boy0
10: Girl3 ranks Boy0 as 1
11: Girl3 ranks Boy2 as 3
12: Boy2 moves on to Girl1
13: Boy3 prefers Girl0
14: Girl0 is previously unmatched
15: Boy3 becomes paired with Girl0
16: Round 2
17: Boy2 prefers Girl1
18: Girl1 is previously unmatched
19: Boy2 becomes paired with Girl1

Results

20: Boy0 is paired with Girl3
21: Boy1 is paired with Girl2 ← Girl2 least favorite is Boy1
22: Boy2 is paired with Girl1
23: Boy3 is paired with Girl0 ← Girl0 least favorite is Boy3

Conclusion of Stable Marriage / Matching

From the first results, we see that everyone is happy and got their favorite person to marry / match with. While in the second results, we see that it was the boys who got the better match up, while the girls got the worst match up. Remember it was the boys in this case that did the “asking”. This shows that the person doing the asking and not afraid of rejection will be better off.

The 3 First Date Questions That will Predict your Romantic Compatibility for the long term

A group of Harvard mathematicians A.K.A the creators of OKCupid have found 3 questions that you could ask on a first date, that could help determine whether a couple have the potential to last the distance from the data they collected on OKCupid. According to these mathematicians, if you can find someone that answers all three of the questions the same way you do, the two of you are a perfect match. There are many other important questions of course like “Do you want kids ?” , “Do you believe in God?” , etc. but those are pretty heavy questions for the first date, so the mathematicians found some lighter questions that can be asked that have statistical significance. The 3 questions you can ask on a first date are below.

1. Do you like horror/scary movies?
2. Have you ever traveled to another country alone?
3. Would you like to ditch it all and go live on a sailboat?

Other fun first date questions that have underlying meanings.

If you want to know if the person you are on a date with will have sex with you on the first date ask:

Do you like the taste of beer?

If the answer is yes, it is likely they will have sex with you on the first date.

If you want to know if the person you are on a date with has the same political views ask:

Do you prefer the people in your life to be simple or complex?

If the person chooses simple then they are most likely conservative, and if they chose complex they are most likely liberal.

If you want to know if the person you are on a date with has the same religious beliefs ask:

Do spelling and grammar mistakes annoy you?

If your date answers ‘No’ , meaning that grammar mistakes do not annoy your date then there is a good chance that your date is at least moderately religious.

The Secretary Problem: An algorithm for deciding who to marry

The below algorithm will give you a 37% chance of finding the optimal person to marry. You may say well 37% isn’t a lot, but it is better than random. The idea is to reject the first 37% and then marry the next person that is better than the best person from the initial 37%.

The Algorithm
Step 1: Estimate how many people you could date in your life, n.

Step 2: Calculate the first 37% of people to date .37 x n

Step 3: Date and reject the first .37 x n people; the best of them will set your benchmark.

Step 4: Continue dating people and settle down with the first person to exceed the benchmark set by the initial .37 x n dates.

Image for post
Image for post

The Relationship Equation

Image for post
Image for post

“The left-hand side of the equation is simply how positive or negative the wife will be in the next thing that she says. Her reaction will depend on her mood in general (w), her mood when she’s with her husband (rwWt), and, crucially, the influence that her husbands actions will have on her (IHM). The Ht in parentheses at the end of the equation is mathematical shorthand for saying that this influence depends on what the husband has just done.

The equations for the husband follow the same pattern: h, rHHt, and IHM are his mood when he’s on his own, his mood when he’s with his wife, and the influence his wife has on his next reaction, respectively.” — Hannah Fry

This equation shows some surprising information, it shows that couples who have a greater tolerance for negativity e.i. couples that let things go, or compromised, had less success then the couples with a low negativity threshold, which were the couples that had the most success in the long term. These are the couples that speak up if something bothers them, and don’t let the small issues build up to become big issues, but rather address them and keep repairing the smallest issues and drama in their relationship.

Hannah Fry ← Author of the The Mathematics of Love
John Gottman ← psychologist who studies why marriages succeed or fail
James Murray ← Mathematician who created the relationship formula

Summary

Let us summarize everything in this article.
1. Always take the risk and ask a potential mate out first. This way you get the person you want instead of waiting for someone to ask you and settling.

2. Once on a date with the potential mate ask the following questions to determine your compatibility. If all the answers match then you are most likely very compatible.

a. Do you like horror/scary movies?
b. Have you ever traveled to another country alone?
c. Would you like to ditch it all and go live on a sailboat?
d. Do you like the taste of beer?
e. Do you prefer the people in your life to be simple or complex?
f. Do spelling and grammar mistakes annoy you?

3. After dating ‘n * .37’ potential mates choose to marry the next person that is better than the best person from the initial 37% or ‘n * .37’, where n is the max number of people you can or want to date within your lifetime.

4. Once in a relationship, speak up if something bothers you, and don’t let the small issues build up to become big issues, but rather address them and keep repairing the smallest issues and drama in your relationship.

Resources:

Books

Algorithms To Live By

Image for post
Image for post

The Mathematics of Love

Image for post
Image for post

Check out the following for content / videos on Algorithm Analysis and Programming:

YouTube Channel:
randerson112358: https://www.youtube.com/channel/UCaV_0qp2NZd319K4_K8Z5SQ

compsci112358:
https://www.youtube.com/channel/UCbmb5IoBtHZTpYZCDBOC1CA

Website:
http://everythingcomputerscience.com/

Video Tutorials on Recurrence Relation:
https://www.udemy.com/recurrence-relation-made-easy/

Video Tutorial on Algorithm Analysis:
https://www.udemy.com/algorithm-analysis/

Twitter:
https://twitter.com/CsEverything

YouTube Channel:

Image for post
Image for post

Computer Science Website:

Image for post
Image for post

Udemy Videos on Recurrence Relation:

Image for post
Image for post

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store