Ordinary Differential Equations/Graphing 1

First-order differential equations basically relate an x value, a y value and a gradient, y' at the point (x,y). As there are 3 variables, it is impossible to represent the solution to a DE in a 2D form. However, we can draw diagrams in 2 dimensions to represent the solutions by eliminating one of the variables.

There are two main ways of doing this, slope fields, described below, and isoclines, which are related to slope fields.

Contents

A slope field is a set of sections of tangents to solutions of the DE arranged over the xy plane. It attempts to show the solutions of a DE not by showing one or more solutions, but by showing a representation of all solutions across the xy plane.

The gradient of a (straight) line is defined as the change in y divided by the change in x. By setting the change in x to 1, we have the change in y equal to the gradient, which is y', the subject of the DE. Some rearrangement may be required to get the DE in to the required form, i.e.

dydx=f(x,y).{\displaystyle {\frac {dy}{dx}}=f(x,y).}

Now, if we draw a line at a point P(xy), with the x component equal to 1, and the y component equal to y' at that point, we have part of the tangent to the solution passing through that point. The solutions to the DE will follow these lines' slopes.

By drawing these lines at intervals across the xy plane, we can get a good idea of what the solutions to the DE look like. Notice that at no point did we have to actually solve the DE, we just plug in the values of x and y, at the points and we have slope field. This is especially useful when the DE is not solvable, for example

dydx=xx.{\displaystyle {\frac {dy}{dx}}=x^{x}.}

Despite being theoretically easy to evaluate, slope fields are difficult to do without a computer, as even a small slope field has hundreds of lines, and the plotting of these is not practical by hand (even if possible). Often, the tangent sections are scaled for clarity so that they do not interfere with each other.

This is probably the simplest DE there is (other than y'=0). It simply states that the gradient of the solution is always 1. This clearly leads to the general solution

y=x+C,{\displaystyle y=x+C,\,}

where C is our constant of integration.

The slope field of this DE (right) is composed of lines with an x component of 1 and a y component of y', i.e. 1, spaced across the xy plane. The solutions to this DE, such as

y=x{\displaystyle y=x\,}

and

y=x+1{\displaystyle y=x+1\,}

clearly follow the slope field. Some solutions are shown in Fig 2, and the similarities can readily be seen.

Notice that the solutions do not necessarily touch any of the lines in the slope field. These lines are only a subset of the infinite number of possible tangents that could be drawn to the infinite number of solutions.

If the DE was

dydx=k,{\displaystyle {\frac {dy}{dx}}=k,}

then the gradient of the slope field would be k, as would the gradient of the solutions.

This slope field will be more complex, as the gradient of the tangent sections will vary, depending on where the section is along the x-axis. The x component of the lines is still 1, but the y component is now x, making the gradient more positive the higher x gets, and more negative the lower x gets.

The solution to the DE

dydx=x{\displaystyle {\frac {dy}{dx}}=x}

is

y=12x2+c{\displaystyle y={\frac {1}{2}}x^{2}+c}

A set of these solutions is drawn along with the slope field in Fig. 4 to show how the two relate.

Now we come to the trickier problem of DE where the derivative is related to the dependent function, y. The easiest one is when y(x) is constant, but this has already been covered, as it is the same as x being constant (see Example 1).

In the slope field, the x component of the lines remains 1, but the y component is equal to y. A common mistake is to assume that because the gradient is a function of y, the y component is set to 1. However, this will mean that the lines no longer represent the gradient as defined by Δy/Δx.

The inclination of the lines will increase as y becomes greater, but will not change if x changes. The slope field looks like Fig. 7.

The solution is as follows:

dydx=y{\displaystyle {\frac {dy}{dx}}=y}

∫1ydy=∫1dx{\displaystyle \int {\frac {1}{y}}dy=\int 1dx}

ln⁡y=x+C{\displaystyle \ln y=x+C\,}

y=Cex{\displaystyle y=Ce^{x}\,}

This makes sense as the exponential function is the only function not to change when differentiated or integrated. Fig. 8 shows some solutions superimposed on the slope field.

This is a good example of where a slope field can be slightly misleading. The even spacing of the field (an artificial property, as the points with lines are chosen on an evenly spaced grid) does not convey the fact that as C increases linearly (as they do in Fig. 8), the solutions get further and further apart.

This is a difficult integration to do (I used a computer), but the slope field is still easy to draw: the y component of each line depends on the sine of the y value. This repeats every 2π units up the y axis, but between π and -π, the slope field looks like Fig. 9.

Now, even though I didn't actually do the DE myself, and I have no idea if it is correct or not, I can compare it to the slope field, as in Fig. 10. This high degree of agreement between the two strongly suggests that the solution to the DE is correct. This is a very useful way of checking a result if you have access to a computer or a good graphing calculator.