Skip to main content

Slope fields and Euler's method: VCE Specialist Mathematics Unit 4

Syllabus dot point

“Slope (direction) fields as a representation of a first-order differential equation, the sketching of solution curves on a slope field, and Euler's method for the numerical approximation of a solution from an initial condition with a chosen step size”

6 min read

Quick answer

A differential equation dydx=f(x,y)\frac{dy}{dx} = f(x, y) assigns a gradient to every point in the plane. A slope field draws a short line segment of that gradient at a grid of points, so a solution curve is one that is tangent to the field everywhere. Euler's method approximates a solution numerically by stepping in straight-line pieces: from a point (xn,yn)(x_n, y_n) it computes the next point by xn+1=xn+hx_{n+1} = x_n + h and yn+1=yn+h f(xn,yn)y_{n+1} = y_n + h\,f(x_n, y_n), where hh is the step size. Smaller steps give more accuracy. Euler always follows the current gradient for one whole step, so it lags behind curving solutions.

Jump to a section
  1. What this dot point is asking
  2. Slope fields
  3. Euler's method
  4. Examples in context
  5. Try this
  6. Exam-style questions

What this dot point is asking

VCAA wants you to read and sketch the slope field of a first-order differential equation, to trace approximate solution curves through it, and to apply Euler's method to compute a numerical approximation to a solution given an initial condition and a step size. These are the qualitative and numerical companions to solving differential equations exactly.

Slope fields

A first-order differential equation dydx=f(x,y)\frac{dy}{dx} = f(x, y) gives the gradient of the solution at any point (x,y)(x, y). A slope field (or direction field) draws a short segment with that gradient at many grid points. The picture shows the "flow" of all solutions at once: a solution curve is any curve that is tangent to the segments everywhere it passes.

To sketch a solution through a given point, start at that point and draw a curve that follows the local segment directions, staying parallel to nearby segments. Different starting points give different members of the solution family, which never cross.

Reading a slope field: where f(x,y)=0f(x, y) = 0 the segments are horizontal; where ff is large the segments are steep; segments that depend only on xx are constant along vertical lines, and those depending only on yy are constant along horizontal lines.

Euler's method

Euler's method turns the gradient information into a numerical solution. Starting from a known point (x0,y0)(x_0, y_0) and using step size hh, it repeatedly takes a straight step along the current gradient:

xn+1=xn+h,yn+1=yn+h f(xn,yn).x_{n+1} = x_n + h, \qquad y_{n+1} = y_n + h\,f(x_n, y_n).

Geometrically, at each step you follow the tangent line for a horizontal distance hh, then recompute the gradient at the new point and repeat. The result is a polygonal (broken-line) approximation to the true solution curve.

Accuracy. Because the method holds the gradient fixed across each step, it drifts away from a curving solution, undershooting or overshooting depending on the concavity. Halving the step size roughly halves the error, so a smaller hh gives a better approximation at the cost of more steps.

Worked example

Two Euler steps

Use Euler's method with step size h=0.1h = 0.1 to estimate y(1.2)y(1.2) for dydx=x+y\frac{dy}{dx} = x + y, given y(1)=2y(1) = 2.

Here f(x,y)=x+yf(x, y) = x + y, x0=1x_0 = 1, y0=2y_0 = 2, h=0.1h = 0.1.

Step 1 (to x=1.1x = 1.1). Gradient at (1,2)(1, 2) is f(1,2)=1+2=3f(1, 2) = 1 + 2 = 3. Then

y1=y0+h f(x0,y0)=2+0.1×3=2+0.3=2.3,x1=1.1.y_1 = y_0 + h\,f(x_0, y_0) = 2 + 0.1\times 3 = 2 + 0.3 = 2.3, \qquad x_1 = 1.1.

Step 2 (to x=1.2x = 1.2). Gradient at (1.1,2.3)(1.1, 2.3) is f(1.1,2.3)=1.1+2.3=3.4f(1.1, 2.3) = 1.1 + 2.3 = 3.4. Then

y2=y1+h f(x1,y1)=2.3+0.1×3.4=2.3+0.34=2.64,x2=1.2.y_2 = y_1 + h\,f(x_1, y_1) = 2.3 + 0.1\times 3.4 = 2.3 + 0.34 = 2.64, \qquad x_2 = 1.2.

So Euler's method estimates y(1.2)≈2.64y(1.2) \approx 2.64.

As a sanity check, the gradients are positive and growing, so yy should rise from 22 and rise faster each step; the increments 0.30.3 then 0.340.34 confirm this. The true solution curves upward, so this two-step estimate is a slight underestimate.

Common exam traps
Using the new gradient too early
In Euler's method the gradient for a step is evaluated at the start of that step, the point (xn,yn)(x_n, y_n), not at the destination.
Wrong step size in the update
The increment is h f(xn,yn)h\,f(x_n, y_n). Forgetting the factor hh overshoots massively.
Drawing crossing solution curves
Distinct solution curves of a first-order equation do not cross, since each point has a single gradient.
Confusing the axes of a slope field
Segments show dydx\frac{dy}{dx}, the gradient, not values of yy. A horizontal segment means gradient zero, not y=0y = 0.

Examples in context

Example 1. For dydx=−xy\frac{dy}{dx} = -\frac{x}{y}, the slope field segments are perpendicular to the radius at each point, and the solution curves are circles.

Example 2. One Euler step for dydx=y\frac{dy}{dx} = y from (0,1)(0, 1) with h=0.5h = 0.5 gives y1=1+0.5(1)=1.5y_1 = 1 + 0.5(1) = 1.5, approximating e0.5≈1.65e^{0.5} \approx 1.65.

Try this

Q1. What does a horizontal segment in a slope field indicate? [1 mark]

  • Cue. The gradient dydx\frac{dy}{dx} is zero there.

Q2. Write the Euler update formula for yn+1y_{n+1}. [1 mark]

  • Cue. yn+1=yn+h f(xn,yn)y_{n+1} = y_n + h\,f(x_n, y_n).

Q3. For dydx=2x\frac{dy}{dx} = 2x with y(0)=1y(0) = 1 and h=0.5h = 0.5, find yy at x=0.5x = 0.5. [2 marks]

  • Cue. Gradient at (0,1)(0,1) is 00, so y1=1+0.5(0)=1y_1 = 1 + 0.5(0) = 1.

Exam-style questions

Questions in the style of VCAA exam questions on this dot point, each with a worked answer. They are written by ExamExplained unless tagged "Past paper"; the year shows the paper a question is modelled on.

2025 VCAA-style2 marks
Consider the differential equation dQ/dt = (300 - Q)/150 with Q(0) = 5. Using Euler's method with a step size of 15 minutes, find Q(30), the approximate quantity of salt in the tank after 30 minutes. Give your answer in kilograms, correct to two decimal places.
Show worked answer →

Euler's method uses Q(next) = Q(current) + h . f(t, Q), with f(t, Q) = (300 - Q)/150 and step size h = 15. Start at t = 0, Q = 5.

Step 1 (to t = 15): slope = (300 - 5)/150 = 295/150 = 1.9667, so Q(15) = 5 + 15 . 1.9667 = 5 + 29.5 = 34.5.

Step 2 (to t = 30): slope = (300 - 34.5)/150 = 265.5/150 = 1.77, so Q(30) = 34.5 + 15 . 1.77 = 34.5 + 26.55 = 61.05.

Therefore Q(30) is approximately 61.05 kg (to two decimal places).

2023 VCAA-style1 mark
Consider the following pseudocode. define f(x,y) = e^(xy); x = 0; y = 0; h = 0.5; n = 0; while n >= 0: y = y + h x f(x,y); x = x + h; n = n + 1; print y; end while. After how many iterations will the pseudocode print 2.709? A. 1 B. 2 C. 3 D. 4 E. 5
Show worked answer →

The pseudocode is Euler's method for dy/dx = e^(xy) with x0 = 0, y0 = 0 and step h = 0.5. Each pass updates y by y = y + h . e^(xy), then increases x by 0.5, then prints y.

Iteration 1: y = 0 + 0.5 . e^(0 . 0) = 0.5 . 1 = 0.5; then x becomes 0.5. Prints 0.5.

Iteration 2: y = 0.5 + 0.5 . e^(0.5 . 0.5) = 0.5 + 0.5 . e^0.25 = 0.5 + 0.642 = 1.142; then x becomes 1.0. Prints 1.142.

Iteration 3: y = 1.142 + 0.5 . e^(1.0 . 1.142) = 1.142 + 0.5 . e^1.142 = 1.142 + 1.567 = 2.709; prints 2.709.

So 2.709 is printed after 3 iterations, which is option C.

Practise this

Sources & how we know this

ExamExplained