Steply

Use Euler's method on dy/dx = -2y, y(0) = 3, step 0.25, to find y(1)

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 = −2y, with y(0) = 3, step 0.25, to find y(1).

dydx = −2y
y(0) = 3, step h = 0.25

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 = −2y at the old point

2 The step size

From x = 0 to x = 1, in steps of 0.25: that is 4 steps.

steps = 1 − 00.25 = 4

3 Go to x = 0.25

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

It is −6.

slope at (0, 3) = −2 × 3 = −6

New y = old y + h times the slope: 3 + 0.25 × (−6), which is 1.5.

Now we are at x = 0.25.

y1 = 3 + 0.25 × (−6) = 1.5

Careful!

Times the step size h!

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

Careful: not y₁ = 3 + (−6) ✗

4 Go to x = 0.5

The slope at (0.25, 1.5) is −3.

slope at (0.25, 1.5) = −2 × 1.5 = −3

New y: 1.5 + 0.25 × (−3) = 0.75.

y2 = 1.5 + 0.25 × (−3) = 0.75

5 Go to x = 0.75

The slope at (0.5, 0.75) is −1.5.

slope at (0.5, 0.75) = −2 × 0.75 = −1.5

New y: 0.75 + 0.25 × (−1.5) = 0.375.

y3 = 0.75 + 0.25 × (−1.5) = 0.375

6 Go to x = 1

The slope at (0.75, 0.375) is −0.75.

slope at (0.75, 0.375) = −2 × 0.375 = −0.75

New y: 0.375 + 0.25 × (−0.75) = 0.1875.

y4 = 0.375 + 0.25 × (−0.75) = 0.1875

All the points in a table.

3
1.5
0.75
0.375
0.1875

So y(1) ≈ 0.1875.

y(1) ≈ 0.1875

7 Check

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

Close to our 0.1875.

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

Smaller steps get closer.

Right!

tiny steps: y(1) ≈ 0.406

Let's look back.

First: the idea.

Then: the step size.

Then: go to x = 0.25.

Then: go to x = 0.5.

Then: go to x = 0.75.

Then: go to x = 1.

Last: check.

Answer
y(1) ≈ 0.1875

Your turn

Try this one yourself, then check:

dydx = −2y
Show the answer
y(1) ≈ 0.125

More from Euler's method

The whole lesson: Euler's method →