Skip to main content

Code Scholars Tutoring · AP Calculus BC

Euler’s method: building a numerical solution step by step

Unit 7 · Topics 7.5 · Detailed notes, a worked example, and a self-check with reasoning.

Understand the idea

Euler's method approximates a solution of a differential equation by following short tangent-line segments. Each step uses the slope evaluated at the current approximate point. It produces a sequence of approximate values, not an exact formula for the solution curve.

For y′=f(x,y)\displaystyle y'=f(x,y), begin with the supplied initial point and a stated step size. Compute the slope, multiply it by the horizontal step, and add the result to the current vertical value. Only after calculating the new point should you evaluate the slope for the next step.

An Euler table should show the old input, old approximate output, slope, and new output. Smaller steps often improve an approximation under suitable regularity conditions, but the numerical result remains an approximation. If concavity is known, tangent-line reasoning can help assess the direction of local error.

xn+1=xn+h,yn+1=yn+hf(xn,yn)x_{n+1}=x_n+h,\qquad y_{n+1}=y_n+h f(x_n,y_n)

A method you can apply

  1. Record (x0,y0)\displaystyle (x_0,y_0), the signed step size h\displaystyle h, and the target input.
  2. At each current point, evaluate f(xn,yn)\displaystyle f(x_n,y_n) and compute yn+1=yn+hf(xn,yn)\displaystyle y_{n+1}=y_n+h f(x_n,y_n).
  3. Update x\displaystyle x as well as y\displaystyle y, repeat the requested number of steps, and label the result approximate.

Worked example

Use Euler's method with h=0.25\displaystyle h=0.25 to approximate y(0.5)\displaystyle y(0.5) when y′=x+y\displaystyle y'=x+y and y(0)=1\displaystyle y(0)=1.

  1. At (0,1)\displaystyle (0,1), the slope is 0+1=1\displaystyle 0+1=1. Thus the first step gives y1=1+0.25(1)=1.25\displaystyle y_1=1+0.25(1)=1.25 at x1=0.25\displaystyle x_1=0.25.
  2. At the updated point (0.25,1.25)\displaystyle (0.25,1.25), the slope is 0.25+1.25=1.5\displaystyle 0.25+1.25=1.5.
  3. The second step gives y2=1.25+0.25(1.5)=1.625\displaystyle y_2=1.25+0.25(1.5)=1.625 at x2=0.5\displaystyle x_2=0.5.
Euler updates with step size 0.25
StepCurrent xCurrent ySlope x + yNext y
10\displaystyle 01\displaystyle 11\displaystyle 11.25\displaystyle 1.25
20.25\displaystyle 0.251.25\displaystyle 1.251.5\displaystyle 1.51.625\displaystyle 1.625
Euler's method gives y(0.5)≈1.625\displaystyle y(0.5)\approx1.625. The second slope must use the first approximate output, not the initial output again.

Try it yourself

Use two Euler steps of size 0.5\displaystyle 0.5 for y′=2x−y\displaystyle y'=2x-y, y(0)=1\displaystyle y(0)=1, to approximate y(1)\displaystyle y(1).

Show solution and reasoning

The first slope is −1\displaystyle -1, giving y(0.5)≈0.5\displaystyle y(0.5)\approx0.5. The next slope is 2(0.5)−0.5=0.5\displaystyle 2(0.5)-0.5=0.5, giving y(1)≈0.5+0.5(0.5)=0.75\displaystyle y(1)\approx0.5+0.5(0.5)=0.75.

AP® is a trademark registered by the College Board, which is not affiliated with, and does not endorse, this material.