KS Maths
Topic 5.16 Β· AI Higher Level

Euler's method

Follow the gradient, in straight lines

Stepping along a differential equation you cannot solve, and how wrong the answer is.

Words you need (10 key words in this lesson)

The maths words this lesson uses, in plain English. Open this before you start if English is not your first language.

exact
Not rounded. Completely correct.The exact answer is one third, not 0.33.
gradient
How steep a line is. Up divided by across.A line going up 2 for each 1 across has gradient 2.
estimate
Find an answer that is close, but not exact.Estimate 19 times 21 as 20 times 20.
add
Put numbers together to find the total.Add 3 and 4 to get 7.
straight line
A line that does not bend.A ruler draws a straight line.
equation
A statement that two things are equal. It has an equals sign.x plus 2 = 5 is an equation.
tangent
A ratio in a right-angled triangle: opposite over adjacent. Also, a line that touches a curve once.Tangent of 45 degrees is 1.
differential equation
An equation that links a function with its rate of change.A rate of change equal to twice y is a differential equation.
decimal place
A digit after the decimal point. We count places from the point.3.14 has two decimal places.
round
Change a number to a nearby simpler number.Round 47 to the nearest ten: 50.

Preview You are reading the start of this lesson. The rest opens with a plan. See plans Already paid? Sign in

Warm-up

Four quick ones from earlier work. Try each on paper before you open the answer; a slip here shows you what to watch for later in the lesson.

  1. f(x, y) = 2x βˆ’ y. Work out f(1, 3).
    Answer

    2(1) βˆ’ 3 = βˆ’1. Put both letters in: the gradient depends on x and on y, and the x is the one that gets left out.

  2. Work out 3 + 0.2 Γ— (βˆ’4).
    Answer

    Multiply first: 0.2 Γ— (βˆ’4) = βˆ’0.8, then add: 3 βˆ’ 0.8 = 2.2. Adding 3 + 0.2 first gives a different, wrong answer.

  3. A straight line has gradient 2.5 and passes through (4, 6). Find its y value at x = 4.4.
    Answer

    Move 0.4 along and 2.5 Γ— 0.4 = 1 up, so y = 7. This is one Euler step: old y plus step times gradient.

  4. A curve bends upwards. Does its tangent at a point lie above or below the curve nearby?
    Answer

    Below. The curve peels away upwards from the tangent. Euler walks along tangents, so this decides which way the error goes.

Words used in this lesson
differential equation
an equation that contains a derivative. For example: dy/dx = 2y βˆ’ x.
step size (h)
the gap between one x value and the next. For example: going from 0 to 1 in steps of h = 0.25.
iterate
repeat the same calculation, feeding each answer into the next. For example: to iterate x β†’ x + 3 starting at 1 gives 1, 4, 7.
estimate (approximate)
an answer that is close but not exact. For example: an estimate of 3.9 for a true value of 4.
underestimate / overestimate
an answer that is too low / too high. For example: 3.9 underestimates 4.
tangent
a straight line that touches a curve and has the same gradient there. For example: the tangent to y = xΒ² at x = 1.
initial condition
the starting point you are given. For example: β€œy = 2 when x = 0”.
exact solution
the answer found by integrating, with no estimation. For example: y = ex is exact for dy/dx = y with y(0) = 1.
error
the gap between the estimate and the true value. For example: estimate 3.9, true 4, error 0.1.
hence
use the result you have just found. For example: β€œfind y1 and hence y2” means use y1.

Predict first. The dashed curve is the exact solution and the red line is Euler. With the number of steps set low, will the red line end above or below the dashed curve? And will adding more steps ever reverse that, or only shrink the gap? Decide, and say why, before you press the button.

Then check

Now press Add steps and compare the Euler value with the exact value in the readings. Does the gap close completely at 20 steps? If your prediction was wrong, go back to the question about tangents in the warm-up.

Higher Level

You know the gradient everywhere, so start at the given point and walk in a straight line for a short step. Recalculate. Walk again. Add steps and watch the staircase close on the true curve.

Euler in straight lines, against the truthdy/dx = x + y, y(0) = 10.20.40.60.8111.522.533.5exact
0.100step size h
3.1875Euler at x = 1
3.4366exact at x = 1
0.2491error

Every segment starts on the right gradient and then drifts, because the curve keeps bending away.

The recipe

yn+1 = yn + h Γ— f(xn, yn)   and   xn+1 = xn + h

In words: new y equals old y plus step times gradient at the old point. The gradient is always worked out where you are, never where you are going, and that is exactly why the method drifts.

Worked example

Solve dydx = x + y with y = 1 at x = 0, using h = 0.1.

nxnynf = x + yyn+1 = yn + 0.1f
00111.1
10.11.11.21.22
20.21.221.421.362
30.31.3621.6621.5282
40.41.52821.92821.72102

So the estimate at x = 0.5 is 1.721. The exact solution is y = 2ex βˆ’ x βˆ’ 1, which gives 1.7974, so Euler is low by about 0.076.

Keep the full accuracy in the table. Rounding each y to 3 decimal places and feeding it back in is a different calculation, and the errors compound. Round once, at the end.

The rest of this lesson is in the full course

Still to come in this lesson:

In the full lesson every figure moves as you drag it, and every answer you type is checked, with a note on what each wrong answer means.

IB Diploma plan: AI HL$99Every Diploma lesson in both courses and both levels, so a change of course never locks you out, and every lesson from Year 7 for the refreshers. $99 for 12 months or $149 for 2 years.

One plan opens every Diploma lesson, AA and AI, SL and HL, for the whole family.

One payment. Nothing renews. Full refund within 30 days. Prices are in US$; Gumroad shows your local currency at checkout. Pay by card on Gumroad, then come back here and type the email you paid with: we email you a sign-in link. For a refund, reply to your Gumroad receipt or email hello@ksmaths.com.

Try a free sample lesson in every unit, and the whole Skill Tree. See this unit.

Already have a revision pack or the Years 7 to 11 plan? Move up and the unused part of what you paid comes off.

Teaching students who need extra support? Student codes for 5, 10 or 30 students.

AI HL Mock Exam Pack, $25BuyPlan $99