Tutorials › Calculus I › Slope-Field Diagnostics for Numerical Trajectories

Euler's Method and Numerical Solutions · Tutorial 1450 of 1495

Slope-Field Diagnostics for Numerical Trajectories

Use slope-field directions and equilibrium behavior to diagnose whether Euler steps move in a qualitatively plausible way.

Advanced 10 min read

What You'll Learn

  • Read the sign and size of a slope-field direction at an Euler node.
  • Check whether a computed Euler increment agrees with the slope and step size.
  • Use equilibria to predict the qualitative motion of autonomous differential equations.
  • Recognize when a large Euler step crosses an equilibrium unexpectedly.
  • Distinguish a plausible numerical trend from a guarantee of accuracy.

Why Diagnose an Euler Trajectory?

An Euler table can contain arithmetic that is internally consistent yet still show a surprising trajectory. A useful independent check is to compare each computed step with the directions indicated by the differential equation's slope field. This does not establish that the numerical values are accurate, but it can reveal sign errors, implausible motion, and steps that cross important levels.

For an initial-value problem \(y'=f(x,y)\), the slope field assigns the slope \(f(x,y)\) to each point \((x,y)\). The exact solution, wherever it exists and is differentiable, follows these local directions. Euler's method uses the direction at a single point to make a straight-line step, so its trajectory is only expected to match the field at the start of each step.

Definition: For a differential equation \(y'=f(x,y)\), a slope field is a representation that associates the slope \(f(x,y)\) with each point \((x,y)\) in the region under consideration. An Euler step from \((x_n,y_n)\) with step size \(h\) is $$ x_{n+1}=x_n+h,\qquad y_{n+1}=y_n+h f(x_n,y_n). $$

Read Each Step's Direction

For a positive step size \(h\), the sign of \(f(x_n,y_n)\) determines the sign of the Euler change in \(y\). If the field slope is positive, the step rises; if it is negative, the step falls; and if it is zero, the step is horizontal. The slope's magnitude also matters: a large positive slope produces a larger rise than a small positive slope when the step size is the same.

For a negative step size, the vertical change is \(h f(x_n,y_n)\), so its sign is the opposite of the field slope's sign. Always check the product, not the slope alone. The secant slope of the Euler segment is $$ \frac{y_{n+1}-y_n}{x_{n+1}-x_n} = \frac{h f(x_n,y_n)}{h} = f(x_n,y_n), $$ provided \(h\ne 0\). Thus each Euler segment has exactly the field slope at its starting point. It need not have the slope shown by the field at the segment's endpoint or at intermediate points.

Worked Example: Checking the Directions Along a Trajectory

Apply Euler's method with \(h=0.25\) to \(y'=x+y\), starting at \((x_0,y_0)=(0,1)\). At the initial point, the field slope is $$ f(0,1)=0+1=1. $$ The first update is $$ x_1=0+0.25=0.25,\qquad y_1=1+0.25(1)=1.25. $$ The segment rises by \(0.25\), and its secant slope is \(0.25/0.25=1\), as required.

At the new point, the field slope is $$ f(0.25,1.25)=0.25+1.25=1.5. $$ Therefore, $$ x_2=0.25+0.25=0.5,\qquad y_2=1.25+0.25(1.5)=1.625. $$ The second segment's slope is \((1.625-1.25)/0.25=0.375/0.25=1.5\).

At \((0.5,1.625)\), the slope is $$ f(0.5,1.625)=0.5+1.625=2.125. $$ The third update gives $$ x_3=0.5+0.25=0.75,\qquad y_3=1.625+0.25(2.125)=1.625+0.53125=2.15625. $$ Its segment slope is \(0.53125/0.25=2.125\). All three field slopes are positive and increase from \(1\) to \(1.5\) to \(2.125\); the computed trajectory rises, with successively steeper Euler segments. The endpoint calculations agree with the Euler formula at every step.

Equilibria as Qualitative Guides

For an autonomous equation \(y'=g(y)\), an equilibrium is a constant solution. A value \(y_*\) is an equilibrium when \(g(y_*)=0\), because the constant function \(y(x)=y_*\) then has derivative zero and satisfies the equation.

Definition: An equilibrium of the autonomous differential equation \(y'=g(y)\) is a value \(y_*\) for which \(g(y_*)=0\). For any Euler step starting exactly at that value, $$ y_{n+1}=y_*+h g(y_*)=y_*. $$ Thus Euler's method preserves an equilibrium when it starts there.

Between equilibria, the sign of \(g(y)\) indicates the direction of motion as \(x\) increases: positive values mean increasing \(y\), and negative values mean decreasing \(y\). This sign information gives a qualitative picture of how a solution moves relative to equilibrium levels. For instance, if \(g(y)>0\) below an equilibrium and \(g(y)<0\) above it, trajectories on either side move toward that level. This describes the direction of the differential equation; a finite Euler step can still jump across the level.

Worked Example: Checking Motion Relative to Equilibria

Consider \(y'=y(2-y)\), with \(y_0=1\) and \(h=0.25\). The equilibria are the roots of \(y(2-y)=0\), namely \(y=0\) and \(y=2\). For \(0<y<2\), both factors \(y\) and \(2-y\) are positive, so \(y'>0\). The slope field therefore points upward between the two equilibria.

Starting at \(y_0=1\), compute each step: $$ f(y_0)=1(2-1)=1,\qquad y_1=1+0.25(1)=1.25. $$ At \(y_1=1.25\), $$ f(y_1)=1.25(2-1.25)=1.25(0.75)=0.9375, $$ so $$ y_2=1.25+0.25(0.9375)=1.25+0.234375=1.484375. $$ At \(y_2=1.484375\), $$ f(y_2)=1.484375(0.515625)=0.765380859375, $$ and hence $$ y_3=1.484375+0.25(0.765380859375)=1.67572021484375. $$ Each value increases and remains below \(2\), consistent with the field's upward direction in this interval. Checking the updates gives \(y_1-y_0=0.25(1)\), \(y_2-y_1=0.25(0.9375)\), and \(y_3-y_2=0.25(0.765380859375)\). The successive increments shrink because the slopes at these nodes shrink.

Why Equilibria Are Useful Checks

Equilibrium levels are especially useful because they give reference points where the field slope is zero. A computed step starting at an equilibrium should leave the value unchanged. Away from equilibria, the sign of the field indicates which direction the differential equation moves, and the size of the Euler increment must agree with \(h f(x_n,y_n)\).

There is an important limitation: equilibrium behavior in the differential equation does not automatically prevent a numerical step from crossing an equilibrium. The equation describes instantaneous direction; Euler's method extrapolates that direction across the entire step. A large step can carry the numerical value into a region where the field points the other way.

Worked Example: Detecting an Overshoot Across an Equilibrium

Consider \(y'=1-y\), starting at \(y_0=0\), with \(h=1.5\). The equilibrium is \(y=1\), since \(1-1=0\). Below \(1\), the slope \(1-y\) is positive, so the solution moves upward toward the equilibrium as \(x\) increases.

At the starting point, the slope is $$ f(0)=1-0=1. $$ The Euler update is $$ y_1=0+1.5(1)=1.5. $$ The numerical value has crossed the equilibrium. The calculation is arithmetically correct: the increment \(1.5\) equals \(h f(y_0)\), and the segment slope is \(1.5/1.5=1\). But at the new point the field slope is $$ f(1.5)=1-1.5=-0.5, $$ which points downward. The field's directions indicate that the numerical trajectory has moved to the opposite side of the equilibrium, where the motion reverses. This is a warning that the step may not capture the intended qualitative behavior. It is not, by itself, a proof of the exact solution's values.

A Reliable Diagnostic Routine

Use the slope field as a consistency check at every node, rather than expecting a polygonal Euler path to lie exactly along the field everywhere. The following routine separates the direct arithmetic check from the broader qualitative check.

1
Evaluate the field at the node.
Compute \(f(x_n,y_n)\) using the current Euler value, not the next one.
2
Check the increment.
Verify that \(y_{n+1}-y_n=h f(x_n,y_n)\), including the sign of \(h\).
3
Compare the qualitative motion.
Check whether rising or falling steps agree with the field's direction and whether the path's relation to equilibria is plausible.
4
Question large jumps.
If a step crosses an equilibrium or enters a region with a sharply different direction, flag it for closer examination.

A common mistake is to evaluate the slope at the new endpoint and use it to justify the step just taken. For example, in the overshoot calculation, one might incorrectly write $$ y_1=0+1.5 f(1.5)=0+1.5(-0.5)=-0.75. $$ That is not the Euler update from \(y_0=0\): it uses the endpoint slope instead of the starting-point slope. The correct calculation is $$ y_1=y_0+h f(y_0)=0+1.5(1)=1.5. $$ The endpoint slope is still useful diagnostically, but it belongs to the next step, not the one already computed.

What the Diagnostics Can and Cannot Establish

If an Euler segment rises while the field slope at its starting point is negative and \(h>0\), the update is inconsistent with the Euler formula. If the arithmetic is consistent but a step crosses an equilibrium, the numerical path may still be qualitatively misleading. Conversely, agreement with the local field directions does not certify accuracy: Euler's method uses only the slope at each node, and its accumulated error can remain significant even when every individual update is calculated correctly.

These checks are valuable because they connect numerical output to the geometry of the differential equation. A table of numbers becomes more informative when each increment has a direction, a scale, and a position relative to the equilibria. Treat the slope field as a diagnostic, not as a substitute for an error estimate or a proof about the exact solution.

Check Your Understanding

Answer these questions using the Euler update and the qualitative direction of the field.

  1. For \(y'=f(x,y)\), what is the slope of an Euler segment when \(h\ne 0\)?
  2. If \(h>0\) and \(f(x_n,y_n)<0\), what should the next Euler value do?
  3. What equation must an equilibrium \(y_*\) satisfy for \(y'=g(y)\)?
  4. Why can an Euler step cross an equilibrium even when the field points toward it?
  5. Why is checking the direction of every step not enough to prove that an Euler approximation is accurate?

Test yourself: Calculus I final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon