Monday, July 14, 2014

Rational Troubles

Rational [mathematics]: a fractional number n/d, where n and d are integers, n is the numerator and d is the denominator...
(Computing Dictionary)

Some time ago (longer than I thought it would be between posts on the subject), I posted a link to a short essay on visual representation of rational numbers in a real world problem.

I frequently find that understanding how fractions/ratios work is a stumbling block for many and the source of not a few brainteasers (for obvious reasons).  Recently, I came across one of Dan Ariely's podcasts (which has an accompanying blog) regarding the way we measure fuel mileage.
The problem posed was one of either replacing an SUV that got 10mpg with a minivan that got 20 or replacing a sedan that got 20mpg with a hybrid that got 50.
The simplest equation that seems to fit the problem is absolute mpg difference.  While the SUV-minivan difference is 10, the sedan-hybrid is 30 (some of the comments in the blog focused on details of how much each cost, how much was owed on each and the like; we will assume that all things are equal and they are trying to make a point on how the problem should be approached and set up).  Being a math guy, I initially thought of opting for the proportional (yes, this involves a ratio) change, which would be a factor of 2 for the first and 2.5 for the second.  Given that this question was asked in such a way that the obvious answer must be wrong and mine matched it, I realized (without putting any real thought into getting the correct answer) that we were dealing with something similar to the problem I posted on some years ago.

This is where the mathmagicians and lay people diverge.  Where you see 30 mpg, we see 30miles/1gallon.
There is a difference:
Using mpg, we are changing the numerator, which means we may be able to go farther on one gallon of gas when we increase that number, but we are really concerned with reducing gallons (if we wanted to just keep our gallons the same and increase the number of miles we go, parking the SUV would be the solution, but we are assuming a need to drive both vehicles).

Before getting into the real solution, let's look at what might be a sticking point for those who remember reducing fractions:
It should be obvious by now that I am heading toward a conclusion where reducing the denominator is better than increasing the numerator.  But that fails to acknowledge that these fractions reduce to the same thing.  For instance: 30 miles per gallon is the same as 60 miles per 2 gallons; if we double gas mileage, we can express that as twice the miles (60 miles per gallon or 120 miles per 2 gallons) or half the fuel (30 miles per half gallon or 60 miles per gallon).
So what gives?

Two things:
First, we are not trying to increase the miles driven (this was stated earlier and will be addressed further later).  We want to minimize gallons over a fixed distance.
Second, when we flip the ratio to give us the important variable in the numerator (where changes matter...again, hang on for proof), we end up with a totally different picture:
The difference between 2 and 4 is a factor of 2, while the difference between 1/2 and 1/4 is a factor of .5 (if we compare them in the same direction).  This means that if I double the price of dime candy, you pay 10 cents more for a piece; if I cut the price in half, you only save 5 cents (despite both using the factor of two - in opposite directions).
Taking this further, doubling the price increased the cents per candy by 10, but reduced the candy per dollar by 5; halving the price decreased the cents per candy by 5, but increased the candy per dollar by 10.
Let's also then say that we like gum, too.  And let's pretend that this gum was 3 cents.  Let's then say that we can go to the store with the double priced candy and get our gum at 1/3 price (1 cent) or go to the store where the candy is half price and pay 3 times the price (6 cents).  Where do we go?
In the one instance, you look at the cost change for the two and find that you can drop a nickel from the candy and add 3 cents to the gum for a net drop of 2 cents; in the other, you add 10 cents to the candy and lose 2 from the gum to get a net increase of 8.  Easy to see that if we were going to buy the same number of each in either case, the savings on the candy trumps.  But what if we always spend a dollar on each and like to maximize the number of total sugary treats we have (say our younger siblings always demand something from us and we can choose to give them whatever we have most).  In this instance, the candy/gum per dollar matters more - $1 each at the cheap candy store gets us 20 candy and (roughly) 11 pieces of gum, or 31 total items; $1 each at the cheap gum store gets us 5 candy and 100 pieces of gum, or 105 total.
THIS is where the gas mileage fallacy comes in.
If we use units where the fuel is in the numerator (other countries use litres/100km, we can use gallons/100miles), what we find is the SUV-minivan exchange results in a decrease from 10 to 5, while the sedan-hybrid goes from 5 to 2.  If both are driven 10000 miles per year, we are talking about cutting 500 gallons from the larger family vehicle compared to 300 for the smaller one; trading out the one that is using the most fuel definitely yields the best return.  And, at $3.50/gallon, bad math could cost $700 per year.

Going back to maximizing miles, if we simply love being on the road and also want our cars to burn an equal quantity of dead dinosaurs, miles per gallon comes becomes a much better metric.  If we decide to burn 1000 gallons per year in each car and want to maximize the number of miles driven, keeping the SUV and swapping the sedan for a hybrid (the opposite of the best case in the dollar/gallon minimizing approach) allows for 10000 miles on the SUV and 50000 miles on the hybrid, for a total of 60000 miles; the minivan/sedan combo yields 20000 for each, or 40000 total miles.

The moral(s) of the story?
1. Those things that are worst are the ones with the most room for improvement.
2. Americans should change their metric for fuel economy (and much else, too)
3. It pays to understand what the numbers mean when doing math.  Not everyone is naturally suited for this, but we can all question whether the numbers make sense - even if you have to do the math the long way (instead of deriving the best units, just add up the total costs both ways and compare).
4. I am ever reminded of my nerd status when I find myself admitting to the kinds of things I read, listen to and think about.  There are worse things.