Learn
Lesson · Differential Equations and Euler's Method · Stepping

The Improved Euler Method

Euler's method uses the slope at the start of a step. The improved method also asks what the slope would be at the end, using a trial Euler step to get there, and moves along the average of the two. That costs two slope readings per step and changes the order: halving h now divides the error by about 4, and on y′ = t² by exactly 4.

k₁ = f(tₙ, yₙ) slope at the start k₂ = f(tₙ + h, yₙ + h·k₁) trial slope yₙ₊₁ = yₙ + h·(k₁ + k₂)/2 y′ = t²: the step is the trapezoid rule halve h: error ÷ 4, here exactly 4
A trial step, two slopes, one average

Core ideas

What this lesson establishes

Three ideas: the trial step, why averaging helps, and what the order of the method is.

1

A trial step finds the slope at the other end

Euler's method reads the slope only where the step begins. The improved method takes an ordinary Euler step first, to a trial point (tₙ + h, yₙ + h·k₁), and reads the slope k₂ there. The trial value is only a guess at where the step would end, and it is used for nothing except that slope.

2

The average of the two slopes is a better rate for the step

The true slope changes through a step, and the start slope is too low where the rate rises and too high where it falls. The slope at the end is wrong the other way. Their average, (k₁ + k₂)/2, is a better stand-in for the whole step. When f depends on t alone this is exactly the trapezoid rule from Accumulation and the Integral.

3

The order is 2: halving the step quarters the error

The error at a fixed T is about C·h², so halving h divides it by 4 and the ratio of successive errors is near 4. A ratio of 4 names order 2. This is not a halved error: it is a different power of h, and for a small step it is a much smaller error.

The material

Two slopes instead of one

The method, one step of it by hand, the equation where it is the trapezoid rule and its error is exactly proportional to h squared, an equation where the ratio only approaches 4, and the misreading of what second order means.

Definition · The improved Euler method

From (tₙ, yₙ) with step h: k₁ = f(tₙ, yₙ), then k₂ = f(tₙ + h, yₙ + h·k₁), then yₙ₊₁ = yₙ + h·(k₁ + k₂)/2.

Two slopes are read per step, so each step costs twice what an Euler step costs. The method is also called Heun's method.

Do one step by hand on y′ = y from y(0) = 1 with h = 1/4. The start slope is k₁ = 1. The trial value is 1 + (1/4)·1 = 5/4, so k₂ = 5/4. The average slope is (1 + 5/4)/2 = 9/8, and y₁ = 1 + (1/4)·(9/8) = 41/32. This is hand arithmetic from the formula; set T to 1/4 in the lab on y′ = y and the first row of its table reads 41/32. Plain Euler gave 5/4 = 40/32 for the same step, and e^(1/4) ≈ 1.28403, rounded, is nearer to 41/32 = 1.28125.

The equation where the step is the trapezoid rule

Take y′ = t². The right side does not mention y, so the trial value never matters: k₁ = tₙ² and k₂ = (tₙ + h)², and the step adds h·(tₙ² + (tₙ + h)²)/2. That is the trapezoid rule on one piece. Its error on a quadratic is exactly proportional to h², because the rule's error is h²·(f′(b) − f′(a))/12 and for f = t² that is h²·2/12 = h²/6.

y′ = t², y(0) = 0, exact y = t³/3, T = 1 h E(h) = h²/6 ratio to the next 1/4 1/96 4 1/8 1/384 4 1/16 1/1536

The lab prints exactly these errors and the ratios 4, 4, and names the order 2. Compare Euler on the same equation at the same h = 1/4: its error is 11/96, eleven times larger. Switch the Method menu to Euler to see 11/96, 23/384, 47/1536 appear in place of these.

Theorem · The improved method is second order

For a right-hand side with continuous second derivatives, the improved method's error at a fixed T is approximately C·h², so halving h divides it by about 4.

As with first order in the previous lesson, the lab demonstrates this on chosen equations by exact ratios and does not prove it in general.

When the ratio is near 4 and is not 4

Change the equation to y′ = t⁴, with exact solution t⁵/5. The errors are 53/2560, 213/40960 and 853/655360, and the ratios are 848/213 ≈ 3.98122 and 3408/853 ≈ 3.99531, both rounded here. They climb towards 4 and are not 4, because the trapezoid error has a smaller term in h⁴ as well. On a cubic the exactness comes back: the error of the rule is h²·(f′(b) − f′(a))/12 with no further terms, and for y′ = t³ that is h²/4, so typing t^3 and t^4/4 into the lab gives 1/64, 1/256, 1/1024, with ratio 4 twice.

Example · Second order is not half the error

At h = 1/4 on y′ = t² Euler's error is 11/96 and the improved method's is 1/96: eleven times smaller, not half. For an equal number of slope readings Euler with h = 1/8 (eight readings) has error 23/384, and the improved method with h = 1/4 (four steps of two readings, eight in all) has 1/96 = 4/384, nearly six times smaller.

The comparison keeps growing in the improved method's favour as the step shrinks, because its error falls by 4 each halving and Euler's falls by 2.

The lab's third preset runs the improved method on y′ = y. The true value is irrational, so the errors, ratios and order are all rounded, and the lab marks them with ≈.

Interactive

Order of a method

Errors at h, h/2 and h/4, and their ratios

The order of a methodhalve h and watch the error
log₂ error against log₂ h

Method

One improved step, and one check of its order

Two slopes, an average, and then the usual measurement.

1

Read the start slope

k₁ = f(tₙ, yₙ), exactly as in Euler's method.

2

Take the trial step and read the slope there

Move to (tₙ + h, yₙ + h·k₁) and compute k₂ = f at that point. The trial value is used only to get k₂.

3

Average the slopes and take the real step

yₙ₊₁ = yₙ + h·(k₁ + k₂)/2. Keep it as a fraction.

4

Measure the error at three step sizes

Run to the same T with h, h/2, h/4, subtract the true value and divide successive errors.

5

Read the order from the ratio

A ratio of 4 is second order. State whether it is exactly 4 or only approaching it.

Two slopes, one average

Score 0 / 0

The error of the improved method on y′ = t²

Show that the improved step on y′ = t² is the trapezoid rule, and that its error is exactly proportional to h².

f depends on t only: k₁ = t², k₂ = (t + h)² step adds h·(t² + (t + h)²)/2 (trapezoid) true rise over a step: ((t + h)³ − t³)/3 = t²·h + t·h² + h³/3 step rise = h·(2t² + 2th + h²)/2 = t²·h + t·h² + h³/2 one step overshoots by h³/2 − h³/3 = h³/6 N steps with N·h = 1: N·h³/6 = h²/6 h = 1/4: 1/96; h = 1/8: 1/384; h = 1/16: 1/1536

Each step overshoots the true rise by exactly h³/6, the same at every t, because the quadratic leaves no t in the difference. Adding 1/h of them gives h²/6, and halving h divides that by exactly 4.

The lab's errors 1/96, 1/384, 1/1536 match. The lab reports the size of the error, so the sign, an overshoot here, does not enter the ratio.

Common mistakes

1
Believing a second-order method has half the error of a first-order oneOrder is about how the error changes with h, not how large it is at one h. On y′ = t² the improved error at h = 1/4 is 1/96 against Euler's 11/96, eleven times smaller, and halving h quarters one error and halves the other.
2
Using the trial value as the answerThe trial point yₙ + h·k₁ is Euler's step, and it is used only to read k₂. The value that is kept is yₙ + h·(k₁ + k₂)/2. On y′ = y the trial value is 5/4 and the kept value is 41/32.
3
Expecting the ratio to be 4 on every equationIt is exactly 4 on y′ = t² and on a cubic, and only approaches 4 on y′ = t⁴ and on y′ = y. The claim of second order is the approach, and the exactness on a quadratic is a feature of that equation.

Check your understanding

✓
Finish when you can take an improved Euler step and show the error quarters when the step halves.

You should be able to compute k₁, the trial value, k₂ and the step for a given equation, run the lab at three step sizes, read the ratio of successive errors as 4, and say on which equations it is exactly 4 and why.

Note: Two slopes bought a power of h. More slopes buy more, and the classic choice uses four. “Runge–Kutta: Four Slopes per Step” shows the error divided by sixteen.

Kept in this browser only, for you. Nothing is sent anywhere and nothing checks it. Carry it to another device.

Feedback and recommendations

Something to change about this lesson? Write it down, tick it off when it is handled, and export the list when you want to act on it. Kept in this browser only: nothing is sent anywhere, and nobody is notified.

No recommendations yet for this lesson.