Ordinary Differential Equations/Graphing 1

First Order Differential Equations

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.

Slope FieldsEdit

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 bookbinding knocked

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.

\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

\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.

Example 1: y'=1Edit

Fig. 1: Slope field of y'=1
Fig. 2: Some solutions of y'=1

Consider the DE

\frac{dy}{dx}=1.

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, \,

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\,

and

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

\frac{dy}{dx}=k,

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


Example 2: y'=xEdit

Fig. 3: Slope field of y'=x
Fig. 4: Slope field and some solutions of y'=x

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

\frac{dy}{dx}=x

is

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.


Example 3: y'=sin xEdit

This is the last example of a DE where the derivative is equal to a function of x only. The DE is

\frac{dy}{dx}=\sin x

The slope field is shown in Fig. 5 below.

Fig.5: Slope field of y'=sin x

The solution to the DE is

y=-\cos x + C \,

and a set of solutions overlaid on the slope field looks like this:

Fig.6: Slope field of y'=sin x overlaid with some solutions

Example 4: y'=yEdit

Fig. 7: Slope field of y'=y
Fig. 8: Slope field and some solutions of y'=y

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 Δyx.

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:

\frac{dy}{dx}=y
\int \frac{1}{y}dy=\int 1 dx
\ln y=x +C \,
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.


Example 5: y' = sin yEdit

Fig. 9: Slope field of y'=sin y
Fig. 10: Slope field and some solutions of y'=sin y

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.

The general solution to

\frac{dy}{dx}=\sin y

is

y=\pm 2 \arccot e^{-x-C}. \,

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.


Example 6: y'=xyEdit

Fig. 11: Slope field of y'=xy
Fig. 12: Slope field and some solutions of y'=xy

This is the last example of an slope field that I will do, and it involves a derivative related to both x and y:

\frac{dy}{dx}=xy.

The slope field looks like Fig. 11, and the x components of the lines are still all 1, despite, the presence of both x and y in the DE. This will never change.

The slope field along with its solutions is shown in Fig. 12.


The next method of graphing First-Order DEs is using isoclines, which have a significant relationship with slope fields.

Next: Isoclines
Last modified on 12 February 2014, at 22:19