9  Investing Basics


Saving preserves your purchasing power; investing grows it. Once your budget is under control and your emergency fund is secure, your next job is to put your accumulated savings to work in the market. The goal isn’t to get rich quick. It’s to let time and compounding build wealth at a pace most people never reach. In this chapter I’ll cover the basics: compounding, what to own, how much risk to take, and which accounts to use.1

9.1 Compounding (the force multiplier)

Compounding is just interest earning interest. Over long horizons, it does the heavy lifting. A dollar invested today becomes several dollars after 30 years, not through luck, but through the math of exponential growth.

If you memorize one shortcut, make it the Rule of 72:

Years to double your money = 72 ÷ annual return %

At 7% return, money doubles every ~10 years. At 10%, every ~7 years. Over 30 years, compounding transforms modest regular contributions into wealth.

The code below grows $10,000 at 7% for 40 years: R plots the balance each year, and Python returns the ending balance.

show/hide
years   <- 0:40
balance <- 10000 * (1.07)^years
plot(years, balance, type = "l",
     xlab = "Years", ylab = "Balance ($)",
     main = "$10,000 at 7% compounded annually")

show/hide
years = list(range(0, 41))
balance = [10000 * (1.07) ** y for y in years]
balance[-1]  # ending balance after 40 years
#> 149744.57839206984

9.2 What to Invest In (the core portfolio)

Most people only need to own three things: stocks, bonds, and cash (which you’ve already saved). The specific split depends on your time horizon and risk tolerance.

  • Stocks (via broad index funds): 70–90% of your portfolio if you have 20+ years
  • Bonds (via index funds): 10–30% for stability and downturns
  • Cash (your emergency fund): Separate, in savings accounts

The hardest part isn’t picking the right stocks; it’s resisting the urge to pick stocks at all. John Bogle’s insight is simple: trying to beat the market costs you money in fees and taxes, so buy the entire market through low-cost index funds instead.

A simple portfolio for most people:

  • 80% total stock market index fund (captures all US stocks)
  • 20% total bond market index fund (stability and downturns)

That’s it. Rebalance once a year (sell a little of whatever grew the most and buy more of what lagged, so you return to 80/20). The whole thing costs ~0.03% per year in fees.

9.3 Risk vs. Return: Choose What You Can Live With

Higher expected returns come with higher expected volatility. A 100% stock portfolio might return 10% per year on average, but it can drop 40% in a bad year. A 60/40 stock-bond portfolio returns ~7% on average but drops only 20% in a bad year.

The right allocation isn’t the one with the highest expected return; it’s the one you can stick with through downturns. Morgan Housel’s principle applies here: a portfolio you abandon in a bear market (a stretch when stock prices fall 20% or more from a recent high) performs worse than a boring portfolio you maintain.

9.4 Diversification (don’t bet on one horse)

Don’t bet on one company, one sector, or one country. Broad index funds make this nearly free. A $1 investment in a total stock market index fund gives you ownership in thousands of companies. If one fails, your return barely changes. If you own 10 tech stocks, one failure takes a real bite out of your portfolio.

9.5 Tax-Advantaged Accounts (where to hold your investments)

Steps 5–7 of the Financial Order of Operations (Section 1) tell you what accounts to use:

Account Contribution Limit (2026) Tax Benefit Best for
401(k) / 403(b) $24,500/year Tax deduction, employer match Employees with matching
Roth IRA $7,500/year Tax-free growth forever Tax-free income in retirement
Traditional IRA $7,500/year Tax deduction now Reducing current income
HSA (if eligible) $4,400/year (self) Triple tax advantage Medical expenses + retirement
Taxable account Unlimited None, but flexible After maxing above

Here is the account order from the table as a sequence:

%%{init: {'theme': 'neutral', 'themeVariables': { 'fontFamily': 'monospace', "darkMode":false, "fontSize":"16px"}}}%%

flowchart TD
    A("i. 401(k) up to the<br>employer match")
    B("ii. Roth IRA or HSA")
    C("iii. Max out the 401(k)")
    D("iv. Taxable brokerage<br>account")
    A --> B
    B --> C
    C --> D
    style A fill:#48a56a,color:#F5F2E8,stroke:#1C1C1E,stroke-width:2px
    style B fill:#0e9aa7,color:#F5F2E8,stroke:#1C1C1E,stroke-width:2px
    style C fill:#0e9aa7,color:#F5F2E8,stroke:#1C1C1E,stroke-width:2px
    style D fill:#86ddcd,color:#1C1C1E,stroke:#1C1C1E,stroke-width:2px

Which Account Gets the Next Dollar?

Work through the steps in order; the sequence is designed to make each dollar work as hard as possible.

NoteWhy Account Type Matters

A $10,000 investment earning 7% annually grows to $76,000 after 30 years. If held in a regular brokerage account, you pay taxes on the gains (~$66,000 × 20% = ~$13,200). In a Roth IRA, you pay $0. Same investment, account type makes a $13,200 difference over 30 years. Account optimization matters more than stock picking.

9.6 Common Investing Mistakes (what to avoid)

  1. Trying to time the market. Even professionals can’t predict short-term market moves. Time in the market beats timing the market.

  2. Chasing past performance. Last year’s best fund is often this year’s worst. Buy broadly; avoid chasing.

  3. Paying high fees. A 1% fee doesn’t sound bad, but over 30 years it cuts your wealth by ~25%. Low-cost index funds cost 0.03–0.1%.

  4. Keeping too much in cash. After your emergency fund, cash earning 4% barely keeps pace with inflation, so it won’t grow your wealth. You need growth.

  5. Selling in a panic. The stock market drops ~10% every 1–2 years. If you sell every time, you lock in losses and miss recoveries. Stay invested.

As Morgan Housel points out, the investors who get rich aren’t the smartest; they’re the ones who stay invested the longest and avoid big mistakes.

9.7 Math for Investing Basics

Investing math is mostly one idea (compounding) applied in a few different ways. Just like we did in the Budgeting chapter, I’ve written each calculation below as an R and Python function.

In code, the ^ symbol (R) and ** symbol (Python) both mean “raise to the power of.” So (1 + 0.07)^10 means “1.07 multiplied by itself 10 times.”

Future Value and the Rule of 72

Each bar below is the previous one multiplied by the same growth factor. The result is not a straight line; it curves upward because each year’s growth is applied to a larger base.

$10,000 growing at 7%: value at each checkpoint

$10,000 growing at 7%: value at each checkpoint

Multiplying by (1 + r) once gives next year’s value; multiplying by it n times gives the value after n years. That’s the formula.

Formula: FV = PV × (1 + r)^n

Where: FV = future value, PV = present value (today’s amount), r = annual return, n = years.

The companion shortcut is the Rule of 72: divide 72 by the return percentage to estimate how many years it takes your money to double.

Years to double ≈ 72 ÷ annual return %

Example: $10,000 at 7% for 10 years grows to ~$19,672, and at 7% money doubles roughly every 10 years.

In R, future_value() multiplies a starting amount by (1 + rate) once for every year.

show/hide
future_value <- function(present_value, rate, years) {
  present_value * (1 + rate)^years
}

rule_of_72 <- function(annual_return_pct) {
  72 / annual_return_pct
}

# scalar: $10,000 at 7% for 10 years
future_value(present_value = 10000, rate = 0.07, years = 10)
#> [1] 19671.51

# how long until your money doubles at 7%?
rule_of_72(annual_return_pct = 7)
#> [1] 10.28571

# vectorized: same $10,000 at 7% across multiple horizons
data.frame(
  years = c(5, 10, 20, 30),
  value = future_value(present_value = 10000, rate = 0.07, years = c(5, 10, 20, 30))
)
#> # A tibble: 4 × 2
#>   years  value
#>   <dbl>  <dbl>
#> 1     5 14026.
#> 2    10 19672.
#> 3    20 38697.
#> 4    30 76123.

The Python version of future_value() works the same way:

show/hide
import numpy as np

def future_value(present_value, rate, years):
    return present_value * (1 + rate) ** years

def rule_of_72(annual_return_pct):
    return 72 / annual_return_pct

# scalar: $10,000 at 7% for 10 years
print(future_value(present_value=10000, rate=0.07, years=10))
#> 19671.513572895663

# how long until your money doubles at 7%?
print(rule_of_72(annual_return_pct=7))
#> 10.285714285714286

# vectorized: numpy lets us pass an array of horizons in one call
horizons = np.array([5, 10, 20, 30])
future_value(present_value=10000, rate=0.07, years=horizons)
#> array([14025.517307  , 19671.5135729 , 38696.84462486, 76122.55042662])

Assuming the present value is in A2, the rate is in B2 (as a decimal), and the years are in C2:

=A2*(1+B2)^C2

Excel also has a built-in function that returns the same number:

=FV(B2, C2, 0, -A2)

For the Rule of 72, put the annual return as a whole number (7, not 0.07) in E2:

=72/E2

To compare several horizons, list the years down column C and copy the first formula down.

Future Value of Regular Contributions

Investing a fixed amount every month builds wealth in two ways: the money you put in, and the growth earned on all previous contributions. The chart below separates these two layers so you can see when growth overtakes contributions.

$500/month contributions at 7%: contributed vs. gains

$500/month contributions at 7%: contributed vs. gains

Each contribution grows for a different number of years, and the annuity formula collapses all of them into a single calculation.

Formula: FV = PMT × [((1 + r)^n − 1) ÷ r]

Where: PMT = the amount contributed each period, r = the return per period, n = the number of periods.

Example: $500/month for 30 years (360 months) at a 7% annual return (~0.583% per month) grows to ~$610,000, of which only $180,000 is money you actually put in.

In R, future_value_series() applies the annuity formula to a regular contribution.

show/hide
future_value_series <- function(contribution, rate, periods) {
  contribution * (((1 + rate)^periods - 1) / rate)
}

# $500/month for 30 years at a 7% annual return (monthly rate = 0.07 / 12)
future_value_series(contribution = 500, rate = 0.07 / 12, periods = 30 * 12)
#> [1] 609985.5

The Python version of future_value_series() works the same way:

show/hide
def future_value_series(contribution, rate, periods):
    return contribution * (((1 + rate) ** periods - 1) / rate)

# $500/month for 30 years at a 7% annual return (monthly rate = 0.07 / 12)
future_value_series(contribution=500, rate=0.07 / 12, periods=30 * 12)
#> 609985.4978879723

Assuming the monthly contribution is in A2, the annual rate is in B2 (as a decimal), and the number of years is in C2:

=A2*(((1+B2/12)^(C2*12)-1)/(B2/12))

The built-in FV() function gives the same answer:

=FV(B2/12, C2*12, -A2)

Real (Inflation-Adjusted) Return

A 7% nominal return sounds good, but inflation is quietly shrinking the purchasing power of every dollar. The chart below shows the three quantities: the stated return, the inflation cost, and what actually remains.

Nominal return, inflation, and real return

Nominal return, inflation, and real return

The real return is what’s left after inflation takes its slice. It’s not a simple subtraction but a ratio, because the percentages compound.

Formula: Real Return = (1 + nominal) ÷ (1 + inflation) − 1

Example: (1.07 ÷ 1.03) − 1 = ~3.88%, slightly less than the 4% you’d get by simple subtraction.

In R, real_return() takes a nominal return and an inflation rate, and returns what’s left after inflation.

show/hide
real_return <- function(nominal, inflation) {
  (1 + nominal) / (1 + inflation) - 1
}

# 7% nominal return against 3% inflation
real_return(nominal = 0.07, inflation = 0.03)
#> [1] 0.03883495

The Python version of real_return() works the same way:

show/hide
def real_return(nominal, inflation):
    return (1 + nominal) / (1 + inflation) - 1

# 7% nominal return against 3% inflation
real_return(nominal=0.07, inflation=0.03)
#> 0.03883495145631066

Assuming the nominal return is in A2 and inflation is in B2 (both as decimals):

=(1+A2)/(1+B2)-1

9.8 Recap

  1. Compounding is the force multiplier. Start early, even if the amounts are small; time matters more than size.

  2. The Rule of 72 reframes spending. Money you don’t spend today doubles every 7–10 years, so saving $50/month for 30 years becomes ~$61,000 after compounding.

  3. Buy broadly through index funds. You don’t need to pick stocks. Own the entire market through low-cost index funds (0.03–0.1% in fees).

  4. Asset allocation (stock/bond split) matters more than stock picking. A boring 80/20 portfolio beats an exciting one you abandon in a downturn.

  5. Use tax-advantaged accounts first. A $10,000 Roth IRA investment saves you $13,000+ in taxes over 30 years compared to a taxable account. Where you hold your investments matters more than which stocks you pick.

  6. Stay invested through downturns. Crashes are features, not bugs. They happen every 5–10 years, and they recover. Selling and missing the recovery is what does the real damage to your returns.

  7. Behavioral discipline beats optimization. A portfolio you follow for 30 years will beat a perfect one you abandon after 18 months.

At this point you have the foundation: budget control, savings discipline, and an investing framework. In the next chapters we’ll go deeper on the investing side: retirement accounts, index funds, and asset allocation.


  1. Ben Felix and John Bogle both emphasize that investing is a decades-long endeavor. The goal is not to beat the market (nearly impossible after fees) but to capture market returns efficiently through low-cost, diversified index funds. Morgan Housel adds: the behavioral discipline to stay invested through downturns matters more than the specific holdings.↩︎