Death and taxes. And dead is dead, but taxes come in a huge panoply of forms. There’s property taxes, excise taxes, sin taxes and income taxes. There’s gas taxes and sales taxes and VAT taxes (yeah, I know) and death taxes.
With my politics I’m not a huge fan of any of them, but they are what they are. And every once in a while they produce some interesting math. One of the more interesting taxes, mathematically speaking, is the capital gains tax. It works like this: you invest your money in stocks or bonds or some other investment vehicle. In an ideal world your investment grows in value and eventually you’ll take your profits and go on vacation.
But hold on! Uncle Sam wants a cut. If you invested $100 and you ended up with $120, Uncle Sam will take a cut of that $20 profit in the forms of a capital gains tax. At the moment the capital gains tax rate is 15%, so you’ll send $3 to the treasury and end up with $117 in your pocket.
Now hold on again! A dollar when you opened your investment is not the same thing as a dollar when you took your profits. Inflation has eroded the value of the dollar and thus your purchasing power vis a vis your original investment is not well described by the difference in the raw dollar amount. You have to adjust for the rescaling of dollars to stuff caused by inflation.
If your investment grows at a constant percentage rate, its growth is given by:

Before inflation and capital gains tax, that’s the growth of your money where r is your interest rate and t is the amount of time that has passed. For convenience we’ve scaled the initial investment to 1. But we’re taxed on our profit, so f(t) becomes:

The second term is the profit, and we multiply it by the tax rate T to find the tax we owe. We subtract that from our previously accumulated total. And that’s the money we have left over. But if we want to know how much this will buy in terms of what dollars bought when you opened your investment, we have to multiply by the factor that adjusts dollars now into dollars then. We’ll pretend inflation is constant as well and occurs at a rate ri. This gives:

So let’s give that a shot with the interest and inflation rates both equal to 4%.
Over time the purchasing power declines to 85% of its original magnitude, because a larger and larger portion of our investment is profit and Washington takes 15% of that. What if our interest rate is just higher than inflation – say, 4.3% compared to inflation at 4%? Here I’ll zoom in the y-axis so the detail is a little more clear:

You actually lose purchasing power at first before it stabilizes and starts to climb. How much does your interest rate need to be to start growing your purchasing power right away? Differentiate f and you get:

Set that equal to zero, let t = 0 and solve for r:

For inflation of 4% and tax of 15%, you need to ear just over 4.7% interest to start actually making a post-tax/post-inflation profit right away. However, if you take a close look at f(t) you’ll see that eventually you will make a real profit as long as your interest does exceed inflation even a tiny bit. Under non-ideal conditions it might take a while; for instance 4% inflation with 4.1% interest and a 90% tax rate would take 2300ish years to break even again. Presumably the numbers involved in most real investments are better.
On the other hand, even in this model it’s always and everywhere better to be invested at any (non-negative) rate than to just let your money sit in a mattress and get eroded by inflation. These days it’s the non-negative rate that’s the tricky part. Good luck!