Steply

Euler's method

Differential Equations · 20 problems, easy to harder

▶ Watch the first one solved

How we do it

  1. The idea
  2. The step size
  3. Go to x = 0.5
  4. Go to x = 1
  5. Go to x = 1.5
  6. Go to x = 2
  7. Check

The steps for Euler's method: y' = 2x - y, y(0) = 1, h = 0.5, estimate y(2). Every solution names its steps, so you always know what comes next.

Worked examples

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

The question

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

dydx = x + y
y(0) = 1, step h = 0.1

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 = 0.3, in steps of 0.1: that is 3 steps.

steps = 0.3 − 00.1 = 3

3 Go to x = 0.1

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

It is 1.

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

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

Now we are at x = 0.1.

y1 = 1 + 0.1 × 1 = 1.1

Careful!

Times the step size h!

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

Careful: not y₁ = 1 + 1 ✗

4 Go to x = 0.2

The slope at (0.1, 1.1) is 1.2.

slope at (0.1, 1.1) = 0.1 + 1.1 = 1.2

New y: 1.1 + 0.1 × 1.2 = 1.22.

y2 = 1.1 + 0.1 × 1.2 = 1.22

5 Go to x = 0.3

The slope at (0.2, 1.22) is 1.42.

slope at (0.2, 1.22) = 0.2 + 1.22 = 1.42

New y: 1.22 + 0.1 × 1.42 = 1.362.

y3 = 1.22 + 0.1 × 1.42 = 1.362

All the points in a table.

1
1.1
1.22
1.362

So y(0.3) ≈ 1.362.

y(0.3) ≈ 1.362

6 Check

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

Close to our 1.362.

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

Smaller steps get closer.

Right!

tiny steps: y(0.3) ≈ 1.3997

Let's look back.

First: the idea.

Then: the step size.

Then: go to x = 0.1.

Then: go to x = 0.2.

Then: go to x = 0.3.

Last: check.

Answer
y(0.3) ≈ 1.362

▶ Watch it solved

Euler's method: y' = 2x - y, y(0) = 1, h = 0.5, estimate y(2) Medium

The question

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

dydx = 2x − y
y(0) = 1, 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 = 2x − y at the old point

2 The step size

From x = 0 to x = 2, in steps of 0.5: that is 4 steps.

steps = 2 − 00.5 = 4

3 Go to x = 0.5

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

It is −1.

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

New y = old y + h times the slope: 1 + 0.5 × (−1), which is 0.5.

Now we are at x = 0.5.

y1 = 1 + 0.5 × (−1) = 0.5

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₁ = 1 + (−1) ✗

4 Go to x = 1

The slope at (0.5, 0.5) is 0.5.

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

New y: 0.5 + 0.5 × 0.5 = 0.75.

y2 = 0.5 + 0.5 × 0.5 = 0.75

5 Go to x = 1.5

The slope at (1, 0.75) is 1.25.

slope at (1, 0.75) = 2 × 1 − 0.75 = 1.25

New y: 0.75 + 0.5 × 1.25 = 1.375.

y3 = 0.75 + 0.5 × 1.25 = 1.375

6 Go to x = 2

The slope at (1.5, 1.375) is 1.625.

slope at (1.5, 1.375) = 2 × 1.5 − 1.375 = 1.625

New y: 1.375 + 0.5 × 1.625 = 2.1875.

y4 = 1.375 + 0.5 × 1.625 = 2.1875

All the points in a table.

1
0.5
0.75
1.375
2.1875

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(2) ≈ 2.1875.

y(2) ≈ 2.1875

7 Check

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

Close to our 2.1875.

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

Smaller steps get closer.

Right!

tiny steps: y(2) ≈ 2.406

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.

Then: go to x = 2.

Last: check.

Answer
y(2) ≈ 2.1875

▶ Watch it solved

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

The question

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

dydx = x − 2y
y(1) = 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 − 2y at the old point

2 The step size

From x = 1 to x = 3, in steps of 0.5: that is 4 steps.

steps = 3 − 10.5 = 4

3 Go to x = 1.5

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

It is 1.

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

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

Now we are at x = 1.5.

y1 = 0 + 0.5 × 1 = 0.5

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 + 1 ✗

4 Go to x = 2

The slope at (1.5, 0.5) is 0.5.

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

New y: 0.5 + 0.5 × 0.5 = 0.75.

y2 = 0.5 + 0.5 × 0.5 = 0.75

5 Go to x = 2.5

The slope at (2, 0.75) is 0.5.

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

New y: 0.75 + 0.5 × 0.5 = 1.

y3 = 0.75 + 0.5 × 0.5 = 1

6 Go to x = 3

The slope at (2.5, 1) is 0.5.

slope at (2.5, 1) = 2.5 − 2 × 1 = 0.5

New y: 1 + 0.5 × 0.5 = 1.25.

y4 = 1 + 0.5 × 0.5 = 1.25

All the points in a table.

0
0.5
0.75
1
1.25

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(3) ≈ 1.25.

y(3) ≈ 1.25

7 Check

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

Close to our 1.25.

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

Smaller steps get closer.

Right!

tiny steps: y(3) ≈ 1.2454

Let's look back.

First: the idea.

Then: the step size.

Then: go to x = 1.5.

Then: go to x = 2.

Then: go to x = 2.5.

Then: go to x = 3.

Last: check.

Answer
y(3) ≈ 1.25

▶ Watch it solved

Practice

Try each one, then open the answer. Stuck? Open the problem to watch every step.

Easy

  1. use Euler's method on dy/dx = x + y, y(0) = 1, step 0.1, to find y(0.3)
    Answer
    y(0.3) ≈ 1.362
  2. use Euler's method on dy/dx = y, y(0) = 1, step 0.1, to find y(0.2)
    Answer
    y(0.2) ≈ 1.21
  3. use Euler's method on dy/dx = x, y(0) = 2, step 0.5, to find y(1)
    Answer
    y(1) ≈ 2.25
  4. use Euler's method on dy/dx = 2x, y(0) = 0, step 0.5, to find y(1.5)
    Answer
    y(1.5) ≈ 1.5
  5. use Euler's method on dy/dx = -y, y(0) = 4, step 0.5, to find y(1)
    Answer
    y(1) ≈ 1
  6. use Euler's method on dy/dx = x - y, y(0) = 1, step 0.5, to find y(1)
    Answer
    y(1) ≈ 0.5
  7. use Euler's method on dy/dx = y - x, y(0) = 2, step 0.1, to find y(0.3)
    Answer
    y(0.3) ≈ 2.631

Medium

  1. Euler's method: y' = 2x - y, y(0) = 1, h = 0.5, estimate y(2)
    Answer
    y(2) ≈ 2.1875
  2. use Euler's method on dy/dx = x + 2y, y(0) = 1, step 0.1, to find y(0.3)
    Answer
    y(0.3) ≈ 1.76
  3. use Euler's method on dy/dx = xy, y(0) = 1, step 0.5, to find y(1.5)
    Answer
    y(1.5) ≈ 1.875
  4. use Euler's method on dy/dx = x^2 + y, y(0) = 1, step 0.5, to find y(1)
    Answer
    y(1) ≈ 2.375
  5. use Euler's method on dy/dx = 1 - y, y(0) = 0, step 0.5, to find y(2)
    Answer
    y(2) ≈ 0.9375
  6. use Euler's method on dy/dx = y^2, y(0) = 1, step 0.1, to find y(0.3)
    Answer
    y(0.3) ≈ 1.3701
  7. use Euler's method on dy/dx = -2y, y(0) = 3, step 0.25, to find y(1)
    Answer
    y(1) ≈ 0.1875

Harder

  1. use Euler's method on dy/dx = x - 2y, y(1) = 0, step 0.5, to find y(3)
    Answer
    y(3) ≈ 1.25
  2. use Euler's method on dy/dx = y - x^2, y(0) = 2, step 0.5, to find y(2)
    Answer
    y(2) ≈ 7.9688
  3. use Euler's method on dy/dx = 2xy, y(0) = 1, step 0.25, to find y(1)
    Answer
    y(1) ≈ 1.9337
  4. use Euler's method on dy/dx = x + y, y(0) = 0, step 0.5, to find y(1.5)
    Answer
    y(1.5) ≈ 0.875
  5. use Euler's method on dy/dx = 3x - y, y(0) = 2, step 0.5, to find y(2)
    Answer
    y(2) ≈ 3.3125
  6. use Euler's method on dy/dx = -xy, y(0) = 2, step 0.5, to find y(2)
    Answer
    y(2) ≈ 0.1875