## 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

$y^{\prime} =f\left(x,y\right)$.

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

${T}^{\prime }\left(t\right)=-0.4\left(T - 72\right)$.

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

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

$\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}$

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

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

This tells us that if a solution to the differential equation $y^{\prime} =3x+2y - 4$ passes through the point $\left(1,2\right)$, then the slope of the solution at that point must equal $3$. To start creating the direction field, we put a short line segment at the point $\left(1,2\right)$ having slope $3$. We can do this for any point in the domain of the function $f\left(x,y\right)=3x+2y - 4$, which consists of all ordered pairs $\left(x,y\right)$ in ${\mathbb{R} }^{2}$. 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 ${y}^{\prime }=3x+2y - 4$ is shown in Figure 2.

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

### 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 $y^{\prime} =3x+2y - 4$. 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 $f(x)$ at $\left(x_0,y_0 \right)$ is given by $f'(x_0)$, the linear approximation of a function $f(x)$ at a point $\left(x_0,y_0 \right)$ is:
$L(x) = y_0 + f'(x_0) (x - x_0)$

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

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

$\Delta y \approx f'(x_0) \Delta x$

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 $\left(0,1\right)$, then the slope of the solution passing through that point is given by $y^{\prime} =3\left(0\right)+2\left(1\right)-4=-2$. Now let $x$ increase slightly, say to $x=0.1$. Using the method of linear approximations gives a formula for the approximate value of $y$ for $x=0.1$. In particular,

$\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}$

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

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 $\left(0,1\right)$.

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

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

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

$y=-\frac{3}{2}x+\frac{5}{4}-\frac{1}{4}{e}^{2x}$,

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

### try it

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

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).

### Interactive

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

$\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}$

Therefore $y=-2$ is a solution to the differential equation. Similarly, $y=2$ 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 $y=k$ is a constant solution to the differential equation. Then ${y}^{\prime }=0$. Substituting this expression into the differential equation yields $0=\left(x - 3\right)\left({k}^{2}-4\right)$. This equation must be true for all values of $x$, so the second factor must equal zero. This result yields the equation ${k}^{2}-4=0$. The solutions to this equation are $k=-2$ and $k=2$, which are the constant solutions already mentioned. These are called the equilibrium solutions to the differential equation.

### Definition

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

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

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

### Definition

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

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

${y}^{\prime }=f\left(x,y\right),y\left({x}_{0}\right)=c$

approaches $k$ as $x$ approaches infinity.

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

${y}^{\prime }=f\left(x,y\right),y\left({x}_{0}\right)=c$

never approaches $k$ as $x$ approaches infinity.

3. $y=k$ 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 $y^{\prime} =\left(x - 3\right)\left({y}^{2}-4\right)$, with the initial condition $y\left(0\right)=0.5$. The direction field for this initial-value problem, along with the corresponding solution, is shown in Figure 6.

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

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

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

### Example: Stability of an Equilibrium Solution

Create a direction field for the differential equation $y^{\prime} ={\left(y - 3\right)}^{2}\left({y}^{2}+y - 2\right)$ 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 $y^{\prime} =\left(x+5\right)\left(y+2\right)\left({y}^{2}-4y+4\right)$ and identify any equilibrium solutions. Classify each of the equilibrium solutions as stable, unstable, or semi-stable.