raw math

Exploring Date Ratios

Robert Eisele

During my recent birthday celebration, I found myself contemplating the intriguing notion that there might exist a precise moment in time where the ages of two individuals are in a distinct ratio. This pondering was sparked by the realization that there could be a specific date when my mother's age precisely doubles mine, coinciding with the age she was when I was born.

In essence, our quest delves into the calculation of ratios between two distinct periods of time. To illustrate this concept, let's consider the relationship between my birth year (1988) and that of my mother (1962). The formula to compute this relationship might take the form:

\[\frac{x - 1988}{x-1962} = \frac{1}{2}\]

... where \(x\) is the year when the to dates are in the given ratio. If we express the equation just with variables, we get the following:

\[\frac{x - a}{x-b} = \frac{m}{n}\]

Now, let's rewrite the equation to solve for \(x\):

\[x = \frac{an-bm}{n-m}\]

Substituting the given values:

\[x = \frac{2(1988)-1(1962)}{2-1}\]

and we get:

\[x = 2014\]

To further refine our calculation, we use MySQL. In the case of my mother and myself, leveraging the number of days to a DATE value instead of focusing solely on the year gives:

SELECT FROM_DAYS(TO_DAYS('1988-01-23') * 2 - TO_DAYS('1962-03-06'));

Thus, it follows that on 12/11/2013 my mother is exactly twice as old as myself. For the general case we can come up with the following stored function to do that job:

CREATE FUNCTION find_date_ratio(a date, b date, m tinyint, n tinyint)
  RETURNS DATE DETERMINISTIC
RETURN FROM_DAYS((n * TO_DAYS(a) - m * TO_DAYS(b)) / (n - m));