Steply

Use Euler's method on dy/dx = 2xy, y(0) = 1, 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 = 2xy, with y(0) = 1, step 0.25, to find y(1).

dydx = 2xy
y(0) = 1, 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 = 2xy 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, 1): put x and y into 2xy.

It is 0.

slope at (0, 1) = 2 × 0 × 1 = 0

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

Now we are at x = 0.25.

y1 = 1 + 0.25 × 0 = 1

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₁ = 1 + 0 ✗

4 Go to x = 0.5

The slope at (0.25, 1) is 0.5.

slope at (0.25, 1) = 2 × 0.25 × 1 = 0.5

New y: 1 + 0.25 × 0.5 = 1.125.

y2 = 1 + 0.25 × 0.5 = 1.125

5 Go to x = 0.75

The slope at (0.5, 1.125) is 1.125.

slope at (0.5, 1.125) = 2 × 0.5 × 1.125 = 1.125

New y: 1.125 + 0.25 × 1.125 = 1.4063.

y3 = 1.125 + 0.25 × 1.125 = 1.4063

6 Go to x = 1

The slope at (0.75, 1.4063) is 2.1095.

slope at (0.75, 1.4063) = 2 × 0.75 × 1.4063 = 2.1095

New y: 1.4063 + 0.25 × 2.1095 = 1.9337.

y4 = 1.4063 + 0.25 × 2.1095 = 1.9337

All the points in a table.

1
1
1.125
1.4063
1.9337

So y(1) ≈ 1.9337.

y(1) ≈ 1.9337

7 Check

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

Close to our 1.9337.

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

Smaller steps get closer.

Right!

tiny steps: y(1) ≈ 2.7183

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) ≈ 1.9337

Your turn

Try this one yourself, then check:

dydx = xy
Show the answer
y(1) ≈ 2.8389

More from Euler's method

The whole lesson: Euler's method →