Intuition Why this page exists
The parent note derived Euler's method and stated its error law. This page does the sweaty part: we hand-crank the method through every kind of input it can meet — growing solutions, decaying ones, negative slopes, a slope that is zero, a step so large the method misbehaves, and a real-world word problem. If you can follow all of these, no exam version can surprise you.
One rule for the whole page, from the parent: ==New = Old + step × slope-at-old==, i.e.
y n + 1 = y n + h f ( x n , y n ) , x n + 1 = x n + h .
Before any numbers, one reminder of what every symbol means, so nothing is used unexplained:
Definition The four symbols we will use in every example
x n — the current horizontal position (think: how far along the road we have walked).
y n — our current estimate of the solution height there (where we think the curve is).
h — the step size : the fixed horizontal distance we jump each time.
f ( x n , y n ) — the slope right where we stand , handed to us by the differential equation.
"Slope" here means rise per unit run — how many units of height you gain per unit of horizontal travel. Multiply it by our run h and you get the rise , h f . Add that rise to y n : that is the whole method.
Definition One more symbol we will meet: the growth rate
λ
Some of our examples have the special shape y ′ = λ y — the slope is just a constant λ ("lambda") times the current height. This is called the linear test equation , and we use it because its true solution is exactly y = y 0 e λ x , so we can check Euler against a known answer .
If λ < 0 the true solution decays toward 0 (like cooling or radioactive decay).
If λ > 0 it grows .
Feeding f = λ y into the Euler update gives y n + 1 = y n + hλ y n = ( 1 + hλ ) y n . So each step simply multiplies the height by the number 1 + hλ . That single number — call it the stability factor — decides everything: if ∣1 + hλ ∣ < 1 the estimates shrink like the truth; if ∣1 + hλ ∣ ≥ 1 they refuse to decay and may blow up. We will see both.
Every problem this topic can throw is one (or a blend) of these cells. The table lists the cell, what makes it distinct, and which example below covers it.
Cell
What makes it special
Covered by
A. Growing solution, positive slope
f > 0 , y climbs, errors are one-sided (undershoot)
Example 1
B. Decaying solution, negative slope
f < 0 , y falls toward a floor
Example 2
C. Step-halving / order check
verify global error ∝ h empirically
Example 3
D. Degenerate: slope = 0 at a point
f = 0 ⇒ a flat step, y unchanged for that step
Example 4
E. Limiting / unstable: h too large
$
1+h\lambda
F. Autonomous non-linear
f depends on y only, but non-linearly
Example 6
G. Real-world word problem
translate physics → IVP → Euler
Example 7
H. Exam twist: back-solve for h or y 0
given the answer, find an input
Example 8
We now walk every cell. Throughout, the derivation and error law come from the parent topic and rest on the Taylor Series Expansion .
y ′ = x + y , y ( 0 ) = 1 , find y ( 0.3 ) with h = 0.1
Forecast: the true solution 2 e x − x − 1 curves upward (it is convex). Euler follows straight tangents, so it should land below the true curve every step. Guess: our y ( 0.3 ) will be a touch under the true ≈ 1.4 .
Step 1 — start. x 0 = 0 , y 0 = 1 . Slope f ( 0 , 1 ) = 0 + 1 = 1 .
Why? The ODE is the slope-machine; feed it the current point.
y 1 = 1 + 0.1 ⋅ 1 = 1.1 , x 1 = 0.1
Step 2. Slope f ( 0.1 , 1.1 ) = 0.1 + 1.1 = 1.2 .
Why? Re-measure the slope at the new point — the road bent, so the old slope is stale.
y 2 = 1.1 + 0.1 ⋅ 1.2 = 1.22 , x 2 = 0.2
Step 3. Slope f ( 0.2 , 1.22 ) = 0.2 + 1.22 = 1.42 .
Why? Same rule a third time — always re-evaluate f at the freshly landed point ( x 2 , y 2 ) before stepping again.
y 3 = 1.22 + 0.1 ⋅ 1.42 = 1.362 , x 3 = 0.3
Verify: true value 2 e 0.3 − 0.3 − 1 = 1.39972 . Our 1.362 is below it (error ≈ 0.038 ), exactly as forecast for a convex curve. ✓
The figure below plots our three orange Euler points against the teal true curve. Notice that the orange polyline sits under the teal curve at every x , and the plum arrow at x = 0.3 measures the gap — this is the accumulated undershoot the forecast predicted. Because the true curve bends upward, straight tangent steps can only cut the corner and fall short.
y ′ = − y , y ( 0 ) = 2 , find y ( 0.4 ) with h = 0.2
Here f = − y , i.e. the linear test equation with growth rate λ = − 1 .
Forecast: true solution 2 e − x falls toward 0 and is convex-from-below. A negative slope means each step subtracts height. Guess: a value near 2 e − 0.4 ≈ 1.34 , and (since the curve is convex) Euler will sit slightly below it.
Step 1. f ( 0 , 2 ) = − 2 . y 1 = 2 + 0.2 ( − 2 ) = 1.6 at x 1 = 0.2 .
Why? Slope is negative, so the rise h f = − 0.4 is a fall .
Step 2. f ( 0.2 , 1.6 ) = − 1.6 . y 2 = 1.6 + 0.2 ( − 1.6 ) = 1.28 at x 2 = 0.4 .
Why? Re-measure the slope at the new, lower height y 1 = 1.6 ; a smaller height gives a shallower fall (− 1.6 instead of − 2 ), so the curve is levelling off.
Verify: true 2 e − 0.4 = 1.34064 . Euler gives 1.28 , below it (error ≈ 0.061 ). The method is stable here because the stability factor ∣1 + hλ ∣ = ∣1 + 0.2 ( − 1 ) ∣ = 0.8 < 1 — the estimates shrink toward 0 just like the truth. ✓ (Contrast this with Example 5, where the same idea fails.)
y ′ = x + y , y ( 0 ) = 1 , compare final error at x = 0.2 for h = 0.1 vs h = 0.05
Forecast: the parent proved global error = O ( h ) . So halving h should roughly halve the error. Predict the ratio ≈ 0.5 .
With h = 0.1 (2 steps): from Example 1's first two lines, y ( 0.2 ) = 1.22 . True 2 e 0.2 − 1.2 = 1.24281 . Error E 0.1 = 0.02281 .
With h = 0.05 (4 steps):
y 1 = 1 + 0.05 ( 0 + 1 ) = 1.05 at 0.05
f = 0.05 + 1.05 = 1.1 , y 2 = 1.05 + 0.05 ( 1.1 ) = 1.105 at 0.10
f = 0.10 + 1.105 = 1.205 , y 3 = 1.105 + 0.05 ( 1.205 ) = 1.16525 at 0.15
f = 0.15 + 1.16525 = 1.31525 , y 4 = 1.16525 + 0.05 ( 1.31525 ) = 1.2310125 at 0.20
Error E 0.05 = 1.24281 − 1.23101 = 0.01180 .
Verify: ratio E 0.05 / E 0.1 = 0.01180/0.02281 = 0.517 ≈ 2 1 . First order confirmed. ✓
Why not exactly 0.5 ? The O ( h ) law is a leading-order statement; tiny higher-order terms nudge it off exact half. As h → 0 the ratio tightens to 0.5 .
y ′ = x 2 − 1 , y ( 0 ) = 0.5 , find y ( 2 ) with h = 1
This is a case people fumble: at some step the slope is exactly zero , so y does not move at all.
Forecast: at x = 1 the slope 1 2 − 1 = 0 . So the step starting at x = 1 will be perfectly flat — y stays put across that step. Watch for it.
Step 1. f ( 0 , 0.5 ) = 0 2 − 1 = − 1 . y 1 = 0.5 + 1 ⋅ ( − 1 ) = − 0.5 at x 1 = 1 .
Why the drop? The slope was negative, so height fell.
Step 2. f ( 1 , − 0.5 ) = 1 2 − 1 = 0 . y 2 = − 0.5 + 1 ⋅ 0 = − 0.5 at x 2 = 2 .
Why unchanged? ==Zero slope ⇒ zero rise ⇒ y n + 1 = y n .== The step is horizontal.
Verify: solve exactly: y = 3 x 3 − x + 0.5 , so y ( 2 ) = 3 8 − 2 + 0.5 = 1.16 6 . Euler's crude h = 1 gives − 0.5 — wildly off because h is huge, but the mechanics of the flat step are correct: y genuinely did not change when f = 0 . ✓ (Degenerate inputs don't break Euler; they just produce a flat segment.)
The figure traces the two orange steps. The first segment slopes down (slope − 1 ); the second, drawn thick in plum, is perfectly horizontal because f = 0 there — the visual proof that a zero slope produces a flat step with y 2 = y 1 . Reading the picture left to right is the calculation.
y ′ = − 2 y , y ( 0 ) = 1 , take h = 1.5 , find y ( 3 )
This is the linear test equation with growth rate λ = − 2 .
Forecast: true solution e − 2 x decays smoothly to ≈ 0 . But the stability factor is 1 + hλ = 1 + 1.5 ( − 2 ) = − 2 , and ∣ − 2∣ = 2 > 1 . Numbers multiplied by something bigger than 1 in size will grow and flip sign . Forecast: oscillating, exploding values — the opposite of the true decay.
Step 1. y 1 = 1 + 1.5 ( − 2 ) ( 1 ) = 1 − 3 = − 2 at x = 1.5 .
Step 2. y 2 = − 2 + 1.5 ( − 2 ) ( − 2 ) = − 2 + 6 = 4 at x = 3 .
Verify: each step multiplies by the stability factor 1 + hλ = − 2 : 1 → − 2 → 4 , i.e. y n = ( − 2 ) n . True e − 6 = 0.00248 . Euler screams to 4 — a stability failure , not a mere accuracy error. ✓
The cure: need ∣1 + hλ ∣ < 1 , i.e. ∣1 − 2 h ∣ < 1 ⇒ 0 < h < 1 . Any h < 1 decays correctly; h = 1.5 violates it. This is precisely the gateway to Numerical Stability and to Backward Euler & Implicit Methods , which stay stable for any h here.
The figure contrasts the smooth teal decay curve e − 2 x (heading gently to 0 ) with the orange Euler points that leap 1 → − 2 → 4 . The plum annotation flags the culprit — a stability factor of size 2 > 1 — and the orange zig-zag straddling the axis shows the tell-tale sign-flipping of an unstable run. When your numbers alternate sign and grow, this picture is what is happening.
Common mistake "The error in Example 5 just means take a smaller
h near the answer."
Why it feels right: O ( h ) says smaller h ⇒ smaller error.
The fix: below the stability threshold, yes. Above it, the iteration diverges no matter what the accuracy law predicts — accuracy and stability are different guarantees .
y ′ = y 2 , y ( 0 ) = 1 , find y ( 0.2 ) with h = 0.1
Here f depends on y squared — a non-linear slope machine. (The true solution y = 1 − x 1 blows up at x = 1 ; we stay safely left of it.)
Forecast: y 2 grows fast as y grows, so slopes accelerate. Euler, using the earlier smaller slope, will undershoot the true steep climb.
Step 1. f ( 0 , 1 ) = 1 2 = 1 . y 1 = 1 + 0.1 ( 1 ) = 1.1 at 0.1 .
Why square? Just evaluate f : ( y 0 ) 2 = 1 .
Step 2. f ( 0.1 , 1.1 ) = 1. 1 2 = 1.21 . y 2 = 1.1 + 0.1 ( 1.21 ) = 1.221 at 0.2 .
Why? Re-evaluate f at the new height y 1 = 1.1 ; squaring a larger height gives a steeper slope (1.21 > 1 ), so the climb is accelerating.
Verify: true 1 − 0.2 1 = 1.25 . Euler gives 1.221 , below it (error ≈ 0.029 ), as forecast. ✓ Non-linearity changes nothing in the recipe — you still just plug the current point into f .
Worked example A cup of coffee at
9 0 ∘ C sits in a 2 0 ∘ C room. Newton's law of cooling gives d t d T = − 0.1 ( T − 20 ) , with t in minutes. Estimate the temperature at t = 20 min using h = 10 min.
Translate: f ( t , T ) = − 0.1 ( T − 20 ) , T 0 = 90 . The negative sign means it cools toward room temperature.
Forecast: true cooling is 20 + 70 e − 0.1 t ; at t = 20 that is 20 + 70 e − 2 ≈ 29. 5 ∘ . With a coarse h = 10 , Euler over-cools (slope biggest at the start, applied over a long step) — expect a value below 29.5 .
Step 1. f ( 0 , 90 ) = − 0.1 ( 90 − 20 ) = − 7 . T 1 = 90 + 10 ( − 7 ) = 2 0 ∘ at t = 10 .
Why so drastic? The start slope is steep and we held it for a whole 10 minutes.
Step 2. f ( 10 , 20 ) = − 0.1 ( 20 − 20 ) = 0 . T 2 = 20 + 10 ( 0 ) = 2 0 ∘ at t = 20 .
Why flat? At 2 0 ∘ we hit room temperature exactly, so the slope is 0 — a degenerate step (Cell D again, arising naturally!).
Verify: Euler says 2 0 ∘ ; truth 29. 5 ∘ . Error ≈ 9. 5 ∘ — large because h = 10 is coarse and the stability margin ∣1 + hλ ∣ = ∣1 + 10 ( − 0.1 ) ∣ = ∣0∣ = 0 collapses the estimate straight to the floor in one jump. Units check: temperature stays in ∘ C throughout. ✓ Smaller h (say h = 2 ) would track the smooth 29. 5 ∘ far better.
y ′ = x + y , y ( 0 ) = 1 , one Euler step of size h lands at y 1 = 1.15 . Find h .
Forecast: we know the recipe, so invert it. Slope at start is f ( 0 , 1 ) = 1 , so y 1 = 1 + h ⋅ 1 . If y 1 = 1.15 , then h must be 0.15 .
Step 1. Write the update: y 1 = y 0 + h f ( x 0 , y 0 ) = 1 + h ( 1 ) .
Why? One step, slope known — a linear equation in h .
Step 2. Solve 1 + h = 1.15 ⇒ h = 0.15 .
Verify: plug back: 1 + 0.15 ( 1 ) = 1.15 . ✓ These "reverse" questions test whether you truly understand the update as an equation , not a black box.
Recall Which cell was hardest — and why?
Cell E (instability). Every other cell only produces accuracy error, controlled by h via the O ( h ) law. Cell E produces a qualitative failure: the numbers diverge from a truth that decays. The lesson: h must satisfy both accuracy and stability constraints.
Mnemonic Scenario checklist before you compute
"Sign, Zero, Size." Check the Sign of f (climb or fall?), spot any Zero slope (flat step), and confirm your Size of h keeps ∣1 + hλ ∣ < 1 (stable). Three glances save you every trap on this page.
Positive slope Euler estimate vs a convex true curve — above or below? Below (tangents undercut a convex curve).
For y ′ = − y , which h keeps Euler stable? Any h with ∣1 − h ∣ < 1 , i.e. 0 < h < 2 .
What does a step with f = 0 do to y ? Nothing — y n + 1 = y n , a flat horizontal step.
Halving h changes the global error by roughly what factor? About 2 1 (first-order, O ( h ) ).
Given y 1 = y 0 + h f and a known y 1 , how do you find h ? Solve the linear equation h = ( y 1 − y 0 ) / f ( x 0 , y 0 ) .
Parent topic — derivation & error law these examples exercise
Taylor Series Expansion — source of the local O ( h 2 ) term each example inherits
Runge-Kutta Methods — would cut the errors seen above dramatically (O ( h 4 ) )
Backward Euler & Implicit Methods — stays stable in Example 5 for any h
Numerical Stability — the ∣1 + hλ ∣ < 1 test used in Examples 2, 5, 7
Lipschitz Continuity — guarantees the error bound behind Example 3
Finite Difference Approximations — the forward-difference view of every step here
Euler update new = old + h times slope
Cell A growing undershoot
Cell D flat step y unchanged
accuracy error only order h
Cell E instability diverges