A programmer wants the most accurate numerical estimate of f'(x) and chooses h = 10⁻¹⁵, reasoning that smaller h means closer to the limit definition. What actually happens?
AThe estimate improves dramatically because h is nearly zero
BThe estimate degrades because catastrophic cancellation in f(x+h) − f(x) amplifies rounding error, overwhelming any gain from smaller truncation error
CThe estimate is unchanged because floating-point arithmetic handles small differences correctly
DThe truncation error increases when h drops below the optimal value
For double precision (ε_machine ≈ 10⁻¹⁶), the rounding error in the derivative grows as ε_machine/h. At h = 10⁻¹⁵, rounding error ≈ 10⁻¹⁶/10⁻¹⁵ = 0.1 — catastrophically large. The numerator f(x+h) − f(x) involves subtracting two nearly equal floating-point numbers, a process that destroys significant digits. Making h smaller than the optimal h_opt ≈ √(ε_machine) ≈ 10⁻⁸ makes things worse, not better.
Question 2 Multiple Choice
Why does the centered difference formula (f(x+h) − f(x−h))/(2h) have O(h²) truncation error while the forward difference (f(x+h) − f(x))/h has only O(h)?
AThe centered formula uses twice as many function evaluations, which averages out errors
BThe symmetric form causes the O(h) terms in the Taylor expansions to cancel, leaving only O(h²) terms
CThe factor of 2h in the denominator reduces truncation error by a factor of 2
DThe centered formula avoids catastrophic cancellation entirely
Taylor-expanding f(x+h) gives f(x) + hf'(x) + (h²/2)f''(x) + (h³/6)f'''(x) + ⋯, and f(x−h) gives f(x) − hf'(x) + (h²/2)f''(x) − (h³/6)f'''(x) + ⋯. Subtracting: f(x+h) − f(x−h) = 2hf'(x) + (2h³/6)f'''(x) + ⋯. Dividing by 2h: f'(x) + (h²/6)f'''(x) + ⋯. The h² terms from each expansion cancelled exactly because the formula is symmetric. This is 'symmetry buys accuracy for free.'
Question 3 True / False
For numerical differentiation, using a step size h smaller than the optimal value increases total error rather than decreasing it.
TTrue
FFalse
Answer: True
Total error = truncation error + rounding error. Truncation error decreases as h → 0 (proportional to h for forward differences), but rounding error increases as h → 0 (proportional to ε_machine/h). The sum has a minimum at the optimal h. Below this optimal value, rounding error dominates and the total error rises. This is the fundamental tradeoff of numerical differentiation.
Question 4 True / False
Making the step size h as small as possible generally produces the most accurate numerical derivative.
TTrue
FFalse
Answer: False
This is the central misconception. Very small h causes catastrophic cancellation: f(x+h) and f(x) become nearly equal floating-point numbers, and their difference loses significant digits. The rounding error in the derivative then grows as ε_machine/h, increasing without bound as h → 0. The optimal h balances truncation error against rounding error, giving h_opt ≈ √(ε_machine) ≈ 10⁻⁸ for forward differences.
Question 5 Short Answer
Explain the two competing sources of error in numerical differentiation and why they create an optimal step size h.
Think about your answer, then reveal below.
Model answer: Truncation error arises because the finite-difference formula approximates the derivative using only finitely many terms of a Taylor expansion — the omitted higher-order terms contribute error proportional to h (for forward differences) or h² (for centered). Rounding error arises from floating-point arithmetic: as h shrinks, f(x+h) and f(x) become nearly equal, and their subtraction destroys significant digits through catastrophic cancellation, producing error proportional to ε_machine/h. Truncation error decreases as h → 0 while rounding error increases, so their sum has a minimum at an optimal h that balances both.
The optimal h_opt ≈ √(ε_machine) for forward differences and ≈ ε_machine^(1/3) for centered differences. Below this value, rounding dominates; above it, truncation dominates. This is a fundamental computational limit — you cannot beat it without more sophisticated methods like Richardson extrapolation.