4.8.28 · D5Numerical Methods

Question bank — Boundary value problems — shooting method, finite difference

1,793 words8 min readBack to topic

Before we start, one glossary of the plain-word names, so no symbol appears unexplained:

  • BVP = boundary value problem: a differential equation where you're told a value at each of two ends, and , but nothing about the starting slope.
  • IVP = initial value problem: everything known at ONE point, so you can march forward.
  • Slope guess : our name for the unknown starting slope that shooting tries to discover.
  • Miss function : how far the shot lands from the target . Root of = correct slope.
  • Stencil: the little algebra recipe that replaces a derivative at a grid point by a combination of neighbour values.
  • Interior node: a grid point strictly between the two ends — the only points we solve for (the ends are given).

True or false — justify

Shooting turns a BVP into an IVP by guessing the missing endpoint value .
False — it guesses the missing starting slope , not . The endpoint is the target we compare against; we never guess it.
For a linear BVP, the shooting method needs exactly two shots to be exact.
True — for a linear ODE the landing value is a straight-line function of , and a line is pinned down by two points, so linear interpolation lands on the true slope with no iteration error.
Halving the step in the central-difference method roughly halves the error.
False — the central stencils are , so halving cuts error by about a factor of four, not two.
The finite-difference matrix for a two-point BVP is always tridiagonal.
True when using the 3-point central stencils: each equation only couples , so nonzeros sit on the main diagonal and its two neighbours — the definition of tridiagonal, solvable by Thomas.
A forward difference is fine to use for the term because it's still a valid derivative approximation.
False in effect — it's only accurate, so it drags the whole scheme down to first order even though the stencil is . Use the central difference to keep the orders matched.
The miss function is always a straight line.
False — only for linear ODEs. For a nonlinear ODE is curved, so two shots aren't enough; you must iterate secant until is below tolerance.
Finite difference and shooting, done accurately, converge to the same curve.
True — both are approximating the one true solution of the same BVP; they differ only in how they hunt for it (aim-and-adjust vs solve-all-at-once), not in the answer.
The diagonal entry of the FDM matrix is .
True for : multiplying the stencil by and collecting the terms gives from the stencil and from the term.
Shooting is generally safer than finite difference on a long, stiff domain.
False — a small slope error can grow exponentially as the IVP marches across a long/stiff interval, so shooting can blow up. Finite difference keeps errors local and is the safer choice there.

Spot the error

", , — let's use finite difference."
This is an IVP, not a BVP — both conditions are at . Finite difference is aimed at two-point BVPs; here you'd just march an IVP solver like RK4 forward.
"With intervals there are interior unknowns to solve for."
There are nodes total but only interior unknowns; the two endpoint nodes are given by the boundary conditions, not solved.
"At node I'll leave on the left with the unknowns."
is known, so that whole term is a number — move it to the right-hand side . Left as-is it references a value that isn't an unknown, breaking the square system.
"Secant needs the derivative to update the slope guess."
No — that's Newton's method. Secant deliberately avoids derivatives by approximating with the straight line through the last two points, which is why it fits shooting where has no cheap formula.
"To get I subtract the two Taylor expansions of ."
Subtracting cancels the term and gives the first derivative stencil. To isolate you add the two expansions, which cancels the odd terms and leaves .
"The stencil for is symmetric: same coefficient on and ."
The convection term breaks symmetry: lower coefficient is and upper is . They match only when .
"I got a number from , so the FDM answer is trustworthy."
A single coarse run gives no error estimate. Halve and check the error drops about ; if it doesn't, the setup is wrong (Forecast-then-Verify).
"Shooting failed to converge, so the BVP has no solution."
More likely a bad initial pair of slope guesses or a stiff/sensitive problem amplifying errors — the BVP may well have a solution that finite difference finds calmly.

Why questions

Why does a BVP resist the simple "march forward" trick that IVPs allow?
Marching needs both and at the same starting point. A BVP only gives at each end and hides the starting slope, so there's nothing complete to march from until that slope is found.
Why is the secant method — rather than plain bisection — the natural partner for shooting?
Bisection needs a sign change and converges slowly; secant uses the two most recent misses to draw a line to the root, converging fast and, for a linear BVP, hitting the answer exactly in one step.
Why do we build the difference formulas from the Taylor series rather than just guessing them?
Taylor expansions expose exactly which terms cancel and which survive, so we can read off the leading error term (the or factor) and know the order of accuracy instead of hoping.
Why does adding the two Taylor expansions give while subtracting gives ?
Adding cancels the odd-power terms (the and ), leaving the even ones so survives; subtracting cancels the even-power terms (including ), leaving . Symmetry of the expansions does the sorting.
Why does the FDM linear system come out tridiagonal instead of full?
Each central stencil reaches only one node left and one node right, so every equation touches three consecutive unknowns — no long-range coupling means all off-band entries are zero.
Why is it worth exploiting the tridiagonal structure with the Thomas algorithm instead of general Gaussian elimination?
Thomas solves a tridiagonal system in work versus for a dense solve, and the band never fills in, so large grids stay cheap and memory-light.
Why does a nonlinear BVP make finite difference harder than shooting?
Nonlinearity makes the discretised equations nonlinear too, so you need Newton on the whole system (Jacobians, iterations); shooting keeps the nonlinearity inside a single scalar and only root-finds one variable.
Why does the central-difference scheme count as second-order even though the individual Taylor terms include and ?
The leading surviving error term after dividing out is proportional to ; the higher powers are smaller still. Order of accuracy is set by the largest remaining error term, which is .

Edge cases

If the slope guess makes give , is that a useless shot?
Not useless — it's the deliberate lowest guess () giving landing value , which brackets behaviour and provides the first point of the line for interpolation.
What happens to shooting if your two slope guesses give the same landing value?
The secant/interpolation formula divides by , which is then zero — the update is undefined. You must pick two guesses that actually produce different landings.
Take the coarsest possible FDM grid, : how many equations do you solve?
Exactly one — there's a single interior node , and with both boundaries known that one equation gives directly, no matrix needed.
What if everywhere in ?
The stencil becomes symmetric: lower and upper coefficients both equal , so the matrix is symmetric tridiagonal. The asymmetry only appears when a first-derivative (convection) term is present.
Does a zero slope guess mean the trajectory stays flat forever?
Only if the ODE forces it — e.g. with stays identically zero. In general a zero starting slope still lets curvature () bend the path upward or downward as advances.
What limiting behaviour do you expect as in FDM, and what's the practical catch?
The discrete solution approaches the true solution like , so accuracy keeps improving — but the system grows and rounding error eventually creeps in, so infinitely small isn't free or ideal in floating point.
If the boundary condition specifies a slope at an end, , instead of a value, is the plain stencil enough?
No — you need an extra difference approximation for the derivative boundary (a one-sided or ghost-node stencil), because the standard interior stencil assumes known values, not slopes, at the ends.
Recall One-line self-test

Cover everything above. Can you state, in one breath, what is, why FDM gives a tridiagonal system, and why halving cuts error by 4? ::: measures how far a shot with slope misses the target; FDM is tridiagonal because each 3-point stencil couples only neighbouring nodes; error drops because the scheme is .