Steply

Use Euler's method on dy/dx = x + y, y(0) = 0, step 0.5, to find…

Step by step, with the reason for every step · Euler's method · Differential Equations

Step by step

The question

Question: use Euler's method on dy/dx = x + y, with y(0) = 0, step 0.5, to find y(1.5).

dydx = x + y
y(0) = 0, step h = 0.5

1 The idea

We cannot solve it exactly here.

So we walk: from a point, follow its slope for a short step h.

Then look at the slope again.

New y = old y + h times the slope.

new y = old y + h × slope
slope = x + y at the old point

2 The step size

From x = 0 to x = 1.5, in steps of 0.5: that is 3 steps.

steps = 1.5 − 00.5 = 3

3 Go to x = 0.5

The slope at our point (0, 0): put x and y into x + y.

It is 0.

slope at (0, 0) = 0 + 0 = 0

New y = old y + h times the slope: 0 + 0.5 × 0, which is 0.

Now we are at x = 0.5.

y1 = 0 + 0.5 × 0 = 0

Careful!

Times the step size h!

We only move 0.5 to the right, so y changes by 0.5 times the slope.

Careful: not y₁ = 0 + 0 ✗

4 Go to x = 1

The slope at (0.5, 0) is 0.5.

slope at (0.5, 0) = 0.5 + 0 = 0.5

New y: 0 + 0.5 × 0.5 = 0.25.

y2 = 0 + 0.5 × 0.5 = 0.25

5 Go to x = 1.5

The slope at (1, 0.25) is 1.25.

slope at (1, 0.25) = 1 + 0.25 = 1.25

New y: 0.25 + 0.5 × 1.25 = 0.875.

y3 = 0.25 + 0.5 × 1.25 = 0.875

All the points in a table.

0
0
0.25
0.875

On a graph:

Euler's steps: straight lines, each with the slope at its start.

The true solution, in green, bends away a little.

So y(1.5) ≈ 0.875.

y(1.5) ≈ 0.875

6 Check

Let's check: a calculator with very tiny steps gives about 1.9817.

Close to our 0.875.

Euler is a bit low: the slope changes during each step.

Smaller steps get closer.

Right!

tiny steps: y(1.5) ≈ 1.9817

Let's look back.

First: the idea.

Then: the step size.

Then: go to x = 0.5.

Then: go to x = 1.

Then: go to x = 1.5.

Last: check.

Answer
y(1.5) ≈ 0.875

Your turn

Try this one yourself, then check:

dydx = x + y
Show the answer
y(1.5) ≈ 7.625

More from Euler's method

The whole lesson: Euler's method →