Scientia sine finibus

Differential Equations / Unit 1, Differential Equations and Their Solutions / Topic 1.2

Units and Topics

Unit 1. Differential Equations and Their Solutions

1.2 Direction Fields

A first order differential equation gives the slope of a solution at each point of the plane. A drawing of these slopes is called a direction field. This topic covers how to draw a direction field, how to read solution curves from it, and how to find the solutions that are constant. A direction field shows how the solutions behave without a formula for them.

You need Topic 1.1 for this topic.

1. The Equation as a Rule for Slopes

A first order equation that is solved for the derivative has the form

y′ = f(t, y)

Here f(t, y) is an expression that contains t, or y, or both. The derivative y′ is the slope of the graph of the solution. So the equation says: at the point (t, y), a solution that passes through this point has the slope f(t, y). The slope is known at each point before any solution is known.

An example: y′ = t − y

For this equation, f(t, y) = t − y. The slope at a point is the first coordinate minus the second coordinate.

f(0, 0) = 0 − 0 = 0at the point (0, 0) the slope is 0f(1, 0) = 1 − 0 = 1at the point (1, 0) the slope is 1f(0, 1) = 0 − 1 = −1at the point (0, 1) the slope is −1f(2, 1) = 2 − 1 = 1at the point (2, 1) the slope is 1

2. Drawing a Direction Field

A direction field is drawn in three steps.

  • Choose a grid of points in the plane, with t on the horizontal axis and y on the vertical axis.
  • Calculate the slope f(t, y) at each point of the grid.
  • Draw a short line segment with that slope through each point.

The table shows the slopes of y′ = t − y on a grid of nine points. Each entry is the value of t at the top of its column minus the value of y at the left of its row.

t = 0t = 1t = 2
y = 2−2−10
y = 1−101
y = 0012

A segment with the slope 0 is horizontal. A segment with the slope 1 rises at 45°, and a segment with the slope −2 falls steeply. All segments have the same length, because a segment shows only a direction. A computer draws hundreds of segments in a fraction of a second, and the drawing below is made in this way.

Try it: a direction field and a solution curve

The gray segments are the direction field of the equation that the menu selects. The blue curve is the solution through the green point. Drag the green point to another place, and the curve changes to the solution through the new point.

3. Solution Curves

The graph of a solution is called a solution curve. At each of its points, a solution curve has the slope that the equation gives, so it is tangent to the segment of the direction field at that point.

To sketch a solution curve by hand, start at a point, and draw a curve that follows the directions of the nearby segments, to the right and to the left. A different starting point gives a different solution curve. The starting point is the initial condition of Topic 1.1, and the solution curves together are the family of solutions.

For the equations of this course, exactly one solution curve passes through each point, so two solution curves do not cross and do not touch. Topic 2.6 states the conditions under which this is true.

4. Isoclines

An isocline is a curve along which all segments of the direction field have the same slope. The isocline for the slope c is the set of points with f(t, y) = c. Isoclines make a direction field easier to draw by hand: find the curve, and draw parallel segments along it.

The isoclines of y′ = t − y

t − y = cthe points where the slope is cy = t − csolve for y

Each isocline is a straight line with the slope 1. On the line y = t the segments are horizontal, on the line y = t − 1 they have the slope 1, and on the line y = t + 1 they have the slope −1.

An isocline that is a solution

On the isocline y = t − 1, the segments have the slope 1, and the line itself has the slope 1. The segments lie along the line, so this line is a solution curve. A check confirms it.

y = t − 1the functiony′ = 1the left side of the equationt − y = t − (t − 1) = 1the right side of the equationy′ = t − ythe equation is satisfied at each time t

The drawing shows that the other solution curves approach this line as t grows. Topic 2.2 finds the general solution, y = t − 1 + Ce−t. The term Ce−t becomes small as t grows, which agrees with the drawing. Most isoclines are not solution curves. An isocline is a solution curve only when its own slope is equal to the slope of its segments.

5. Equilibrium Solutions

In many equations the right side contains y and does not contain t. Such an equation is called autonomous.

y′ = f(y)

The slope depends only on the height y, so all segments on one horizontal line are parallel. A constant function y = c has the derivative 0. It is a solution exactly when f(c) = 0. A constant solution is called an equilibrium solution, and its solution curve is a horizontal line.

An example: y′ = y(1 − y)

y(1 − y) = 0the condition for an equilibrium solutiony = 0 or y = 1a product is zero when one of its factors is zero

The equilibrium solutions are y = 0 and y = 1. Between and outside these two lines, the sign of f(y) gives the direction of the solutions.

RegionSign of y(1 − y)Solutions
y above 1NegativeFall toward the line y = 1
y between 0 and 1PositiveRise toward the line y = 1
y below 0NegativeFall away from the line y = 0

Solutions that start near y = 1 approach it, so this equilibrium solution is called stable. Solutions that start near y = 0 move away from it, so this equilibrium solution is called unstable. Select this equation in the drawing above, and drag the point across the two lines. Topic 2.5 studies stability in detail.

6. An Example from Physics: Terminal Velocity

An object falls through air. Its downward velocity v, in meters per second, satisfies the equation below. The term 9.8 is the acceleration of gravity, and the term −0.2v is the effect of air resistance, which grows with the speed.

dv/dt = 9.8 − 0.2v

The equation is autonomous. Its equilibrium solution is the velocity at which the acceleration is zero.

9.8 − 0.2v = 0the condition for an equilibrium solution0.2v = 9.8add 0.2v to both sidesv = 49divide both sides by 0.2

For v below 49 the right side is positive, and the velocity increases. For v above 49 the right side is negative, and the velocity decreases. Each solution approaches 49 meters per second, whatever the starting velocity is. This velocity is called the terminal velocity. The direction field gives this result without a formula for v(t).

What a Direction Field Shows

  • It shows the shape of all solutions at once, and how they behave as t grows.
  • It works for equations that have no solution formula, such as y′ = t² − y² in the drawing.
  • It does not give exact values. Topic 1.3 turns the idea into a method that produces numbers.

Common Mistakes

  • Calculating the slope at one point and drawing the segment at another point.
  • Drawing longer segments for larger slopes. A segment shows a direction, and all segments have the same length.
  • Sketching two solution curves that cross.
  • Following only one segment for a long distance. A solution curve must follow the direction at each point that it passes.
  • Treating each isocline as a solution curve. Along an isocline the slopes are equal, but the isocline usually has a different slope.
  • Looking for equilibrium solutions by setting y equal to zero. The condition is f(y) = 0.

Summary

IdeaStatement
SlopeA solution of y′ = f(t, y) has the slope f(t, y) at the point (t, y)
Direction fieldShort segments with the slope f(t, y) at the points of a grid
Solution curveA curve that is tangent to the direction field at each of its points
IsoclineThe points with f(t, y) = c, where all segments have the slope c
Autonomous equationy′ = f(y), with the same slopes along each horizontal line
Equilibrium solutionA constant solution y = c, which requires f(c) = 0

Practice

Work each problem on paper first. Then open the answer to check your work.

1. For the equation y′ = t + y, find the slopes at the points (0, 0), (1, 1), (−1, 2), and (2, −2).

f(0, 0) = 0 + 0 = 0the slope at (0, 0)f(1, 1) = 1 + 1 = 2the slope at (1, 1)f(−1, 2) = −1 + 2 = 1the slope at (−1, 2)f(2, −2) = 2 − 2 = 0the slope at (2, −2)

2. Find the isoclines of y′ = t + y for the slopes 0 and −1. Is one of them a solution curve?

t + y = 0, so y = −tthe isocline for the slope 0t + y = −1, so y = −t − 1the isocline for the slope −1

Both lines have the slope −1. On the second line the segments also have the slope −1, so the line y = −t − 1 is a solution curve.

y = −t − 1the functiony′ = −1the left sidet + y = t − t − 1 = −1the right side

3. Find the equilibrium solutions of y′ = y² − 4, and say which one is stable.

y² − 4 = 0the condition for an equilibrium solutiony² = 4add 4 to both sidesy = 2 or y = −2take the square root

For y between −2 and 2 the right side is negative, so the solutions fall. For y above 2 and for y below −2 it is positive, so the solutions rise.

Solutions near y = −2 approach it, so y = −2 is stable. Solutions near y = 2 move away from it, so y = 2 is unstable.

4. For the equation y′ = 3 − y, describe the solutions with y(0) = 1 and with y(0) = 5 as t grows.

3 − y = 0the condition for an equilibrium solutiony = 3the equilibrium solution

At y = 1 the slope is 3 − 1 = 2, which is positive. The solution rises, and it approaches 3.

At y = 5 the slope is 3 − 5 = −2, which is negative. The solution falls, and it approaches 3.

5. At which points do the solution curves of y′ = t² − y have a horizontal tangent?

t² − y = 0a horizontal tangent has the slope 0y = t²solve for y

The tangents are horizontal at the points of the parabola y = t².

6. A falling object has the equation dv/dt = 9.8 − 0.4v. Find the terminal velocity, and the acceleration at the moment when v = 10.

9.8 − 0.4v = 0the acceleration is zero at the terminal velocityv = 9.8/0.4 = 24.5the terminal velocity, in meters per seconddv/dt = 9.8 − 0.4(10)substitute v = 10dv/dt = 5.8the acceleration, in meters per second squared

Python Practice

Step 1. The slope at one point

For the equation y′ = t − y, the slope at a point is the first coordinate minus the second coordinate. The code below stores the coordinates of the point (2, 1) under the names t and y, calculates the slope, and prints it.

Python

The slope is 1, as in Part 1. Now change the point to (0, 3). The slope should be −3.

Python

Step 2. The slopes at several points

The instruction np.array stores a list of numbers. When two names store lists of the same length, a calculation with the names is done for each pair of matching numbers. The code below calculates the slopes of y′ = t − y at the points (0, 0), (1, 0), and (2, 0), which is the bottom row of the table in Part 2.

Python

The slopes are 0, 1, and 2. Now calculate the middle row of the table, which has y = 1 at each point. The slopes should be −1, 0, and 1.

Python

Step 3. The slopes on a whole grid

The instruction np.meshgrid builds a grid of points from a list of t values and a list of y values. It gives two tables. The table T holds the t coordinate of each grid point, and the table Y holds the y coordinate of each grid point. A calculation with T and Y then gives the slope at each point of the grid.

Python

The last table is the table of slopes of Part 2. Now change the code so that S holds the slopes of the equation y′ = t + y on the same grid.

Python

Step 4. Equilibrium solutions

For an autonomous equation, the slope depends only on y. The code below calculates f(y) = y(1 − y) at five heights. A value of 0 marks an equilibrium solution, and the sign of each other value shows whether the solutions rise or fall at that height.

Python

The values are −2, 0, 0.25, 0, and −2. The equilibrium solutions are y = 0 and y = 1. Between them the slope is positive, and outside them it is negative, as in Part 5.

Now do the same for the equation y′ = y² − 4 of Practice Problem 3, at the heights −3, −2, 0, 2, and 3. The values should be 5, 0, −4, 0, and 5.

Python

Step 5. Check the general solution

Part 4 states that y = t − 1 + Ce−t is the general solution of y′ = t − y. The code below checks the solution with C = 2 by the method of Topic 1.1. It stores the function at 1001 times between 0 and 4, estimates the derivative with np.gradient, and prints the largest difference between the derivative and the right side t − y.

Python

The largest difference is about 0.004, so the two sides agree. Now check the solution with C = −3. The difference should be small again, because the function is a solution for each value of C.

Python

Quiz

This quiz has 5 questions on this topic. A question asks you either to choose one answer or to type numbers. The page grades your answers and explains each one. A number can be typed as a whole number, a decimal, a fraction such as 1/3, or a calculation such as sqrt(18)/2 or arccos(1/2). The page shows the value of a calculation next to the box. Angles in a calculation are in degrees. The Calculator button under each question opens a calculator. Your answers are saved in your browser, so they are still on the page when you come back to it.

Choose how your answers are checked

1. Find the slope of the direction field of y′ = t² − y at the point (2, 1).

2. How is a solution curve of y′ = f(t, y) related to the direction field?

3. Find the two equilibrium solutions of y′ = y² − 9.

4. Which line is the isocline of y′ = t − y for the slope 2?

5. A solution of y′ = 5 − y starts at y(0) = 1. What happens to y as t grows?

Next: Topic 1.3, The Method of Euler