On this page
A boundary-value problem gives you conditions at two ends, such as y(0) = 0 and y(1) = 1. The ODE solvers you already know, from Euler's method to Runge–Kutta RK4, want a starting value and a starting slope at one end. Shooting bridges the gap: guess the missing slope, fire a solution across, see where it lands, re-aim.
What is the shooting method for boundary-value problems?
Take y″ = f(x, y, y′) with y(a) = α and y(b) = β. Michael Heath's Scientific Computing slides on boundary-value problems put it plainly: if we knew y′(a), we would have an initial-value problem, so we try increasingly accurate guesses for y′(a) until the solution at b matches β.
Call the guessed slope s and the landing height y_s(b). The problem collapses to one equation in one unknown:
g(s) = y_s(b) − β = 0.
The shooting method turns a boundary-value problem into root-finding for the initial slope, solvable by any one-dimensional zero finder (Heath).
How does the secant method correct the slope?
Each value of g comes out of a whole integration, so you cannot easily differentiate it. Douglas Harder's ECE 204 notes on the shooting method at the University of Waterloo therefore use the secant method, which needs two starting guesses and no derivative. For a refresher, our post on the secant method for root finding works through √2.
Harder's recipe, in five steps:
First slope: the straight line joining the boundary points, s₀ = (β − α)/(b − a).
Integrate with s₀ and read the landing height y₀.
Second slope: aim as far past the target as you just missed it, s₁ = (2β − y₀ − α)/(b − a).
Integrate with s₁ and read y₁.
Secant update: s₂ = s₁ − (y₁ − β)(s₁ − s₀)/(y₁ − y₀). Repeat until the miss at b is within tolerance.
Worked example: y″ = −y with y(0) = 0 and y(1) = 1
Here a = 0, b = 1, α = 0 and β = 1. With y′(0) = s, the solution is y = s sin x. So every shot lands at y_s(1) = s sin 1 ≈ 0.841471 s. Normally RK4 gives each landing height; the exact formula lets you check every digit.
Shot 1: s₀ = (1 − 0)/1 = 1. It lands at y₀ = 0.841471, short by 0.158529.
Shot 2: s₁ = 2 − 0.841471 = 1.158529. It lands at y₁ = 0.974868, still short by 0.025132.
Secant step: s₂ = 1.158529 − (0.974868 − 1)(0.158529)/(0.974868 − 0.841471) = 1.158529 + 0.029867 = 1.188396.
The exact answer is s = 1/sin 1 = 1.188395…, so s₂ agrees to rounding.
Why does a linear problem need only one correction?
Harder's notes state that if the ODE is linear, only one iteration of the secant method is ever needed (ECE 204 shooting method notes). The example shows why. For a linear problem, the landing height is a straight-line function of the slope: here g(s) = 0.841471 s − 1. The secant step takes the root of a line through two points of g, so when g is itself a line, it lands exactly. The only error left is your initial-value solver's.
When does the shooting method fail?
There is nothing to hit. Heath's slides give y″ = −y with y(0) = 0 and y(b) = β, where b is a whole multiple of π: there are infinitely many solutions if β = 0 and none if β ≠ 0 (Heath, existence and uniqueness). Every shot is s sin x and sin b = 0, so every shot lands at 0: g is flat, and the secant step divides by zero.
The initial-value problem is unstable. Heath notes that simple shooting inherits the stability or instability of the associated initial-value problem, which may be unstable even when the boundary-value problem is stable. Try y″ = 100y with y(0) = 0 and y(1) = 1: the shots are (s/10) sinh 10x, and sinh 10 ≈ 11013, so each shot lands at about 1101 s, and changing the slope by 0.001 moves the landing point by about 1.1. Heath's remedy is multiple shooting: split [a, b] into pieces, shoot on each, and require the pieces to join.
The equation is nonlinear. The landing height is no longer linear in s, so you need several secant steps, a poor guess can send the iteration astray, and Harder warns the solution may not be unique. Check every result against both boundary conditions.
How should you practise it?
Redo the example with RK4 and step 0.1, and compare your s₂ with 1/sin 1. Change the target to y(1) = 2 and confirm one secant step gives 2/sin 1. Then set b = π and watch the method break. For linear problems, compare the exact route through Green's function for ODEs.
If these ideas still feel separate, the Fermi Concept Library covers every concept in physics, chemistry, biology, mathematics and computing, so you can revisit each piece. For practice, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer.



