Direction Fields

Learning Outcomes

  • Draw the direction field for a given first-order differential equation.
  • Use a direction field to draw a solution curve of a first-order differential equation

Creating Direction Fields

Direction fields (also called slope fields) are useful for investigating first-order differential equations. In particular, we consider a first-order differential equation of the form

[latex]y^{\prime} =f\left(x,y\right)[/latex].

 

An applied example of this type of differential equation appears in Newton’s law of cooling, which we will solve explicitly later in this chapter. First, though, let us create a direction field for the differential equation

[latex]{T}^{\prime }\left(t\right)=-0.4\left(T - 72\right)[/latex].

 

Here [latex]T\left(t\right)[/latex] represents the temperature (in degrees Fahrenheit) of an object at time [latex]t[/latex], and the ambient temperature is [latex]72^\circ\text{F}\text{.}[/latex] Figure 1 shows the direction field for this equation.

A graph of a direction field for the given differential equation in quadrants one and two. The arrows are pointing directly to the right at y = 72. Below that line, the arrows have increasingly positive slope as y becomes smaller. Above that line, the arrows have increasingly negative slope as y becomes larger. The arrows point to convergence at y = 72. Two solutions are drawn: one for initial temperature less than 72, and one for initial temperatures larger than 72. The upper solution is a decreasing concave up curve, approaching y = 72 as t goes to infinity. The lower solution is an increasing concave down curve, approaching y = 72 as t goes to infinity.

Figure 1. Direction field for the differential equation [latex]{T}^{\prime }\left(t\right)=-0.4\left(T – 72\right)[/latex]. Two solutions are plotted: one with initial temperature less than [latex]72^\circ\text{F}[/latex] and the other with initial temperature greater than [latex]72^\circ\text{F}\text{.}[/latex]

The idea behind a direction field is the fact that the derivative of a function evaluated at a given point is the slope of the tangent line to the graph of that function at the same point. Other examples of differential equations for which we can create a direction field include

[latex]\begin{array}{c}y^{\prime} =3x+2y - 4\hfill \\ y^{\prime} ={x}^{2}-{y}^{2}\hfill \\ y^{\prime} =\frac{2x+4}{y - 2}.\hfill \end{array}[/latex]

 

To create a direction field, we start with the first equation: [latex]y^{\prime} =3x+2y - 4[/latex]. We let [latex]\left({x}_{0},{y}_{0}\right)[/latex] be any ordered pair, and we substitute these numbers into the right-hand side of the differential equation. For example, if we choose [latex]x=1[/latex] and [latex]y=2[/latex], substituting into the right-hand side of the differential equation yields

[latex]\begin{array}{cc}{y}^{\prime }\hfill & =3x+2y - 4\hfill \\ & =3\left(1\right)+2\left(2\right)-4=3.\hfill \end{array}[/latex]

 

This tells us that if a solution to the differential equation [latex]y^{\prime} =3x+2y - 4[/latex] passes through the point [latex]\left(1,2\right)[/latex], then the slope of the solution at that point must equal [latex]3[/latex]. To start creating the direction field, we put a short line segment at the point [latex]\left(1,2\right)[/latex] having slope [latex]3[/latex]. We can do this for any point in the domain of the function [latex]f\left(x,y\right)=3x+2y - 4[/latex], which consists of all ordered pairs [latex]\left(x,y\right)[/latex] in [latex]{\mathbb{R} }^{2}[/latex]. Therefore any point in the Cartesian plane has a slope associated with it, assuming that a solution to the differential equation passes through that point. The direction field for the differential equation [latex]{y}^{\prime }=3x+2y - 4[/latex] is shown in Figure 2.

A graph of the direction field for the differential equation y’ = 3 x + 2 y – 4 in all four quadrants. In quadrants two and three, the arrows point down and slightly to the right. On a diagonal line, roughly y = -x + 2, the arrows point further and further to the right, curve, and then point up above that line.

Figure 2. Direction field for the differential equation [latex]y^{\prime} =3x+2y – 4[/latex].

We can generate a direction field of this type for any differential equation of the form [latex]y^{\prime} =f\left(x,y\right)[/latex].

Definition


A direction field (slope field) is a mathematical object used to graphically represent solutions to a first-order differential equation. At each point in a direction field, a line segment appears whose slope is equal to the slope of a solution to the differential equation passing through that point.

Using Direction Fields

We can use a direction field to predict the behavior of solutions to a differential equation without knowing the actual solution. For example, the direction field in Figure 2 serves as a guide to the behavior of solutions to the differential equation [latex]y^{\prime} =3x+2y - 4[/latex]. Before developing this method, it is worthwhile to revisit the notion of a linear approximation.

Recall: Linear Approximation OF a Function

The linear approximation of a function at a given point, also known as the linearization, is equivalent to the equation of the tangent line to the graph of the function at that point.

Since the slope of a function [latex] f(x) [/latex] at [latex] \left(x_0,y_0 \right) [/latex] is given by [latex] f'(x_0) [/latex], the linear approximation of a function [latex] f(x) [/latex] at a point [latex] \left(x_0,y_0 \right) [/latex] is:
[latex] L(x) = y_0 + f'(x_0) (x - x_0)[/latex]

For values near the point [latex] \left(x_0,y_0 \right) [/latex], [latex] L(x) \approx f(x) [/latex].  In other words, [latex] L(x) [/latex] can be used to predict function values near [latex] \left(x_0,y_0 \right) [/latex].

Put another way, the actual change in the function output, [latex] \Delta y [/latex], can be approximated using the slope at [latex] \left(x_0,y_0 \right) [/latex].

[latex] \Delta y \approx f'(x_0) \Delta x [/latex]

To use a direction field, we start by choosing any point in the field. The line segment at that point serves as a signpost telling us what direction to go from there. For example, if a solution to the differential equation passes through the point [latex]\left(0,1\right)[/latex], then the slope of the solution passing through that point is given by [latex]y^{\prime} =3\left(0\right)+2\left(1\right)-4=-2[/latex]. Now let [latex]x[/latex] increase slightly, say to [latex]x=0.1[/latex]. Using the method of linear approximations gives a formula for the approximate value of [latex]y[/latex] for [latex]x=0.1[/latex]. In particular,

[latex]\begin{array}{cc}L\left(x\right)\hfill & ={y}_{0}+{f}^{\prime }\left({x}_{0}\right)\left(x-{x}_{0}\right)\hfill \\ & =1 - 2\left({x}_{0}-0\right)\hfill \\ & =1 - 2{x}_{0}.\hfill \end{array}[/latex]

 

Substituting [latex]{x}_{0}=0.1[/latex] into [latex]L\left(x\right)[/latex] gives an approximate [latex]y[/latex] value of [latex]0.8[/latex].

At this point the slope of the solution changes (again according to the differential equation). We can keep progressing, recalculating the slope of the solution as we take small steps to the right, and watching the behavior of the solution. Figure 3 shows a graph of the solution passing through the point [latex]\left(0,1\right)[/latex].

A graph of the direction field for the differential equation y’ = 3 x + 2 y – 4 in all four quadrants. In quadrants two and three, the arrows point down and slightly to the right. On a diagonal line, roughly y = -x + 2, the arrows point further and further to the right, curve, and then point up above that line. The solution passing through the point (0, 1) is shown. It curves down through (-5, 10), (0, 2), (1, 0), and (3, -10).

Figure 3. Direction field for the differential equation [latex]y^{\prime} =3x+2y – 4[/latex] with the solution passing through the point [latex]\left(0,1\right)[/latex].

The curve is the graph of the solution to the initial-value problem

[latex]y^{\prime} =3x+2y - 4,y\left(0\right)=1[/latex].

 

This curve is called a solution curve passing through the point [latex]\left(0,1\right)[/latex]. The exact solution to this initial-value problem is

[latex]y=-\frac{3}{2}x+\frac{5}{4}-\frac{1}{4}{e}^{2x}[/latex],

 

and the graph of this solution is identical to the curve in Figure 3.

try it

Create a direction field for the differential equation [latex]y^{\prime} ={x}^{2}-{y}^{2}[/latex] and sketch a solution curve passing through the point [latex]\left(-1,2\right)[/latex].

Watch the following videos to see the worked solution to the above Try It

You can view the transcript for “4.2.1” here (opens in new window).

You can view the transcript for “4.2.2” here (opens in new window).

Now consider the direction field for the differential equation [latex]y^{\prime} =\left(x - 3\right)\left({y}^{2}-4\right)[/latex], shown in Figure 5. This direction field has several interesting properties. First of all, at [latex]y=-2[/latex] and [latex]y=2[/latex], horizontal dashes appear all the way across the graph. This means that if [latex]y=-2[/latex], then [latex]y^{\prime} =0[/latex]. Substituting this expression into the right-hand side of the differential equation gives

[latex]\begin{array}{cc} \left(x-3\right)\left(y^{2}-4\right)\hfill & =\left(x-3\right)\left(\left({-2}\right)^{2}-4\right)\hfill \\ & =\left(x-3\right)\left(0\right)\hfill \\ & =0\hfill \\ & =y^{\prime} .\hfill \end{array}[/latex]

 

Therefore [latex]y=-2[/latex] is a solution to the differential equation. Similarly, [latex]y=2[/latex] is a solution to the differential equation. These are the only constant-valued solutions to the differential equation, as we can see from the following argument. Suppose [latex]y=k[/latex] is a constant solution to the differential equation. Then [latex]{y}^{\prime }=0[/latex]. Substituting this expression into the differential equation yields [latex]0=\left(x - 3\right)\left({k}^{2}-4\right)[/latex]. This equation must be true for all values of [latex]x[/latex], so the second factor must equal zero. This result yields the equation [latex]{k}^{2}-4=0[/latex]. The solutions to this equation are [latex]k=-2[/latex] and [latex]k=2[/latex], which are the constant solutions already mentioned. These are called the equilibrium solutions to the differential equation.

A direction field for the given differential equation. The arrows are horizontal and pointing to the right at y = -4, y = 4, and x = 6. The closer the arrows are to x = 6, the more horizontal the arrows become. The further away, the more vertical they are. The arrows point down for y > 4 and x < 4, -4 < y < 4 and x > 6, and y < -4 and x < 6. In all other areas, the arrows are pointing up.

Figure 5. Direction field for the differential equation [latex]y^{\prime} =\left(x – 3\right)\left({y}^{2}-4\right)[/latex] showing two solutions. These solutions are very close together, but one is barely above the equilibrium solution [latex]x=-2[/latex] and the other is barely below the same equilibrium solution.

Definition


Consider the differential equation [latex]y^{\prime} =f\left(x,y\right)[/latex]. An equilibrium solution is any solution to the differential equation of the form [latex]y=c[/latex], where [latex]c[/latex] is a constant.

To determine the equilibrium solutions to the differential equation [latex]y^{\prime} =f\left(x,y\right)[/latex], set the right-hand side equal to zero. An equilibrium solution of the differential equation is any function of the form [latex]y=k[/latex] such that [latex]f\left(x,k\right)=0[/latex] for all values of [latex]x[/latex] in the domain of [latex]f[/latex].

An important characteristic of equilibrium solutions concerns whether or not they approach the line [latex]y=k[/latex] as an asymptote for large values of [latex]x[/latex].

Definition


Consider the differential equation [latex]{y}^{\prime }=f\left(x,y\right)[/latex], and assume that all solutions to this differential equation are defined for [latex]x\ge {x}_{0}[/latex]. Let [latex]y=k[/latex] be an equilibrium solution to the differential equation.

  1. [latex]y=k[/latex] is an asymptotically stable solution to the differential equation if there exists [latex]\epsilon >0[/latex] such that for any value [latex]c\in \left(k-\epsilon ,k+\epsilon \right)[/latex] the solution to the initial-value problem

    [latex]{y}^{\prime }=f\left(x,y\right),y\left({x}_{0}\right)=c[/latex]



    approaches [latex]k[/latex] as [latex]x[/latex] approaches infinity.

  2. [latex]y=k[/latex] is an asymptotically unstable solution to the differential equation if there exists [latex]\epsilon >0[/latex] such that for any value [latex]c\in \left(k-\epsilon ,k+\epsilon \right)[/latex] the solution to the initial-value problem

    [latex]{y}^{\prime }=f\left(x,y\right),y\left({x}_{0}\right)=c[/latex]



    never approaches [latex]k[/latex] as [latex]x[/latex] approaches infinity.

  3. [latex]y=k[/latex] is an asymptotically semi-stable solution to the differential equation if it is neither asymptotically stable nor asymptotically unstable.

Now we return to the differential equation [latex]y^{\prime} =\left(x - 3\right)\left({y}^{2}-4\right)[/latex], with the initial condition [latex]y\left(0\right)=0.5[/latex]. The direction field for this initial-value problem, along with the corresponding solution, is shown in Figure 6.

A direction field for the given differential equation. The arrows are horizontal and pointing to the right at y = -4, y = 4, and x = 6. The closer the arrows are to x = 6, the more horizontal the arrows become. The further away, the more vertical they are. The arrows point down for y > 4 and x < 4, -4 < y < 4 and x > 6, and y < -4 and x < 6. In all other areas, the arrows are pointing up. A solution is graphed that goes through (0, 0.5). It begins along y = -4 in quadrant three, increases from -4 to 4 between x = -1 and 1, and ends going along y = 4 in quadrant 1.

Figure 6. Direction field for the initial-value problem [latex]y^{\prime} =\left(x – 3\right)\left({y}^{2}-4\right),y\left(0\right)=0.5[/latex].

The values of the solution to this initial-value problem stay between [latex]y=-2[/latex] and [latex]y=2[/latex], which are the equilibrium solutions to the differential equation. Furthermore, as [latex]x[/latex] approaches infinity, [latex]y[/latex] approaches [latex]2[/latex]. The behavior of solutions is similar if the initial value is higher than [latex]2[/latex], for example, [latex]y\left(0\right)=2.3[/latex]. In this case, the solutions decrease and approach [latex]y=2[/latex] as [latex]x[/latex] approaches infinity. Therefore [latex]y=2[/latex] is an asymptotically stable solution to the differential equation.

What happens when the initial value is below [latex]y=-2?[/latex] This scenario is illustrated in Figure 7, with the initial value [latex]y\left(0\right)=-3[/latex].

A direction field for the given differential equation. The arrows are horizontal and pointing to the right at y = -4, y = 4, and x = 6. The closer the arrows are to x = 6, the more horizontal the arrows become. The further away, the more vertical they are. The arrows point down for y > 4 and x < 4, -4 < y < 4 and x > 6, and y < -4 and x < 6. In all other areas, the arrows are pointing up. A solution is graphed that goes along y = -4 in quadrant 3 and curves between x = -1 and x = 0 to go to negative infinity along the y axis.

Figure 7. Direction field for the initial-value problem [latex]y^{\prime} =\left(x – 3\right)\left({y}^{2}-4\right),y\left(0\right)=-3[/latex].

The solution decreases rapidly toward negative infinity as [latex]x[/latex] approaches infinity. Furthermore, if the initial value is slightly higher than [latex]-2[/latex], then the solution approaches [latex]2[/latex], which is the other equilibrium solution. Therefore in neither case does the solution approach [latex]y=-2[/latex], so [latex]y=-2[/latex] is called an asymptotically unstable, or unstable, equilibrium solution.

Example: Stability of an Equilibrium Solution

Create a direction field for the differential equation [latex]y^{\prime} ={\left(y - 3\right)}^{2}\left({y}^{2}+y - 2\right)[/latex] and identify any equilibrium solutions. Classify each of the equilibrium solutions as stable, unstable, or semi-stable.

try it

Create a direction field for the differential equation [latex]y^{\prime} =\left(x+5\right)\left(y+2\right)\left({y}^{2}-4y+4\right)[/latex] and identify any equilibrium solutions. Classify each of the equilibrium solutions as stable, unstable, or semi-stable.