Euler's Method
AP Calculus BC · Unit 7 — Differential Equations
Euler's method — walking the slope field one step at a time
Given $\dfrac{dy}{dx}=f(x,y)$ and a starting point $(x_0,y_0)$, choose a step size $h$ and repeat:
$$x_{n+1}=x_n+h,\qquad y_{n+1}=y_n+h\cdot f(x_n,y_n)$$Each step follows the tangent line at the point you are standing on, not the point you are heading to. The result is a polygonal path that approximates the solution curve.
Two facts the exam tests more often than the arithmetic:
- Direction of the error. If the solution is concave up on the interval, every tangent segment lies below the curve, so Euler underestimates. Concave down gives an overestimate. Decide concavity from the sign of $\frac{d^{2}y}{dx^{2}}$, not from whether $y$ is increasing.
- Size of the error. Euler's method is first order: halving $h$ roughly halves the error. It never becomes exact for $h>0$ unless the solution is a straight line.
Stepping backwards, from $x_0$ to a smaller $x$, simply means $h<0$; the formula is unchanged.
Worked example: two Euler steps and the direction of the error
Let $\dfrac{dy}{dx}=x+2y$ with $y(0)=1$. Use Euler's method with two equal steps, $h=0.25$, to approximate $y(0.5)$.
Solution
Step 1. At $(x_0,y_0)=(0,1)$: $f=0+2(1)=2$.
$$y_1=1+0.25\cdot 2=1.5\quad\text{at } x_1=0.25$$Step 2. At $(0.25;\,1.5)$: $f=0.25+2(1.5)=3.25$.
$$y_2=1.5+0.25\cdot 3.25=2.3125\quad\text{at } x_2=0.5$$So $y(0.5)\approx 2.3125$.
Direction of the error. $y''=1+2y'=1+2(x+2y)$; at $(0,1)$ this gives $y''=1+2(2)=5>0$, and $y''$ stays positive on the whole interval because $y$ is positive and increasing. The graph is concave up, so $2.3125$ is an underestimate.
Key technical point: the slope in step 2 must be computed at the $y_1=1.5$ just found, not at $y_0=1$.