Euler's method
Master Euler’s method in Year 12 VCE Specialist Mathematics. Euler’s method is a step-by-step numerical way to estimate the solution of a differential equation \(\dfrac{dy}{dx}=f(x,y)\), following the tangent one small step at a time from a known starting point. It sits in the Calculus area of study of the VCE Mathematics Study Design (VCAA), within the Differential equations topic of Unit 4.
You will learn to apply the update rule \(y_{n+1}=y_n+h\,f(x_n,y_n)\) with \(x_{n+1}=x_n+h\), take one or several steps to estimate \(y\) at a target \(x\), see how the step size \(h\) affects accuracy, and compare the estimate with the exact solution — a first numerical tool for differential equations.
Theory
Euler's method is a step-by-step way to estimate the solution of a differential equation \(\dfrac{dy}{dx}=f(x,y)\) when an exact formula is hard to find. In Year 12 Specialist Mathematics you start from a known point \((x_0,y_0)\) and take steps of size \(h\) using the update \(y_{n+1}=y_n+h\,f(x_n,y_n)\), \(x_{n+1}=x_n+h\), to reach an estimate of \(y\) at a target \(x\).
A differential equation \(\dfrac{dy}{dx}=f(x,y)\) gives the slope of the solution curve at every point. With an initial condition \(y=y_0\) when \(x=x_0\), Euler's method builds an approximate solution one small step at a time.
The idea is to follow the tangent. At the current point \((x_n,y_n)\) the slope is \(f(x_n,y_n)\); moving a horizontal step size \(h\) along that straight tangent raises \(y\) by \(h\,f(x_n,y_n)\). This gives the next point \((x_{n+1},y_{n+1})\).
Repeating the step traces a polyline of short straight segments that approximates the true curve. Because it uses only the slope at the start of each step (a first-order approximation), it drifts away from the exact solution — the estimate is rarely exact.
Accuracy depends on the step size: a smaller \(h\) (with more steps to reach the same \(x\)) hugs the curve more closely and is generally more accurate, but takes more work. Where the exact solution is known, the Euler estimate can be compared with it to find the error.
Euler's method advances from the current point \((x_n,y_n)\) by one step of size \(h\), using the slope \(f(x_n,y_n)\) from the differential equation:
The \(x\)-values step up by \(h\) each time, so after \(n\) steps:
Where the exact solution \(y(x)\) is known, the error of the estimate at a target \(x\) is the difference from the exact value:
How to apply Euler's method
- Start at the given point \((x_0,y_0)\) and note the step size \(h\) and the slope function \(f(x,y)=\dfrac{dy}{dx}\).
- Evaluate the slope at the current point, \(f(x_n,y_n)\) — always at the start of the step.
- Take one step: \(y_{n+1}=y_n+h\,f(x_n,y_n)\) and \(x_{n+1}=x_n+h\).
- Repeat until \(x_n\) reaches the target \(x\); the last \(y_n\) is the estimate. A step table keeps each line tidy:
For \(\dfrac{dy}{dx}=x+y\) with \(y=1\) at \(x=0\) and \(h=0.1\), two steps give \(y\approx 1.22\) at \(x=0.2\):
| \(n\) | \(x_n\) | \(y_n\) | \(f(x_n,y_n)=x_n+y_n\) | \(y_{n+1}=y_n+h\,f\) |
|---|---|---|---|---|
| 0 | \(0\) | \(1\) | \(1\) | \(1.1\) |
| 1 | \(0.1\) | \(1.1\) | \(1.2\) | \(1.22\) |
Evaluate the slope at the starting point \((x_0,y_0)=(1,2)\):
| \(f(x_0,y_0)\) | \(=\) | \(3(1)^2\) |
| \(=\) | \(3\) |
Take one Euler step \(y_1=y_0+h\,f(x_0,y_0)\):
| \(y_1\) | \(=\) | \(2 + 0.1(3)\) |
| \(=\) | \(2 + 0.3\) | |
| \(=\) | \(2.3\) |
After one step, \(y_1 = 2.3\).
Step 1 — slope at \((0,1)\), then update:
| \(f(x_0,y_0)\) | \(=\) | \(0 + 1 = 1\) |
| \(y_1\) | \(=\) | \(1 + 0.1(1)\) |
| \(=\) | \(1.1\) |
Step 2 — slope at \((0.1,\,1.1)\), then update:
| \(f(x_1,y_1)\) | \(=\) | \(0.1 + 1.1 = 1.2\) |
| \(y_2\) | \(=\) | \(1.1 + 0.1(1.2)\) |
| \(=\) | \(1.22\) |
Each line of the working is one row of the step table:
| \(n\) | \(x_n\) | \(y_n\) | \(f(x_n,y_n)=x_n+y_n\) | \(y_{n+1}=y_n+h\,f\) |
|---|---|---|---|---|
| 0 | \(0\) | \(1\) | \(1\) | \(1.1\) |
| 1 | \(0.1\) | \(1.1\) | \(1.2\) | \(1.22\) |
At \(x=0.2\), \(y_2 = 1.22\).
Three steps of \(h=0.5\) take \(x\) from \(0\) to \(1.5\):
| \(y_1\) | \(=\) | \(2 + 0.5(0+1) = 2.5\) |
| \(y_2\) | \(=\) | \(2.5 + 0.5(0.5+1) = 3.25\) |
| \(y_3\) | \(=\) | \(3.25 + 0.5(1+1) = 4.25\) |
At \(x=1.5\), \(y \approx 4.25\).
Two Euler steps to reach \(x=1\):
| \(y_1\) | \(=\) | \(1 + 0.5(1) = 1.5\) |
| \(y_2\) | \(=\) | \(1.5 + 0.5(1.5) = 2.25\) |
Error \(=\) exact \(-\) estimate:
| \(\text{error}\) | \(=\) | \(2.718 - 2.25\) |
| \(=\) | \(0.468\ldots\) | |
| \(\approx\) | \(0.47\) |
\(y(1)\approx 2.25\), about \(0.47\) below the exact value — a smaller \(h\) would reduce this error.
Common pitfalls
Frequently asked questions
What is Euler's method?
It is a step-by-step numerical method for estimating the solution of a differential equation \(\dfrac{dy}{dx}=f(x,y)\) from a starting point \((x_0,y_0)\). Each step follows the tangent for a horizontal distance \(h\), using \(y_{n+1}=y_n+h\,f(x_n,y_n)\).
What is the formula for Euler's method?
The update rule is \(y_{n+1}=y_n+h\,f(x_n,y_n)\) with \(x_{n+1}=x_n+h\), where \(h\) is the step size and \(f(x_n,y_n)\) is the slope \(\dfrac{dy}{dx}\) at the current point.
How do I estimate y at a particular x value?
Work out how many steps reach the target: \(n=(x-x_0)/h\). Then apply the update rule that many times, advancing \(x\) by \(h\) each step; the final \(y_n\) is the estimate at that \(x\).
Does a smaller step size give a better approximation?
Generally yes. A smaller \(h\) (with more steps) follows the changing slope more closely, so the polyline stays nearer the true curve. For this first-order method, halving \(h\) roughly halves the error.
Why does Euler's method under- or overestimate?
Euler holds the slope constant across each step. Where the solution curve bends upward (concave up) the straight step falls below it, so Euler underestimates; where it bends downward it overestimates.
How does Euler's estimate compare with the exact solution?
When the exact solution is known, the error is \(y_{\text{exact}}-y_{\text{Euler}}\). For example, \(\dfrac{dy}{dx}=y\) from \((0,1)\) with \(h=0.5\) estimates \(y(1)\approx 2.25\), about \(0.47\) below the exact \(e\approx 2.718\).