Midterm Review

Math 128A, Fall 2026 · Per-Olof Persson

Worked solutions to a selection of review exercises, covering Chapters 1 through 4.1. Exercise numbers refer to Burden and Faires.

1.2.6(c) — Four-digit rounding arithmetic

Evaluate \[ (121 \ominus 0.327) \ominus 119 \] using four-digit rounding arithmetic, and find the absolute and relative errors.

Solution.

Work from the inside out, rounding to four digits after each operation: \[ \begin{aligned} (121 \ominus 0.327) \ominus 119 &= fl(120.673) \ominus 119 \\ &= 120.7 \ominus 119 \\ &= fl(1.7) = 1.7 . \end{aligned} \]

The true value is \[ 121 - 0.327 - 119 = 1.673, \] so the errors are \[ \text{absolute error} = |1.7 - 1.673| = 0.027, \qquad \text{relative error} = \frac{0.027}{1.673} = 0.0161 . \]

For the number of significant digits, find the largest \(t\) with \[ \frac{|p - p^*|}{|p|} \le 5\times 10^{-t} . \] Since \(0.0161 \le 5\times 10^{-2} = 0.05\) but \(0.0161 > 5\times 10^{-3}\), the answer is good to 2 significant digits — a single subtraction of nearby numbers has cost two of the four digits we started with.

1.3.9(a) — A weaker rate of convergence still holds

Suppose \(0 < q < p\) and \(F(h) = L + O(h^p)\). Show that \(F(h) = L + O(h^q)\).

Solution.

By definition of \(O(h^p)\) there are constants \(K\) and \(\delta\) with \[ |F(h) - L| \le K|h^p| \qquad\text{whenever } |h| < \delta . \]

Split off the extra power. Since \(p - q > 0\) and \(|h| < \delta\), \[ |F(h) - L| \le K|h|^{p-q}|h|^{q} \le K\delta^{\,p-q}|h^q| = K_2|h^q| \qquad\text{whenever } |h| < \delta, \] with \(K_2 = K\delta^{\,p-q}\) a constant. That is exactly the statement \[ F(h) = L + O(h^q). \]

The content is that a higher-order rate implies every lower-order one: \(O(h^2)\) convergence is also \(O(h)\) convergence, just stated less sharply.

2.2.9 — A unique fixed point, and how many iterations

Show that \(g(x) = \pi + 0.5\sin\frac{x}{2}\) has a unique fixed point on \([0, 2\pi]\), and find how many iterations are needed for an error of at most \(10^{-2}\) starting from \(p_0 = \pi\).

Solution.

(a) \(g\) maps the interval into itself. Since \(\sin\frac{x}{2} \in [-1,1]\), \[ g(x) \in \left[\pi - 0.5,\ \pi + 0.5\right] \subset [0, 2\pi] \qquad\text{for } x \in [0,2\pi] . \]

(b) The derivative is bounded. \[ g'(x) = 0.25\cos\frac{x}{2} \in [-0.25,\ 0.25], \] so \[ |g'(x)| \le k = \tfrac14 < 1 \qquad\text{for } x \in [0,2\pi]. \]

Both hypotheses of the fixed-point theorem hold, so there is a unique fixed point in \([0,2\pi]\).

Iteration count. The error bound is \(|p_n - p| \le k^n|p_0 - p|\), and with \(p_0 = \pi\) the initial error is at most \(\pi\). Requiring \[ \left(\tfrac14\right)^{n}\pi \le 10^{-2} \qquad\Longrightarrow\qquad 4^{\,n} \ge 100\pi, \] and taking logarithms, \[ n \ge \frac{\log(100\pi)}{\log 4} = 4.15 . \] So 5 iterations suffice.

2.5.17(a) — Taylor polynomials satisfy the Aitken condition

Let \(P_n(x)\) be the \(n\)th Taylor polynomial for \(f(x) = e^x\) about \(x_0 = 0\), and set \(p_n = P_n(x)\). Show that \(\{p_n\}\) satisfies the hypothesis of Aitken’s theorem.

Solution.

The limit is \(p = e^x\), and the Taylor remainder gives \[ P_n(x) - e^x = -\frac{e^{\xi_n}}{(n+1)!}x^{\,n+1}, \qquad \xi_n \in [0, x]. \]

Forming the ratio the theorem asks about, the factorials and powers of \(x\) telescope: \[ \frac{p_{n+1} - p}{p_n - p} = \frac{P_{n+1}(x) - e^x}{P_n(x) - e^x} = \frac{-e^{\xi_{n+1}}x^{\,n+2}/(n+2)!}{-e^{\xi_n}x^{\,n+1}/(n+1)!} = \frac{e^{\xi_{n+1}}}{e^{\xi_n}}\cdot\frac{x}{n+2}. \]

Both \(\xi_n\) and \(\xi_{n+1}\) lie in \([0,x]\), so the exponential factor stays bounded while \(\dfrac{x}{n+2} \to 0\). Hence \[ \frac{p_{n+1} - p}{p_n - p} \longrightarrow 0 \qquad\text{as } n \to \infty, \] which is a limit of modulus less than one — the condition Aitken’s \(\Delta^2\) method requires.

3.5.11 — Completing a natural cubic spline

A natural cubic spline \(S\) on \([0,2]\) is given by \[ S(x) = \begin{cases} S_0(x) = 1 + 2x - x^3, & 0 \le x \le 1, \\[4pt] S_1(x) = 2 + b(x-1) + c(x-1)^2 + d(x-1)^3, & 1 \le x \le 2 . \end{cases} \] Find \(b\), \(c\) and \(d\).

Solution.

Each spline condition pins down one coefficient.

(c) Continuity of value at \(x=1\). \[ S_0(1) = 1 + 2 - 1 = 2, \qquad S_1(1) = 2 . \qquad\checkmark \] These already agree, so nothing is determined here.

(d) Continuity of the first derivative. Differentiating, \(S_0'(x) = 2 - 3x^2\), so \[ S_0'(1) = 2 - 3\cdot 1^2 = -1, \qquad S_1'(1) = b \qquad\Longrightarrow\qquad \boxed{b = -1}. \]

(e) Continuity of the second derivative. With \(S_0''(x) = -6x\), \[ S_0''(1) = -6, \qquad S_1''(1) = 2c \qquad\Longrightarrow\qquad \boxed{c = -3}. \]

(f) The natural boundary conditions. At the left end, \[ S_0''(0) = -6\cdot 0 = 0, \qquad\checkmark \] which holds automatically. At the right end, \[ S_1''(2) = 2c + 6d(2-1) = 0 \qquad\Longrightarrow\qquad d = -\frac{c}{3} = \boxed{1}. \]

4.1.28 — A finite-difference formula for the third derivative

Derive an approximation to \(f'''(x_0)\) using Taylor polynomials.

Solution.

Expand at the four points \(x_0 \pm h\) and \(x_0 \pm 2h\), keeping terms through \(h^4\): \[ \begin{aligned} f(x_0-2h) &= f(x_0) - 2hf'(x_0) + \tfrac{4h^2}{2}f''(x_0) - \tfrac{8h^3}{6}f'''(x_0) + \tfrac{16h^4}{24}f^{(4)}(x_0) + O(h^5), \\ f(x_0-h) &= f(x_0) - hf'(x_0) + \tfrac{h^2}{2}f''(x_0) - \tfrac{h^3}{6}f'''(x_0) + \tfrac{h^4}{24}f^{(4)}(x_0) + O(h^5), \\ f(x_0+h) &= f(x_0) + hf'(x_0) + \tfrac{h^2}{2}f''(x_0) + \tfrac{h^3}{6}f'''(x_0) + \tfrac{h^4}{24}f^{(4)}(x_0) + O(h^5), \\ f(x_0+2h) &= f(x_0) + 2hf'(x_0) + \tfrac{4h^2}{2}f''(x_0) + \tfrac{8h^3}{6}f'''(x_0) + \tfrac{16h^4}{24}f^{(4)}(x_0) + O(h^5). \end{aligned} \]

Antisymmetric combinations. Subtracting the pairs kills every even-order term, including the \(f^{(4)}\) one: \[ \begin{aligned} f(x_0+h) - f(x_0-h) &= 2hf'(x_0) + \tfrac{2h^3}{6}f'''(x_0) + O(h^5), \\ f(x_0+2h) - f(x_0-2h) &= 4hf'(x_0) + \tfrac{16h^3}{6}f'''(x_0) + O(h^5). \end{aligned} \]

Eliminating \(f'\). Take the second minus twice the first, so the \(4hf'\) terms cancel: \[ \begin{aligned} f(x_0+2h) - 2f(x_0+h) + 2f(x_0-h) - f(x_0-2h) &= \left(\tfrac{16}{6} - \tfrac{4}{6}\right)h^3 f'''(x_0) + O(h^5) \\ &= \tfrac{12h^3}{6}f'''(x_0) + O(h^5) \\ &= 2h^3 f'''(x_0) + O(h^5). \end{aligned} \]

Solving, \[ f'''(x_0) = \frac{1}{2h^3}\Bigl[f(x_0+2h) - 2f(x_0+h) + 2f(x_0-h) - f(x_0-2h)\Bigr] + O(h^2), \] a second-order accurate formula. The symmetry of the stencil is what buys the \(O(h^2)\): an unsymmetric combination would only be \(O(h)\).