## Calculus Of One Real Variable - A Tutorial By Pheng Kim Ving Chapter 16: Differential Equations Group 16.4: Approximate Solutions Section 16.4.1: Approximate Graphical Solutions – Direction Fields

16.4.1
Approximate Graphical Solutions – Direction Fields

 1. Direction Fields Of y ' = f (x, y)

In this section, we'll use the abbreviations:

“DE” for “differential equation”,

“DF” for “direction field”, and
“ES” for “equilibrium solution”.

Approximate Solutions

Consider the differential equation (DE): looks simple and can't be solved in terms of elementary functions. Remark that Eq. [1.2], which can be written as y'y2 = x2,
is non-linear, due to the term
y2.

Some DEs that can't be solved in terms of elementary functions can be solved by the method of power series or by the
method of non-elementary functions, called special functions. Special functions are studied in advanced courses. The methods
of power series and of special functions are presented in courses on DEs. Other DEs that can't be solved in terms of
elementary functions are worse: they can't be solved by either the method of power series or the method of special functions
or any method. They simply are impossible to solve, at least so far, in the sense of obtaining an explicit formula for the
solution, whether the formula is an elementary or a special function.

For the impossible ones, we have to settle with their approximate solutions, which fortunately exist.

In this section we present a method, the method of direction fields, to construct approximate graphical solutions of DEs of the
form
y ' = f (x, y), y ' = f (x), and y ' = f ( y), including equations that can be solved in terms of elementary functions, for the
purpose of demonstrating the validity of the method. In the next section we'll discuss a method to determine approximate
numerical solutions.

For an impossible DE, despite the absence of an explicit or exact solution, its approximate solution allows us to learn a lot
about its exact solution. The approximate solutions suffice for many practical purposes.

##### Direction Fields (DFs)

A solution curve of a DE is the graph of a solution of the DE. To assure ourselves that the direction field (DF) of a DE indeed
generates approximate graphical solutions of the DE, we consider an example DE that can be solved exactly, solve it, draw
some exact-solution curves, sketch the DF of the DE, and see that the DF is consistent with the exact-solution curves and so
generates approximate graphical solutions of the DE.

Consider the DE:

y ' = x + y. y = - x - 1 + Cex,

y = Cex - x - 1.

This last equation is the general solution. The graphs of some particular solutions for some values of C are sketched in
Fig. 1.1. Fig. 1.1   Graphs Of y = - x - 1 + Cex For Some Values Of C. ### Fig. 1.2

Direction Field Of y ' = x + y.

Now consider again the DE:

y ' = x + y.

It says that the derivative y' of any solution y at any point (x, y) that's on the graph of y equals x + y. We know that the
derivative
y ' is the slope of the tangent of the graph of y at the point (x, y). So this equation y ' = x + y tells us that the slope
of the tangent at point (
x, y) on the graph of y = y(x) equals the sum x + y of the x- and y-coordinates of that point. For
example, the slope of the tangent at point (1, 0) is 1 + 0 = 1, and the slope of the tangent at point (1, -3) is 1 + (-3) = -2. So
we select a number of points. Preferrably we draw grid lines that intersect the scaling points on the
x- and y-axis, and select
the points of intersection of the grid lines. At each selected point, we draw a short line segment that's centered at that point
and that has slope equal to the sum of the coordinates of that point. See Fig. 1.2. Thus the line segment at each point is a
short segment of the tangent line of the graph of the particular solution that passes thru that point at that point. As a
consequence, each little tangent line segment represents the direction in its vicinity of the solution curve that passes thru its
midpoint. For this reason, the set of all the tangent line segments is called the direction field
(DF) or slope field  of the DE. A
small portion of the solution curve that passes thru or near a point is approximately parallel to the tangent line segment at
that point. The DF indicates the directions in which the solution curves proceed at each point, and hence is a visualization of
the general shape of the set of all the solution curves.

We notice that the shapes of the approximate-solution curves as suggested by the DF in Fig. 1.2 are consistent with the
exact-solution curves in Fig. 1.1. Now we're assured that indeed the DF of a DE generates approximate graphical solutions of
the DE.

Consider a first-order DE of the form:

 y’ = f (x, y), [1.3]

where f (x, y) is a function of the 2 variables x and y. Because the derivative y ' is the slope of the tangent to the graph of the
function
y geometrically speaking and the rate of change of the function y algebraically speaking, the function f (not y; it’s f (x,
y), not y, that equals y ') in Eq. [1.3] is called the slope function or the rate function. Recall that the slope of a curve at a point
is defined to be the slope of the tangent line of the curve at that point.

Definitions 1.1 – Direction Fields

 Consider the DE:   y ' = f (x, y).   At any point (x, y), the slope of the tangent of the graph of the particular solution y = y(x) that passes thru that point equals f (x, y). The function f  is called the slope function or rate function. A short line segment centered at any point (x, y) and with slope f (x, y) is called a lineal element. The set of lineal elements is called the direction field (DF) or slope field of the DE. A solution curve  is the curve or graph of a solution of the given DE. The DF indicates the directions in which the solution curves proceed at each point, and thus gives the general shapes of all the solution curves.

Remark that we can draw a DF without knowing the general solution of the DE. DFs are a method by which we investigate the
qualitative characteristics of the solutions of the DE
y ' = f (x, y). They're useful and important precisely because they can still
be constructed in cases where the DE can't be solved exactly.

Drawing A Lineal Element

As an example, to draw a lineal element with slope 3 centered at a point, we mentally choose a small distance as the unit,
then we go from the point horizontally to the right for 1 unit, then go vertically up by 3 units and mark a dot there, then join
the point and the dot by a line segment, and extend the line segment to the other side of the point by about the same distance
so that the point is approximately the midpoint of the line segment.

As another example, to draw a lineal element with slope -3/2 centered at a point, we mentally choose a small distance as the
unit, then we go from the point horizontally to the right by 2 units, then go vertically down by 3 units and mark a dot there,
then join the point and the dot by a line segment, and extend the line segment to the other side of the point by about the
same distance so that the point is approximately the midpoint of the line segment.

For large slopes such as 100.8 or -4,766, we can use the property that the slope of a line is the trigonometric ratio tangent of
the angle that the line makes with a ray that's parallel to and goes in the same direction as the positive
x-axis. For example,
let's say the slope is 100.8. We reach for a calculator and calculate
arctan 100.8 = 89o, approximately. We draw a lineal
element that approximately makes an angle of 89
o with the ray, which isn't drawn but simply imagined. If the angle is positive
then we go in the counterclockwise direction, if the angle is negative then we go in the clockwise direction. Observe that for
small slopes, we of course can use this approach too, but using the above approach saves us time.

For fractional slopes with large numerators and/or denominators such as 193/152 or -3/85, we can first determine their
decimal forms, then proceed in one of the above approaches.

##### Example 1.1

Sketch the DF of the DE y ' = x2 + y2.

Solution Fig. 1.3   Calculations Of Slopes At A Number Of Points. The 1st column contains values of x and the 1st row contains values of y. A cell in any other row and column is the sum of the squares of the x-value in that row and of the y-value in that column. Fig. 1.4   DF Of y ' = x2 + y2.

EOS

Remark 1.1

In Example 1.1, we calculate and display in the table in Fig. 1.3 the slopes at the points (x, y) where x = -2, -1, 0, 1, and 2,
and
y = -2, -1, 0, 1, and 2. Each of the 5 values of x corresponds to 5 values of y. So there are 5 x 5 = 25 points, and thus 25
slopes to calculate. Then we draw in Fig. 1.4 little line segments at these points with these slopes. The resulting picture is the
required DF. A table displaying the calculations of slopes at a number of points such as the one in Fig. 1.3 is optional unless it's
explicitly required.

The more line segments we draw in a DF, the more detailed and the clearer the DF becomes. However it's tedious to compute
slopes and draw line segments for a large number of points by hand. Fortunately there exist computer programs that perform
this task. They're in the category of function graphers or plotters. Fig. 1.5 displays a computer-drawn DF of the DE of Example
1.1. Of course it presents a clearer picture of the DF than does Fig. 1.4. Fig. 1.5   Computer-Drawn DF Of y ' = x2 + y2.

Example 1.2 Solution Fig. 1.6 EOS

 2. Graphical Solutions Of y ' = f (x, y)

Example 2.1

Sketch the solution curve of the following initial-value problem without solving the initial-value problem: Approximately determine from the solution curve its intercepts, asymptotes, end behaviors, intervals of increasing/decreasing,
intervals of concavity, and inflection points.

Note - How To Sketch

We're asked to sketch the graph of the particular solution of the DE y ' = x2 + y2 that passes thru the point (1, 0) without
solving the DE and substituting
x = 1 and y = 0 to obtain the desired particular solution. For this purpose, first we draw the
DF of the DE, as done in Fig. 2.1. Next we sketch the solution curve thru the point (1, 0). To do so, we start from the point (1,
0), first to one side of the tangent line segment centered at (1, 0) and approximately parallel to it, then to its other side, again
approximately parallel to it. As we proceed, the curve is approximately parallel to nearby line segments. The DF and the
solution curve are sketched in Fig. 2.1.

Solution ### Fig. 2.1

Approximate Solution Curve Of Initial-Value Problem:  EOS

Remark 2.1 - On Example 2.1

The solution curve in Fig. 2.1 passes thru the points (1, 0) and (0, -1/2). This is because it's the solution that must pass thru
the point (1, 0) and because the point (0, -1/2) happens to belong to it. It passes thru the midpoints of the lineal elements at
points (1, 0) and (0, -1/2). Remember that the midpoint of the lineal element at a point (
x, y) is the point (x, y) itself. In the
picture, the solution curve doesn't pass thru the midpoint of any other lineal element. This is because all other points
considered in the picture belong to other solutions. We're sure that the solution curve has no horizontal asymptotes. If there
are no vertical asymptotes either, if we extend the length of one or both axes sufficiently, there'll be other lineal elements such
that the solution curve passes thru their midpoints. Also, whether or not there are horizontal or vertical asymptotes, if we
increase the number of points horizontally within each unit of the
x-axis and/or the number of points vertically within each unit
of the
y-axis sufficiently, there'll be other lineal elements such that the solution curve passes thru their midpoints.

Definitions 2.1 – Graphical Solutions And Integral Curves

 Consider the initial-value problem: To sketch the solution curve of this initial-value problem, we sketch the DF of the DE y ' = f (x, y), then we draw a curve thru the point (x1, y1) and approximately parallel to nearby lineal elements. The curve obtained is an approximate solution curve or approximate graphical solution of the given initial-value problem.   A solution curve is the graph of a solution y, which is an antiderivative or (indefinite) integral of y', and thus is also called an integral curve.

Example 2.2

Sketch the DF of y ' = x2 + y2. Then sketch the solution curves that pass thru the points (-2, 0), (-1, 0), (0, 0), (1, 0), and (2, 0)
respectively.

Solution Fig. 2.2   Some Solution Curves Of y ' = x2 + y2.

EOS

 3. Direction Fields And Graphical Solutions Of y' = f (x) And y' = f ( y)

Differential Equations Of The Form y ' = f (x)

Example 3.1

Sketch the DF of the DE y ' = 2x - 2.

Solution Fig. 3.1   DF Of y ' = 2x - 2.

EOS

Lineal Elements Along Any Vertical Line Are Parallel

In Example 3.1, at every point (x, y), the slope y ' = 2x - 2 depends only on x; it doesn't depend on y. At any point with
x-coordinate x1, the slope is 2x1 - 2, whatever y is, so the lineal elements along the vertical line x = x1 have the same fixed
slope of 2
x1 - 2, and thus are parallel. The lineal elements along any vertical line are parallel. In general, in the DF of the DE of
the form
y ' = f (x), the lineal elements along any vertical line are parallel.

Solution Curves Obtained By Shifting A Copy Of A Known One Vertically

Now refer to Fig. 3.2. The DF is that of y ' = 2x - 2 of Example 3.1. Suppose a solution curve C1 that passes thru the point
(-0.5, 1) is known. Let's shift a copy of
C1 vertically up by 1.5 units and label the new curve as C2. Since the lineal elements
along any vertical line are parallel,
C2 is approximately parallel to all nearby lineal elements, as each of them is parallel to a
lineal element vertically below it and to which
C1 is approximately parallel. As a consequence, C2 is also a solution curve.
Similarly, the curve
C3, obtained by shifting a copy of C1 vertically down by 1 unit, is also a solution curve. In general, if a Fig. 3.2   Solution Curves Obtained From A Known Solution Curve.

solution curve of the equation y ' = f (x) is known, then every other solution curve can be obtained by just shifting a copy of the
known one vertically up or down.

Recall that the general solution of y' = f (x) is the general antiderivative y = F(x) + C of f (x), where F(x) is an antiderivative
of
f (x) and C is an arbitrary constant. So any 2 solution curves differ from each other by a constant. Thus if a solution curve is
known, then every other solution curve can be obtained by just shifting a copy of the known one vertically up or down, as also
demonstrated by DFs.

Differential Equations Of The Form y ' = f ( y)

Example 3.2

Sketch the DF of the DE y ' =  y + 1.

Solution Fig. 3.3   DF Of y ' =  y + 1.

EOS

Lineal Elements Along Any Horizontal Line Are Parallel

In Example 3.2, at every point (x, y), the slope y ' =  y + 1 depends only on y; it doesn't depend on x. At any point with
y-coordinate y1, the slope is  y1 + 1, whatever x is, so the lineal elements along the horizontal line y = y1 have the same fixed
slope of
y1 + 1, and thus are parallel. The lineal elements along any horizontal line are parallel. In general, in the DF of the DE
of the form
y ' = f ( y), the lineal elements along any horizontal line are parallel.

Solutions Curves Obtained By Shifting A Copy Of A Known One Horizontally

Now refer to Fig. 3.4. The DF is that of y ' =  y + 1 of Example 3.2. Suppose a solution curve C1 that passes thru the point (2,
1) is known. Let's shift a copy of
C1 horizontally left by 2.75 units and label the new curve as C2. Since the lineal elements
along any horizontal line are parallel,
C2 is approximately parallel to all nearby lineal elements, as each of them is parallel to a
lineal element horizontally to the right of it and to which
C1 is approximately parallel. As a consequence, C2 is also a solution
curve. Similarly, the curve
C4, obtained by shifting a copy of a known solution curve C3 that passes thru the point (-1, -2)
horizontally right by 1.25 units, is also a solution curve. In general, if a solution curve of the equation
y ' = f ( y) is known, then
arbitrarily many other solutions curves can be obtained by just shifting a copy of the known one horizontally left or right. Note
that
C4 can't be obtained by shifting a copy of C1 horizontally. Not every solution curve can be obtained by shifting a copy of a
single known solution curve horizontally. Fig. 3.4   Solution Curves Obtained From A Known Solution Curve.

The Differential Equations  y ' = f (x) And  y ' = f ( y)

 For the DE of the form y ' = f (x), in its DF, the lineal elements along any vertical line are parallel, and if a solution curve is known, we can obtain every other solution curve by shifting a copy of the known one vertically up or down.   For the DE of the form y ' = f ( y), in its DF, the lineal elements along any horizontal line are parallel, and if a solution curve is known, we can obtain arbitrarily many other solution curves by shifting a copy of the known one horizontally right or left. Note that in general not every solution curve can be obtained by shifting a copy of a single known solution curve horizontally. The DE y ' = f ( y), where the derivative y' depends only on the function y and not on the variable x, is said to be autonomous.

 4. Equilibrium Solutions

Equilibrium Solutions

For convenience a copy of the picture in Fig. 3.4 is re-produced in Fig. 4.1 with the horizontal line y = - 1 becoming solid and
colored dark blue. The DE is
y' = y + 1.

In Fig. 4.1, the constant function y = -1 is a solution of the DE y' = y + 1 (check: y = -1 for all x, y' = 0, y + 1 = (-1) + 1
= 0, so
y' = y + 1). The DE y' = y + 1 has infinitely many solutions. So the quantity y = g(x) such that y' = y + 1 has infinitely Fig. 4.1   The equilibrium solution of y' = y + 1 is y = -1.

many possibilities for its formula g(x).

For convenience, let's think of x as time. Let's consider a particular value of x, for example the initial time x = 0. There, if the
value of
y is -0.75 then y behaves in the way indicated by the curve C1; if the value of y is -1 then y behaves in the way
indicated by the horizontal line
y = -1; if the value of y is -1.75 then y behaves in the way indicated by the curve C4; if the
value of
y is 3.25 then y behaves in the way indicated by the curve C2; etc. The overall behavior of any individual y on its
domain depends on its value at a particular time, for example at the initial time
x = 0, which is reasonable and believable.

The solution y = -1 is constant. If the quantity y takes on the constant solution y = -1, then of course it's constant, it doesn't
change as
x changes, it's in an equilibrium state. Consequently the constant solution y = -1 is called an equilibrium solution
of the DE
y' = y + 1. If at x = 0 the quantity y takes on the value -1, then it's an equilibrium solution. Note that of course the
solution “curves” of the equilibrium solutions are horizontal lines.

Finding Equilibrium Solutions

As done above, equilibrium solutions can be found from DFs. If a DE can be solved, it may be possible to obtain its equilibrium
solutions, if they exist, from the general solution. Let's solve
y' = y + 1:

y' = y + 1,

y' - y = 1,
y'e-x - ye-x = e-x,
(
ye-x)' = e-x,
ye-x = - e-x + C,     C = arbitrary constant; this C isn't related to the curve names Ci's in Fig. 4.1,
y = - 1 + Cex,
y = Cex - 1. We see that we can obtain the equilibrium solution of y' = y + 1 from its DF and its general solution. For this particular DE, it's
possible too to obtain its equilibrium solutions directly from its equation without solving it, as follows. If
y = k is an equilibrium
solution, then
y' = 0, consequently it must be that y + 1 = 0 also, hence k + 1 = 0, it follows that k = -1; we conclude that y =
-1 is the equilibrium solution. In generaal, to find equilibrium solutions of
y' = f( y), we note that if y = k, where k is a constant,
is an equilibrium solution, then
y' = 0, consequently it must be that f(k) = 0 also, where we substitute y = k. Therefore we
solve the equation
f(k) = 0 for k. If it can be solved and if a constant  solution exists, say k = k1, then y = k1 is an equilibrium
solution of
y' = f( y). If there are no constant solutions then there are no equilibrium solutions.

Example 4.1

Find the equilibrium solutions of the following DEs if they exist. Solution

a) If y = k is an equilibrium solution then y' = 0, then k2 + 1= 0, which is false (in the realm of real numbers). So there are
no equilibrium solutions.

b) If y = k is an equilibrium solution then y' = 0, then x + k = 0, then k = -x, which is false because -x isn't a constant. So
there are no equilibrium solutions.

c) If y = k is an equilibrium solution then y' = 0, then k3 - 17k2 - 60k = 0, then k(k2 - 17k - 60) = 0, then k(k + 3)(k - 20) =
0, then
k = 0, -3, or 20. So the equilibrium solutions are y = 0, y = -3, and y = 20. EOS

Remarks 4.1 - On Example 4.1

a) For part c, suppose we use the DF of the DE to find the equilibrium solutions. If the range of the y-axis is from b1 to b2 with

b1 < -3 and 0 < b2 < 20, then we would miss the equilibrium solution y = 20. So we should use the DE itself whenever
possible to find its equilibrium solutions without solving it.

b) For part d, suppose we use the DF of the DE to find the equilibrium solutions. If the y-coordinates of the points where we
draw lineal elements include the numbers with values
m + 0.5 where m is any integer, then the equilibrium solutions are
visible, as illustrated in Fig. 4.2. Otherwise, they aren't, as illustrated in Fig. 4.3, and likely we may be misled to declare that
there are no equilibrium solutions. So, again, we should use the DE itself whenever possible to find its equilibrium solutions
without solving it. Fig. 4.2   The equilibrium solutions are visible. Fig. 4.3   The equilibrium solutions aren't visible.

 5. Matching Differential Equations With Direction Fields

Example 5.1 - Matching DEs With DFs

Match the DE with its DF labelled a thru d in Fig. 5.1. Give reasons for your answer.

1) y' = x(3 - y).          
2)
y' = sin x cos y.     
3)
y' = x + y - 2.         
4)
y' = 3 - y. Fig. 5.1   DFs To Match DEs.

Solution

1) b. The slope of  at the origin is (0)(3 - 0) = 0. Only b and d have slope 0 at the origin. The slope of  at (1, 1) is (1)(3 -
1) = 2. The slope of b at (1, 1) appears to be 2, while the slope of d at (1, 1) is clearly strictly between 0 and 1. So 
matches b.

2) d. The slope of  at the origin is sin 0 cos 0 = (0)(1) = 0. Only b and d have slope 0 at the origin. Now b has already been
found to match . So  must match d.

3) a. The slope of  at the origin is 0 + 0 - 2 = -2 < 0. Only a has a negative slope at the origin. So  must match a.

4) c. Equation  is different from any other equation. Now a, b, and d have already been matched. So  has to match c.

EOS

Remark 5.1 - On Example 5.1

For part 4. The equations y' = sin2 x and y' = 1 - cos2 x, although looking different, are actually the same, since sin2 x + cos2 x
= 1, and thus
sin2 x = 1 - cos2 x, for all real x.

# Problems & Solutions

1. Sketch the DF of the DE y ' = x2 - y2. Find equilibrium solutions if they exist.

##### Solution  2. Sketch the solution curve of the following initial-value problem without solving the given DE: Approximately determine from the solution curve its intercepts, asymptotes, end behaviors, intervals of increasing/decreasing,
intervals of concavity, and inflection points.

##### Solution  3. b) Determine all the equilibrium solutions. Are they visible in the given DF? Why or why not? ##### Solution  Note 4. Match the DEs with the DFs labelled A thru D. Give reasons for your answer.

a) y' = 2x + y - 1.

b) y' = (2 - x) y.
c)
y' = ex/10ey/3.

d) y' = 2 - x. ##### Solution

a) C. The slope of a at the origin is 2(0) + 0 - 1 = -1 < 0. Only C has a negative slope at the origin. Thus a must match C.

b) B. The slope of b at the origin is (2 - 0)(0) = 0. Only B has slope 0 at the origin. Thus b must match B.

c) D. The slope of c at the origin is e0/10e0/3 = 1 > 0. Only A and D have a positive slope at the origin. There the slope of D
appears to be 1 while that of A clearly is > 1. Thus c must match D.

d) A. The equation in d is different from any other equation. Now B, C, and D have already been matched. Thus d must match

A.

5. The DF of the DE: together with the solution curve that passes thru the origin (0, 0) is shown. Obtain from this solution curve the solution curve
that passes thru the point (0, 2) and the solution curve that passes thru the point (0, -1). Explain how you obtain these
solution curves. Solution The given DE is of the form y ' = f (x). So the lineal elements on any vertical line are parallel. The solution curve that passes
thru the point (0, 2) is obtained by shifting a copy of the given solution curve vertically up by 2 units. The solution curve that
passes thru the point (0, -1) is obtained by shifting a copy of the given solution curve vertically down by 1 unit.