impera Open Impera

AP Calculus BC · Differential equations

Euler's method

1Following the slope field step by step

Many differential equations $\frac{dy}{dx} = f(x, y)$ cannot be solved exactly. Euler's method builds an approximate solution by taking small straight-line steps along the tangent line.

From a known point $(x_0, y_0)$, with step size $h$ (also written $\Delta x$):

$$x_{n+1} = x_n + h$$
$$y_{n+1} = y_n + h \cdot f(x_n, y_n)$$

Each step is a linearization: new $y$ = old $y$ + (slope at the old point) × (step).

Check yourself

For dy/dx = x + y at (0, 1) with h = 0.1, the first Euler step gives y ≈

  • 1.01

  • 1.2

  • 1.1

  • 0.9

Show the answer

1.1

1 + 0.1 × (0 + 1).

2Working through a table

Worked example

$\frac{dy}{dx} = x + y$, $y(0) = 1$. Estimate $y(0.3)$ with $h = 0.1$.

  1. $(0, 1)$: slope $= 1$. $y_1 = 1 + 0.1(1) = 1.1$.
  2. $(0.1, 1.1)$: slope $= 1.2$. $y_2 = 1.1 + 0.1(1.2) = 1.22$.
  3. $(0.2, 1.22)$: slope $= 1.42$. $y_3 = 1.22 + 0.1(1.42) = 1.362$.
  4. So $y(0.3) \approx 1.362$.

The exact solution is $y = 2e^x - x - 1$, giving $y(0.3) = 2e^{0.3} - 1.3 \approx 1.400$. Euler's estimate is a little low.

Worked example

$\frac{dy}{dx} = 2y$, $y(0) = 3$. Estimate $y(1)$ with two steps.

  1. $h = 0.5$. $(0, 3)$: slope $6$. $y_1 = 3 + 0.5(6) = 6$.
  2. $(0.5, 6)$: slope $12$. $y_2 = 6 + 0.5(12) = 12$.
  3. Exact: $3e^2 \approx 22.2$. Large steps give a poor estimate.
Check yourself

For dy/dx = 2y, y(0) = 3, one step of h = 0.5 gives:

  • 3

  • 6

  • 4.5

  • 12

Show the answer

6

3 + 0.5 × 6.

3Over- or underestimate?

Each step follows the tangent line, so the error depends on concavity:

  • If the solution curve is concave up ($y'' > 0$), tangent lines lie below the curve, so Euler underestimates.
  • If it is concave down ($y'' < 0$), Euler overestimates.

Euler's method for dy/dx = x + y, y(0) = 1: each red step follows the tangent slope

To find $y''$, differentiate $\frac{dy}{dx}$ implicitly. For $\frac{dy}{dx} = x + y$: $y'' = 1 + y' = 1 + x + y$, which is positive near $(0, 1)$, so the curve is concave up and Euler underestimates (as found above: 1.362 < 1.400).

Smaller steps give better estimates: halving $h$ roughly halves the error, at the cost of more steps.

Check yourself

If y″ < 0 along the solution, Euler's method gives:

  • An underestimate

  • The exact value

  • No information

  • An overestimate

Show the answer

An overestimate

Tangent lines lie above a concave down curve.

4Going deeper: organizing the steps in a table, and judging the direction of the error

Euler's method approximates the solution of $\frac{dy}{dx} = f(x, y)$ through a starting point by following tangent-line segments in steps of size h:

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

"New y = old y + (step) × (slope at the old point)."

Lay it out as a table: columns for x, y, the slope f(x, y), and the change h × slope.

Worked example

$\frac{dy}{dx} = x + y$, y(0) = 1. Approximate y(1) with two steps.

  1. h = 0.5.
  2. At (0, 1): slope = 1; change = 0.5(1) = 0.5; new point (0.5, 1.5).
  3. At (0.5, 1.5): slope = 2; change = 0.5(2) = 1; new point (1, 2.5).
  4. y(1) ≈ 2.5. (The exact solution $y = 2e^x - x - 1$ gives 3.437.)

Worked example (four steps): the same problem with h = 0.25.

  1. (0, 1): slope 1; y = 1.25.
  2. (0.25, 1.25): slope 1.5; y = 1.625.
  3. (0.5, 1.625): slope 2.125; y = 2.156.
  4. (0.75, 2.156): slope 2.906; y = 2.883.
  5. y(1) ≈ 2.883: closer to 3.437. Smaller steps give better accuracy.

Negative steps: to go backward (say from x = 2 to x = 1.8), use h = −0.2.

Worked example

$\frac{dy}{dx} = 2x - y$, y(1) = 3. Approximate y(0.8) with one step.

  1. Slope at (1, 3): −1.
  2. y ≈ 3 + (−0.2)(−1) = 3.2.

Overestimate or underestimate? Each step follows a tangent line, so the answer depends on concavity.

  • Solution concave up: tangent lines lie below: Euler gives an underestimate.
  • Concave down: an overestimate.

Find the concavity by differentiating the differential equation.

Worked example

for $\frac{dy}{dx} = x + y$ with y(0) = 1:

  1. $\frac{d^2y}{dx^2} = 1 + \frac{dy}{dx} = 1 + x + y$.
  2. On the interval, x ≥ 0 and y ≥ 1, so the second derivative is positive.
  3. The solution is concave up: 2.5 is an underestimate (confirmed: 2.5 < 3.437).

From a table of derivative values: if the question gives values of f′ at certain points and a starting value, use the given slope at each step.

Worked example

f(1) = 4, f′(1) = 2, f′(1.5) = 3. Approximate f(2) with two steps of 0.5.

  1. f(1.5) ≈ 4 + 0.5(2) = 5.
  2. f(2) ≈ 5 + 0.5(3) = 6.5.

Relation to other ideas

  • One Euler step is exactly a tangent-line (linear) approximation.
  • The path of Euler's method follows the slope field in straight segments.
  • When the equation is $\frac{dy}{dx} = f(x)$ only, Euler's method is a left Riemann sum.

Why use it? Most differential equations cannot be solved exactly; numerical methods like this (and more refined versions) are how they are solved in practice.

Common mistakes

  • Using the slope at the new point.
  • Forgetting to update x.
  • Using the wrong step size (dividing the interval by the wrong number of steps).
  • Sign errors with a negative step.
  • Deciding over or under from whether y is increasing, not from concavity.
Check yourself

Euler's method with step size 0.1 is used on dy/dx = y, starting at (0, 2). What is the approximation for y(0.1)?

  • 2.1

  • 2.4

  • 2.2

  • 2.02

Show the answer

2.2

The slope at (0, 2) is 2, so y increases by 0.1 × 2.

5For top marks

  • Show each step in a table: $x_n$, $y_n$, slope, $h \times$ slope.
  • Use the slope at the start of each step, not the end.
  • Count steps carefully: from $x = 0$ to $x = 1$ with $h = 0.25$ needs 4 steps.
  • Justify over/underestimate with the sign of $y''$ and the word "concave".
Example

"Since $\frac{d^2y}{dx^2} = 1 + x + y > 0$ for $x \ge 0$, $y > 0$, the solution is concave up, so the Euler approximation is an underestimate."

Check yourself

To go from x = 1 to x = 2 with h = 0.25, how many Euler steps are needed?

  • 5

  • 8

  • 4

  • 2

Show the answer

4

1 ÷ 0.25.

Now test yourself

This lesson has a 8-question quiz and 5 exam-style questions with mark schemes in Impera. Free, with your progress saved.

Practise in Impera