Stiff Differential Equations
Stiff differential equations have solutions with parts that change on very different time scales, such as a fast transient that dies out almost at once next to a slow trend. Explicit methods like Euler’s method must then use tiny steps just to stay stable. Implicit methods such as the backward Euler method, yₙ₊₁ = yₙ + h·f(xₙ₊₁, yₙ₊₁), stay stable with large steps.
Before this lesson: Euler’s Method, Multistep Methods and Eigenvalues and Eigenvectors
The idea: stability, not accuracy, limits the step size
Consider y′ = −50(y − cos x). Any solution is pulled toward cos x within about 0.1 time units and then follows cos x slowly. After that brief transient, a step of 0.1 would be plenty to follow the smooth curve.
Euler’s method with h = 0.1 explodes anyway. Each step multiplies the error by 1 − 50h = −4, so tiny round-off and transient errors grow without bound. To stay stable it needs h ≤ 0.04, even where the solution is almost flat. That mismatch is what makes an equation stiff.
The fix is an implicit method. The backward Euler method evaluates the slope at the new point, which damps every decaying component no matter how large h is. The price is solving an equation for yₙ₊₁ at each step.
Stiff differential equations: the test equation
Apply a method to the test equation y′ = λy with λ < 0, whose exact solution decays. One step multiplies yₙ by an amplification factor R(z), where z = hλ:
\begin{aligned} \text{Euler:}\quad y_{n+1} &= (1 + h\lambda)\,y_n \\ \text{Backward Euler:}\quad y_{n+1} &= \frac{1}{1 - h\lambda}\,y_n \end{aligned}The method is stable when |R(z)| ≤ 1. For real λ < 0, Euler’s method needs h ≤ 2/|λ|, while the backward Euler factor is between 0 and 1 for every h > 0. A method that is stable on the whole left half-plane is called A-stable.
For a system y′ = Ay, the same test applies to each eigenvalue of A. The stiffness ratio is the largest |Re λ| divided by the smallest; a ratio of 1000 or more usually signals a stiff problem.
How to solve a stiff equation
- Spot stiffness: large negative eigenvalues (or ∂f/∂y) next to slow behavior you care about, or an explicit solver that needs far smaller steps than the solution’s shape suggests.
- Choose an implicit method: backward Euler (first order), the trapezoidal method or a backward differentiation formula.
- At each step, solve yₙ₊₁ = yₙ + h·f(xₙ₊₁, yₙ₊₁) for yₙ₊₁: directly if f is linear in y, otherwise with Newton’s method.
- Choose h for accuracy on the slow part of the solution; stability no longer limits it.
Stiff differential equations examples
Example 1: Euler’s method versus backward Euler on y′ = −20y
Solve y′ = −20y, y(0) = 1, whose exact solution e^(−20x) is almost 0 by x = 0.3. Compare Euler’s method and backward Euler with h = 0.15.
h\lambda = 0.15(-20) = -3
Find z = hλ.
1 + h\lambda = 1 - 3 = -2
Euler’s amplification factor.
y_1 = -2,\quad y_2 = 4,\quad y_3 = -8
Euler: multiply by −2 each step.
\dfrac{1}{1 - h\lambda} = \dfrac{1}{1 + 3} = \dfrac{1}{4}Backward Euler factor.
y_1 = 0.25,\quad y_2 = 0.0625,\quad y_3 \approx 0.015625
Backward Euler: multiply by 1/4 each step.
e^{-20(0.45)} = e^{-9} \approx 0.000123Exact value at x = 0.45.
Answer: Euler’s method gives −8 at x = 0.45 and keeps doubling with alternating signs, because |−2| > 1. Backward Euler gives 0.0156, which decays like the true solution. Euler would need h ≤ 2/20 = 0.1 to avoid growth.
Example 2: A slow solution with a fast transient
Use backward Euler with h = 0.1 on y′ = −50(y − cos x), y(0) = 0. Find y(0.1) and y(0.2), then compare a table of values with the exact solution and with Euler’s method.
y_{n+1} = y_n - 5(y_{n+1} - \cos x_{n+1})Backward Euler: hf = 0.1(−50)(yₙ₊₁ − cos xₙ₊₁).
6y_{n+1} = y_n + 5\cos x_{n+1}Collect yₙ₊₁ on the left.
y_1 = \dfrac{0 + 5\cos 0.1}{6} \approx \dfrac{4.975021}{6} \approx 0.829170First step, from y₀ = 0.
y_2 = \dfrac{0.829170 + 5\cos 0.2}{6} \approx \dfrac{0.829170 + 4.900333}{6} \approx 0.954917Second step.
| x | Backward Euler | Exact | Euler |
|---|---|---|---|
| 0.1 | 0.829170 | 0.989867 | 5.0 |
| 0.2 | 0.954917 | 0.983601 | −15.0 |
| 0.5 | 0.885779 | 0.886816 | 1025.5 |
| 1.0 | 0.556309 | 0.556909 | −1,049,205.1 |
Answer: y(0.1) ≈ 0.829 and y(0.2) ≈ 0.955. Backward Euler lags during the quick transient but then tracks cos x closely: by x = 1 the error is 0.0006. Euler’s method with the same h multiplies its error by −4 each step and is useless. The exact solution is y = (2500 cos x + 50 sin x)/2501 − (2500/2501)e^(−50x).
Example 3: The Euler step-size limit
An equation has ∂f/∂y ≈ −1000 along its solution, which changes slowly on [0, 10]. What is the largest stable step for Euler’s method, and how many steps does it need?
|1 + h(-1000)| \le 1 \Rightarrow 0 \le 1000h \le 2
Stability condition for z = −1000h.
h \le \dfrac{2}{1000} = 0.002Solve for h.
\dfrac{10}{0.002} = 5000Number of steps to reach x = 10.
Answer: h ≤ 0.002, so Euler’s method needs at least 5000 steps, even if a step of 0.1 (100 steps) would resolve the slow solution. Backward Euler can use the larger step.
Example 4: Backward Euler for a nonlinear equation
Take one backward Euler step with h = 0.2 for y′ = −5y², y(0) = 1. Solve the implicit equation with Newton’s method and check the result with the quadratic formula.
y_1 = 1 + 0.2(-5y_1^2) = 1 - y_1^2
Backward Euler step.
g(y) = y^2 + y - 1 = 0,\quad g'(y) = 2y + 1
Write the step as a root-finding problem.
y^{(1)} = 1 - \dfrac{g(1)}{g'(1)} = 1 - \dfrac{1}{3} \approx 0.666667Newton from the old value y = 1.
y^{(2)} = 0.666667 - \dfrac{0.111111}{2.333333} \approx 0.666667 - 0.047619 = 0.619048Second Newton iteration.
y_1 = \dfrac{-1 + \sqrt{1 + 4}}{2} = \dfrac{-1 + \sqrt{5}}{2} \approx 0.618034Quadratic formula, positive root.
y(0.2) = \dfrac{1}{1 + 5(0.2)} = 0.5Exact solution y = 1/(1 + 5x).
Answer: y₁ ≈ 0.618, and two Newton iterations already give 0.619. The error 0.118 comes from the large step, not from instability; Euler’s method gives 1 − 0.2(5) = 0 here.
Example 5: A fast sensor in a slowly cooling room (word problem)
A room cools by dR/dt = −0.1(R − 20) from R(0) = 30°C, with t in minutes. A small sensor reads S(0) = 25°C and responds fast: dS/dt = −100(S − R). Use backward Euler with h = 1 minute to estimate R(1) and S(1).
\lambda_1 = -0.1,\quad \lambda_2 = -100,\quad \dfrac{100}{0.1} = 1000Eigenvalues of the linear system (triangular matrix) and the stiffness ratio.
R_1 = 30 - 0.1(R_1 - 20) \Rightarrow 1.1R_1 = 32
Backward Euler for R.
R_1 = \dfrac{32}{1.1} \approx 29.090909Divide.
S_1 = 25 - 100(S_1 - R_1) \Rightarrow 101S_1 = 25 + 100R_1
Backward Euler for S, using the new R₁.
S_1 = \dfrac{25 + 2909.0909}{101} \approx 29.050405Substitute and divide.
R(1) = 20 + 10e^{-0.1} \approx 29.048374,\quad S(1) \approx 29.057432Exact values.
Answer: R(1) ≈ 29.09°C and S(1) ≈ 29.05°C, both within 0.05°C of the exact values. Euler’s method with h = 1 gives S₁ = 25 − 100(25 − 30) = 525°C; it would need h ≤ 0.02 minutes for the sensor equation alone.
Common mistakes
| Mistake | Example of the error | Fix |
|---|---|---|
| Blaming accuracy when the problem is stability | Seeing Euler blow up on y′ = −50(y − cos x) and only halving h once | Check |1 + hλ| ≤ 1; if the needed h is far smaller than the solution’s shape suggests, switch to an implicit method. |
| Evaluating f at the old point in backward Euler | yₙ₊₁ = yₙ + h·f(xₙ, yₙ) | That is Euler’s method; backward Euler uses f(xₙ₊₁, yₙ₊₁). |
| Taking the wrong root of the implicit equation | Choosing (−1 − √5)/2 in Example 4 | Pick the root near yₙ, or start Newton’s method at yₙ. |
| Judging stiffness by the size of λ alone | Calling y′ = −1000y stiff on [0, 0.01] | Stiffness compares the fast time scale with the length of the interval or the slow scale you need. |
| Assuming every implicit method damps fast components | Using the trapezoidal method with hλ = −100 | Its factor is −49/51 ≈ −0.96, so the transient oscillates slowly; backward Euler damps it at once. |
Related methods
The trapezoidal method
The trapezoidal method (Adams-Moulton 2, from multistep methods) has factor (1 + z/2)/(1 − z/2). It is A-stable and second order, but for very stiff components the factor approaches −1, so it does not damp them quickly. Backward Euler, whose factor approaches 0, has this stronger property (L-stability).
Backward differentiation formulas
BDF methods approximate y′(xₙ₊₁) from several earlier y-values; BDF1 is backward Euler and BDF2 is yₙ₊₁ − (4/3)yₙ + (1/3)yₙ₋₁ = (2/3)h·f(xₙ₊₁, yₙ₊₁). They are the standard methods in stiff solvers such as MATLAB’s ode15s and SciPy’s BDF option.
Explicit methods for comparison
Explicit methods such as Heun’s method and the Runge-Kutta method have bounded stability regions too, so they share Euler’s problem on stiff equations. They remain the best choice for non-stiff problems, where each step is cheap.
Practice problems
- What is the largest stable step for Euler’s method on y′ = −40y?
- Take two steps with h = 0.1 for y′ = −40y, y(0) = 1, using Euler’s method and the backward Euler method.
- Use backward Euler with h = 0.5 for y′ = −10(y − 2), y(0) = 0. Find y₁ and y₂.
- Find the eigenvalues and stiffness ratio of A with rows (−51, 49) and (49, −51). What is Euler’s step limit for y′ = Ay?
- Show that the backward Euler factor 1/(1 − hλ) is between 0 and 1 for every h > 0 when λ < 0.
- Take one backward Euler step with h = 0.5 for y′ = −y², y(0) = 2, using the quadratic formula. Compare with the exact y(0.5) = 1.
- For Problem 6, do one Newton iteration on the implicit equation, starting at y = 2.
- Is y′ = −0.5y on 0 ≤ x ≤ 10 stiff? What limits Euler’s step size?
- A chemical concentration satisfies y′ = −200(y − 3) with y(0) = 0 and x in seconds. Use one backward Euler step with h = 0.1 and compare with Euler’s method.
- Find the trapezoidal-method factor (1 + z/2)/(1 − z/2) for z = −3 and z = −100.
Show answers
1.
|1 + h(-40)| \le 1 \Rightarrow h \le \dfrac{2}{40}Euler stability condition.
Answer: h ≤ 0.05
2.
h\lambda = 0.1(-40) = -4,\quad 1 + h\lambda = -3
Euler’s factor.
y_1 = -3,\quad y_2 = 9
Euler steps.
\dfrac{1}{1 - h\lambda} = \dfrac{1}{5} = 0.2Backward Euler factor.
y_1 = 0.2,\quad y_2 = 0.04
Backward Euler steps.
Answer: Euler gives −3 and 9 (growing); backward Euler gives 0.2 and 0.04 (decaying like e^(−40x))
3.
y_{n+1} = y_n - 5(y_{n+1} - 2) \Rightarrow 6y_{n+1} = y_n + 10Backward Euler with h·(−10) = −5.
y_1 = \dfrac{0 + 10}{6} \approx 1.666667First step.
y_2 = \dfrac{1.666667 + 10}{6} \approx 1.944444Second step.
Answer: y₁ ≈ 1.6667 and y₂ ≈ 1.9444, approaching the equilibrium 2 without oscillation
4.
\det(A - \lambda I) = (-51 - \lambda)^2 - 49^2 = 0
-51 - \lambda = \pm 49 \Rightarrow \lambda = -2 \text{ or } \lambda = -100Take square roots.
\dfrac{100}{2} = 50,\quad h \le \dfrac{2}{100} = 0.02Stiffness ratio and the Euler limit set by λ = −100.
Answer: λ = −2 and −100; ratio 50; Euler needs h ≤ 0.02
5.
h \gt 0,\ \lambda \lt 0 \Rightarrow -h\lambda \gt 0 \Rightarrow 1 - h\lambda \gt 1
The denominator exceeds 1.
0 \lt \dfrac{1}{1 - h\lambda} \lt 1Take the reciprocal.
Answer: the factor is always between 0 and 1, so backward Euler decays for every step size
6.
y_1 = 2 - 0.5y_1^2 \Rightarrow y_1^2 + 2y_1 - 4 = 0
Backward Euler step, multiplied by 2.
y_1 = \dfrac{-2 + \sqrt{4 + 16}}{2} = -1 + \sqrt{5} \approx 1.236068Quadratic formula, positive root.
Answer: y₁ ≈ 1.236; the error is about 0.236 because h = 0.5 is large, but the step is stable
7.
g(y) = y^2 + 2y - 4,\quad g(2) = 4,\quad g'(2) = 2(2) + 2 = 6
Evaluate g and g′ at y = 2.
y = 2 - \dfrac{4}{6} \approx 1.333333Newton step.
Answer: about 1.3333 (more iterations approach 1.236068)
8.
h \le \dfrac{2}{0.5} = 4Euler stability limit.
Answer: no; the stability limit h ≤ 4 is far larger than any step needed for accuracy on [0, 10], so accuracy, not stability, sets h
9.
y_1 = 0 - 20(y_1 - 3) \Rightarrow 21y_1 = 60
Backward Euler with h·(−200) = −20.
y_1 = \dfrac{60}{21} \approx 2.857143Divide.
y_1^{\text{Euler}} = 0 + 0.1(-200)(0 - 3) = 60Euler step.
Answer: backward Euler gives about 2.857, near the equilibrium 3; Euler gives 60, far off, and its factor 1 − 20 = −19 makes later steps worse
10.
\dfrac{1 + (-1.5)}{1 - (-1.5)} = \dfrac{-0.5}{2.5} = -0.2z = −3.
\dfrac{1 + (-50)}{1 - (-50)} = \dfrac{-49}{51} \approx -0.960784z = −100.
Answer: −0.2 and about −0.96; both are stable, but the second barely damps the fast component, which is why backward Euler is preferred for very stiff problems
Stiff differential equations FAQ
What makes a differential equation stiff?
An equation is stiff when its solution contains components that decay much faster than the part you want to follow, so an explicit method’s step size is limited by stability rather than accuracy. For linear systems, a large ratio between the largest and smallest |Re λ| of the eigenvalues signals stiffness.
Why is the backward Euler method good for stiff equations?
Its amplification factor 1/(1 − hλ) is less than 1 in size for every h > 0 when λ < 0, so it stays stable with any step size and damps fast components immediately.
Why don’t explicit methods work well for stiff equations?
Every explicit method has a bounded stability region, so a large negative λ forces a tiny step even after the fast component has died out. The work then becomes huge.
What solvers are used for stiff equations?
Implicit methods such as backward Euler, BDF methods and implicit Runge-Kutta methods, solved with Newton’s method at each step. Software examples are MATLAB’s ode15s and SciPy’s solve_ivp with the BDF or Radau method.
Summary
- A stiff equation has fast-decaying components next to a slow solution, so explicit methods need tiny steps to stay stable.
- On y′ = λy, Euler’s method multiplies by 1 + hλ and needs h ≤ 2/|λ|.
- Backward Euler, yₙ₊₁ = yₙ + h·f(xₙ₊₁, yₙ₊₁), multiplies by 1/(1 − hλ) and is stable for every h.
- Implicit steps need an equation solve: directly for linear f, by Newton’s method otherwise.
- For systems, compare eigenvalues: a large stiffness ratio signals a stiff problem.
Previous lesson: Multistep Methods
Next lesson: Shooting Method
Back to the Numerical Methods Index