Home / Courses / Differential Equations / Unit 3
Differential Equations Unit 3: Numerical methods
When you can't solve an equation exactly, numerical methods approximate the solution step by step.
Covers: Euler's method, improved Euler, Runge-Kutta (overview)
Study guide
Many differential equations can't be solved with formulas, so numerical methods approximate the solution step by step. Starting from an initial point (x₀, y₀), they choose a step size h and use the equation's slopes to estimate the next point.
Euler's method uses the slope at the start of each step: yₙ₊₁ = yₙ + h·f(xₙ, yₙ), with xₙ₊₁ = xₙ + h. It follows tangent lines, so it drifts away from curving solutions. Euler's method is first order: halving h roughly halves the error. It underestimates when solutions are concave up and overestimates when they're concave down.
The improved Euler (Heun's) method first predicts the next point with an Euler step, then computes the slope there, and averages the two slopes: yₙ₊₁ = yₙ + (h/2)[f(xₙ, yₙ) + f(xₙ₊₁, ỹ)]. It's second order, so halving h cuts the error to about a quarter.
The classic Runge–Kutta method (RK4) samples four slopes per step, at the start, twice at the midpoint, and at the end, and combines them in a weighted average with weights 1, 2, 2, 1. It's fourth order and very accurate, which is why it's the standard method in software.
Errors come from both the method (truncation error) and rounding. Smaller steps reduce truncation error but need more work, and comparing results at two step sizes gives a practical accuracy check.
Set up a table with columns n, xₙ, yₙ, slope f(xₙ, yₙ) and h·slope, and fill it in one row at a time. For improved Euler, add columns for the predicted ỹ and the slope there, and average the two slopes before stepping. Euler's method makes an error of about h² in each step (local error). Over a fixed interval it takes about 1/h steps, so the total (global) error is about proportional to h. A method of order p has global error proportional to hᵖ.
Key ideas
- Euler's method follows the tangent line for one step at a time.
- Error shrinks as the step size h shrinks.
- Improved Euler (Heun) averages the slope at the start and at the predicted end of each step.
- Runge–Kutta (RK4) combines four slopes per step and is far more accurate.
Formulas and rules
Common mistakes
- Using the next point's slope in plain Euler's method.
- Too large a step on a rapidly changing solution.
Words to know
- Euler's method step
- yₙ₊₁ = yₙ + h·f(xₙ, yₙ)
- Euler's method error
- First order: halving h roughly halves the error.
- Improved Euler (Heun's) method
- Averages the slope at the start and at the predicted endpoint.
- Runge–Kutta 4 (RK4)
- Uses a weighted average of four slopes per step.
- Numerical methods
- Approximate solutions when no closed form exists.
- Euler's method
- yₙ₊₁ = yₙ + h·f(xₙ, yₙ)
- Step size (h)
- The increment in x per step.
- Truncation error
- Error from the method's approximation itself.
- Round-off error
- Error from limited numerical precision.
- Order of a method
- Error ∝ hᵖ; Euler is 1, improved Euler 2, RK4 4.
- RK4 weights
- Slopes combined with weights 1, 2, 2, 1, divided by 6.
Sample practice questions
21 more questions like these, from level 1 to 5, are in the practice set.
Euler's method: y′ = y, y(0) = 1, h = 0.5. One step gives y(0.5) ≈
- 1.25
- 2
- 1.5
- 1.65
Show the answer and steps
Answer: C) 1.5
- y₁ = y₀ + h·f(x₀, y₀) = 1 + 0.5(1).
- = 1.5.
Take a second step to estimate y(1).
- 2.72
- 2
- 2.25
- 2.5
Show the answer and steps
Answer: C) 2.25
- Slope at (0.5, 1.5) is 1.5.
- y₂ = 1.5 + 0.5(1.5) = 2.25.
The exact value is e ≈ 2.72. Why is Euler's estimate low?
- The solution is concave up, so tangent lines lie below it
- Rounding error
- Euler always overestimates
- h is too small
Show the answer and steps
Answer: A) The solution is concave up, so tangent lines lie below it
- y = eˣ is concave up.
- Tangent lines lie below a concave-up curve, so each step undershoots.