# Dollar Cost Averaging and Gas Prices

Dollar cost averaging says the if you invest a set dollar amount at the fixed frequency, you will come out better than purchasing a set number of shares at the same frequency. While filling up the gas tank this morning I was wondering if the same held true. Would I be better off putting a fix dollar amount of gas in the car every week instead of putting a fix number of gallons/liters of gas in the car?

Second part of the question. Now knowing that the number of gallons/liters of gas each week is not fixed. Is it cheaper to top off each week vs going as long as you can before you fill up the tank? Where is the inflection point?

*Note I was unsure about the tags for this, so please reassign accordingly.

-

You want to buy at the lowest price. Dollar cost averaging will cause you to buy more at lower prices if the price is fluctuating. If there is a long term trend, you want to move your purchases in the indicated direction-earlier if the trend is upward. It depends upon your forecast for future prices. If there is no transaction cost, buy gas any time it is cheaper than you predict for the future, and hold off when it is more expensive.

-

The following calculation answers your first question. It is not clear how to model price fluctuations precisely enough to answer the second question.

Suppose that the price per gallon in Week $1$ is $p_1$ dollars, and the price per gallon in Week $2$ is $p_2$ dollars.

Let's examine first the case where we buy $X$ gallons in Week $1$, followed by $X$ gallons in Week $2$, what you have called the fixed number of gallons. Then we have spent a total amount $$p_1X+p_2X$$ for $2X$ gallons, so the average cost per gallon is $$\frac{p_1X+p_2X}{2X}$$ which simplifies to $$\frac{p_1+p_2}{2}.$$

The above result didn't really require such a detailed calculation. I was getting into shape for the next calculation, which is harder!

Suppose that we spend $D$ dollars in Week $1$, and $D$ dollars in Week $2$. How many gallons have we bought? It may be useful to write down explicitly the relationship between "unit cost" $p$ (price per gallon), total cost $d$, and amount bought $x$. We have in general $$px=d.$$ This can be rewritten as $$x=\frac{d}{p}.$$

If we spent $D$ dollars in Week $1$, and the price was $p_1$, we bought $D/p_1$ gallons. Similarly, in Week $2$ we bought $D/p_2$ gallons. So the total amount we bought is $$\frac{D}{p_1}+\frac{D}{p_2},$$ and the total cost was $2D$, so the average price per gallon was $$\frac{2D}{\frac{D}{p_1}+\frac{D}{p_2}}.$$ With some algebraic manipulation, this simplifies to $$\frac{2p_1p_2}{p_1+p_2}.$$

Terminology: The number $(p_1+p_2)/2$ is called the Arithmetic Mean of $p_1$ and $p_2$. The number $2p_1p_2/(p_1+p_2)$ is called the Harmonic Mean of $p_1$ and $p_2$.

It turns out that the arithmetic mean of two positive quantities is always at least as large as the harmonic mean. Here is a proof. We want to show that $$\frac{p_1+p_2}{2} \ge \frac{2p_1p_2}{p_1+p_2}.$$ This is equivalent to showing that $$(p_1+p_2)^2 \ge 4p_1p_2.$$ Expand the square, move things around. We want to show that $$p_1^2-2p_1p_2+p_2^2\ge 0.$$ But this is obvious, since $p_1^2-2p_1p_2+p_2^2=(p_1-p_2)^2$, and any square is $\ge 0$.

Conclusion: Fixed dollar amount is never more expensive per gallon than fixed number of gallons. And fixed dollar amount always gives a lower cost per gallon, if prices change.

Your first question contemplated only two strategies. Things get much more complicated if we have some knowledge about the likely price fluctuations. But if we have such prior knowledge, we can get rich, and let the chauffeur worry about filling the tank.

-

If the price of gas is going up, then it makes sense to fill your tank today, because gas will only cost more tomorrow.

If the price of gas is going down, it makes sense to only put in five dollars today, and get more cheaper gas for five dollars tomorrow, and more cheaper gas for five dollars the day after.

No complicated math is necessary to figure this out. An 18 year-old trying to save every dime will figure out the principle of dollar-cost-averaging purely by accident.

The bottom line is, dollar cost averaging is smart if the price is predicted to go down tomorrow.

-