Calculus 1

Slope fields

An equation gives the slope of its solutions at every point, but no formula for them. How much of the solutions’ shape can be seen from the slopes alone?

Where you are 7 in Differential equations

When you reach for it

A first-order differential equation solved for the derivative, \dfrac{dy}{dx} = f(x, y), gives the slope of a solution curve at every point it passes through, before any formula for the solution is known. Differential equations and their solutions tested proposed solutions and met families of them, one curve for each value of a constant; Writing a differential equation from a description wrote such equations from descriptions of a rate. Many equations have no solution formula that can be found, and even when one exists, what usually matters is the shape: which way solutions head, where they level off, what they do in the long run.

A slope field shows that shape. Reach for it to see a whole family of solutions at once, to sketch the solution through a given point, to match an equation with a picture, and to decide whether an equilibrium pulls nearby solutions in or pushes them away.

The procedure

Day 1: drawing a slope field

At a point (x_0, y_0) the equation says that a solution curve through it has slope f(x_0, y_0) there. A slope field (or direction field) draws, at each point of a grid, a short segment centered at the point with that slope. Each segment is a small piece of the tangent line to the solution curve through its point, and computing it is substitution. By hand a small grid and a table of values are enough. Only direction is recorded, so all segments have the same length: slope 0 is horizontal, slope 1 rises at 45°, a large slope is nearly vertical.

An isocline is a curve f(x, y) = m along which the slope is a constant m, so all its segments are parallel; drawing a few first organizes the field. The isocline f(x, y) = 0 carries the horizontal segments, where solutions level off and can turn around. An isocline is not a solution curve in general: a solution crosses it unless the isocline runs in the direction of its own segments (Example 1).

Two kinds of equation give recognizable fields.

  • If f depends on x only, \dfrac{dy}{dx} = f(x), each vertical line carries one slope. The solutions are the antiderivatives F(x) + C (Antiderivatives and indefinite integrals): copies of one curve shifted up and down.
  • If f depends on y only, \dfrac{dy}{dx} = g(y), the equation is called autonomous and each horizontal line carries one slope. If y = \varphi(x) is a solution, so is y = \varphi(x - c) for every constant c, since by the chain rule its derivative is \varphi'(x - c) = g\big(\varphi(x - c)\big): solution curves are copies shifted left and right. A number c with g(c) = 0 gives an equilibrium solution y = c, a constant function whose derivative 0 equals g(c); its graph is a row of horizontal segments. These are the equilibria found from \dfrac{dy}{dt} = 0 in Writing a differential equation from a description.

When f depends on both variables, isoclines do the organizing.

Day 2: reading solutions from the field

To sketch the solution through a point, start there and draw a curve tangent to every segment it meets, bending gradually between them. The sketch shows shape, not exact values. Where f is well behaved two solution curves never cross or touch (Boundaries), so a sketch runs alongside its neighbors.

The equation also gives exact information along a solution.

  • Rising and falling. Where f(x, y) > 0 the solution is increasing, and where f(x, y) < 0 decreasing (Increasing, decreasing, constant, positive and negative intervals).
  • Concavity. Differentiate \dfrac{dy}{dx} = f(x, y) with respect to x, treating y as a function of x as in Implicit differentiation, then replace each \dfrac{dy}{dx} by f(x, y). The result gives \dfrac{d^2y}{dx^2} in terms of x and y; its sign gives the concavity (Concavity and inflection points).
  • Turning points. A solution has a horizontal tangent where it meets the isocline f = 0; if the slope changes sign there, it is a local maximum or minimum.

Matching a field with an equation runs substitution the other way: at a few points where the candidates disagree, compute each candidate’s slope and compare with the drawn segments. Patterns help first: one slope per vertical line means f depends on x only, one slope per horizontal line means y only.

Stability concerns an equilibrium y = c of an autonomous equation \dfrac{dy}{dt} = g(y). It is stable if solutions starting close to c on either side approach c as t \to \infty, which happens when g > 0 just below c and g < 0 just above. It is unstable if nearby solutions move away on both sides, and semi-stable if they approach from one side and leave on the other. A sign chart of g decides which.

Worked examples

Example 1

Day 1: Nuka’s field by hand

Nuka draws the slope field of \dfrac{dy}{dx} = \dfrac{x - y}{2} at the 25 points with x and y in \{-2, -1, 0, 1, 2\}. Find the slopes and the isoclines. Is the isocline of slope 0 a solution curve? Is any isocline?

Solution

Substitute each point; at (-2, 2), for instance, the slope is \dfrac{-2 - 2}{2} = -2. Rows are values of y, columns values of x:

y \ x-2-1012
2-2-1.5-1-0.50
1-1.5-1-0.500.5
0-1-0.500.51
-1-0.500.511.5
-200.511.52

Each entry becomes a segment of that slope (Figure 1).

−2 −1 1 2 −2 −1 1 2 x y
Figure 1The slope field of \dfrac{dy}{dx} = \dfrac{x - y}{2} on a 5 by 5 grid (Example 1). The dashed line y = x is the isocline of slope 0; the solid line y = x - 2 is the isocline of slope 1, and also a solution curve.

The slope is m where \dfrac{x - y}{2} = m, that is, on the line y = x - 2m: the isoclines are parallel lines of slope 1. The isocline of slope 0 is y = x, the diagonal of zeros. It is not a solution curve: the line has slope 1 while every segment on it is horizontal, so solutions cross it.

The isocline of slope 1 is y = x - 2, a line whose own slope is 1. Its segments point along it, and substitution confirms it is a solution: \dfrac{dy}{dx} = 1 and \dfrac{x - (x - 2)}{2} = 1. Its grid points (0, -2), (1, -1) and (2, 0) all carry slope 1 in the table.

Example 2

Day 1: a field that depends on x only

Describe the slope field of \dfrac{dy}{dx} = \tfrac{1}{2}x^2 - 1 on the same grid, and its solution curves.

Solution

There is no y, so each column has one slope:

\begin{aligned} &x = \pm 2: \ 1, \qquad x = \pm 1: \ -\tfrac{1}{2}, \\ &x = 0: \ -1. \end{aligned}

No grid point carries a horizontal segment. The isoclines of slope 0 are where \tfrac{1}{2}x^2 = 1, the lines \displaystyle x = \pm\sqrt{2}, which pass between the columns; the sign change from -\tfrac{1}{2} at x = 1 to 1 at x = 2 shows one is there. The solutions are the antiderivatives

y = \frac{x^3}{6} - x + C.

Any two have the same slope above each x, so they differ by a constant: one curve shifted up and down (Figure 2). Each has a local maximum at \displaystyle x = -\sqrt{2} and a local minimum at \displaystyle x = \sqrt{2}, where the slope changes sign.

−2 −1 1 2 −2 −1 1 2 x y
Figure 2The field of \dfrac{dy}{dx} = \tfrac{1}{2}x^2 - 1 with the solutions y = \dfrac{x^3}{6} - x + C for C = -1, 0, 1 (Example 2), copies of one curve shifted up and down. The dashed lines \displaystyle x = \pm\sqrt{2} are the isoclines of slope 0.
Example 3

Day 1: a field that depends on y only

Describe the slope field of \dfrac{dy}{dx} = y^2 - 1, find its equilibrium solutions, and show that the solution curves through (0, 0) and (1, 0) are shifted copies.

Solution

There is no x, so each row has one slope:

\begin{aligned} &y = \pm 2: \ 3, \qquad y = \pm 1: \ 0, \\ &y = 0: \ -1. \end{aligned}

The equilibria are where y^2 - 1 = 0: y = 1 and y = -1. The constant y = 1 has derivative 0 and 1^2 - 1 = 0, so it is a solution, and likewise y = -1. Between them y^2 - 1 < 0 and solutions fall; outside, y^2 - 1 > 0 and they rise, more steeply farther out (Figure 3).

−2 −1 1 2 −2 −1 1 2 x y
Figure 3The field of \dfrac{dy}{dx} = y^2 - 1 (Example 3). The equilibrium solutions y = \pm 1 are horizontal lines. The solutions through (0, 0) and (1, 0) are the same curve shifted 1 unit sideways.

Let y = \varphi(x) be the solution with \varphi(0) = 0 and put \psi(x) = \varphi(x - 1). By the chain rule,

\begin{aligned} \psi'(x) &= \varphi'(x - 1) = \varphi(x - 1)^2 - 1 \\ &= \psi(x)^2 - 1, \end{aligned}

and \psi(1) = \varphi(0) = 0. So the solution through (1, 0) is the one through (0, 0) moved 1 unit right. Whether the equilibria attract or repel is Exercise 17.

Example 4

Day 2: following the segments

Paninnguaq sketches solutions of Nuka’s equation \dfrac{dy}{dx} = \dfrac{x - y}{2}. (a) Find \dfrac{d^2y}{dx^2} in terms of x and y. (b) Describe the solution through (0, 1). (c) Describe the solution through (0, -3).

Solution

(a) Differentiate with respect to x, with y a function of x, and substitute for \dfrac{dy}{dx}:

\begin{aligned} \frac{d^2y}{dx^2} &= \frac{1}{2}\left(1 - \frac{x - y}{2}\right) \\ &= \frac{2 - x + y}{4}. \end{aligned}

This is positive exactly where y > x - 2, above the solution line of Example 1, and negative below it.

(b) At (0, 1) the slope is -\tfrac{1}{2} and the second derivative is \dfrac{3}{4}: decreasing and concave up. The solution starts above the solution y = x - 2 and cannot cross it, so it is concave up everywhere. It falls while above the isocline y = x, which rises to meet it; there the slope is 0 and turns from negative to positive, a local minimum, which Figure 4 shows near (0.8, 0.8). On y = x the second derivative is \dfrac{2}{4} > 0, so any solution meeting this line has a minimum there, never a maximum. Afterward it lies between the isoclines y = x and y = x - 2, with slopes between 0 and 1: it rises, and the field suggests it runs ever closer to y = x - 2.

−1 1 2 3 4 −3 −2 −1 1 2 3 x y
Figure 4Following the segments (Example 4). The solution through (0, 1) is concave up with its minimum on the isocline y = x; the one through (0, -3) is increasing and concave down. Neither crosses the solution y = x - 2.

(c) At (0, -3) the slope is \dfrac{3}{2} and the second derivative is -\dfrac{1}{4}. The solution starts below y = x - 2 and stays there, so it is concave down throughout; and there y < x - 2, so the slope \dfrac{x - y}{2} exceeds 1. It increases everywhere, flattening toward slope 1 as it nears the line from below.

Example 5

Day 2: Dimas matches four fields

Match the four fields of Figure 5 with the equations

\begin{aligned} &\text{(i) } y' = y - 1, \qquad \text{(ii) } y' = 1 - x, \\ &\text{(iii) } y' = xy, \qquad \text{(iv) } y' = y - x. \end{aligned}
A B C D
Figure 5Four fields to match with four equations (Example 5). Each window runs from -2 to 2 both ways, axes through the center.
Solution

Dimas computes each slope at three points where the equations disagree:

Point(i)(ii)(iii)(iv)
(0, 0)-1100
(1, 0)-100-1
(0, 2)1102

The four columns differ, so these points decide. In A all three segments are horizontal: (iii), whose slope xy is 0 on both axes. In B the center segment falls with slope -1 and the one at (0, 2) rises with slope 1: (i), and each row of B has one slope, as for an equation in y alone. In C the center is level and (1, 0) falls: (iv), level along y = x. In D the center rises with slope 1 and (1, 0) is level: (ii), with one slope per column. So A is (iii), B is (i), C is (iv) and D is (ii).

Example 6

Day 2: stable and unstable equilibria

For \dfrac{dy}{dt} = y^3 - 4y, find and classify the equilibria, describe the solution with y(0) = 1.5 including its concavity, and give the long-run behavior for each starting value.

Solution

Since y^3 - 4y = y(y - 2)(y + 2), the equilibria are y = -2, y = 0 and y = 2. Between them the sign of g(y) = y^3 - 4y is fixed, and one test value per interval gives it:

IntervalTestSolutions
y < -2g(-3) = -15fall
-2 < y < 0g(-1) = 3rise
0 < y < 2g(1) = -3fall
y > 2g(3) = 15rise

Near 0, solutions below rise and solutions above fall, both toward 0: stable. Near 2, those below fall and those above rise, both away: unstable. Near -2, likewise away: unstable (Figure 6).

0.5 1 1.5 2 −3 −2 −1 1 2 3 t y
Figure 6The field of \dfrac{dy}{dt} = y^3 - 4y (Example 6). Solutions near y = 0 approach it: stable. Solutions near y = \pm 2 move away: unstable.

Differentiating with respect to t, with the chain rule on the right,

\begin{aligned} \frac{d^2y}{dt^2} &= \left(3y^2 - 4\right)\frac{dy}{dt} \\ &= \left(3y^2 - 4\right)\left(y^3 - 4y\right). \end{aligned}

The solution with y(0) = 1.5 starts with slope -2.625 and stays in 0 < y < 2, so it decreases throughout. While \displaystyle y > \dfrac{2}{\sqrt{3}} \approx 1.15 the first factor is positive and the slope negative: concave down. Below that height both factors are negative: concave up. So it has an inflection point at height \displaystyle \dfrac{2}{\sqrt{3}} and then levels off toward 0.

In the long run a solution starting strictly between -2 and 2 approaches 0; one starting at -2, 0 or 2 stays; one starting above 2 increases without bound, and one below -2 decreases without bound. No formula was needed. (Following segments in short straight steps, instead of by eye, is Euler’s method, a Calculus 2 topic: Euler's method.)

Boundaries

  • The equation must be defined at the point. Where f is undefined there is no segment: \dfrac{dy}{dx} = \dfrac{y}{x} has none on the y-axis (Exercise 14).
  • A field is a sample. Segments sit only at grid points, and a coarse grid can miss what lies between: the integer grid of Example 2 has no horizontal segment although the slope is 0 along \displaystyle x = \pm\sqrt{2}.
  • No crossing needs a smooth right side. That solution curves never cross or touch is a theorem, stated without proof, valid near any point where f is continuous and has a continuous derivative with respect to y (holding x fixed). Without that, solutions can meet: for \dfrac{dy}{dx} = 3y^{2/3} both y = 0 and y = x^3 pass through the origin, since 3x^2 = 3\left(x^3\right)^{2/3}.
  • An isocline is not a solution curve. The isocline f = 0 is a solution only when it is a horizontal line, as for \dfrac{dy}{dt} = g(y); in Example 1, y = x is not.
  • A sign chart in y needs an autonomous equation. If the slope also depends on t, one height carries different slopes at different times, and the stability test of Example 6 decides nothing.

Where this goes next

Separable differential equations finds formulas for the solutions of many equations, including several here, and picks the one through a given point, which can be compared with the sketch. Exponential growth and decay models and Logistic growth study the two most used autonomous equations, whose equilibria are classified as in Example 6. Euler’s method turns “follow the segments” into arithmetic.

Exercises

Day 1: slopes and isoclines

  1. For \dfrac{dy}{dx} = 2x - y, find the slope of the segment at (0, 0), (1, 0), (1, 2), (-1, 1) and (2, -1).
  2. For \dfrac{dy}{dx} = y - x^2, find the slope at (1, 1), (-2, 1), (0, -2) and (2, 4). Describe the isoclines, and name the isocline of slope 0.
  3. For \dfrac{dy}{dx} = x + 2y, find the isoclines of slope -2, 0 and 2. Which isocline, of any slope, is also a solution curve? Verify it.
  4. For \dfrac{dy}{dx} = y(x - 1), find where the segments are horizontal, and give the sign of the slope in each of the four regions this cuts the plane into.
  5. Find the slopes of the field of \dfrac{dy}{dx} = x^2 - xy at the nine points with x and y in \{-1, 0, 1\}.

Day 1: fields in one variable

  1. For \dfrac{dy}{dx} = \cos x, find the slopes along x = 0, x = \dfrac{\pi}{2} and x = \pi, every isocline of slope 0, and the solution curves.
  2. For \dfrac{dy}{dx} = 4 - y^2, find the equilibrium solutions and the slopes along y = 0, y = 1 and y = 3. For which y do the segments rise?
  3. For \dfrac{dy}{dx} = e^{-y}, find the slopes along y = 0 and y = \ln 2. Explain why there is no equilibrium and every solution is increasing.

Day 2: solution curves

  1. For \dfrac{dy}{dx} = 2x - y, find \dfrac{d^2y}{dx^2} in terms of x and y. Describe the solution at (0, 0) and at (1, 3): rising or falling, concavity, any extremum.
  2. Show that y = 2x - 2 solves \dfrac{dy}{dx} = 2x - y, and find where the other solutions are concave up and where concave down.
  3. For \dfrac{dy}{dx} = y - x^2, show that the solution through (0, -1) is decreasing and concave down for every x \ge 0.
  4. For \dfrac{dy}{dx} = y(x - 1), describe the solution through (0, 2): where it falls and rises, its extremum, and its concavity.

Day 2: matching

  1. A field has slope 0 at (0, 0), slope 1 at (1, 0) and (0, 1), and slope -1 at (-1, 0) and (0, -1). Which of y' = x + y, y' = x^2 + y^2, y' = x + y^2 and y' = xy + 1 can it belong to?
  2. Show that in the field of \dfrac{dy}{dx} = \dfrac{y}{x} the segment at each point (a, ka) with a \ne 0 points along the line y = kx. What does that say about the solution curves?
  3. Match y' = y^2 + 2, y' = 1 - y^2 and y' = x^2 - 4 with: (A) horizontal segments along two vertical lines; (B) every segment rises with slope at least 2; (C) horizontal segments along two horizontal lines.

Day 2: equilibria and stability

  1. For \dfrac{dy}{dt} = 4 - y^2, classify the equilibria, and describe the long run of the solutions with y(0) = 0, y(0) = 3 and y(0) = -3.
  2. Classify the equilibria of \dfrac{dy}{dx} = y^2 - 1 from Example 3, and say what the solution through (0, 0) does as x \to \infty.
  3. For \dfrac{dy}{dt} = y(y - 3)^2, find and classify the equilibria, and describe the solutions with y(0) = 1, y(0) = 4 and y(0) = -1.
  4. For \dfrac{dy}{dt} = \sin y, find every equilibrium and classify each.

Reasoning

  1. Show that two different solution curves of \dfrac{dy}{dx} = f(x), with f continuous on an interval, never meet there.
  2. Show that if y = \varphi(t) solves \dfrac{dy}{dt} = g(y), so does y = \varphi(t - c) for every constant c, and say what that means for the slope field.
  3. Nuka says that wherever a solution curve meets the isocline of slope 0, it has a local maximum or minimum. Give a counterexample using \dfrac{dy}{dx} = x^2.
  4. Dimas draws two solution curves of \dfrac{dy}{dx} = f(x, y) crossing at an angle at a point where f is defined. Explain why that is impossible.
  5. For \dfrac{dy}{dt} = g(y) with g smooth, let a < b be equilibria with g > 0 between them. Paninnguaq says a solution with a < y(0) < b rises but never reaches b. Explain why.
Answers
  1. 0, 2, 0, -3, 5. For example at (-1, 1): 2(-1) - 1 = -3.
  2. 0, -3, -2, 0. The isocline of slope m is the parabola y = x^2 + m, so the isoclines are one parabola shifted up and down; the isocline of slope 0 is y = x^2.
  3. x + 2y = m gives y = -\dfrac{x}{2} + \dfrac{m}{2}: y = -\dfrac{x}{2} - 1, y = -\dfrac{x}{2} and y = -\dfrac{x}{2} + 1. All have slope -\tfrac{1}{2}, so the solution is the isocline of slope -\tfrac{1}{2}, y = -\dfrac{x}{2} - \dfrac{1}{4}. Check: y' = -\tfrac{1}{2} and x + 2\left(-\dfrac{x}{2} - \dfrac{1}{4}\right) = -\dfrac{1}{2}.
  4. Horizontal along y = 0 and along x = 1. Positive where x > 1, y > 0 and where x < 1, y < 0; negative in the other two regions.
  5. Listing x = -1, 0, 1 in order: row y = 1: 2, 0, 0; row y = 0: 1, 0, 1; row y = -1: 0, 0, 2. Since x^2 - xy = x(x - y), the slope is 0 on x = 0 and on y = x.
  6. Slopes 1, 0 and -1, the same all the way up each line. Isoclines of slope 0: x = \dfrac{\pi}{2} + k\pi, k any integer. Solution curves y = \sin x + C, sine curves shifted up and down.
  7. Equilibria y = 2 and y = -2. Slopes 4, 3 and -5. Segments rise for -2 < y < 2.
  8. Slopes 1 and \tfrac{1}{2}, since e^{-\ln 2} = \tfrac{1}{2}. The slope e^{-y} is never 0, so no equilibrium, and always positive, so every solution increases; the segments flatten as y grows.
  9. \dfrac{d^2y}{dx^2} = 2 - \dfrac{dy}{dx} = 2 - 2x + y. At (0, 0): slope 0, second derivative 2, a local minimum, concave up. At (1, 3): slope -1, second derivative 3, decreasing and concave up.
  10. y' = 2 and 2x - (2x - 2) = 2. The second derivative 2 - 2x + y = y - (2x - 2) is positive above the line (concave up) and negative below it (concave down).
  11. The slope at (0, -1) is -1. For x \ge 0 the parabola y = x^2 is at height 0 or more, so while the solution stays at or below -1 its slope y - x^2 is negative and it keeps falling; it could only reach the parabola by first climbing back above -1, which a falling curve cannot do. The second derivative y' - 2x = (y - x^2) - 2x is a negative term plus a term at most 0: concave down.
  12. Slope at (0, 2): 2(0 - 1) = -2. The equilibrium y = 0 is a solution, so this curve stays above it, and the slope has the sign of x - 1: falling for x < 1, a local minimum at x = 1, rising after. The second derivative is y'(x - 1) + y = y\left((x - 1)^2 + 1\right) > 0: concave up everywhere.
  13. Only y' = x + y, which fits all five points. xy + 1 is 1 at (0, 0); x^2 + y^2 is 1 at (-1, 0); x + y^2 is 1 at (0, -1).
  14. At (a, ka) the slope is \dfrac{ka}{a} = k, the slope of y = kx. Each half-line y = kx (x > 0 or x < 0) runs along its own segments and is a solution: y' = k = \dfrac{kx}{x}. There is no field on the y-axis.
  15. (A) is y' = x^2 - 4, level along x = \pm 2. (B) is y' = y^2 + 2, since y^2 + 2 \ge 2. (C) is y' = 1 - y^2, level along y = \pm 1.
  16. y = 2 is stable and y = -2 unstable: 4 - y^2 > 0 for -2 < y < 2 and negative outside. From 0 the solution rises toward 2, from 3 it falls toward 2, from -3 it decreases without bound.
  17. y = -1 is stable and y = 1 unstable: y^2 - 1 < 0 between them and positive outside. The solution through (0, 0) decreases toward -1.
  18. Equilibria 0 and 3. The sign of y(y - 3)^2 is negative for y < 0 and positive for 0 < y < 3 and y > 3. So y = 0 is unstable and y = 3 is semi-stable: solutions below rise toward it, solutions above rise away. From 1 the solution rises toward 3; from 4 it increases without bound; from -1 it decreases without bound.
  19. y = k\pi, k any integer. For even k, \sin y is negative just below k\pi and positive just above: unstable. For odd k the signs reverse: stable.
  20. Two solutions are antiderivatives of the same f, so their difference has derivative 0 and is constant. If they met at one point the constant would be 0, the same curve.
  21. By the chain rule \dfrac{d}{dt}\varphi(t - c) = \varphi'(t - c) = g\big(\varphi(t - c)\big). The field repeats along every horizontal line, so a solution curve moved sideways stays tangent to the segments.
  22. y = \dfrac{x^3}{3} meets the isocline of slope 0, the line x = 0, at the origin, but y' = x^2 \ge 0 on both sides, so it rises straight through with no extremum.
  23. At the common point each curve has slope f of that point, so the two are tangent there and cannot cross at an angle. (Where the no-crossing theorem applies they cannot meet at all.)
  24. Between a and b, g > 0, so the solution increases. The constant y = b is a solution, and by the no-crossing theorem of Boundaries the rising solution never meets it, so it stays below b; increasing and bounded, it levels off, and the field suggests toward b.
unattributed · CC-BY-SA-4.0