Approximating Solutions Using Euler's Method
Introduced
8:26
Modeling with Differential Equations
Normally you are handed a function and asked for its slope. A differential equation turns that around. You are handed a rule for the slope at every point, and…
English narration · English and 中文 subtitles you can switch
In this lesson
| English |
|---|
| Euler's method/ˈɔɪləz ˈmeθəd/ |
| step size/step saɪz/ |
Walking a solution one small step at a time
- Not every differential equation can be solved with a formula — but you can still approximate the solution numerically.
- Euler's method 欧拉法 follows the slope field in tiny straight steps from a starting point.
- At each point, use the differential equation to get the slope, then step forward along it.
- Repeat, and you trace an approximate solution curve.
The update rule
- Given $\dfrac{dy}{dx}=f(x,y)$ and a start $(x_0,y_0)$, take a fixed step size 步长 $h$:
-
$$y_{n+1}=y_n+h\,f(x_n,y_n),\qquad x_{n+1}=x_n+h$$
- The new $y$ = old $y$ + (slope there) × (step $h$).
- It's "current value plus slope times step" — a tangent-line jump.

Euler's method steps along the tangent; the estimate drifts from the true solution
The slope field and exact exponential solution
This field is $dy/dx=ay$, with exact solution $y=y_0e^{ax}$. It illustrates tangent directions, without calculating Euler steps. The worked Euler example below instead uses $dy/dx=x+y$.
Euler's update rule is $y_{n+1}=$
Difficulty 1/5 · 100 coins + a small bonus on first completion today
Old $y$ plus slope times step.
The fixed increment $h$ used at each Euler step is called the ____ size.
Difficulty 1/5 · 100 coins + a small bonus on first completion today
$x$ advances by the step size $h$ each iteration.
Marching through a table
- Organize the work in a table: at each row, read $(x_n,y_n)$, compute the slope $f(x_n,y_n)$, then get $y_{n+1}$.
- Advance $x$ by $h$ each row and repeat until you reach the target $x$.
- Each step is just arithmetic; the differential equation supplies the slope.
- After a few rows you have an approximate $y$ at the target.
For $\dfrac{dy}{dx}=x+y$, $y(0)=1$, $h=0.5$: the slope at $(0,1)$ is $1$. Find $y_1$.
Difficulty 2/5 · 140 coins + a small bonus on first completion today
$1+0.5(1)=1.5$.
For $dy/dx=x+y$ with step $h=0.5$, the current point is $(0.5,1.5)$. Find the Euler estimate $y(1)\approx y_2$.
Difficulty 2/5 · 140 coins + a small bonus on first completion today
At $(0.5,1.5)$, the slope is $0.5+1.5=2$. Then $y_2=y_1+h f(x_1,y_1)=1.5+0.5(2)=2.5$.
Accuracy and step size
- Euler's method is only an approximation — it follows straight tangents, so it drifts from the true curve.
- A smaller step size $h$ generally gives a more accurate estimate for a smooth, stable problem (but more steps).
- On a concave-up curve Euler tends to underestimate; concave-down, overestimate.
- More steps, less error — the classic accuracy trade-off.
Using a smaller step size $h$ generally makes Euler's estimate...
Difficulty 1/5 · 100 coins + a small bonus on first completion today
Smaller steps drift less from the true curve.
You must recompute the slope at each new point, not reuse the initial slope.
Difficulty 1/5 · 100 coins + a small bonus on first completion today
The slope $f(x_n,y_n)$ changes each step.
Use the slope at the current point $(x_n,y_n)$ for each step, not a fixed slope. And each step updates both $x$ (by $h$) and $y$ (by $h\cdot f$). A common error is reusing the initial slope for every step — the slope must be recomputed at each new point.
Approximate $y(1)$ for $\dfrac{dy}{dx}=x+y$, $y(0)=1$, with step $h=0.5$.
- Step 1: slope at $(0,1)$ is $0+1=1$; $y_1=1+0.5(1)=1.5$, $x_1=0.5$.
- Step 2: slope at $(0.5,1.5)$ is $0.5+1.5=2$; $y_2=1.5+0.5(2)=2.5$, $x_2=1$.
- So $y(1)\approx 2.5$.
$\dfrac{dy}{dx}=xy$ with $y(1)=2$. Use one Euler step with $h=0.1$ to estimate $y(1.1)$.
Difficulty 2/5 · 140 coins + a small bonus on first completion today
Slope at $(1,2)$ is $2$. $y\approx2+0.1\times2=2.2$.
$\dfrac{dy}{dx}=x-y$ with $y(0)=1$. Use two Euler steps with $h=0.5$ to estimate $y(1)$.
Difficulty 2/5 · 140 coins + a small bonus on first completion today
Slope $-1$ at $(0,1)$ gives $y=0.5$ at $x=0.5$. Slope $0$ there, so $y(1)\approx0.5$.
Halve the step. Same problem, $\dfrac{dy}{dx}=x+y$, $y(0)=1$, now with $h=0.25$.
| $x_n$ | $y_n$ | slope $x_n+y_n$ | $y_{n+1}=y_n+0.25\times\text{slope}$ |
|---|---|---|---|
| 0 | 1 | 1 | 1.25 |
| 0.25 | 1.25 | 1.5 | 1.625 |
| 0.5 | 1.625 | 2.125 | 2.15625 |
| 0.75 | 2.15625 | 2.90625 | 2.8828 |
- $y(1)\approx2.883$. The exact value is $2e-2\approx3.437$, so the smaller step is closer than 2.5, but both are too low.
From the $h=0.25$ table, what is the Euler estimate of $y(1)$, to 3 decimal places?
Difficulty 2/5 · 140 coins + a small bonus on first completion today
The last row gives $2.8828\ldots\approx2.883$.
Over- or underestimate?
- AP questions ask you to justify this with the second derivative. Find $\dfrac{d^2y}{dx^2}$ by differentiating $\dfrac{dy}{dx}$ (use the chain rule on $y$).
- If $\dfrac{d^2y}{dx^2}>0$ on the interval, the curve is concave up, the tangent steps lie below it, and Euler underestimates. If it is negative, Euler overestimates.
Justify the direction. For $\dfrac{dy}{dx}=x+y$ with $y(0)=1$:
- $\dfrac{d^2y}{dx^2}=1+\dfrac{dy}{dx}=1+x+y$.
- On $0\le x\le1$ the solution has $x\ge0$ and $y>0$, so $\dfrac{d^2y}{dx^2}>0$: concave up, so both estimates are underestimates.
For a solution, $\dfrac{d^2y}{dx^2}<0$ on the whole interval. What can you say about an Euler estimate?
Difficulty 1/5 · 100 coins + a small bonus on first completion today
The curve is concave down, so the tangent steps lie above it.
If $\dfrac{dy}{dx}=y^2$, what is $\dfrac{d^2y}{dx^2}$?
Difficulty 1/5 · 100 coins + a small bonus on first completion today
$\dfrac{d^2y}{dx^2}=2y\dfrac{dy}{dx}=2y\cdot y^2=2y^3$.
Euler's method approximates a differential equation's solution by stepping along tangents: $y_{n+1}=y_n+h\,f(x_n,y_n)$ with fixed step size $h$, recomputing the slope at each point. It's approximate (straight steps drift from the curve); a smaller $h$ generally improves accuracy for a smooth, stable problem.
What went wrong? Only the site team sees this.