Boundary Value Problems

Work in progress. This note is still being written and incomplete.

A boundary value problem (BVP) is a differential equation with conditions specified at 2 distinct points, called boundary conditions.

Standard Form

y′′=f(x,y,y′),a≤x≤b,y(a)=α, y(b)=βy'' = f(x, y, y'), \quad a \leq x \leq b, \quad y(a) = \alpha,\ y(b) = \beta

Linear and Nonlinear BVPs

The BVP is linear if ff has the form

f(x,y,y′)=p(x)y′+q(x)y+r(x)f(x,y,y') = p(x)y' + q(x)y + r(x)

for some functions pp, qq, rr, giving

y′′=p(x)y′+q(x)y+r(x),a≤x≤b,y(a)=α, y(b)=βy'' = p(x)y' + q(x)y + r(x), \quad a \leq x \leq b, \quad y(a) = \alpha,\ y(b) = \beta

Otherwise, the BVP is nonlinear.

Existence and Uniqueness

The BVP has a unique solution on [a,b][a,b] iff

  • ff, fyf_y, and fy′f_{y'} are continuous on D={(x,y,y′)∣a≤x≤b, y,y′∈R}D = \{(x,y,y') \mid a \leq x \leq b,\ y, y' \in \mathbb{R}\}
  • fy(x,y,y′)>0f_y(x,y,y') > 0 for all (x,y,y′)∈D(x,y,y') \in D
  • a constant M>0M > 0 exists with ∣fy′(x,y,y′)∣≤M|f_{y'}(x,y,y')| \leq M for all (x,y,y′)∈D(x,y,y') \in D

Examples:

  • y′′+e−xy+sin⁡(y′)=0y'' + e^{-xy} + \sin(y') = 0, 0≤x≤10 \leq x \leq 1, y(0)=y(1)=0y(0) = y(1) = 0 has a unique solution, since fy=xe−xy>0f_y = xe^{-xy} > 0 for all x,yx,y and ∣fy′∣=∣cos⁡(y′)∣≤1|f_{y'}| = |\cos(y')| \leq 1 for all y′y'.

A linear BVP is solved by the linear shooting method or a linear finite-difference method. A nonlinear BVP is solved by the nonlinear shooting method or a nonlinear finite-difference method.

Linear Shooting Method

The linear shooting method solves a linear BVP by combining solutions to 2 initial value problems.

Applying the general existence and uniqueness theorem to f(x,y,y′)=p(x)y′+q(x)y+r(x)f(x,y,y') = p(x)y' + q(x)y + r(x) gives fy=q(x)f_y = q(x) and fy′=p(x)f_{y'} = p(x), so a unique solution exists iff

  • pp, qq, rr are continuous on [a,b][a,b]
  • q(x)>0q(x) > 0 for x∈[a,b]x \in [a,b]

Superposition Idea

The ODE is linear, so if y1y_1 solves

y1′′=p(x)y1′+q(x)y1+r(x)y_1'' = p(x)y_1' + q(x)y_1 + r(x)

and y2y_2 solves the homogeneous equation

y2′′=p(x)y2′+q(x)y2y_2'' = p(x)y_2' + q(x)y_2

then y=y1+c y2y = y_1 + c\,y_2 solves the same ODE for any constant cc.

Auxiliary IVPs

Fix

y1(a)=α, y1′(a)=0,y2(a)=0, y2′(a)=1y_1(a) = \alpha,\ y_1'(a) = 0, \qquad y_2(a) = 0,\ y_2'(a) = 1

so that y(a)=y1(a)+c y2(a)=αy(a) = y_1(a) + c\,y_2(a) = \alpha for any cc. Solve

y1′′=p(x)y1′+q(x)y1+r(x),a≤x≤b,y1(a)=α, y1′(a)=0y_1'' = p(x)y_1' + q(x)y_1 + r(x), \quad a \leq x \leq b, \quad y_1(a) = \alpha,\ y_1'(a) = 0 y2′′=p(x)y2′+q(x)y2,a≤x≤b,y2(a)=0, y2′(a)=1y_2'' = p(x)y_2' + q(x)y_2, \quad a \leq x \leq b, \quad y_2(a) = 0,\ y_2'(a) = 1

by reducing each to a first-order system and applying order 4 Runge-Kutta. q(x)>0q(x) > 0 guarantees y2(b)≠0y_2(b) \neq 0 whenever y2y_2 is non-constant.

Combining Solutions

cc is chosen so that y(b)=βy(b) = \beta

y1(b)+c y2(b)=β  ⟹  c=β−y1(b)y2(b)y_1(b) + c\,y_2(b) = \beta \implies c = \frac{\beta - y_1(b)}{y_2(b)} y(x)=y1(x)+β−y1(b)y2(b) y2(x)y(x) = y_1(x) + \frac{\beta - y_1(b)}{y_2(b)}\, y_2(x)

is the unique solution to the BVP.

Nonlinear Shooting Method

The nonlinear shooting method solves a nonlinear BVP by approximating the initial slope y′(a)y'(a) that makes an initial value problem’s solution hit the far boundary condition.

Idea

For a guess tt, let y(x,t)y(x,t) solve the IVP

y′′=f(x,y,y′),a≤x≤b,y(a)=α, y′(a)=ty'' = f(x,y,y'), \quad a \leq x \leq b, \quad y(a) = \alpha,\ y'(a) = t

The method finds tt such that y(b,t)−β=0y(b,t) - \beta = 0, using Newton’s method.

Newton Iteration

tk=tk−1−y(b,tk−1)−βy′(b,tk−1)t_k = t_{k-1} - \frac{y(b,t_{k-1}) - \beta}{y'(b,t_{k-1})}

y′(b,tk−1)y'(b,t_{k-1}) can’t be obtained analytically since y(b,tk−1)y(b,t_{k-1}) is only a point approximation. Define z(x,t)=∂y(x,t)∂tz(x,t) = \dfrac{\partial y(x,t)}{\partial t}. Differentiating the IVP with respect to tt gives

z′′=∂f∂y(x,y,y′) z+∂f∂y′(x,y,y′) z′,a≤x≤b,z(a)=1, z′(a)=0z'' = \frac{\partial f}{\partial y}(x,y,y')\,z + \frac{\partial f}{\partial y'}(x,y,y')\,z', \quad a \leq x \leq b, \quad z(a) = 1,\ z'(a) = 0

Substituting z(b,tk−1)z(b,t_{k-1}) for y′(b,tk−1)y'(b,t_{k-1})

tk=tk−1−y(b,tk−1)−βz(b,tk−1)t_k = t_{k-1} - \frac{y(b,t_{k-1}) - \beta}{z(b,t_{k-1})}

Procedure

  • Choose an initial guess t0t_0
  • Repeat for k=0,1,2,…k = 0, 1, 2, \ldots until ∣y(b,tk)−β∣|y(b,t_k) - \beta| is sufficiently small
    • Approximate yk(x)=y(x,tk)y_k(x) = y(x,t_k) from

      y′′=f(x,y,y′),a≤x≤b,y(a)=α, y′(a)=tky'' = f(x,y,y'), \quad a \leq x \leq b, \quad y(a) = \alpha,\ y'(a) = t_k
    • Approximate zk(x)=z(x,tk)z_k(x) = z(x,t_k) from

      z′′=∂f∂y(x,yk,yk′) z+∂f∂y′(x,yk,yk′) z′,a≤x≤b,z(a)=1, z′(a)=0z'' = \frac{\partial f}{\partial y}(x,y_k,y_k')\,z + \frac{\partial f}{\partial y'}(x,y_k,y_k')\,z', \quad a \leq x \leq b, \quad z(a) = 1,\ z'(a) = 0
    • Update

      tk+1=tk−yk(b)−βzk(b)t_{k+1} = t_k - \frac{y_k(b) - \beta}{z_k(b)}

Linear Finite-Difference Method

The finite-difference method approximates the solution of a linear BVP by replacing derivatives with centered difference formulas at mesh points and solving the resulting linear system.

Mesh Points

Partition [a,b][a,b] into N+1N+1 subintervals of length h=b−aN+1h = \dfrac{b-a}{N+1}. Mesh points are

xi=a+ih,i=0,1,…,N+1x_i = a + ih, \quad i = 0, 1, \ldots, N+1

Centered Difference Formulas

y′′(xi)=1h2(y(xi+1)−2y(xi)+y(xi−1))−h212y(4)(ξi)y''(x_i) = \frac{1}{h^2}\big(y(x_{i+1}) - 2y(x_i) + y(x_{i-1})\big) - \frac{h^2}{12}y^{(4)}(\xi_i) y′(xi)=12h(y(xi+1)−y(xi−1))−h26y′′′(ηi)y'(x_i) = \frac{1}{2h}\big(y(x_{i+1}) - y(x_{i-1})\big) - \frac{h^2}{6}y'''(\eta_i)

for some ξi,ηi∈(xi−1,xi+1)\xi_i, \eta_i \in (x_{i-1}, x_{i+1}).

Linear Difference Equation

Substituting the centered difference formulas into the linear BVP and dropping the O(h2)O(h^2) error term, y(xi)≈wiy(x_i) \approx w_i satisfies

w0=α,wN+1=βw_0 = \alpha, \quad w_{N+1} = \beta −(1+h2p(xi))wi−1+(2+h2q(xi))wi−(1−h2p(xi))wi+1=−h2r(xi)-\left(1 + \frac{h}{2}p(x_i)\right)w_{i-1} + \big(2 + h^2 q(x_i)\big)w_i - \left(1 - \frac{h}{2}p(x_i)\right)w_{i+1} = -h^2 r(x_i)

for i=1,…,Ni = 1, \ldots, N, with truncation error O(h2)O(h^2).

Matrix Form

Aw=bAw = b

with AA tridiagonal, using

ai=−1−h2p(xi),di=2+h2q(xi),ci=−1+h2p(xi)a_i = -1 - \frac{h}{2}p(x_i), \quad d_i = 2 + h^2 q(x_i), \quad c_i = -1 + \frac{h}{2}p(x_i) A=(d1c1a2d2c2⋱⋱⋱aNdN)A = \begin{pmatrix} d_1 & c_1 & & \\ a_2 & d_2 & c_2 & \\ & \ddots & \ddots & \ddots \\ & & a_N & d_N \end{pmatrix} w=(w1w2⋮wN−1wN),b=(−h2r(x1)−a1α−h2r(x2)⋮−h2r(xN−1)−h2r(xN)−cNβ)w = \begin{pmatrix} w_1 \\ w_2 \\ \vdots \\ w_{N-1} \\ w_N \end{pmatrix}, \quad b = \begin{pmatrix} -h^2r(x_1) - a_1\alpha \\ -h^2r(x_2) \\ \vdots \\ -h^2r(x_{N-1}) \\ -h^2r(x_N) - c_N\beta \end{pmatrix}

Solve for ww with LU decomposition or another linear solver.

If pp, qq, rr are continuous on [a,b][a,b] and q(x)≥0q(x) \geq 0 on [a,b][a,b], the linear system has a unique solution whenever h<2Lh < \dfrac{2}{L}, where L=max⁡a≤x≤b∣p(x)∣L = \max_{a \leq x \leq b} |p(x)|.

Nonlinear Finite-Difference Method

The finite-difference method for a nonlinear BVP replaces derivatives with centered difference formulas and solves the resulting nonlinear system with Newton’s method.

A unique solution exists iff

  • ff, fyf_y, fy′f_{y'} are continuous for x∈[a,b]x \in [a,b] and y,y′∈(−∞,∞)y, y' \in (-\infty, \infty)
  • fy(x,y,y′)≥δf_y(x,y,y') \geq \delta for some δ>0\delta > 0
  • a constant kk exists with k=max⁡(∣fy(x,y,y′)∣, ∣fy′(x,y,y′)∣)k = \max\big(|f_y(x,y,y')|,\ |f_{y'}(x,y,y')|\big)

Nonlinear Difference Equation

Using the centered difference formulas at mesh points x0,…,xN+1x_0, \ldots, x_{N+1} on [a,b][a,b], y(xi)≈wiy(x_i) \approx w_i satisfies

w0=α,wN+1=βw_0 = \alpha, \quad w_{N+1} = \beta −wi+1−2wi+wi−1h2+f(xi,wi,wi+1−wi−12h)=0-\frac{w_{i+1} - 2w_i + w_{i-1}}{h^2} + f\left(x_i, w_i, \frac{w_{i+1}-w_{i-1}}{2h}\right) = 0

for i=1,…,Ni = 1, \ldots, N, with truncation error O(h2)O(h^2).

Nonlinear System

2w1−w2+h2f(x1,w1,w2−α2h)−α=0−w1+2w2−w3+h2f(x2,w2,w3−w12h)=0  ⋮−wN−2+2wN−1−wN+h2f(xN−1,wN−1,wN−wN−22h)=0−wN−1+2wN+h2f(xN,wN,β−wN−12h)−β=0\begin{aligned} 2w_1 - w_2 + h^2 f\left(x_1, w_1, \frac{w_2 - \alpha}{2h}\right) - \alpha &= 0 \\ -w_1 + 2w_2 - w_3 + h^2 f\left(x_2, w_2, \frac{w_3 - w_1}{2h}\right) &= 0 \\ &\ \ \vdots \\ -w_{N-2} + 2w_{N-1} - w_N + h^2 f\left(x_{N-1}, w_{N-1}, \frac{w_N - w_{N-2}}{2h}\right) &= 0 \\ -w_{N-1} + 2w_N + h^2 f\left(x_N, w_N, \frac{\beta - w_{N-1}}{2h}\right) - \beta &= 0 \end{aligned}

This is a system of NN nonlinear equations in NN unknowns, with a unique solution whenever h<2Lh < \dfrac{2}{L}. Solve with Newton’s method.

Written by September 29, 2026 3 min read
Was this helpful?