Getting Better With Age

Posted by Dan Temkin on February 2, 2017

The Math behind the Diminishing Gap Between Partners

Recently, I was doing an online assessment as part of a job application and they asked the following question:

Mary is 16 years old. She is 4 times as old as her brother. How old will Mary be when she is twice as old as her brother?

While, this question was not very difficult (the answer is 24), it got me thinking about the popular dating maxim that the significance of an age gap between you and your partner diminishes with age.

The very nature of this question, that someone who is 4 times your age could become 2 times your age motivated me to explore the phenomenon. I found that it does hold up and as such proves the maxim to be true, mathematically speaking.

Just plug in any value you like for “Your_Age” and “Partners_Age” and enjoy!

To run using Jupyter Notebook download or for use with a local interpreter download (WARNING! Requires plotly to be installed). Or you can copy and paste the code below. Enjoy!

Your_Age = 28  
Partners_Age =  45 

>>> AgeDifference(Your_Age, Partners_Age)

...   When You Are 28 Your Partner will be 45 which is 1.61 times older than you
...   When You Are 33 Your Partner will be 50 which is 1.52 times older than you
...   When You Are 38 Your Partner will be 55 which is 1.45 times older than you
...   When You Are 43 Your Partner will be 60 which is 1.4 times older than you
...   When You Are 48 Your Partner will be 65 which is 1.35 times older than you
...   When You Are 53 Your Partner will be 70 which is 1.32 times older than you
...   When You Are 58 Your Partner will be 75 which is 1.29 times older than you
...   When You Are 63 Your Partner will be 80 which is 1.27 times older than you
...   When You Are 68 Your Partner will be 85 which is 1.25 times older than you
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import plotly.graph_objs as graph

def AgeDifference(Age1, Age2, Max_Age=100):
    if Age1 < Age2:
        young = Age1
        old = Age2
        diff = old - young
        diffdesc = "older than you"
    elif Age1 > Age2:
        young = Age2
        old = Age1
        diff = young - old
        diffdesc = "younger than you"

    elif Age1 == Age2:
        diff = 0
        diffdesc = "the same age as you"
    rng = range(young, Max_Age)
    diffs = dict([(str(Year), (Year + abs(diff))/Year) for Year in rng])
    for i in range(Age1, len(diffs.keys()), 5):
        print("When You Are %s Your Partner will be %s which is %s times %s" % (i, i+diff, round(diffs[str(i)], 2), diffdesc))

    iplot({"data":[{"x": [k for k in diffs.keys()], 
                    "y":[v for v in diffs.values()]}], 
           "layout":graph.Layout(xaxis=dict(title='Your Age'), 
                                 yaxis=dict(title='Age Multiple'), 
                                 title="Age Ratio")})