James Ashton MathsFREE MATHEMATICS. OPEN TO EVERYONE.
HomeIB DiplomaA levelAbout
IB Diploma › Maths AI HL › Calculus › Slope fields & Euler

Slope fields & Euler’s method

Most differential equations cannot be solved exactly. A slope field shows the shape of every solution at once, and Euler’s method builds an approximate solution step by step. The same idea works for coupled systems such as predators and prey.

AHL 5.15AHL 5.16HL onlyPaper 1Paper 2Paper 3GDC allowed≈ 50 min to work through
Before you start: Differential equations and tangents to curves (Introduction to differentiation).

1What you need to know

Tick these off as you go. By the end of the page you should be able to do all of them without notes.

  • Draw and interpret slope fields, and sketch solution curves on themAHL 5.15
  • Find equilibrium solutions and long-term behaviour from a slope fieldAHL 5.15
  • Use Euler’s method to approximate the solution of dydx=f(x,y)AHL 5.16
  • Use Euler’s method for coupled systems dxdt=f1(x,y,t), dydt=f2(x,y,t)AHL 5.16
  • Explain how the step size affects the accuracyAHL 5.16

2Notes & worked examples

Each idea is followed by a worked example. Try the question yourself first, then reveal the solution one step at a time.

The big idea

A differential equation dydx=f(x,y) gives the gradient at every point, even if we cannot solve it. Draw a short line with that gradient at many points and you get a slope field. Follow the little lines and you trace a solution. Euler’s method does the following numerically: take a small step along the tangent, then look up the new gradient, and repeat.

2.1 Slope fields

-2-10123-2-10123

Slope field for dydx=x−y

To sketch a solution curve through a given point, start at the point and move so the curve is always tangent to the nearby lines; curves never cross. Where the lines are horizontal, dydx=0. A horizontal line of zero slopes, such as y=2 for dydx=0.5y(2−y), is an equilibrium solution.

Worked example 1Paper 1
For dydx=x−y, find the gradient at (2,1) and at (0,2), and describe the solution through (0,1).
At (2,1): 2−1=1; at (0,2): 0−2=−2
All the slopes along y=x−1 equal 1, so this line is itself a solution.
Check: y = x − 1 gives dy/dx = 1 = x − y.
Through (0,1): the curve dips to a minimum where it crosses y=x, then rises towards the line y=x−1.

2.2 Euler’s method

Euler’s method In formula booklet
xn+1=xn+h,yn+1=yn+hf(xn,yn)

h is the step length. For a coupled system, update both: xn+1=xn+hf1(xn,yn,tn), yn+1=yn+hf2(xn,yn,tn), tn+1=tn+h.

Worked example 2Paper 1
Use Euler’s method with h=0.1 to estimate y(0.3) for dydx=x+y, y(0)=1.
y1=1+0.1(0+1)=1.1
y2=1.1+0.1(0.1+1.1)=1.22
y3=1.22+0.1(0.2+1.22)=1.362
The exact solution y=2ex−x−1 gives 1.400: Euler underestimates here, because the solution is concave-up and each tangent step falls below the curve.
A smaller step gives a better estimate.
Worked example 3 (faded)Paper 1
For dydx=2x, y(1)=3, h=0.5, find y1.
y1=3+0.5×2(1)= 4  ← you work this out

2.3 Coupled systems

Two populations that affect each other, such as rabbits x and foxes y, give a pair of equations. Euler’s method updates both values at each step, using the old values of both in each formula. A spreadsheet or the GDC does many steps quickly.

Worked example 4Paper 2
For dxdt=0.5x−0.01xy, dydt=−0.4y+0.005xy, with x=100, y=20 at t=0, use h=0.1 to find x and y at t=0.2.
Step 1: x=100+0.1(50−20)=103; y=20+0.1(−8+10)=20.2
Step 2: x=103+0.1(51.5−20.806)=106.07; y=20.2+0.1(−8.08+10.403)=20.43
On your TI-Nspire Calculator tricks →

In the TI-Nspire Lists & Spreadsheet app, put x0 and y0 in row 1, then in row 2 type formulas such as =a1+0.1 and =b1+0.1·(a1+b1) and fill down (menu → Data → Fill). For a coupled system use one column each for t, x and y. In the exam you may use any permitted technology, but show the first step by hand so the method is clear.

3Explore it

The slope field for dy/dx = x − y with an Euler path (red) starting at (0, y₀), and the exact solution (dashed). Make the step h smaller and watch the red path approach the true curve.

4Common mistakes & exam tips

Common mistakes

  • Using the new x value with the old y value (or the other way round) when working out the gradient.
  • Forgetting to multiply the gradient by h.
  • In a coupled system, using the updated x to compute the new y in the same step.
  • Drawing solution curves that cross each other or cut across the slope lines.
  • Rounding at each step: keep full accuracy and round only the final answer.

Exam tips

  • Set the working out as a table: n, xn, yn, f(xn,yn), yn+1.
  • To explain under- or overestimation, link it to the concavity of the solution curve.
  • "How could the approximation be improved?": use a smaller step size.
  • For equilibrium solutions, solve dydx=0 for constant y.

5Practice

Fluency questions build the basics. Problem-solving questions make you think about which method to use.

FluencyP1
For dydx=xy, find the gradient at (2,−1).
−2
FluencyP2
Find the equilibrium solutions of dydx=y(3−y).
y=0 and y=3
FluencyP3
Use Euler’s method with h=0.2 to find y(0.4) for dydx=y, y(0)=1.
1.2, then 1.44
FluencyP4
Compare your answer above with the exact value e0.4.
e0.4=1.492: Euler underestimates.
Problem solvingP5
Use Euler’s method with h=0.25 to estimate y(1) for dydx=x2−y, y(0)=1.
0.75, 0.578, 0.496, 0.513: y(1)≈0.513
Problem solvingP6
For the predator–prey system in WE4, find the non-zero equilibrium.
0.5−0.01y=0⇒y=50; −0.4+0.005x=0⇒x=80

6Exam-style questions

Original questions in the style of the IB Maths AI HL exam, with full markschemes. Your GDC is allowed throughout: use it, but write down what you entered and what it gave you. Give yourself about 1 minute per mark.

Question 1Paper 1[5 marks]

Consider the differential equation dydx=x2−y, with y=1 when x=0.

  • (a)Use Euler’s method with a step length of 0.25 to find an approximate value of y when x=1.[4]
  • (b)The exact value is 0.632. State, with a reason, how the approximation could be improved.[1]
(a)
yn+1=yn+0.25(xn2−yn)(M1)
0.75, 0.578(A1)
0.496(A1)
0.513A1
(b)
use a smaller step length, so each tangent step stays closer to the curveR1
Question 2Paper 1[5 marks]

The slope field for the differential equation dydx=0.5y(2−y) is shown.01234500.511.522.53

  • (a)Find the gradient of the solution curve at the point (1,1).[1]
  • (b)Write down the equilibrium solutions.[2]
  • (c)Sketch the solution curve through (0,0.5) and describe its long-term behaviour.[2]
(a)
0.5A1
(b)
y=0A1
y=2A1
(c)
increasing S-shaped curve following the slopesA1
y→2 as x increasesA1
Question 3Paper 2[8 marks]

The numbers of rabbits, r, and foxes, f, on an island are modelled by drdt=0.4r−0.02rf and dfdt=−0.3f+0.005rf, where t is in years. Initially r=100 and f=15.

  • (a)Use Euler’s method with a step length of 0.5 to find the values of r and f after 1 year.[4]
  • (b)Find the non-zero equilibrium populations.[3]
  • (c)Explain what the term −0.02rf represents.[1]
(a)
r1=105, f1=16.5(M1)(A1)
r2=108.7A1
f2=18.4A1
(b)
0.4−0.02f=0 and −0.3+0.005r=0(M1)
f=20A1
r=60A1
(c)
rabbits being eaten by foxes: the loss grows with the number of meetings between themR1

7Check yourself

Six quick questions, marked instantly. Aim for 6/6 before moving on. Fractions like 3/2 are accepted.

8Past-paper practice

Once you are scoring well above, try these real IB Maths AI HL questions on this topic. Your school or teacher will have the papers.

PaperQuestionFocusDifficulty
Nov 2021 · Paper 1Q13Slope field for dydx=e−x2−y★★☆
May 2024 · TZ2 · Paper 1Q7Euler’s method with step size 0.1★☆☆
May 2024 · TZ1 · Paper 2Q5Identifying a slope field, then Euler’s method★★☆
Nov 2024 · Paper 1Q17Fish and insects: Euler’s method for a coupled system★★★
Spotted a mistake on this page?Tell me and I'll fix it. The button opens an email with this page already named, or write to jamesashtonmaths@gmail.com.
Report a mistake