Worked Numerical and Applied Methods: Cholesky Factorisation, Iterative Solvers, Newton and Bisection Counts, Quadrature Errors, Runge–Kutta, the d'Alembert Solution, Sturm Comparison and the Assignment Problem

The Mathematics paper names Cholesky factorisation (numerical analysis), the d'Alembert formula (partial differential equations), Sturm oscillation (ordinary differential equations) and solving assignment problems (linear programming) — and the existing chapters state the methods without the worked arithmetic. The positive-definite matrix [[4,2,2],[2,5,3],[2,3,6]] factors as LLᵀ with L = [[2,0,0],[1,2,0],[1,1,2]]; Newton's method for √2 reaches 1.414216 in three steps from x₀ = 1; Simpson's rule with 2 intervals gives 2.0944 for ∫₀^π sin x dx; one RK4 step on y′ = y has error 8.5e-08; the wave equation with u(x, 0) = e^(−x²) gives u(0, 1) = 0.3679; and the 3 × 3 assignment costs [[9,2,7],[3,6,3],[5,8,1]] have an optimum of 6.
Overview

Cholesky Factorisation, LU and Iterative Solvers

2 min read

A real symmetric positive-definite matrix A has a unique factorisation A = LLᵀ with L lower triangular with positive diagonal (Cholesky), computed by l_jj = √(a_jj − Σ_(k<j)l_jk²) and l_ij = (a_ij − Σ_(k<j)l_ikl_jk)/l_jj for i > j. For A = [[4, 2, 2], [2, 5, 3], [2, 3, 6]]: l₁₁ = 2, l₂₁ = 2/2 = 1, l₃₁ = 1; l₂₂ = √(5 − 1) = 2, l₃₂ = (3 − 1 × 1)/2 = 1; l₃₃ = √(6 − 1 − 1) = 2, so L = [[2,0,0],[1,2,0],[1,1,2]] and det A = (2 × 2 × 2)² = 64. The cost is n³/3 flops, about half of LU, and no pivoting is needed; the algorithm breaks down (a negative number under the root) exactly when A is not positive definite. To solve Ax = b: Ly = b by forward substitution then Lᵀx = y by back substitution. LU factorisation with partial pivoting costs 2n³/3 flops, and for diagonal-dominant matrices pivoting is unnecessary; Doolittle sets the diagonal of L to 1 and Crout that of U.

Iterative methods. Writing A = D + L + U, Jacobi is x^(k+1) = −D⁻¹(L + U)x^(k) + D⁻¹b and Gauss–Seidel uses the newest values, x^(k+1) = −(D + L)⁻¹Ux^(k) + (D + L)⁻¹b. Convergence for any start needs the spectral radius of the iteration matrix below 1; strict diagonal dominance guarantees both, and Gauss–Seidel also converges for symmetric positive-definite A. For M = [[4,1,1],[1,5,2],[1,2,6]] the Jacobi matrix has spectral radius 0.5359 < 1, so each Jacobi sweep reduces the error by that factor asymptotically; for consistently ordered matrices the Gauss–Seidel radius is its square (0.2872), roughly twice as fast. Successive over-relaxation (SOR) with a factor ω in (0, 2) can speed it up, with an optimal ω = 2/(1 + √(1 − ρ_J²)). The condition number κ(A) = ‖A‖‖A⁻¹‖ bounds the amplification of relative error in the solution, ‖δx‖/‖x‖ ≤ κ‖δb‖/‖b‖.

QuantityValue
Cholesky factor of [[4,2,2],[2,5,3],[2,3,6]]L = [[2,0,0],[1,2,0],[1,1,2]]
Determinant64
Cost: Cholesky vs LUn³/3 vs 2n³/3
Jacobi spectral radius of [[4,1,1],[1,5,2],[1,2,6]]0.5359

A real symmetric positive-definite matrix A has a unique factorisation A = LLᵀ with L lower triangular with positive diagonal (Cholesky), computed by l_jj = √(a_jj − Σ_(k<j)l_jk²) and l_ij…

Root-Finding and Quadrature Error Counts

2 min read

Newton: x_(n+1) = x_n − f(x_n)/f′(x_n), quadratically convergent for a simple root (the error squares). For f = x² − 2 from x₀ = 1: x₁ = 1.5, x₂ = 1.416667, x₃ = 1.414216, x₄ = 1.414213562, against √2 = 1.414213562 — the number of correct digits roughly doubles each step (0, 1, 3, 6, 12). Bisection halves the bracket each time: after n steps the error is at most (b − a)/2ⁿ, so to reach 10⁻⁶ from [1, 2] needs n ≥ log₂(10⁶) → 20 steps. The secant method has order (1 + √5)/2 = 1.618 and regula falsi is linear; fixed-point iteration x = g(x) converges if |g′| < 1 near the root (linearly, with rate |g′|) and quadratically if g′(x*) = 0 (Newton is the case g = x − f/f′). Newton fails for a multiple root (linear) unless the multiplicity m is used in x − m f/f′.

Quadrature. The trapezoidal rule has error −(b − a)h²f″(ξ)/12 and Simpson's rule −(b − a)h⁴f⁗(ξ)/180, exact for cubics. For ∫₀^π sin x dx = 2: Simpson with 2 intervals (h = π/2) is (h/3)[0 + 4 × 1 + 0] = 2.0944, error 0.0944; with 4 intervals it is 2.0046, error 0.0046 — the error fell by a factor of 20.7, close to the predicted 2⁴ = 16 when h halves (not exact at this coarse h). The trapezoid with 4 intervals gives 1.8961, error 0.1039, larger than Simpson's. A Gauss–Legendre rule with n points is exact for polynomials of degree 2n − 1: the two-point rule ∫₋₁¹f ≈ f(−1/√3) + f(1/√3) integrates x³ and below exactly. Richardson extrapolation (Romberg) combines two estimates to cancel the leading error term: (4T_(h/2) − T_h)/3 reproduces Simpson.

QuantityValue
Newton for √2 from x₀ = 1: x₁, x₂, x₃1.5; 1.416667; 1.414216
Bisection steps for 10⁻⁶ from [1, 2]20
Simpson n = 2 / n = 4 for ∫₀^π sin x2.0944 / 2.0046
Trapezoid n = 41.8961
Order of the secant method1.618

Newton: x_(n+1) = x_n − f(x_n)/f′(x_n), quadratically convergent for a simple root (the error squares). For f = x² − 2 from x₀ = 1: x₁ = 1.5, x₂ = 1.416667, x₃ = 1.414216, x₄ = 1.414213562…

Runge–Kutta, Euler and Finite-Difference Stability

2 min read · 1 part

For y′ = f(t, y), the Euler step y_(n+1) = y_n + hf has local error O(h²) and global error O(h); classical RK4 uses y_(n+1) = y_n + (h/6)(k₁ + 2k₂ + 2k₃ + k₄) with local error O(h⁵) and global O(h⁴). One step on y′ = y, y(0) = 1, h = 0.1: k₁ = 1, k₂ = 1.05, k₃ = 1.0525, k₄ = 1.10525, so y₁ = 1.1051708333 against e^0.1 = 1.1051709181, an error of 8.5e-08; Euler gives 1.1 with an error of 5.2×10⁻³. For the test equation y′ = λy (λ < 0), Euler is stable only for |1 + hλ| < 1, i.e. h < 2/|λ| (an interval of absolute stability); implicit (backward) Euler is stable for all h > 0 (A-stable) and suits stiff equations. Multistep methods (Adams–Bashforth explicit, Adams–Moulton implicit, predictor–corrector) reuse earlier values at one function evaluation per step, but need a starter and have stability limits.

Finite differences for the heat equation u_t = αu_xx: the explicit (FTCS) scheme u_i^(n+1) = u_i^n + r(u_(i+1)^n − 2u_i^n + u_(i−1)^n) with r = αΔt/Δx² is stable only if r ≤ ½. With α = 1 and Δx = 0.1: Δt ≤ 0.5 × 0.01 = 0.005; halving Δx forces Δt down by 4. Crank–Nicolson (implicit, second order in time) and backward Euler are unconditionally stable, solved with a tridiagonal system at each step (Thomas algorithm, O(n)). The truncation error of the central difference for u_xx is O(Δx²), and the Lax equivalence theorem says that for a consistent linear scheme stability is necessary and sufficient for convergence. For the wave equation the CFL condition cΔt/Δx ≤ 1 limits the explicit leapfrog scheme; for the Laplace equation the five-point formula u_ij = ¼(u_(i+1,j) + u_(i−1,j) + u_(i,j+1) + u_(i,j−1)) is solved iteratively (Jacobi, Gauss–Seidel, SOR).

QuantityValue
RK4 step on y′ = y, h = 0.11.1051708333
RK4 and Euler errors8.5e-08; 5.2×10⁻³
Euler stability limit for y′ = λyh < 2/|λ|
FTCS heat: maximum Δt, α = 1, Δx = 0.10.005

For y′ = f(t, y), the Euler step y_(n+1) = y_n + hf has local error O(h²) and global error O(h); classical RK4 uses y_(n+1) = y_n + (h/6)(k₁ + 2k₂ + 2k₃ + k₄) with local error O(h⁵) and…

The d'Alembert Solution, Sturm Comparison and the Assignment Problem

3 min read · 3 parts

d'Alembert's formula for the infinite-string wave equation u_tt = c²u_xx with u(x, 0) = f(x), u_t(x, 0) = g(x) is u(x, t) = ½[f(x − ct) + f(x + ct)] + (1/2c)∫_(x−ct)^(x+ct) g(s)ds — a forward and a backward travelling wave. With f(x) = e^(−x²), g = 0, c = 1: u(0, 1) = ½[e^(−1) + e^(−1)] = 0.3679; the initial hump splits into two of half height travelling in opposite directions. With f = 0, g(x) = cos x and c = 1: u = ½[sin(x + t) − sin(x − t)] = cos x sin t, so u(0, π/2) = 1.0. The domain of dependence of (x, t) is [x − ct, x + ct] and the domain of influence of a point is a cone; characteristics are x ± ct = constant. A reflected wave on a half-line with a fixed end u(0, t) = 0 uses the odd extension of the data, and with a free end u_x(0, t) = 0 the even extension.

Sturm comparison: if q₂(x) ≥ q₁(x) then between any two zeros of a solution of y″ + q₁y = 0 there is a zero of every solution of y″ + q₂y = 0. For q = k², solutions are sin(kx) with consecutive zeros π/k apart: y″ + 4y = 0 has zeros π/2 apart and y″ + 9y = 0 has them π/3 apart, so every solution of the second equation oscillates faster, with a zero between any two zeros of sin 2x. The Sturm separation theorem: zeros of two independent solutions of the same equation interlace. For y″ + q(x)y = 0, if q ≤ 0 no nontrivial solution has two zeros, and if q > 1/(4x²) (for x > 0) solutions oscillate (infinitely many zeros), the border case being the Euler equation. The assignment problem (n workers, n jobs, cost matrix C) is a transportation problem with unit supplies and demands, solved by the Hungarian method (row and column reductions, then cover the zeros with the minimum number of lines, adjusting until n lines are needed). For C = [[9,2,7],[3,6,3],[5,8,1]], the optimum assignment (worker 1 to job 2, worker 2 to job 1, worker 3 to job 3) costs 2 + 3 + 1 = 6, found by checking all 3! = 6 permutations and by reducing rows (2, 3, 1) and columns.

QuantityValue
d'Alembert u(0, 1) for f = e^(−x²), g = 0, c = 10.3679
u(0, π/2) for f = 0, g = cos x1.0
Zero spacing for y″ + 4y = 0 / y″ + 9y = 0π/2 / π/3
Assignment optimum for [[9,2,7],[3,6,3],[5,8,1]]6
🎯 Cholesky and a bisection count
For the symmetric positive definite matrix [[4, 2], [2, 3]] the Cholesky factor L satisfies LLᵀ = A: l₁₁ = √4 = 2, l₂₁ = 2/2 = 1, l₂₂ = √(3 − 1²) = √2, so L = [[2, 0], [1, √2]], using about half the work of LU. Bisection on [1, 2] to an error below 0.01 needs n with (2 − 1)/2ⁿ < 0.01, i.e. 2ⁿ > 100, n = 7 steps. Jacobi and Gauss–Seidel iterations converge for a strictly diagonally dominant matrix, with Gauss–Seidel normally the faster, and Newton's method roughly doubles the number of correct digits per step near a simple root.

d'Alembert's formula for the infinite-string wave equation u_tt = c²u_xx with u(x, 0) = f(x), u_t(x, 0) = g(x) is u(x, t) = ½[f(x − ct) + f(x + ct)] + (1/2c)∫_(x−ct)^(x+ct) g(s)ds — a…

Key takeaways

  • Cholesky A = LLᵀ for symmetric positive-definite A, l_jj = √(a_jj − Σl_jk²), cost n³/3; Jacobi and Gauss–Seidel converge when the iteration matrix has spectral radius below 1.
  • Newton is quadratic, secant 1.618, bisection halves the bracket (n ≥ log₂((b − a)/ε)); Simpson is exact for cubics with error ∝ h⁴.
  • RK4 has global error O(h⁴); Euler is stable for h < 2/|λ|; the FTCS heat scheme needs r = αΔt/Δx² ≤ ½; the CFL condition limits the wave scheme.
  • d'Alembert u = ½[f(x − ct) + f(x + ct)] + (1/2c)∫g; Sturm comparison forces zeros of the faster oscillator between zeros of the slower; the Hungarian method solves assignment.

Practice questions (24)

Attempt each one before opening the answer. Every explanation names the tempting wrong option as well as the right one, because that is where marks are lost.

  1. A real symmetric matrix has a Cholesky factorisation LLᵀ with real positive diagonal exactly when it is:

    1. positive definite
    2. only nonsingular and sparse
    3. only invertible
    4. only diagonally dominant
    Show answer

    Answer: A — positive definite

    A negative or zero quantity under a square root signals that A is not positive definite; invertibility or diagonal dominance alone does not guarantee the factorisation.
  2. In the Cholesky factor L of [[4,2,2],[2,5,3],[2,3,6]], the entry l₃₃ is:

    Numerical answer — type the value.

    Show answer

    Answer: 2

    l₃₃ = √(a₃₃ − l₃₁² − l₃₂²) = √(6 − 1 − 1) = 2, with L = [[2,0,0],[1,2,0],[1,1,2]].
  3. Newton's method on f(x) = x² − 2 starting at x₀ = 1 gives x₃ equal to (six decimals):

    Numerical answer — type the value.

    Show answer

    Answer: 1.414216

    x₁ = 1.5, x₂ = 1.416667, x₃ = 1.414216, the digits correct roughly doubling each step.
Show the other 21 questions
  1. The minimum number of bisection steps to locate a root in [1, 2] to within 10⁻⁶ (using (b − a)/2ⁿ ≤ 10⁻⁶) is:

    Numerical answer — type the value.

    Show answer

    Answer: 20

    2ⁿ ≥ 10⁶ gives n ≥ log₂ 10⁶ = 19.93, so n = 20.
  2. Simpson's rule with 2 subintervals applied to ∫₀^π sin x dx gives (four decimals):

    Numerical answer — type the value.

    Show answer

    Answer: 2.0944

    h = π/2: (h/3)[0 + 4 × 1 + 0] = (π/6) × 4 = 2.0944; the exact value is 2 and four subintervals give 2.0046.
  3. One classical RK4 step with h = 0.1 on y′ = y, y(0) = 1 gives y₁ (nine decimals):

    Numerical answer — type the value.

    Show answer

    Answer: 1.105170833

    y₁ = 1 + 0.1 + 0.005 + 0.000166667 + 0.00000416667 = 1.105170833, against e^0.1 = 1.105170918.
  4. The explicit scheme for the heat equation u_t = u_xx with Δx = 0.1 is stable only for Δt not exceeding (three decimals):

    Numerical answer — type the value.

    Show answer

    Answer: 0.005

    r = Δt/Δx² ≤ ½ gives Δt ≤ 0.5 × 0.01 = 0.005.
  5. For the wave equation u_tt = u_xx with u(x, 0) = e^(−x²) and u_t(x, 0) = 0, d'Alembert's formula gives u(0, 1) (four decimals) of:

    Numerical answer — type the value.

    Show answer

    Answer: 0.3679

    u(0, 1) = ½[f(−1) + f(1)] = ½[e^(−1) + e^(−1)] = e^(−1) = 0.3679.
  6. For the cost matrix [[9, 2, 7], [3, 6, 3], [5, 8, 1]], the minimum total cost of an assignment of 3 workers to 3 jobs is:

    Numerical answer — type the value.

    Show answer

    Answer: 6

    Worker 1 → job 2 (2), worker 2 → job 1 (3), worker 3 → job 3 (1) costs 6; the other five permutations cost 7 to 21.
  7. Which statements are correct?

    1. Between two zeros of sin 2x, every solution of y″ + 9y = 0 has a zero
    2. Cholesky factorisation works for every symmetric matrix
    3. The explicit FTCS heat scheme is stable for any Δt
    4. Newton's method converges quadratically to a simple root
    Show answer

    Answer: A — Between two zeros of sin 2x, every solution of y″ + 9y = 0 has a zero; D — Newton's method converges quadratically to a simple root

    Sturm comparison gives the first, and the second-order convergence of Newton the third. FTCS needs r ≤ ½, and Cholesky needs positive definiteness.
  8. Forward substitution solves Ly = b with L = [[1, 0], [2, 1]] and b = (3, 8). The component y₂ is ____.

    Numerical answer — type the value.

    Show answer

    Answer: 2

    y₁ = 3, then y₂ = 8 − 2 × 3 = 2. Answering 8 forgets to subtract the contribution of y₁ through the multiplier 2.
  9. The number of arithmetic operations needed by Gaussian elimination on a dense n × n system grows as

    1. n²
    2. n³ (about 2n³/3 flops)
    3. n log n
    4. 2ⁿ
    Show answer

    Answer: B — n³ (about 2n³/3 flops)

    Eliminating below each of n pivots touches an (n − k)² block, summing to about 2n³/3. n² is the cost of the triangular back-substitution alone, the tempting partial count.
  10. One Newton step for f(x) = x² − 4 from x₀ = 3 gives x₁ = ____ (four decimals).

    Numerical answer — type the value.

    Show answer

    Answer: 2.1667

    x₁ = x₀ − f(x₀)/f′(x₀) = 3 − 5/6 = 2.1667, already near the root 2. Dividing by f(x₀) instead of f′(x₀) inverts the correction.
  11. Near a simple root, Newton's method converges

    1. quadratically
    2. with order 1.618
    3. linearly
    4. cubically
    Show answer

    Answer: A — quadratically

    The error obeys eₙ₊₁ ≈ (f″/2f′)eₙ², so correct digits roughly double each step. Order 1.618 belongs to the secant method, and at a multiple root Newton drops to linear.
  12. One Euler step with h = 0.5 for y′ = −y, y(0) = 1 gives y₁ = ____ (one decimal).

    Numerical answer — type the value.

    Show answer

    Answer: 0.5

    y₁ = 1 + 0.5 × (−1) = 0.5, against the exact e^(−0.5) = 0.607; the coarse step underestimates. Answering 1.5 adds the slope instead of following its negative sign.
  13. The upwind scheme for u_t + 2u_x = 0 with Δx = 0.1 is stable for Courant number c·Δt/Δx ≤ 1. The largest allowed Δt (two decimals) is ____.

    Numerical answer — type the value.

    Show answer

    Answer: 0.05

    Δt ≤ Δx/c = 0.1/2 = 0.05: information may not travel more than one cell per step. Multiplying (0.20) inverts the CFL condition.
  14. The fixed-point iteration xₙ₊₁ = cos xₙ starts at x₀ = 0. The value of x₁ is ____.

    Numerical answer — type the value.

    Show answer

    Answer: 1

    x₁ = cos 0 = 1; the iteration then converges (|sin x| < 1 near the root) to about 0.739. Answering 0 confuses x₁ with the starting value.
  15. For A = [[2, 1], [1, 2]], the spectral radius of the Jacobi iteration matrix (one decimal) is ____.

    Numerical answer — type the value.

    Show answer

    Answer: 0.5

    B_J = −D⁻¹(L + U) = [[0, −½], [−½, 0]] has eigenvalues ±½, so ρ = 0.5 < 1 and Jacobi converges. Answering 0.25 gives the Gauss–Seidel value ρ_J² for this consistently ordered matrix.
  16. One regula-falsi step for f(x) = x² − 2 on [1, 2] gives the new point x = ____ (four decimals).

    Numerical answer — type the value.

    Show answer

    Answer: 1.3333

    x = a − f(a)(b − a)/(f(b) − f(a)) = 1 − (−1)(1)/(2 − (−1)) = 4/3 = 1.3333. Bisection would give 1.5; the false-position point uses the chord, weighting towards the end where |f| is smaller.
  17. One step of Heun's method (improved Euler) with h = 0.1 for y′ = y, y(0) = 1 gives y₁ = ____ (three decimals).

    Numerical answer — type the value.

    Show answer

    Answer: 1.105

    k₁ = 1, predictor 1.1 gives k₂ = 1.1, and y₁ = 1 + 0.1 × (1 + 1.1)/2 = 1.105, matching e^0.1 = 1.10517 to second order. Plain Euler gives 1.100.
  18. The explicit scheme uᵢⁿ⁺¹ = uᵢⁿ + r(uᵢ₋₁ⁿ − 2uᵢⁿ + uᵢ₊₁ⁿ) with r = 0.25 is applied where uᵢ₋₁ⁿ = 0, uᵢⁿ = 1, uᵢ₊₁ⁿ = 0. The new value uᵢⁿ⁺¹ (one decimal) is ____.

    Numerical answer — type the value.

    Show answer

    Answer: 0.5

    uᵢⁿ⁺¹ = 1 + 0.25(0 − 2 + 0) = 0.5: the peak diffuses outward. With r > ½ the update would overshoot below zero, the instability that limits r ≤ ½; forgetting the factor 2 gives 0.75.
  19. The order of convergence of the secant method at a simple root, (1 + √5)/2, to three decimals, is ____.

    Numerical answer — type the value.

    Show answer

    Answer: 1.618

    eₙ₊₁ ≈ C eₙeₙ₋₁ leads to p² = p + 1, so p = 1.618, the golden ratio: faster than bisection (1) but slower than Newton (2), at one function evaluation per step.
  20. One classical RK4 step with h = 0.1 for y′ = −2y, y(0) = 1 gives y₁ = ____ (six decimals).

    Numerical answer — type the value.

    Show answer

    Answer: 0.818733

    For y′ = λy, RK4 gives y₁ = 1 + z + z²/2 + z³/6 + z⁴/24 with z = −0.2: 0.818733, versus e^(−0.2) = 0.818731. Stopping at the z² term (0.820000) is the Heun/RK2 value.
  21. Simpson's 3/8 rule with h = 1 is applied to ∫₀³ x³ dx. The result (two decimals) is ____.

    Numerical answer — type the value.

    Show answer

    Answer: 20.25

    S = (3h/8)[f(0) + 3f(1) + 3f(2) + f(3)] = (3/8)(0 + 3 + 24 + 27) = 20.25, equal to the exact 81/4 because the rule is exact for cubics. Using the trapezoidal rule with h = 1 instead gives 22.50, which overestimates the cubic.