 ## A Theoretical Introduction to Slope Fields

Long ago, in a class room not so very far away, you learned about a mathematical idea called the derivative. Now assuming that you passed the course you were taking back then, you should have learned a very important property of the derivative:

the derivative of a function gives its slope

When we work with differential equations, we are dealing with expressions in which the derivative appears as a variable. For example, we might be asked to analyze the differential equation:

dy/dx = x2

If we simply replace the variable dy/dx in the above equation by what we learned it means from our calculus course, we get the following statement:

slope = x2

So what? Well, let's remind ourselves of our usual goal when we are given a differential equation:

find the function whose derivative appears in the equation

In our example this means that our goal is to find y.

Now you may be one of those clever students who's always one step ahead of the instructor. If so you're probably already having thoughts about how you could easily solve the current example (i.e. find y) using integration. Hold that thought! Unfortunately integration isn't something we will always be able to use. Many (most?) differential equations can't be integrated directly. What we're leading into here is a method that can help us on far more differential equations than can be solved using integration.

Anyway, let's get back to our analysis of slope. We've established that our goal is to find the function which satisfies:

slope = x2

In other words, we're seeking a function whose slope at any point in the (x,y)-plane is equal to the value of x2 at that point. Let's amplify that by examining a few selected points.

• At the point (1,2) the slope would be 12 = 1.
• At the point (5,3) the slope would be 52 = 25.
• At the point (-3,11) the slope would be (-3)2 = 9.

(Notice that the y-value of these points doesn't influence the slope in this particular example. This will not always be the case.)

Hmmm...maybe we could use these slopes to get a picture of what the function we seek—the function which has these slopes—looks like? Well, for starters we'd need to be a bit more systematic about how we choose our points. (The choices I made above were somewhat random.)

We could divide the entire plane into a grid, kind of like the squares on a piece of graph paper, and at each grid intersection we could make a slope calculation like we were doing above. Obviously doing this for the entire plane is actually impossible, since it's infinite, so we'll have to be satisfied with some "reasonable" subset of the plane.

This is starting to sound like a lot of work. We may be talking about slope calculations at literally thousands of points, here. Sounds like a job for someone who doesn't mind doing myriads of mind-numbingly repetitive tasks. Someone who can maintain accuracy despite the mountain of (admittedly trivial) calculations involved. Well, you knew you were sitting at a computer for a reason, didn't you?

OK, so we'll have the computer do the calculations, but there's still something we haven't decided on yet! What do we do with all those thousands of slopes once we've found them? We mentioned earlier that we'd use the slopes to get a picture of what the function y looks like. One way of doing this would be to graphically represent each of the slopes that we find at points all over the plane by a short line segment that is actually as steep as the slope says it should be at that point. We can think of these little line segments as tangent lines to the function y that we've been looking for all this time. We will, of course, have the computer also carry out the job of drawing all the little tangent lines for us. We call the resulting picture a slope field, or direction field.

The picture produced by a computer program may look a little like this: A sample slope field made with Mathematica

If you feel that you followed the above description of how a slope field is formed then carry on down the page. If you're still a little lost you can either read a summary of the procedure, or you can even return to the beginning of this Introduction and read it through again.

### Making Slope Fields with the Computer

Let's continue to use the example of finding a slope field for the differential equation:

dy/dx = x2

As I mentioned above, it would be impossible to produce a slope field covering the entire, infinite, Cartesian plane. Instead, for our example, let's restrict the section of the plane we consider to:

-2 ≤ x ≤ 2, and -2 ≤ y ≤ 2

To see how we would create a slope field for this example with Mathematica, go to the next page... If you're lost, impatient, want an overview of this laboratory assignment, or maybe even all three, you can click on the compass button on the left to go to the table of contents for this laboratory assignment.

ODE Laboratories: A Sabbatical Project by Christopher A. Barker

©2017 San Joaquin Delta College, 5151 Pacific Ave., Stockton, CA 95207, USA
e-mail:
cbarker@deltacollege.edu