Taxes
Each topic starts with a real scenario and a bar model, then three levels of exercises. Level 1 (Guided) fills in the blanks of a finished function. Level 2 (Practice) applies it to new numbers. Level 3 (Challenge) asks a new question with little scaffolding. The R and Python exercises run in your browser: click Run Code to try, Submit Answer to check, and use the hint or solution if you get stuck. Excel exercises have a solution you can reveal.
1 Book Topics
- Where your paycheck goes: withholding for federal income tax, Social Security (6.2%), Medicare (1.45%), and state tax; FICA (7.65%) starts at the first dollar (about $3,443 on $45,000); 401(k) contributions are your money, not a tax
- Tax brackets: 2026 single filer brackets (10% to 37%); only dollars above each line get the higher rate, so a raise always leaves you with more; marginal rate vs. effective rate
- Deductions vs. credits: the 2026 standard deduction is $16,100; credits cut tax dollar for dollar (Saver’s Credit up to $1,000 for income up to $40,250, American Opportunity, Earned Income)
- The W-4 and your refund: a big refund is an interest free loan to the government; aim for a small refund or small bill; side income needs 25% to 30% set aside for taxes (self employment tax of about 15.3%)
- Filing: due around April 15; IRS Free File, VITA, Free File Fillable Forms (Direct File is not available for 2026)
- Tax loss harvesting: only matters in a taxable account, and mostly delays taxes rather than avoiding them
- When to hire a pro: side income, rentals or a business, big life changes, IRS letters, large taxable sales
2 Your Tax Bill, Bracket by Bracket
Each slice of taxable income is taxed at its own rate. The standard deduction comes off the top first, so those dollars are taxed at 0%.
Formula: Tax = Σ (Rate × Income in that bracket), and Effective rate = Tax ÷ Income
On $45,000, the tax is ($12,400 × 10%) + ($16,500 × 12%) = $3,220. That is an effective rate of about 7.2%, even though the top bracket is 12%.
How to read this result: the marginal rate tells you what happens to your next dollar. The effective rate tells you what share of your whole salary went to federal income tax. Use the marginal rate for decisions (like a Traditional 401(k) contribution) and the effective rate for budgeting.
2.1 Level 1: Guided
Fill in the blanks to finish income_tax() for a 2026 single filer (standard deduction $16,100), then find the federal income tax on a $45,000 salary.
Put the salary in A2 (45000). The taxable income is the salary minus $16,100. Write the tax in B2 using the first three brackets (10% to $12,400, 12% to $50,400, 22% above).
=LET(t, MAX(A2-16100, 0),
0.10*MIN(t, 12400) + 0.12*MAX(MIN(t, 50400)-12400, 0) + 0.22*MAX(MIN(t, 105700)-50400, 0))This returns $3,220.
Taxable income is what’s left after the deduction. In each bracket, tax only the part of taxable income above that bracket’s lower edge l.
def income_tax(income, deduction=16100):
taxable = max(income - deduction, 0)
lower = [0, 12400, 50400, 105700, 201775, 256225, 640600]
upper = lower[1:] + [float("inf")]
rate = [0.10, 0.12, 0.22, 0.24, 0.32, 0.35, 0.37]
return sum(r * max(min(taxable, u) - l, 0) for r, l, u in zip(rate, lower, upper))
income_tax(45000)Taxable income is what’s left after the deduction. In each bracket, tax only the part of taxable income above that bracket’s lower edge.
income_tax <- function(income, deduction = 16100) {
taxable <- max(income - deduction, 0)
lower <- c(0, 12400, 50400, 105700, 201775, 256225, 640600)
upper <- c(lower[-1], Inf)
rate <- c(0.10, 0.12, 0.22, 0.24, 0.32, 0.35, 0.37)
sum(rate * pmax(pmin(taxable, upper) - lower, 0))
}
income_tax(45000)2.2 Level 2: Practice
What is the effective tax rate (tax ÷ income) on a $100,000 salary? Give a decimal.
Change A2 to 100000 and divide the tax by the salary.
The tax is $13,170, so =B2/A2 returns 0.1317. Even with a 22% marginal rate, only 13% of income goes to federal income tax.
Tax on $100,000 divided by $100,000.
income_tax(100000) / 100000Tax on $100,000 divided by $100,000.
income_tax(100000) / 1000002.3 Level 3: Challenge
The marginal rate is the tax on your next dollar: income_tax(salary + 1) - income_tax(salary). Checking salaries in $1,000 steps from $20,000 to $200,000, what is the lowest salary whose next dollar is taxed at 22%?
Work it out from the brackets: the 22% bracket starts at $50,400 of taxable income.
Add back the deduction: =50400 + 16100 is $66,500. The first whole $1,000 above it is $67,000.
Use min(s for s in salaries if round(income_tax(s + 1) - income_tax(s), 2) == 0.22). Rounding avoids tiny decimal errors.
salaries = range(20000, 200001, 1000)
min(s for s in salaries if round(income_tax(s + 1) - income_tax(s), 2) == 0.22)income_tax() uses max(), so it handles one salary at a time. Use sapply(salaries, function(s) income_tax(s + 1) - income_tax(s)), round to 2 digits, then min(salaries[...]).
salaries <- seq(20000, 200000, by = 1000)
marginal <- sapply(salaries, function(s) income_tax(s + 1) - income_tax(s))
min(salaries[round(marginal, 2) == 0.22])3 How Much of a Raise You Keep
The tax on a raise is the tax on the new income minus the tax on the old income. Only the part of the raise above a bracket line gets the higher rate.
Formula: Tax on raise = Tax(new income) − Tax(old income), and Amount kept = Raise − Tax on raise
On $66,000, taxable income goes from $49,900 to $51,900. The first $500 fills the 12% bracket and the last $1,500 is taxed at 22%. The tax rises from $5,740 to $6,130, so you keep $1,610 of the $2,000 (before FICA and state tax).
How to read this result: the share you keep can never drop below 63% (100% minus the top 37% rate). A raise that stays inside one bracket keeps exactly 1 minus that rate. A raise that crosses a line lands somewhere in between.
3.1 Level 1: Guided
Fill in the blanks to finish raise_kept(), then find how much of a $2,000 raise on a $66,000 salary you keep after federal income tax.
With your tax formula from Level 1, put the old salary in A2 (66000) and the new salary in A3 (68000). Find the amount kept.
=2000 - (B3 - B2)The tax rises from $5,740 to $6,130, so you keep $1,610. Part of the raise is taxed at 12% and part at 22%.
The extra tax is the tax on the new salary minus the tax on the old salary.
def raise_kept(old_income, raise_amount):
return raise_amount - (income_tax(old_income + raise_amount) - income_tax(old_income))
raise_kept(66000, 2000)The extra tax is the tax on the new salary minus the tax on the old salary.
raise_kept <- function(old_income, raise) {
raise - (income_tax(old_income + raise) - income_tax(old_income))
}
raise_kept(66000, 2000)3.2 Level 2: Practice
The same $2,000 raise on a $100,000 salary. How much do you keep?
Change the salaries to 100000 and 102000.
The same formula returns $1,560: the whole raise is taxed at 22%.
Old salary 100000, raise 2000.
raise_kept(100000, 2000)Old salary 100000, raise 2000.
raise_kept(100000, 2000)3.3 Level 3: Challenge
Find how much of a $2,000 raise is kept at each of these salaries: $30,000, $45,000, $66,000, $100,000, and $150,000.
Put the salaries in A2:A6, the tax on each in B, the tax on salary + 2,000 in C, and the amount kept in D.
With the tax formula in B and C, D2 is =2000 - (C2 - B2), filled down. The amounts kept are $1,760, $1,760, $1,610, $1,560, and $1,520.
A list comprehension: [raise_kept(o, 2000) for o in old].
old = [30000, 45000, 66000, 100000, 150000]
[raise_kept(o, 2000) for o in old]raise_kept() handles one salary at a time, so use sapply(old, raise_kept, raise = 2000).
old <- c(30000, 45000, 66000, 100000, 150000)
sapply(old, raise_kept, raise = 2000)




