Saturday, May 5, 2012

Inversely Proportional

I am embarrassed to admit that at about the time I learned to drive I reasoned as follows: in order to get better gas mileage, the car should be driven faster. This wasn't thought through very well, and it was just instinct. But there was a reason buried in my mind, and it was that at higher speeds we can cover more distance per unit of time, by definition. And so, as we cover greater and greater distances for the same unit of time, we will get more miles to the gallon. Now, that is not true, but here is what does make it true: if the car always used fuel at the same rate (in volume of fuel per unit of time) then, yes, greater speed would always lead to greater gas mileage. If the car always uses fuel at 2 gallons per hour, no matter what the speed is, then the more miles you can cram into that hour, then the greater the miles per gallon will be. But the car's fuel use does diminish with increasing speed. Anyone who has ever run or ridden a bike can be persuaded of this: For how long can you run at your top speed? For how long can you walk. Now I don't know the details on how the human body works, and I'm sure it's more complicated than I know, but I take it to support maintaining higher speeds of travel take more energy.

So let's take that a step further: Suppose that the car will use fuel at a greater rate as the speed increases. Perhaps that as the car idles, it uses fuel at 1 hour per gallon, but at 60 miles per hour, it uses fuel at 0.6 hours per gallon (taking only 36 minutes to use the same volume of fuel). This would mean that the fuel use depends on the speed, and that the two quantities are inversely proportional: as one quantity goes up, the other goes down. Now if we further assume that the two values are also linearly related, then we can get an equation that gives the fuel use (y) in terms of the speed (x): y = (-1/150)x + 1. This equation has two implications of note: the car takes one hour to burn a gallon of fuel at idle, and for each increase in speed of 15 miles per hour thereafter the car will 0.1 fewer hours to burn a gallon of fuel.

There is another issue of note here. I started this post with the erroneous assumption that the car always used fuel at the same rate, and the implication was that the gas mileage would be limited by the speed of the car (or the best gas mileage is obtained by traveling at the top speed). Another, every crazier scenario would be that the car used less fuel with increasing speed. But neither of those scenarios is realistic: Life seems to always involve trade-offs, and the more we have of one thing usually entails the less we have of another. Thus, in our real world example, as we increase speed we sacrifice fuel use, and so neither too slow or too fast will yield the optimum gas mileage. At some middle speed there is the best compromise between speed and fuel use. Note that gas mileage (z) is x times y , or z = x((-1/150)x + 1). With methods of algebra or calculus we can find that the maximum value z takes is 37.5 miles per gallon at 75 miles per hour.

Although it's probably intuitive to believe that there is some moderate speed that will give optimum gas mileage in our situation, let me now consider a more meaningful and mathematical reason why that is. This reason has to do with the way the fuel use increases with increasing speed. We agreed that as the speed increases, it will take less time to use the same volume of fuel, and that for each increase in speed of 15 miles per hour thereafter the car will 0.1 fewer hours to burn a gallon of fuel. But it's not the absolute changes that matter here: Take for example that we start by considering that the car takes an hour to burn one gallon of fuel when idling. If the car is later traveling at 15 miles per hour, it will then take only 0.9 hours to burn a gallon of fuel. But in terms of a percentage, the fuel use only decreased by 10%. But as the car speeds up, the fuel use keeps decreasing by a greater and greater percentage of itself.

It's the percentages that are the key here, not the absolute change. Although the fuel use increases with increasing speed, you will find that initially the fuel use is changing by a much smaller percentage than the speed, then they change by equal percentages, and then the fuel use changes by a greater percentage than the speed. It turns out that the optimum speed is the speed at which the fuel use and speed are changing by the same percentages.

One final word: there are some things about this that are no doubt untrue, and this entire blog post may be pointless. Are the fuel use and speed linearly related? Probably not, but I wouldn't be surprised that they are under portions of the graph excluding the extremely fast or slow speeds. Another thing is to consider the price of item and the quantity that can be sold at that price, and the resulting revenue: it's the same problem with the variables relabeled.

Friday, May 4, 2012

Selling a house

Today we are as close as we have ever come to selling our house and buying a new one. I've done a lot of math regarding this, and today I'll write about one aspect. We are asking $180,000 for our house, and we owe $155,000. If there were no commissions, fees or other costs to selling a house then we could keep $180,000 - $155,000 = $25,000. But the truth is that there are such things. It's complicated to explain all the costs of selling a house. Some are calculated as percentages of the sell price, others are flat fees. But it is probably a safe assumption to say that the cost of selling the house will be 10% of the price at which it is sold. Now, I can from this number calculate our profit from selling the house at various prices, but it would have more explanatory power to have a single equation whose features explain the general relationship between the sell price and our profit.

So, here goes. Let x be the sell price and y be the profit. The equation would be y = x - 155,000 - 0.1x, which would simplify to y = 0.9x - 155,000. This equation says a number of things about how the sell price determines our profit.

(1) The sell price and profit are linearly related. One thing this means is that the graph is a line. Now, it is a fact that the graph is a line, but it does not enlighten the situation at all. Something better is this: being linearly related means that if the sell price increases by a certain amount, the increase in profit will be some constant multiple of that amount. Mathematician or not, everyone would believe that if the sell price were to increase, then so would the profit, but for a linear equation the point is that it doesn't matter what the sell price increases from. An increase in the sell price from $1 to $2 has exactly the same effect as an increase from $100 to $101. The key to understanding precisely what this means is by examining the slope of the line.

(2) The slope of the line is 0.9/1, and here's what that means: if the sell price increases by $1, then the profit will increase by $0.9. But any other proportion is also true, so if the sell price changes by $1,000, then the profit changes by $900. So, a $1,000 increase in the selling price will mean an additional $900 in profit.

(3) The x-intercept of the line represents the sell price at which the profit is zero. For our equation y = 0.9x - 155,000, the x-intercept is 155,000/0.9 = 172,223. So, for every $1,000 that we sell above that, we profit $900. But if we sell any less than $172,000, we would have to pay to sell the house.