43.10.06 · numerical-analysis / 10-numerical-odes

Finite-difference methods for two-point boundary-value problems

shipped3 tiersLean: none

Anchor (Master): LeVeque 2007 *Finite Difference Methods for Ordinary and Partial Differential Equations* (SIAM) Ch. 2 (the steady-state BVP in full: variable coefficients $(\kappa u')'$, the discrete Green's function and comparison-function stability bound, the half-order Neumann pitfall, and Newton on the discrete nonlinear system); Keller 1992 *Numerical Methods for Two-Point Boundary-Value Problems* (Dover) Ch. 1-3 (shooting, multiple shooting, and the finite-difference method with its convergence theory); Stoer-Bulirsch 2002 *Introduction to Numerical Analysis* 3e (Springer) §7.3 (shooting, multiple shooting, and difference methods for boundary-value problems)

Intuition Beginner

An initial-value problem hands you everything at one end: a starting height and a starting slope, and you march forward. A two-point boundary-value problem is stingier. It tells you the height at the left end of an interval and the height at the right end, and asks for the curve in between that obeys a differential equation and threads both pins. You know where the rope is nailed at both walls; you must find the sag.

This change of question changes the method. You can no longer just walk forward, because you are not given the starting slope. Two honest tricks get around this. The first is to guess the missing slope, march forward as if it were an initial-value problem, and see where you land at the far wall. If you overshoot, lower the guess; if you undershoot, raise it. Correcting the guess until you hit the right end on the nose is the shooting method, named for aiming a cannon.

The second trick refuses to march at all. Lay down a row of grid points across the interval and, at each one, replace the second derivative by a simple comparison of a point with its two neighbours: how far it sits below their average. Writing that relation at every interior point gives a tidy system of linear equations, one per unknown, each touching only a point and its two neighbours. That banded system is the finite-difference method, and you solve it all at once instead of stepping through it.

Two questions then matter, the same two that matter for every approximation. Does the grid answer approach the true answer as the grid gets finer? And can the method invent a value the true solution would never take? For the steady problems here the answers are yes-it-converges, at a rate set by the spacing squared, and no-it-cannot, because of a discrete echo of a fact about the smooth problem: with no source pushing, the solution sits between its boundary values and never overshoots them.

Visual Beginner

The picture is a single interior grid point with its two neighbours, and the weights the second-difference stencil attaches to each. The centre point is compared against the average of the point to its left and the point to its right.

The stencil places a weight of two on the centre and a weight of minus one on each neighbour, all divided by the square of the spacing. When the source is zero, this forces the centre value to be exactly the average of its left and right neighbours — a straight line through the two.

          -1        +2        -1
   (j-1) ------- ( j ) ------- (j+1)
     |             |             |
   U_{j-1}        U_j         U_{j+1}
position weight in the stencil meaning
centre point the value being solved for
each of the two neighbours pulls the centre toward the neighbour average
anything else the stencil is local, so the system is tridiagonal

The takeaway: the entire finite-difference method is this one small picture, copied to every interior grid point in a single line of points. The two endpoint dots are not unknowns — their values are handed to you by the boundary data — so the unknowns are only the interior dots, and each one is tied to just two neighbours. That is why the linear system is tridiagonal and cheap to solve.

Worked example Beginner

Let us solve the smallest interesting case by hand. Take the interval from to and put down a grid with spacing , so there are three interior points at , , . We solve with a constant source , and boundary values and .

The true solution of with both ends pinned at is the downward parabola , so we have an exact answer to check against: , , .

Step 1. Write the stencil at each interior point. The relation becomes . With , , so at every interior point.

Step 2. Plug in the three points, using and at the ends. At : . At : . At : .

Step 3. Use the left-right symmetry of the data: . The middle equation becomes , so . The first equation is ; substitute : , giving .

Step 4. Read off the rest: and .

What this tells us: the three grid values are , , — and they match the exact answer at these points exactly. That is special to this example: the source is constant, so the true solution is a quadratic, and the centred second difference reproduces the second derivative of a quadratic with no error at all. For a general source the grid answer would be close but not exact, with a gap that shrinks like the spacing squared.

Check your understanding Beginner

Formal definition Intermediate+

Consider the linear two-point boundary-value problem on a bounded interval , $$ -u''(x) + q(x),u(x) = f(x), \quad x \in (a,b), \qquad u(a) = \alpha, \ \ u(b) = \beta, $$ with , , , and Dirichlet data . The continuous existence and uniqueness of a classical solution under is taken as input from the boundary-value theory of the underlying ODE; this unit is the numerical treatment. The more general variable-coefficient (divergence/self-adjoint) form is $$ -\big(\kappa(x),u'(x)\big)' + q(x),u(x) = f(x), \qquad \kappa(x) \ge \kappa_0 > 0, $$ which reduces to the first form when .

The grid and the second-difference operator. Fix , set the mesh width , and place grid points for . The interior indices are , numbering unknowns ; the boundary values , are fixed by the data. For a grid function the second-difference operator is $$ (D^2 V)j = \frac{V{j-1} - 2V_j + V_{j+1}}{h^2}, $$ and the discretised problem replaces by : $$ -\frac{U_{j-1} - 2U_j + U_{j+1}}{h^2} + q_j U_j = f_j, \qquad q_j = q(x_j), \ f_j = f(x_j), $$ at every interior , with substituted from the data.

The tridiagonal system. Collecting the interior unknowns into gives the linear system $$ A_h,U = F, \qquad A_h = \frac{1}{h^2},\mathrm{tridiag}(-1,,2,,-1) + \mathrm{diag}(q_1,\dots,q_N), $$ where except in the two boundary-adjacent rows, which carry the moved data: and . The matrix is symmetric, tridiagonal, has diagonal entries and off-diagonal entries , and is solved by the Thomas algorithm — Gaussian elimination 43.03.01 specialised to a tridiagonal matrix, costing operations with no fill-in. For the variable-coefficient form, the conservative discretisation evaluates at the cell midpoints : $$ -\big(\kappa(x)u'\big)'\big|{x_j} \approx -\frac{\kappa{j+1/2}(U_{j+1}-U_j) - \kappa_{j-1/2}(U_j - U_{j-1})}{h^2}, $$ which keeps symmetric tridiagonal with off-diagonals and preserves the sign pattern.

Local truncation error. The local truncation error is the residual obtained by inserting the exact solution into the discrete operator, $$ \tau_j = \Big[-D^2 u(x_j) + q_j u(x_j)\Big] - f_j = -D^2 u(x_j) + u''(x_j), $$ measuring the failure of the exact solution to satisfy the discrete equation. The scheme is consistent of order if . The symbols , , the tridiagonal generator , the discrete maximum norm , and the Landau symbol are introduced here with these definitions.

M-matrix and monotonicity. A real square matrix is an M-matrix if it has nonpositive off-diagonal entries and a nonnegative inverse ( entrywise); equivalently here, is monotone implies entrywise. The sign pattern of (positive diagonal, nonpositive off-diagonals) together with weak diagonal dominance (, with strict dominance in the boundary-adjacent rows once the data is moved to ) and irreducibility delivers this structure, the algebraic carrier of the discrete maximum principle.

Counterexamples to common slips

  • Consistency is not convergence. The truncation error measures how well the exact solution satisfies the discrete equation; alone it says nothing about how far the computed lies from . Bridging the two needs the stability bound on . A scheme can be consistent yet diverge if its discrete operator is not stable.

  • The naive one-sided Neumann difference is only first order. Imposing a Neumann condition by the one-sided difference has truncation error , which pollutes the global error down to first order even though the interior stencil is . The centred ghost-point treatment restores second order; conflating the two loses an order of accuracy.

  • The shooting residual can be ill-conditioned even when the BVP is well-posed. For problems with growing modes, the initial-value map amplifies the slope guess exponentially, so the residual is steep and a small error in swings wildly. The BVP is well-conditioned; the IVP reformulation need not be. Multiple shooting is the remedy.

  • The boundary values are data, not unknowns. Only the interior values are solved for; the boundary grid values enter through the right-hand side . Treating boundary points as unknowns mis-sizes the system and breaks the M-matrix structure.

Key theorem with proof Intermediate+

The signature result is that the centred finite-difference scheme for the two-point BVP converges at second order in the maximum norm, and that this follows from two separately checkable facts: a consistency estimate (the truncation error is ) and a stability estimate (the discrete solution operator is bounded in the maximum norm uniformly in ). The stability estimate is itself a consequence of the discrete maximum principle, and the sharp constant is geometric.

Theorem (consistency + stability convergence). Let solve on with and Dirichlet data , , and let solve the tridiagonal system . Then there is a constant , independent of , with $$ |U - u|\infty := \max{1\le j\le N} |U_j - u(x_j)| \le C,h^2 \max_{[a,b]} |u''''|, \qquad C = \frac{(b-a)^2}{96}. $$ [LeVeque, R. J. — Finite Difference Methods for Ordinary and Partial Differential Equations: Steady-State and Time-Dependent Problems; Süli, E. & Mayers, D. F. — An Introduction to Numerical Analysis]

Proof. Let be the global error grid function, vanishing at . Since encodes , and the exact solution satisfies by the definition of the truncation error, subtraction gives at every interior point, that is with vanishing on the boundary.

Consistency. Expand in a Taylor series about . The centred second difference gives $$ \frac{u(x_{j-1}) - 2u(x_j) + u(x_{j+1})}{h^2} = u''(x_j) + \frac{h^2}{12}u''''(\xi_j), $$ for some , the odd-order terms cancelling by symmetry. Hence , so .

Stability. The claim is the uniform bound . Introduce the comparison (barrier) grid function , the restriction of a quadratic with , hence exactly at every interior point (the centred second difference of a quadratic is its exact second derivative). On , , the maximum attained at the midpoint. Given any interior grid function with and on the boundary, set . Using , at every interior point $$ (A_h W^{\pm})j = \pm R_j - |R|\infty(-D^2\phi_j + q_j\phi_j) = \pm R_j - |R|\infty(1 + q_j\phi_j) \le \pm R_j - |R|\infty \le 0, $$ since and each component of is at most ; on the boundary . The discrete maximum principle (Proposition 1 below) gives throughout, that is . Hence , which is exactly .

Synthesis. Apply the stability bound to , which satisfies and vanishes on the boundary: $$ |E|\infty \le \frac{(b-a)^2}{8}|A_h E|\infty = \frac{(b-a)^2}{8}|\tau|\infty \le \frac{(b-a)^2}{8}\cdot\frac{h^2}{12}\max{[a,b]}|u''''| = \frac{(b-a)^2}{96}h^2\max_{[a,b]}|u''''|. $$ This is the stated estimate with .

Bridge. This proof is the foundational reason the difference method is trusted: it factors the error into a consistency piece, controlled by Taylor expansion of the stencil, and a stability piece, controlled by the maximum-norm bound on , and their product is the convergence rate. This is exactly the consistency-plus-stability template that builds toward the two-dimensional elliptic theory of 43.11.01, where the same comparison-function argument bounds the inverse of the 5-point Laplacian and the very tridiagonal generator here reappears as the Kronecker factor assembled into ; it generalises the discrete-Gronwall stability idea of the IVP theory 43.10.01, where the role here played by was played by the accumulated one-step amplification factor. The stability half is dual to the consistency half — one bounds how the scheme amplifies residuals, the other bounds the residual the exact solution leaves behind — and putting these together is the central insight that a consistent, stable discretisation converges at the consistency rate. The same pattern appears again in the shooting method, where the stability question migrates from to the conditioning of the initial-value map that the Newton root-solve inverts.

Exercises Intermediate+

Advanced results Master

Theorem 1 ( is a symmetric positive definite M-matrix). For the matrix is symmetric, has positive diagonal entries and nonpositive off-diagonal entries , is irreducible (the grid path is connected) and weakly diagonally dominant with strict dominance in the boundary-adjacent rows, and is therefore a nonsingular M-matrix with entrywise. It is moreover positive definite: the tridiagonal part has eigenvalues and , so the sum is positive definite. Monotonicity () is equivalent to and is the matrix form of the discrete maximum principle [LeVeque, R. J. — Finite Difference Methods for Ordinary and Partial Differential Equations: Steady-State and Time-Dependent Problems].

Theorem 2 (the discrete Green's function and the sharp stability constant). For the Dirichlet problem with the inverse has nonnegative entries , the discrete Green's function, satisfying the row-sum identity for the barrier with ; consequently , a mesh-independent constant. For the pure problem this is sharp, and converges entrywise to the continuous Green's function of on . The maximum-norm convergence rate is the product of this stability constant with the truncation error [Süli, E. & Mayers, D. F. — An Introduction to Numerical Analysis].

Theorem 3 (Neumann/Robin conditions, ghost points, and the half-order pitfall). A Neumann condition imposed by the one-sided difference has truncation error , and this boundary residual degrades the global convergence to first order despite the interior stencil. The second-order remedy introduces a ghost point and a fictitious value , imposes the centred condition , and applies the interior stencil at the boundary node itself; eliminating yields a modified first row that restores , at the cost of breaking the symmetry of unless the equation is rescaled by in the Neumann row. A Robin condition () is handled identically by the ghost-point centred difference, and the resulting first row preserves the M-matrix sign pattern. The discrete operator on a pure-Neumann or periodic interval is singular (the constant grid function is a null vector), reflecting the continuous solvability constraint [LeVeque, R. J. — Finite Difference Methods for Ordinary and Partial Differential Equations: Steady-State and Time-Dependent Problems].

Theorem 4 (nonlinear BVPs by Newton, and the contrast with shooting). For the nonlinear two-point BVP with Dirichlet data, the centred discretisation (with ) is a nonlinear system whose Newton iteration 43.02.03 has tridiagonal Jacobian $$ J(U) = \tfrac1{h^2}\mathrm{tridiag}(-1,2,-1) - \mathrm{diag}(g_u(x_j, U_j, D_0 U_j)) - \tfrac{1}{2h}\mathrm{antidiag}\big(g_{u'}\big), $$ solved in per step; when and the Jacobian remains an M-matrix and Newton converges quadratically from a good initial guess. The shooting alternative recasts the BVP as the IVP , , , integrated by a one-step method 43.10.01, and solves the residual by Newton, with obtained from the variational (sensitivity) IVP , , . Shooting inherits the conditioning of the IVP: for problems with exponentially growing modes the map is exponentially sensitive, and multiple shooting — partitioning and matching at interface nodes — is the stabilised variant that trades the ill-conditioned single trajectory for a larger but well-conditioned coupled system [Keller, H. B. — Numerical Methods for Two-Point Boundary-Value Problems].

Synthesis. The one-dimensional two-point BVP is the model case in which consistency and stability are each visible as a separate, checkable structure, and convergence is their product: the foundational reason the difference method works is that is an M-matrix, and this single algebraic fact carries the discrete maximum principle, the inverse-monotonicity , the sharp mesh-independent stability constant , and the nonnegativity of the discrete Green's function. This is exactly the discrete shadow of the continuous BVP, whose Green's function approximates and whose comparison/barrier argument the stability proof restricts to the grid. The central insight is that the maximum norm, not the energy norm, is the natural setting for the finite-difference method — the M-matrix monotonicity is an phenomenon — and this same apparatus is dual to the two-dimensional elliptic theory of 43.11.01, where the tridiagonal generator here becomes the Kronecker factor of the 5-point Laplacian and the quadratic barrier becomes the paraboloid comparison function. Putting these together, the consistency-plus-stability proof here generalises into the Lax-Richtmyer framework for evolution problems and specialises, in the shooting method, into a statement about the conditioning of an initial-value flow composed with a Newton root-solve; the bridge throughout is that local accuracy fixed by Taylor matching, propagated under a stability bound, yields global convergence at the consistency rate, whether the stability lives in or in the derivative of the shooting map.

Full proof set Master

Proposition 1 (discrete maximum principle, ). If a grid function on satisfies at every interior point with , then ; in particular if on the boundary then throughout.

Proof. The hypothesis is . Let and suppose is attained at an interior index . Then , so , hence . Equality forces both neighbours to equal and . If this gives , contradicting . Where on a stretch of interior points, equality propagates along the connected path until it reaches an index adjacent to the boundary; that boundary value then also equals , so . In all cases . The final clause is the case .

Proposition 2 ( is monotone: ). For the matrix representing on the interior with Dirichlet boundary is nonsingular and entrywise; equivalently, implies .

Proof. Nonsingularity: if with on the boundary, then satisfies both and , so by Proposition 1 applied to and to both and are controlled by the boundary values ; hence and is injective, thus invertible. For monotonicity, suppose , i.e. , with on the boundary. Apply Proposition 1 to : satisfies , so , giving everywhere. Taking for each basis vector shows every column of is nonnegative, hence . The sign pattern (positive diagonal, nonpositive off-diagonals) together with this nonnegative inverse is the definition of an M-matrix.

Proposition 3 (uniform stability bound ). For every and , the discrete solution operator satisfies , independent of .

Proof. Let be the grid restriction of , for which and, since is quadratic and the centred second difference is exact on quadratics, at every interior point. On , with the maximum at the midpoint. Fix a right-hand side and let , so on the boundary. Set . At interior points, using and , $$ (-D^2 Z^\pm_j + q_j Z^\pm_j) = \pm R_j - |R|\infty(-D^2\phi_j + q_j\phi_j) = \pm R_j - |R|\infty(1 + q_j\phi_j) \le \pm R_j - |R|\infty \le 0, $$ since $|R_j| \le |R|\inftyZ^\pm = -|R|\infty\phi \le 0Z^\pm \le 0\pm W_j \le |R|\infty\phi_j \le \tfrac{(b-a)^2}{8}|R|\inftyj|W|\infty \le \tfrac{(b-a)^2}{8}|R|\inftyR|A_h^{-1}|\infty \le (b-a)^2/8\square$

Proposition 4 (exact eigensystem of the Dirichlet second-difference matrix). On with , the matrix has the orthogonal eigenvectors , , with eigenvalues .

Proof. Write and , noting so . Apply at interior index : $$ (T_h s^{(k)})_j = \frac{-\sin((j-1)\theta_k) + 2\sin(j\theta_k) - \sin((j+1)\theta_k)}{h^2}. $$ The identity gives $$ (T_h s^{(k)})_j = \frac{2\sin(j\theta_k)(1 - \cos\theta_k)}{h^2} = \frac{2(1-\cos\theta_k)}{h^2},s^{(k)}_j = \frac{4}{h^2}\sin^2!\tfrac{\theta_k}{2},s^{(k)}_j, $$ the last step by the half-angle identity. The boundary entries vanish: and , so is a genuine interior eigenvector with . The vectors are orthogonal (discrete sine transform) and complete in . Adding shifts the quadratic form by a nonnegative amount, so is positive definite with smallest eigenvalue as .

Connections Master

  • The one-step ODE integrators of 43.10.01 are the engine inside the shooting method: shooting recasts the two-point BVP as the initial-value problem with an unknown initial slope , marches it to the far endpoint with an Euler/Runge-Kutta scheme of known order, and reads the boundary residual . The accuracy of the integrator sets the accuracy of , and the IVP convergence theory of that unit is what guarantees the shooting trajectory itself is computed to order ; this unit supplies the boundary-coupling and root-solve layer that wraps around the IVP march.

  • The Newton and secant root-finders of 43.02.03 solve the two nonlinear equations this unit produces: the scalar shooting residual (with from the variational IVP, or one exact secant step in the linear case), and the discrete nonlinear system from a nonlinear BVP, whose tridiagonal Jacobian makes each Newton step an solve. The superlinear/quadratic convergence theory there is what certifies that the outer iteration of both methods terminates rapidly near a solution.

  • The Gaussian-elimination and LU theory of 43.03.01 is what actually solves the tridiagonal system at the heart of the finite-difference method: specialised to a tridiagonal matrix, elimination becomes the Thomas algorithm, costing operations with no fill-in, and the symmetric positive definiteness of established here means the factorisation needs no pivoting. Each Newton step of a nonlinear BVP is one such tridiagonal solve, so the linear-solver unit is invoked once per outer iteration.

  • The two-dimensional elliptic finite-difference theory of 43.11.01 is the direct multidimensional successor: the tridiagonal generator that is the whole operator here becomes the Kronecker factor assembled into the 5-point Laplacian there, the quadratic barrier becomes the paraboloid comparison function on the square, and the one-dimensional discrete maximum principle becomes the two-dimensional one. This unit is the genuinely one-dimensional ODE-BVP precursor of that elliptic PDE unit; it owns the scalar two-point problem, shooting, variable coefficients, and the ghost-point boundary conditions, while that unit owns the Kronecker assembly and the explicit two-dimensional spectrum.

  • The continuous nth-order linear ODE theory of 02.06.02 is the object this unit discretises and the source of the superposition principle that makes linear shooting exact in one step: the decomposition into a particular and a homogeneous solution is exactly the structure of the general solution of a linear ODE, and the well-posedness of the BVP (uniqueness when ) rests on the continuous boundary-value theory the numerical method approximates without reproving.

Historical & philosophical context Master

The finite-difference treatment of boundary-value problems for ordinary differential equations descends from the same 1928 work of Richard Courant, Kurt Friedrichs, and Hans Lewy, Über die partiellen Differenzengleichungen der mathematischen Physik (Mathematische Annalen 100, 32–74) [Courant, Friedrichs & Lewy 1928], that founded the convergence theory of difference schemes; their use of the discrete maximum principle and a comparison function to bound the discrete inverse is the argument that, specialised to one dimension, gives the stability constant used here. The recasting of convergence into the algebraic language of monotone and M-matrices — the inverse-positivity property that carries the discrete maximum principle — is due to the matrix-theoretic tradition of Lothar Collatz, whose The Numerical Treatment of Differential Equations (Springer, 1960) developed the discrete maximum principle for two-point problems, and Richard Varga, whose Matrix Iterative Analysis (Prentice-Hall, 1962) connected diagonal dominance and irreducibility to monotonicity.

The shooting method and its multiple-shooting stabilisation, together with the systematic finite-difference theory for linear and nonlinear two-point boundary-value problems, were consolidated by Herbert B. Keller in Numerical Methods for Two-Point Boundary-Value Problems (Blaisdell, 1968; reprinted Dover, 1992) [Keller, H. B. — Numerical Methods for Two-Point Boundary-Value Problems], which gave the conditioning analysis explaining why single shooting fails for problems with growing modes and how matching across subintervals repairs it. The variable-coefficient conservative discretisation and the ghost-point treatment of Neumann and Robin conditions, with the attendant half-order accuracy caveat, are developed in Randall LeVeque's Finite Difference Methods for Ordinary and Partial Differential Equations (SIAM, 2007) [LeVeque, R. J. — Finite Difference Methods for Ordinary and Partial Differential Equations: Steady-State and Time-Dependent Problems], whose Chapter 2 is the steady-state one-dimensional core that this unit follows.

Bibliography Master

@book{leveque2007fdm,
  author    = {LeVeque, Randall J.},
  title     = {Finite Difference Methods for Ordinary and Partial Differential Equations: Steady-State and Time-Dependent Problems},
  publisher = {Society for Industrial and Applied Mathematics (SIAM)},
  year      = {2007}
}

@book{sulimayers2003,
  author    = {S\"{u}li, Endre and Mayers, David F.},
  title     = {An Introduction to Numerical Analysis},
  publisher = {Cambridge University Press},
  year      = {2003}
}

@book{keller1992twopoint,
  author    = {Keller, Herbert B.},
  title     = {Numerical Methods for Two-Point Boundary-Value Problems},
  publisher = {Dover Publications},
  year      = {1992},
  note      = {Reprint of the Blaisdell edition, 1968}
}

@book{stoerbulirsch2002,
  author    = {Stoer, Josef and Bulirsch, Roland},
  title     = {Introduction to Numerical Analysis},
  edition   = {3},
  series    = {Texts in Applied Mathematics},
  volume    = {12},
  publisher = {Springer-Verlag},
  year      = {2002}
}

@book{collatz1960differential,
  author    = {Collatz, Lothar},
  title     = {The Numerical Treatment of Differential Equations},
  edition   = {3},
  publisher = {Springer-Verlag},
  year      = {1960}
}

@book{varga2000matrix,
  author    = {Varga, Richard S.},
  title     = {Matrix Iterative Analysis},
  edition   = {2},
  publisher = {Springer-Verlag},
  year      = {2000}
}

@article{courantfriedrichslewy1928,
  author  = {Courant, Richard and Friedrichs, Kurt and Lewy, Hans},
  title   = {{\"U}ber die partiellen Differenzengleichungen der mathematischen Physik},
  journal = {Mathematische Annalen},
  volume  = {100},
  number  = {1},
  year    = {1928},
  pages   = {32--74}
}