You are on page 1of 70

# Differential Equations.

Phil Ramsden.

1
1.1

Introduction
Differential equations

Consider the following simple reaction. There are three reactants, X, Y and Z. At time t = 0, there are 400 units of X and no Y or Z at all. X is unstable, and X-molecules become Y -molecules at a rate equal to 2 per cent of their number every second. Y is also unstable, and Y -molecules become Z-molecules at a rate equal to 1 per cent of their number every second. Systems like this, in which the rates of change of some set of quantities depend on their various values, abound in nature. Think, for example, of Newtons Law of Cooling, which states that the rate at which a bodys temperature falls is equal to a constant multiplied by the difference between that temperature and the surroundings. Or think of a rock falling vertically to Earth from a great distance: neglecting air resistance, the acceleration of the rock depends on its distance from the Earths centre. What they all have in common is that they can be expressed in equations containing derivatives. The rate at which a quantity x increases is dx/dt, and if this is negative, the quantity falls. So Newtons Law of Cooling can be written d = k( s ), (1) dt where t is time, is temperature and s is the temperature of the surroundings; and Newtons Universal Law of Gravitation in one dimension can be written d2 x k = 2, (2) 2 dt x where x is the distance between the rock and the centre of the Earth. Our reaction example is a bit trickier, because there are two quantities involved, but if x is the amount of X and y is the amount of Y then we can say

## dx = 0.02x, dt dy = 0.02x 0.01y. dt

(3) (4)

Equations that link the derivatives of quantities with their values are called differential equations. The study of differential equations is probably the single largest and most important area of applied calculus. Differential equations are excellent ways of describing how systems work. However, what we often want to do is to predict how systems will behave. In other words, a statement linking the rate of change of a quantity to that quantitys value is not much use as it stands; we usually want an explicit relationship between that quantity and time, such as (t) = s + (0 s )ekt . (5)

Getting from a differential equation to an explicit relationship is called solving the differential equation, and the explicit relationship is called the solution.

1.2

Techniques

There are three classes of technique we can bring to bear to the solution of differential equations. 1. One is symbolic: we use calculus techniques to obtain an explicit equation or set of equations. It can be shown using calculus, for example, that the values of x and y in our reaction are given by x(t) = 400e0.02t , y(t) = 800(e0.01t e0.02t ). (6) (7)

(Youll learn how to do this calculation later in the course.) Armed with this knowledge, we can plot the values of x and y, as in Figure 1. 2. The second is numerical. Often, symbolic techniques fail. When they do, number-crunching is often a viable alternative. You briefly met this idea on the Matlab course, in the form of the ode45 and bvp4c commands. Numerical techniques lie outside the scope of this part of the course, though you will learn about them later in your mathematical careers. 2

## xt 400 yt 300 200 100 t 50 100 150 200 250 300

Figure 1: Explicit plots of the solution of the system x = 0.02x, y = 0.02x 0.01y for x(0) = 400, y(0) = 0 3. The third class of technique, which is less well-known than it deserves to be, is known as qualitative. Here, we shift focus away from exact predictions, in favour of descriptions of our solutions in broader terms. We may be interested, for example, in the long-term behaviour of our solution. Is it bounded or does it zoom off to infinity? If its bounded, does it zero in on a limiting value, does it oscillate for ever, or does it buzz around chaotically? And so on. The point is, we can often get answers to this kind of question without needing either an explicit symbolic solution or any data from number-crunching. Like numerical methods, qualitative methods often come into their own when symbolic methods fail. However, their great strength is the structural insight they give us into differential equations and their solutions, meaning that we often want to use them even when symbolic methods work just fine.

1.3

Order
d = k( s ), dt

## Some terminology. A differential equation such as (8)

in which there is only one dependent variable and only its first derivative appears, is called a first order differential equation. One like k d2 x = 2, dt2 x (9)

in which the highest derivative present is the second, is called second order. And so on. (Note: a differential equation containing several derivatives has an order determined by the highest derivative present.) Systems of more than one differential equation are sometimes called coupled: an example is our reaction equations dx = 0.02x, dt dy = 0.02x 0.01y. dt (10) (11)

In fact, it turns out that theres a strong link between two coupled firstorder equations and one second-order one, meaning that you sometimes hear coupled systems of this type referred to as second-order systems. This generalises in the obvious way.

1.4

Families of curves

Consider reaction kinetics again. Suppose we want to predict the concentration of reactants over time. Clearly, we need to know not only how the reaction rate depends on the concentrations, but also what the concentrations are at the start of the experiment. This is true in general: if you only know how quantities change over time, and have no information about what values they have to start with, you wont be able to predict their values in the future. If all you have is a differential equation, or a coupled system, without this additional information, all youll be able to say is that the solutions belong to a certain family. On its own, a differential equation specifies a family of curves. Worked Example 1.1 Find a simple differential equation whose solutions are the family of curves x = k t2 , where k is a constant. (12)

We start by differentiating (12), to obtain dx = 2k t. dt But k = x/t2 , and therefore 2x dx x = 2t 2 = . dt t t (14) (13)

Worked Example 1.2 Find a simple differential equation whose solutions are the family of curves x = A t + B e2t , (15)

where A and B are constants. Here, there are two unknown constants. To eliminate those, we need three equations, meaning we must differentiate twice: dx = A + 2 Be2t , dt dx = 4 Be2t . 2 dt From (16) and (17) we obtain that 2 dx d2 x 2 = 2 A, dt dt (18) (16) (17)

and from (15) and (17) we get that 4x It follows that 4t which rearranges to give (1 2 t) d2 x dx + 4 t 4 x = 0. 2 dt dt (21) d2 x = 4 A t. dt2 (19)

dx d2 x d2 x 2t 2 = 4x 2 , dt dt dt

(20)

The curve family y = k x2 from Example 1.1 is illustrated in Figure 2. We can see the relationship between this family and the corresponding differential equation via a qualitative construct called a gradient field diagram. The way they work is this. Consider the differential equation 5

x 3 2 1 t 3 2 1 1 2 3 1 2 3

## Figure 2: Some members of the family of curves y = k x2 , k constant dx 2x = . dt t (22)

Now, any solution of this equation, x(t), will have gradient 2 x/t at the point (t, x). We illustrate this by choosing a set of points (t, x) and simply placing a tangent at each of them with gradient 2 x/t. Figure 3 shows a standard version of this diagram, with the solution family superimposed to show the relationship between them; Figure 4 shows one with irregularly placed tangents (less usual, but I prefer it). Well defer discussion of second-order equations and their solution families till later in the course.

1.5

Plan

Weve seen two examples of how to go from a family of solution curves to the corresponding differential equation. We usually want to go the other way, though: to start with the differential equation and find the family of solution curves, or some particular member of that family. Thats in general much more difficult, and forms the bulk of this course. In the next section, we bring symbolic methods to bear on various types of first-order differential equations. In the next, we look at second-order differential equations, again symbolically. In the final section, we consider various qualitative approaches to both first-order and second-order equations.

x 3 2 1 t 3 2 1 1 2 3 1 2 3

Figure 3: Solution family and regular gradient field for the differential equation x = 2 x/t.

x 3 2 1 t 3 2 1 1 2 3 1 2 3

Figure 4: Solution family and irregular gradient field for the differential equation x = 2 x/t.

In this introductory section weve tended to assume that the independent variable is time, t, and called the dependent variable x. In chapters 2 and 3, we wont usually make this assumption: the independent variable will be called x and the dependent variable y.

2
2.1

## First-Order Differential Equations

Recap and introduction
Recall that a differential equation is an equation linking the derivative of a quantity with that quantitys value. Example: d y/d x = 2y/x. Recall too that a differential equation is first order if it contains only a first derivative. The above example is first order. Each differential equation specifies a family of solutions; together, these are said to constitute the general solution of the differential equation. In our example, the general solution is y = k x2 , k constant. When, with the aid of additional information, we are able to pick out one particular member of the family that fits our problem, this is known as a particular solution. In our example, the solution for which y(1) = 2 is y = 2 x2 . Finding the general solution, or a particular solution, is known as solving the differential equation.

Note that the general solution of a first order differential equation contains one unknown constant. It follows that to determine that constants value, we in general need just one additional piece of information, such as y(1) = 2. Differential equations of the type we study here, in which there is only one independent variable, are called ordinary differential equations or ODEs. When there are two or more independent variables, we have what are called partial differential equations or PDEs; you study these later in your mathematical careers. Solving differential equations is, as a general problem, very hard. What well do in this section is consider, in turn, various types for which symbolic techniques exist.

2.2

dy = g(x)h(y) dx

## A differential equation has separable variables if it is of the form (23)

or can be expressed in that form. So our example above, which can be written as dy 2 = y, dx x has separable variables. To solve such a differential equation, write it in the form 1 dy = g(x) h(y) dx and then integrate both sides with respect to x to get 1 dy dx = h(y) dx or simply 1 dy = h(y) g(x) dx (26) (25) (24)

g(x) dx.

(27)

Worked Example 2.1 Find the general solution of the differential equation dy 2y = . (28) dx x We have 1 2 dy = dx, (29) y x which gives us ln |y| = 2 ln |x| + c. (30) Raising e to the power of both sides gives |y| = |x|2 ec , or Setting k = ec gives y = ec x2 . y = k x2 , (32) (33) (31)

2.2.1

Further examples

2. x

2.3

dy =F dx y x

## A differential equation is homogeneous in x and y if its in the form (34)

or can be expressed in that form. First order differential equations that are homogeneous in their variables can be converted into separable-variables form using the substitution y(x) = x u(x). Often, a homogeneous equation will appear in the form dy p(x, y) = , dx q(x, y) (36) (35)

where p and q are both polynomials and all the terms of both p and q are of the same degree. Worked Example 2.2 Find the general solution of the equation dy y 2 + xy = . dx x2 Note first that dy y y 2 /x2 + xy/x2 = = x2 /x2 dx x We set y = u x. Differentiating, dy du =u+x dx dx 10 (39)
2

(37)

y . x

(38)

## and we therefore have that u+x Simplifying, x giving and thus du y = dx x

2

y = u2 + u. x

(40)

du = u2 , dx 1 dx x

1 du = u2

## 1 = c ln |x|. u In terms of our original variables, this becomes x = c ln |x|, y

(44)

x . (45) c ln |x| This family of solutions is illustrated in Figure 5, against the background of the gradient field for the differential equation. y= 2.3.1 Further examples dy x2 + y 2 = ; dx y dy + x y = y2. dx

and hence

## Find the general solution of the following ODEs: 1. x

2. x2

2.4

A special case
dy 2x + y 3 = . dx x 2y 4 x = X + 2, y = Y 1, 11

## It isnt homogeneous in x and y. However, if we perform the substitution (47) (48)

y 3 2 1 x 3 2 1 1 2 3 1 2 3

Figure 5: General solution and irregular gradient field for the differential equation dy/dx = (y 2 + xy)/x2 . we obtain 2X + 4 + Y 1 3 X + 2 2Y + 2 4 2X + Y , (49) = X 2Y which is homogeneous in X and Y . Where did this substitution come from? The answer is that if we solve, simultaneously, the equations dY dX = 2x + y 3 = 0, x 2y 4 = 0, (50) (51)

we obtain x = 2 and y = 1; it is these values, 2 and 1 that then get used in the substitution. In general, for a differential equation of the form dy ax + by + c = , dx lx + my + n this is the technique: 1. Solve simultaneously the equations ax + by + c = 0, lx + my + n = 0, 12 (53) (54) (52)

obtaining the solutions x = x0 and y = y0. 2. Perform the substitution x = X + x0, y = Y + y0, (55) (56)

obtaining a differential equation that is homogeneous in X and Y . 3. Solve this differential equation using the technique of the above section. Heres the calculation in full for our example Worked Example 2.3 Find the general solution of the ODE dy 2x + y 3 = . dx x 2y 4 We start by solving simultaneously the equations 2x + y 3 = 0, x 2y 4 = 0, obtaining x = 2 and y = 1. We then perform the substitution x = X + 2, y = Y 1, obtaining 2X + Y 2 + Y /X dY = = . dX X 2Y 1 2Y /X U +X Rearranging, X dU dX = 2+U U 1 2U 2+U U 2U 2 = 1 2U 1 2U 2U 2 + 2 . = 1 2U 13 dU 2+U = . dX 1 2U (62) (60) (61) (58) (59) (57)

(64)

## Separating the variables, we obtain 1 2U dU = 2U 2 + 2 1 dX. X (65)

This is actually easier to deal with if we double both sides, because then we get 1 2U 2 dX. (66) dU = 2+1 U X The left hand side is simply 2ln|X| + c. The right hand side is tan1 U ln(U 2 + 1). The general solution is therefore tan1 U ln(U 2 + 1) = 2 ln |X| + c, or or or tan1 (Y /X) ln((X 2 + Y 2 )/X 2 ) = ln(X 2 ) + c, tan1 (Y /X) ln(X 2 + Y 2 ) = c, tan1 (68) (69) (67)

y+1 ln((x 2)2 + (y + 1)2 ) = c. (70) x2 This general solution, superimposed on the gradient field for the differential equation, is shown in Figure 6. 2.4.1 Further example

2.5

dy = 0. dx

## Consider the differential equation 4 x y + 1 + (2 x2 + cos y) (72)

On the face of it, this looks very difficult, and it would be, except that by an enormous stroke of luck, this equation happens to be in a form that makes it exceptionally easy to solve. To see this, consider the expression 2 x2 y + x + sin y. 14

1 1

Figure 6: General solution and irregular gradient field for the differential equation dy/dx = (2x + y 2)/(x 2y 4). Lets differentiate this implicitly: d dy dy (2 x2 y + x + sin y) = 4 x y + 2 x2 + 1 + cos y dx dx dx dy = 4 x y + 1 + (2 x2 + cos y) . dx

(73)

In other words, the left-hand side of (72) happens to be the derivative of something. This allows us to rewrite (72) as d (2 x2 y + x + sin y) = 0, dx which gives us the general solution 2 x2 y + x + sin y = k, shown in Figure 7. Differential equations that can be written in the form d (f (x, y)) = g(x) dx (76) (75) (74)

are known as exact. Actually, g(x) can always be written as zero, and often, though not always, it will be convenient to do that. 15

y 3 2 1 x 3 2 1 1 2 3 1 2 3

Figure 7: General solution and irregular gradient field for the differential equation 4 x y + 1 + (2 x2 + cos y) dy/dx = 0. Which is all very well, but how did we know (a) that (72) was exact, and (b) the f (x, y) of which the left-hand side was a derivative? To check whether a differential equation is exact is quite easy if you know a little partial differentiation. The expression d (f (x, y)) dx may be rewritten as f dy f + . x y dx p(x, y) + q(x, y)

## Thus, if the expression

dy dx is the derivative of f (x, y), and only if this is so, then p(x, y) = f , x f q(x, y) = . y 2f p = , y xy 16 (77) (78)

## q 2f = . x xy So the differential equation p(x, y) + q(x, y) is exact if and only if dy = g(x) dx

(80)

q p = . y x

(81)

But although its nice to have an easy way of checking whether a differential equation is exact, this doesnt on its own help us solve it. For that we need to find f (x, y): the expression that the left-hand side is a derivative of. We can do this by integration. Knowing as we do that p(x, y) = f , x f . q(x, y) = y

its easy to see that f (x, y) = f (x, y) = p(x, y) dx, q(x, y) dy. (82) (83)

In our example, p(x, y) = 4 x y + 1 and q(x, y) = 2 x2 + cos y. From (82) we get f (x, y) = (4 x y + 1) dx (84)

= 2 x2 y + x + k1 (y).

Note that because two variables are involved, we get not a constant of integration but an arbitrary pure function of y. (To see this, imagine partialdifferentiating with respect to x again; its not only constants that go to zero.) In the same way, from (82) we get f (x, y) = (2 x2 + cos y) dy (85)

= 2 x2 y + sin y + k2 (x). 17

These results can be reconciled by setting k1 (y) = sin y and k2 (x) = x, giving f (x, y) = 2 x2 y + x + sin y, and the solution 2 x2 y + x + sin y = k as above. Note that differential equations of the form p(x, y) + q(x, y) dy =0 dx

are often expressed in terms not of the derivative dy/dx but of the differentials dx and dy: p(x, y) dx + q(x, y) dy = 0. Well leave unexplored what precisely the above expression represents. 2.5.1 Further examples

Check whether the following ODEs are exact, and find the general solutions of the ones that are: 1. (2x + y) + (x + 2y) 2. (x + 2y) + (2x + y) dy = 0; dx dy = 0; dx

2.6

## First order, linear

dy dn y dn1 y + pn1 (x) n1 + p1 (x) + p0 (x)y = q(x). n dx dx dx

## A differential equation is linear if it can be expressed in the form pn (x) (86)

The key thing is that neither y nor its derivatives have had anything done do them other than multiplication by a function of x. First order linear differential equations are all of the form p1 (x) dy + p0 (x)y = q(x). dx 18 (87)

1 1

Figure 8: General solution and irregular gradient field for the differential equation dy/dx cos x y sin x = 1. dy y sin(x) = 1. (88) dx It just so happens that this equation is exact: its left hand side is expressible as a derivative. In fact, this equation can be written cos x d (y cos(x)) = 1, dx which can be easily solved to give y cos x = x + c, which rearranges to give y = (x + c) sec x. (91) This general solution, and the gradient field for the ODE, are shown in Figure 8. The trouble is, this differential equation could have been presented as dy y tan x = sec x, dx or cot x dy y = cosec x, dx 19 (92) (90) (89) An example is

(93)

or in any number of forms, in none of which is the left hand side a derivative. So our problem is, given a first order linear differential equation in any old form, how do make it exact? The following technique is guaranteed to work. 1. First, express the ODE in the form dy + P (x) y = Q(x). dx (94)

2. Now, integrate P (x) with respect to x (or, more accurately, find any function whose derivative is P (x); you dont have to bother with constants of integration, for example). 3. Take the result of this integration, and raise e to its power. This gives us what we call the integrating factor, I(x). 4. Multiply throughout by I(x), to obtain I(x) dy + P (x) I(x) y = I(x) Q(x). dx (95)

5. This is always equivalent to d (I(x) y) = I(x) Q(x). dx 6. The general solution is then given by I(x) y = So if wed been given I(x) Q(x) dx. (97) (96)

dy y = cosec x, dx wed first have divided throughout by cot x to obtain cot x dy y tan x = sec x. dx

(98)

(99)

We then integrate tan x with respect to x. Recall that the integral of tan x is ln | sec x| + c, and therefore the integral of tan x is ln | sec x| + c = ln | sec x|1 + c = ln | cos x| + c. 20

We only need one function whose derivative is tan x, so let;s choose ln(cos x). If we raise e to the power of ln(cos x), we obtain cos x. Multiplying throughout by cos x gives us cos x dy y sin(x) = 1, dx (100)

which, as weve seen, can be rewritten d (y cos x) = 1, dx whose general solution is y cos x = x + c as above. 2.6.1 Further examples (102) (101)

## Find the general solution of the ODEs 1. dy y = x2 ; dx x dy 3 y = (x + 1)5 . dx

2. (x + 1)

2.7

Summary
dy = g(x) h(y) dx dy = h(y)

## Separable variables: g(x) dx. (103)

Homogeneous in x and y: dy =F dx put y(x) = x u(x) and then du = F (u) u 21 dx . x (105) y ; x (104)

Exact where

p(x, y) + q(x, y)

dy = 0, dx

(106) (107)

p q = ; y x d [f (x, y)] = 0, dx

rewrite as where

(108)

## p(x, y) dx q(x, y) dy. (109)

dy + P (x) y = Q(x); dx
P (x) dx

(110)

3
3.1

## Second-Order Differential Equations

Linear ODEs

In this section, well be looking only at second-order linear ODEs: that is, at differential equations of the form a(x) dy d2 y + c(x) y = f (x). + b(x) 2 dx dx (112)

Even this limited class is hard to solve in its full generality, so well be focusing on three special cases: the case where c(x) = 0, the case where a, b and c are all constants and the case where f (x) = 0.

22

3.2

## The case c(x) = 0

dy d2 y = f (x) + b(x) dx2 dx

## Equations of the form a(x) (113)

are relatively easy to handle: we can simply set z= and then solve a(x) using an integrating factor. 3.2.1 Example x satisfying 1. y = 1 and dy/dx = 0 at x = 0; 2. y = 1 and dy/dx = 0 at x = 1. d2 y dy =x + dx2 dx (115) dy dx (114)

dz + b(x) z = f (x) dx

## Find the solution of

3.3

Constant coefficients
dy d2 y + c y = f (x), +b 2 dx dx

## In this subsection, we look at equations of the form a (116)

where a, b and c are constants. We start with the case where f (x) = 0, which is said to be homogeneous in y (note the slight clash of terminology with the last section). Well need the following key fact about linear homogeneous ODEs. Theorem 3.1 If f (x) and g(x) are both solutions of a linear homogeneous ODE, then so is A f (x) + B g(x), where A and B are constants. 23

Well also need to use the fact that the general solution of a second-order ODE always has two unknown constants. Lets focus on the following example: d2 y dy 4 + 3 y = 0. 2 dx dx (117)

We reason as follows. In (117), by adding a multiple of y to multiples of its first and second derivatives, we get zero. So a good guess is that y is an exponential function: the only class of function that, when differentiated, gives a multiple of itself. We therefore look for a solution of the form y = ex , (118)

where is a constant. If we make this assumption, we obtain, by differentiating (118) twice, dy = ex , dx d2 y = 2 ex . dx2 Substituting into our original ODE (117) gives (2 4 + 3) ex = 0. Cancelling, we obtain 2 4 + 3 = 0, (122) whose solutions are = 1 and = 3. So it looks as if ex and e3x are both solutions of the ODE (117). But by Theorem 3.1, we therefore know that y = A ex + B e3x (123) (121) (119) (120)

is also a solution, where A and B are any constants. Since (123) is a solution containing two unknown constants, it must be the general solution of the ODE (117). 3.3.1 Terminology

The quadratic equation (122) is known as the auxiliary equation of the ODE (117). Its OK, in general, to proceed straight from the ODE to the auxiliary equation, omitting the reasoning above. 24

3.3.2

Further examples

3.4

## First complication: what if the roots are non-real?

d2 y dy + 5 y = 0. 4 2 dx dx 2 4 + 5 = 0, 42 2 1 5 = 2 i. 21 (126) (124) (125)

## Yet the general solution

y = A e(2+i) x + B e(2i) x looks decidedly odd. What can we do? Note first that (126) can be expressed as y = A e2 x ei x + B e2 x ei x = e2 x (A ei x + B ei x ). Recall, too, that and thus eix cos x + i sin x, y = e2 x (A [cos x + i sin x] + B [cos x i sin x]) = e2 x ([A + B] cos x + i [A B] sin x).

(127)

(128)

As long as A and B are conjugate, both [A+B] and [AB] are real constants; call them P and Q respectively. We therefore have that y = e2 x (P cos x + Q sin x). (129)

In general, if the roots of the auxiliary equation are = i, then the general solution is y = e x [P cos( x) + Q sin( x)]. (130)

This result is quotable: you can go straight from the auxiliary equation to the solution. 25

3.4.1

Further examples

3.5

(131)

## Consider the ODE

(132)

the left-hand-side of which is a perfect square, and whose root, = 2, is therefore repeated. The reason this is a problem is that what looks like the right general solution, y = A e2x + B e2x , can be rewritten as y = (A + B) e2x = C e2x . As you can see, this isnt general enough: theres really only one unknown constant here. What comes to our rescue is the fact that y = x e2x is also a solution of the equation (131), as we can easily verify: y = (2x+1) e2x and y = (4x+4) e2x , meaning that y 4y + 4y = e2x (4x + 4 8x 4 + 4x) = 0. Now, since e2x and x e2x are both solutions, so (by Theorem 3.1) is y = A e2x + B x e2x = e2x (A + B x), (133)

and its this thats our general solution. In general, if the auxiliary equation has repeated root = , then the general solution is y = ex (A + B x). 3.5.1 Further examples (134)

## Find the general solution of 1. y + 2y + y = 0; 2. 9y 12y + 4y = 0. 26

3.6

Inhomogeneous equations
dy d2 y + c y = 0. +b 2 dx dx

## So far, we have considered only equations of the form a (135)

We now move to the more general case where the right-hand-side is a function of x; equations like this are called inhomogeneous. It might be thought that this makes things much more complicated, but actually, it doesnt. Our strategy for finding the general solution of the equation a is as follows: 1. Find the general solution of (135). 2. Find any old solution of (136). 3. Add them together. The general solution of (135) is known as the complementary function. It contains two unknown constants. Because its a solution of (135), if we substitute it into d2 y dy a 2 +b + c y, dx dx we get 0. The any old solution that we find for (136) is called the particular integral. It doesnt contain any unknown constants, so it wont do on its own as a general solution. However, if we substitute it into a dy d2 y + c y, +b 2 dx dx dy d2 y + c y = f (x) +b 2 dx dx (136)

we get f (x). Its not hard to show that if we substitute the sum of the C.F. and the P.I. into d2 y dy a 2 +b + c y, dx dx we get f (x). Moreover, this sum contains two unknown constants. It is, therefore, the general solution of (136). For example, consider the ODE y 4y + 3y = e2x . 27 (137)

The complementary function is the solution of y 4y + 3y = 0, which can be quickly shown to be y = Aex + Be3x . It can also be shown that y = e2x satisfies (137). So the general solution of (137) is y = Aex + Be3x e2x . (141) (140) (139) (138)

The only thing left mysterious in the above example is where the particular integral came from. Its easy to verify that y = e2x satisfies (137), but how did we know to do that? The answer is that we look for a particular integral in same form as the right hand side of the ode. Specifically: 1. If the right-hand-side is a polynomial of degree n, set y = Mn xn + + M1 x + M0 , and find the values of Mn , , a0 for which y satisfies the ode. 2. If the right-hand-side is of the form a ex , set y = M ex , and find the value of M for which y satisfies the ode. 3. If the right-hand-side is a trigonometrical function of the form a cos qx + b sin qx, set y = M cos qx + N sin qx, and find the values of M and N for which y satisfies the ode. Important note: this applies even if one or other of a or b is zero. 28

This is called the method of undetermined coefficients. The method works similarly for sums and products of functions of the above types. For example, if the right hand side is the product of ex and a polynomial of degree n, look for a particular integral of the form y = (Mn xn + + M1 x + M0 ) ex , etc. Worked Example 3.1 Find the general solution of the ode y 4y + 3y = 10 cos x. (142)

We begin by finding the complementary function: that is, the general solution of y 4y + 3y = 0. (143) The auxiliary equation is 2 4 + 3 = 0, (144) (145)

whose roots are = 1 and = 3. The complementary function is therefore y = A ex + B e3x . Next, we find a particular integral, by trying a function of the form y = M cos x + N sin x. If we substitute this into y 4y + 3y, we obtain (M cos x N sin x) 4 (M sin x + N cos x) + 3(M cos x + N sin x), which simplifies to (2M 4N ) cos x + (4M + 2N ) sin x. Since this must be identical to 10 cos x, we have 2M 4N = 10, 4M + 2N = 0. (147) (148) (146)

The solution of this pair of simultaneous equations is M = 1, N = 2, meaning that the particular integral is y = cos x 2 sin x, and the general solution is therefore y = A ex + B e3x + cos x 2 sin x. 29 (150) (149)

3.6.1

Further examples

## Find the general solution of 1. y + y 2y = x2 + 2x + 1; 2. y + y 2y = x2 ex ; 3. y + y 2y = 3 cos x; 4. y + y 2y = x2 ex + 3 cos x.

3.7

Complication: what if the complementary function and the trial particular integral clash?
y 4y + 3y = 2 ex . y = A ex + B e3x . (151)

## Consider the ode The complementary function is

(152)

This raises a difficulty if we use the rules of the above section, because they seem to tell us that our trial particular integral ought to be y = b ex . The trouble is, thats a case of the complementary function (corresponding to A = b, B = 0). It follows (and is easily verified) that if we substitute it into y 4y + 3y, we get zero (whereas what we want is 2 ex ). To get round this problem, we need to add a couple of extra rules to our method. The first is that if the same form as the right hand side rule gives us a trial particular integral p(x) that clashes with the complementary function, we should use x p(x) instead. The second is that if x p(x) also clashes with the complementary function, which can sometimes happen, we should use x2 p(x). Worked Example 3.2 Find the general solution of the ode y 4y + 3y = 2 ex . As above, the complementary function is y = A ex + B e3x . 30 (154) (153)

We would ordinarily use a trial particular integral of the form y = M ex , but this clashes with the C.F., so we try y = M x ex instead. Substituting into y 4y + 3y gives (M ex + 2bx ex ) 4 (M ex + bx ex ) + 3 (M x ex ), which simplifies to 2M ex . Since this must be identical to 2 ex , we have M = 1, and the particular integral is y = xex . The general solution is therefore y = (A x) ex + B e3x . Worked Example 3.3 Find the general solution of the ode y 4y + 4y = 2 e2x . The auxiliary equation is 2 4 + 4 = 0, which has the repeated root = 2. The complementary function is therefore y = e2x (A + B x). (157) (156) (155)

We would ordinarily use a trial particular integral of the form y = M e2x , but this clashes with the C.F., so we might try y = M x e2x instead. However, this also clashes with the C.F. so we try y = M x2 e2x . Substituting into y 4y + 4y gives (2M e2x + 8M x e2x + 4M x2 e2x ) 4 (2M x e2x + 2M x2 e2x ) + 4 (M x2 e2x ), which simplifies to 2M e2x . Since this must be identical to 2 e2x , we have M = 1, and the particular integral is y = x2 e2x . The general solution is therefore y = (A + Bx + x2 ) e2x . (158)

31

ax

bx

Ft

3.8

## Application: Linear Oscillators

Consider a particle of mass m moving in a straight line under three forces: a restoring force, directed towards a mean position on the line and proportional to the particles distance from that position; a damping force, directed against the particles motion and proportional to its speed; a time dependent external driving force, F (t). There are many examples of such systems; the most straightforward is probably a particle oscillating on the end of an elastic spring, as shown in figure 9. Its easy to show that the particles equation of motion is m d2 x dx = a x c + F (t). 2 dt dt (159)

Rearranging, and setting 0 = a/m, p = c/(2m) and f (t) = F (t)/m, we obtain dx d2 x + 0 2 x = f (t). + 2p (160) 2 dt dt In the absence of driving (also called forcing), the equation becomes d2 x dx + 2p + 0 2 x = 0. 2 dt dt (161)

The behaviour of the oscillator then depends on the relative values of p and 0 . 1. Undamped oscillation

32

x A0

t
0

A0

Figure 10: Motion of the undamped, undriven linear oscillator If p = 0, the equation is d2 x + 0 2 x = 0, dt2 and the general solution is x = A cos 0 t + B sin 0 t = A0 cos (0 t ). (163) (162)

This type of motion, which is sometimes called simple harmonic motion, is shown in Figure 10. The quantity A0 is known as the amplitude, and 0 , the number of radians per second, is called the angular frequency. The angular frequency of the motion of an oscillator when it is undamped and undriven is called the oscillators natural angular frequency. 2. Underdamped oscillation The auxiliary equation for the ODE (161) is 2 + 2 p + 0 2 = 0. The roots of (164) are given by = 2p 4p2 40 2 , 2 p 2 0 2 . (164)

= p 33

(165)

x A0

A0

Figure 11: Motion of the underdamped, undriven linear oscillator If p < 0 , then these roots are non-real and equal to p i and the general solution is 0 2 p2 , (166)

## x = ept (A cos 1 t + B sin 1 t) = A0 ept cos (1 t ),

where 1 2 = 0 2 p2 . This motion is illustrated in Figure 11. The oscillator is said to be underdamped or weakly damped. 3. Critically damped oscillations If p = 0 , the auxiliary equation (164) has the repeated root = p, and the general solution is x = ept (A + B t). (167)

An example of this critically damped motion is shown in Figure 12. 4. Overdamped oscillations If p > 0 , then the roots of the auxiliary equation (164) are 1 = p + 2 = p and the general solution is x = A e1 t + +B e2 t . 34 (168) p2 0 2 , p2 0 2 ,

## Figure 13: Motion of the overdamped, undriven linear oscillator

35

under

critical

over

Figure 14: Comparison of underdamping, overdamping and critical damping Note that both roots are negative, and therefore both components of the general solution decay as t . An example of this overdamped or strongly damped motion is shown in Figure 13. Figure 14 illustrates that both underdamped and overdamped motion decays relatively slowly. If an oscillator is to return as quickly as possible to its mean position, it should be critically damped. 3.8.1 Examples

1. (a) A 1 kg mass on a spring is subject to a restoring force whose value in newtons is 100 times the displacement of the mass in metres. Calculate the natural frequency of this oscillator. (b) The mass is also subject to a damping force that may be adjusted, but that is always equal to a constant, k, times the speed of the mass, in the opposite direction to its motion. Show that the equation of motion is x + k x + 100 x = 0, 36

and find the value of k associated with critical damping. (c) Consider the cases k = 25, k = 20 and k = 16. For each, find the motion of a particle released from rest with a positive displacement of 1 metre. Sketch all three solutions on the same pair of axes.

3.9

Driven oscillators

If an oscillator is subjected to an external driving force, its equation of motion becomes dx d2 x + 0 2 x = f (t). + 2p (169) 2 dt dt The solution then consists of a complementary function, corresponding to the solutions of the undriven equation above, together with a particular integral introduced by the driving. If any damping at all is present, the complementary function is transient: that is, it decays as t . Whether damping is present or not, the particular integral is persistent: that is, it continues for as long as the system is driven. Since in practice there is always some damping, it is generally the particular integral that characterises the behaviour of the system in the long term. However, well consider both the damped and the undamped case for completeness sake. Were interested, here, in sinusoidal driving, for which f (t) = k sin t. 1. Undamped, driven oscillator The equation of motion of an undamped, sinusoidally driven oscillator with natural frequency 0 is d2 x + 0 2 x = k sin t. dt2 The complementary function is x = A cos 0 t + B sin 0 t. (171) (170)

The particular integral comes in two forms, depending on whether = 0 or = 0 . In the latter case, its of the form x = c cos t + d sin t. Substituting into (170) gives c ( 2 + 0 2 ) cos t + d ( 2 + 0 2 ) sin t k sin t. 37 (173) (172)

2

k , 0 2
2

## Note that the amplitude of this component of the motion, k , 0 2

2

k sin t. 0 2

(174)

If happens to be exactly equal to 0 , the particular integral has the form (175) x = t (c cos 0 t + d sin 0 t). Substituting into (170) gives, after simplification, 20 (d cos 0 t c sin 0 t) k sin 0 t, from which we get that d = 0 and c= giving the particular integral x= This is unbounded as t . k cos t. 20 (177) k , 20 (176)

## depends on the driving frequency , and tends to infinity as 0 .

The case = 0 , in which the motions amplitude increases without bound as t , is called resonance. In the absence of damping, then, resonance occurs when the driving frequency is equal to the natural frequency. Figures 15, 16 and 17 show the motion of an undamped oscillator for driving frequency respectively far from, close to and equal to the resonant frequency 0 2. Damped, driven oscillator If there is damping, the equation of motion is dx d2 x + 0 2 x = k sin t. + +2p 2 dt dt 38 (178)

## Figure 16: Motion of an undamped linear oscillator close to resonance

39

Figure 17: Motion of an undamped linear oscillator at resonance The form of complementary function depends on whether the oscillator is underdamped, overdamped or critically damped. In all cases, however, the C.F. is transient, and it is the particular integral that eventually dominates. This particular integral takes the form x = c cos t + d sin t. (179)

We omit the details, which are not difficult conceptually but which are long-winded. It turns out that the particular integral may be written x= where tan = The amplitude of this motion, k 4 2 p2 + (0 2 2 )2 , k 4 2 p2 + (0 2 2 )2 cos (t + ), (180)

0 2 2 . 2p

depends on the driving frequency , and attains a maximum when the expression 4 2 p2 + (0 2 2 )2 40

Figure 18: Motion of a very weakly damped linear oscillator far from resonance attains a minimum, which occurs at 2 = 0 2 2p2 . This maximum amplitude motion is what we call resonance in the presence of damping. Note that resonance can only occur if p < 0 / 2: that is, only for significantly underdamped oscillators. Figures 18 and 19 show the motion of a very weakly damped driven oscillator respectively far from, and at, resonance. Figure 20 shows how the amplitude of the particular integral varies as we vary the (angular) driving frequency. The lower curves correspond to stronger damping. Some of the curves (those corresponding to very weak damping) have maxima, and thus exhibit resonance. The points where resonance occurs are shown on these curves, and the curve through these points is shown as a thick black line. Note that the curve for zero damping has a vertical asymptote at = 0 , the natural frequency; it is this asymptote that corresponds to resonance in the undamped case. 3.9.1 Example

## Figure 19: Motion of a very weakly damped linear oscillator at resonance

ampl.

increasing damping

driv. freq.
0

Figure 20: Amplitude of the particular integral in response to varying driving frequencies for varying strengths of the damping

42

(a) Find the particular integral in the motion of the mass. (b) Show that in just one of the cases k = 5 and k = 4, the system is capable of undergoing resonance, and find the resonant frequency in this case.

3.10

## The General Homogeneous Equation

a(x)

d2 y dy + b(x) + c(x) y = 0 (181) 2 dx dx cannot, usually, be solved in closed form. That is, theres usually no solution that can be written as a finite algebraic expression made up of the familiar calculator functions. Often, however, we can instead find a solution in the form of an infinite series. For example, consider the ode y + x y 4y = 0, satisfying y(0) = 0, y (0) = 1. Suppose that y = a0 + a1 x + a2 x2 + a3 x3 + a4 x4 + + an xn + . It follows that y y = a1 + 2 a2 x + 3 a3 x2 + 4 a4 x3 + + n an xn1 + , (184) 2 n2 = 2 a2 + 3 2 a3 x + 4 3 a4 x + + n (n 1) an x + (185) . (183) (182)

## Odes of the form

Substituting into (182) and considering each coefficient of xn separately, we obtain 2 a2 4a0 3 2 a3 + a1 4a1 4 3 a4 + 2 a2 4a2 (n + 2) (n + 1) an+2 + n an 4an In general, an+2 = 4n an . (n + 2) (n + 1) 43 = 0, = 0, = 0, = 0,

(186)

Whats more, we know that a0 = y(0) = 0 and a1 = y (0) = 1. It follows that a2 = 4 a0 = 0, 2 3 a3 = 32 a1 = 1 , 2 2 a4 = 43 a2 = 0, 1 1 a5 = 54 a3 = 40 , The solution may therefore be written y =x+ Note that the ratio x3 x5 + + . 2 40 (187)

an+2 xn+2 an xn x2

is equal to

4n , (n + 2) (n + 1) which tends to zero for all values of x as n . It follows by the ratio test that this series converges for all values of x. Alternative method. Its possible to get the same result by differentiating the differential equation (182), y + x y 4y = 0

n times and then substituting x = 0. The nth derivative of y is y (n+2) , and that of 4y is 4y (n) . To to find the n derivative of x y , we must use Leibniz Rule: Dn (x y ) = x Dn (y ) + n D(x) Dn1 (y ) + 0 + 0 + = x y (n+1) + n y (n) . It follows that Substituting x = 0 gives y (n+2) + x y (n+1) + (n 4) y (n) = 0. y (n+2) (0) = (4 n) y (n) (0). Thus y (0) y (0) y (4) (0) y (5) (0) = 4 y(0) = 3 y (0) = 2 y (0) = 1 y (0) 44 = = = = 0, 3, 0, 3, (189) (188)

(190)

Since, by Maclaurins Theorem, y(x) = y(0) + x y (0) + we have in this case that x3 x5 3+ 3 + 3! 5! x3 x5 = x+ + + . 2 40 The ratio test calculation is as above. y(x) = x + 3.10.1 Further examples x2 y (0) + , 2! (191)

(192)

1. Find the solution of the equation (1 x2 ) y x y + y = 0 that satisfies the conditions y(0) = 1, 2. Find the solution of the equation (2 x) y + y = 0 that satisfies the conditions y(1) = 1, y (1) = 0. y (0) = 0.

4
4.1

Qualitative Methods
Phase space

The kinds of methods weve been studying so far actually only work in a minority of cases. In particular differential equations that are nonlinear can often be very hard or impossible to solve. When symbolic methods fail, we can reach either for some sort of number-crunching technique or what we call qualitative methods. We focus here on coupled systems: on differential equations of the form dx = f1 (x, y), dt dy = f2 (x, y). dt 45 (193) (194)

Note that neither derivative depends on the independent variable t; this class of system is called autonomous. Note, too, that the second-order differential equation d2 x dx = F x, (195) 2 dt dt can be rewritten dx = y, (196) dt dy = F (x, y). (197) dt It follows that every second-order differential equation can be written as a coupled system. (The reverse is also true, though we wont go into that.) Reaction kinetics supplies many examples of coupled autonomous systems, such as the one in the Introduction; these are studied in more depth at the very end of these notes. The state of a coupled system is represented by a pair of numbers, (x, y), which in turn can be represented as a point in a 2D plane that we call phase space. Associated with each pair of numbers is a pair of time-derivatives, (x, y), which depend on x and y. This vector represents the velocity with which the state point (x, y) moves through phase space. We can represent it using an arrow. In this way, we can associate an arrow with every point in the plane, and thus diagram our coupled differential equation system in the form of a vector field plot, as in Figure 21. Conceived in this way, a coupled autonomous differential system is a flow in phase space: drop a spot of ink on to the point representing the systems initial state, and the evolution of the system through time is represented by the path that the spot traces out. Several such paths (the technical term is trajectory or orbit) are also shown in each of Figures 21. Perhaps the clearest way of diagramming a coupled autonomous differential equation system is to show a vector field plot together with some sample trajectories, as in Figure 21 (which shows a system well be studying shortly). Vector field plots are time-consuming to produce, however, and in practice well only ever ask you to sketch sample trajectories, as in Figure 22.

4.2

Linear Systems

To begin with, well confine our attention to linear systems: that is, to systems of the form dx = a x + b y, (198) dt 46

1 1

Figure 21: Example of an irregular vector field plot showing sample trajectories

1 1

## Figure 22: Example of a diagram showing sample trajectories only

47

dy = c x + d y. dt

(199)

In practice, most interesting systems are nonlinear, but it turns out, perhaps surprisingly, that if we know about linear systems we have most of what we need in order to understand nonlinear ones. Note: All linear autonomous coupled systems can in fact be solved exactly, without using qualitative methods. This isnt hard, but in many ways it doesnt really tell us much that we can use, so we mostly wont bother with it. One thing that all linear systems have in common is that at the origin (and usually, though not always, only there), x = y = 0. Points at which both derivatives are zero are called critical points or fixed points of the system. The key to sketching trajectories is understanding critical points in general: how to locate them and the various forms in which they arise. With linear systems, the first bit is easy: critical points always occur at the origin, and in most cases only there.

4.3

## Uncoupled Linear Systems

Well start with the simplest linear systems of all: those that arent even coupled, and that are therefore of the form dx = a x, dt dy = d y. dt Solving such systems exactly is extremely easy: the general solution is x = x0 ea t , y = y0 ed t . But what does this tell us about trajectories and critical points? The simplest case is that in which a = d, and therefore x = x 0 ea t , y = y0 ea t . In this case, its clear that y= y0 x, x0 (204) (205) (202) (203) (200) (201)

48

1 1

Figure 23: Vector field plot and sample trajectories for an unstable star and therefore that all trajectories are straight lines through the origin. If a = d > 0, then x and y increase as t increases, and the trajectories are away from the origin: this is shown in Figure 23. The type of critical point represented by the origin in this system is called, for obvious reasons, a star. This kind of star, in which the trajectories are all outward bound, is said to be unstable. If a = d < 0, then both x and y tend to zero as x increases, and the trajectories are all inward bound. The origin forms what we call a stable star. This is shown in Figure 24 Now consider the case in which a and d are unequal, but of the same sign. For instance, lets look at the specific example a = 1, d = 2. Here, the general solution is x = x0 et , y = y0 e2 t . A little bit of algebra gives us y= y0 2 x, x0 2 (206) (207)

meaning that all trajectories are parabolas whose axis is the y-axis and whose vertex is the origin. This family of trajectories is shown in Figure 25. In general, we can expect broadly this type of shape (outward trajectories tangential at the origin to the x-axis) whenever d > a > 0. If a > d > 0, the 49

1 1

Figure 24: Vector field plot and sample trajectories for a stable star

1 1

Figure 25: Vector field plot and sample trajectories for an unstable node

50

1 1

Figure 26: Vector field plot and sample trajectories for a saddle trajectories are tangential to the y-axis instead. In either case, the critical point at the origin is called an unstable node. Stable nodes arise when a and d are distinct and negative. In all cases of nodes, the trajectories are tangential to the axis associated with the numerically smaller coefficient. The only uncoupled case weve yet to consider is that for which a and d are of opposite sign. Consider, for example, the system x = x0 e t , y = y0 e2 t . Its easy to show that in this case, y = y 0 x0 2 1 , x2 (208) (209)

## meaning that the trajectories are all of the form y= k . x2

Furthermore, as t increases, x tends to infinity and y tends to zero, meaning that all trajectories approach the x-axis asymptotically. This is illustrated in Figure 26; this type of critical point is called a saddle or col. Saddles are always unstable, since all trajectories but two end up being outward bound. 51

4.4

## Coupled Linear Systems

So far, weve met three kinds of critical point: the star (which can be stable or unstable), the node (which can be stable or unstable) and the saddle (which is always unstable). These have all arisen in the context of simple uncoupled systems. At this stage, we may wonder what happens if we allow the systems to be coupled: that is, if we allow the coefficients b and c in dx = a x + b y, dt dy = c x + d y. dt to be nonzero. We might expect a vast new menagerie of critical points to arise; alternatively, we may hope that coupling the equations doesnt make that much difference. The truth is somewhere between the two: both nodes and saddles (though not stars) can arise in coupled systems, and theyre joined by three further types: the centre, the spiral and the improper node. The key to unlocking the behaviour of coupled systems is to consider the matrix a b . c d Specifically, we calculate this matrixs eigenvalues. In the uncoupled case weve just looked at, where b = c = 0, the eigenvalues are simply a and d. If we ignore (for the moment) the case a = d, then the eigenvectors are simply the coordinate axes. We can therefore summarise the findings of the above chapter as follows: If both eigenvalues are positive, we have an unstable node; trajectories are tangential to the eigenvector corresponding to the smaller eigenvalue. If both eigenvalues are negative, we have a stable node; trajectories are tangential to the eigenvector corresponding to the numerically smaller eigenvalue. If one eigenvalue is positive and the other is negative, we have a saddle; trajectories approach asymptotically the eigenvector corresponding to the positive eigenvalue. As you know, when we calculate the eigenvalues of a general 2 2 matrix, one of three things can happen: 52

the eigenvalues are real and distinct; the eigenvalues are non-real; the eigenvalues are real and equal. If the eigenvalues are real and distinct, the above findings transfer directly; the only difference is that the eigenvectors no longer correspond to the coordinate axes. Consider, for example, the system x = 2 x 2 y, y = 2 x 7 y. To calculate the eigenvalues of the matrix 2 2 2 7 we solve the characteristic equation 2 2 = 0. 2 7 This can be written which rearranges to give (2 ) (7) + 4 = 0, 2 + 9 + 18 = 0. The eigenvalues are therefore 3 and 6. The eigenvector corresponding to 3 is given by 1 2 2 4 x y = 0, (215) (213) (214) (212) , (210) (211)

which reduces to x = 2y, giving eigenvector (2, 1)T . That corresponding to 6 is given by 4 2 2 1 x y = 0, (216)

which reduces to y = 2x, giving eigenvector (1, 2)T . The critical point is therefore a stable node, with trajectories tangential to the eigenvector (2, 1)T . This is shown in Figure 27. 53

1 1

Figure 27: Vector field plot and sample trajectories for the stable node corresponding to x = 2 x 2 y, y = 2 x 7 y Secondly, consider the system x = 2 x 2 y, y = 2 x 3 y. To calculate the eigenvalues of the matrix 2 2 2 3 we solve the characteristic equation 2 2 = 0. 2 3 This can be written which rearranges to give (2 ) (3 ) + 4 = 0, 2 + 2 = 0. (220) (221) (219) , (217) (218)

The eigenvalues are therefore 2 and 1. The eigenvector corresponding to 2 is given by 4 2 2 1 54 x y = 0, (222)

which reduces to y = 2x, giving eigenvector (1, 2)T . That corresponding to 1 is given by 1 2 2 4 x y = 0, (223)

which reduces to x = 2y, giving eigenvector (2, 1)T . The critical point is therefore a saddle, with trajectories eventually asymptotic to the line corresponding to the eigenvector (2, 1)T . This is the system that is shown in Figure 21 above. But what if the eigenvalues are non-real? Then the uncoupled systems from the previous section cant help us. We can get a clue as to whats going on by considering the undriven oscillator equation from the last section x + 2 p x + 0 2 x = 0. Expressed as a coupled system, this is simply x = y, y = 0 2 x 2 p y. Now: the matrix 0 1 0 2 2 p (226) (227) (224) (225)

## has characteristic equation

(2 p ) + 0 2 = 0 or simply 2 + 2 p + 0 2 = 0.

Notice that this is the same as the auxiliary equation for the original ODE. (Whenever we express a second-order ODE with constant coefficients as a coupled system, this turns out to be the case.) Notice, too, that the eigenvalues are p p2 0 2 . These eigenvalues are non-real if and only if 0 2 > p2 , and in these circumstances the general solution of the original ODE is x = A ep t cos(t + ), where 2 = 0 2 p2 . There are three cases. If p = 0 we have x = A cos(t + ), y = x = A sin(t + ). 55 (228)

## Note that in this case,

y2 x2 + 2 2 = 1, A2 A and the trajectories are ellipses. If p > 0 we have something very similar, except that both x and x decay to zero: the trajectories therefore spiral in to the origin. If p < 0, they spiral outwards. This suggests that the following may be true in general. If the eigenvalues of the matrix a b c d

are non-real and of the form i, then: if = 0 then the trajectories are ellipses; if > 0 then the trajectories are outward spirals; if < 0 then the trajectories are inward spirals. Proving this in general takes a little work, but it is indeed the case. The critical points concerned are known as a centre, an unstable spiral point and a stable spiral point respectively. Clockwise and anticlockwise motion may be distinguished by looking at the value of the off-diagonal difference b c: if it is positive, then the motion is clockwise, and if negative, anticlockwise. For example, consider the system x = x + 2 y, y = x + y. To calculate the eigenvalues of the matrix 1 2 1 1 we solve the characteristic equation 1 2 = 0. 1 1 This can be written (1 ) (1 ) + 2 = 0, 56 (232) (231) , (229) (230)

1 1

Figure 28: Vector field plot and sample trajectories for the centre corresponding to x = x + 2 y, y = x + y which rearranges to give 2 + 1 = 0. (233) The eigenvalues are therefore i and i, and we have a centre. The offdiagonal difference is 3, which is positive, and motion is therefore clockwise. This critical point is shown in Figure 28. Consider now the system x = x 2 y, y = 2 x y. To calculate the eigenvalues of the matrix 1 2 2 1 we solve the characteristic equation 1 2 = 0. 2 1 This can be written (1 ) (1 ) + 4 = 0, 57 (237) (236) , (234) (235)

1 1

Figure 29: Vector field plot and sample trajectories for the stable spiral corresponding to x = x 2 y, y = 2 x y which rearranges to give 2 + 2 + 5 = 0. (238) The eigenvalues are 1 2 i, and we have a spiral; because the real part is negative, the spiral is stable. The off-diagonal difference is 4, which is negative, and therefore the motion is anticlockwise. This critical point is shown in Figure 29. The only case we have yet to consider is that in which the eigenvalues are equal. This can occur in one of two ways: either the matrix is simply a multiple of the unit matrix or there is just one eigenvector. The former case is uncoupled, and has already been covered. The latter is what you get if you merge the two eigenvectors of a node together: the trajectories are all characteristic S-shaped swirls, each tangential to the sole eigenvector. This type of critical point is called an improper node; as with spirals and centres, we can distinguish clockwise and anticlockwise motion by examining the off-diagonal difference. Consider, for example, the system x = 3x y, y = x + y. To calculate the eigenvalues of the matrix 3 1 1 1 58 , (239) (240)

1 1

Figure 30: Vector field plot and sample trajectories for the unstable improper node corresponding to x = 3x y, y = x + y we solve the characteristic equation 3 1 = 0. 1 1 This can be written (3 ) (1 ) + 1 = 0, which rearranges to give 2 4 + 4 = 0. (243) There is one repeated eigenvalue, 2, and yet the matrix isnt simply a multiple of the unit matrix. We have an improper node; since the eigenvalue is positive, it is unstable. The off-diagonal difference b c is negative, and therefore the motion is anticlockwise. To find the line of tangency, we find the sole eigenvector by solving 1 1 1 1 x y = 0, (244) (242) (241)

to obtain x = y, corresponding to the eigenvector (1, 1). This critical point is illustrated in Figure 30.

59

4.5

## Summary of Results for Linear Systems

x = a x + b y, y = cx + dy

## All linear systems

have a unique critical point (that is, at the origin. To classify that critical the matrix a c Then:

a point where x and y are both zero) point, first calculate the eigenvalues of b d .

1. If the eigenvalues are real and distinct, the critical point is either a node or a saddle. If both eigenvalues are positive, the critical point is an unstable node; the trajectories are tangential to the eigenvector associated with the smaller eigenvalue. If both eigenvalues are negative, the critical point is a stable node; the trajectories are tangential to the eigenvector associated with the numerically smaller eigenvalue. If the eigenvalues are of opposite sign, the critical point is a saddle; trajectories approach asymptotically the eigenvector associated with the positive eigenvalue. 2. If the eigenvalues are non-real and of the form i, the critical point is either a spiral point or a centre. If > 0, the critical point is an unstable spiral point. If < 0, the critical point is a stable spiral point. If = 0, the critical point is a centre. In all three cases, the motion is clockwise if b c is positive and anticlockwise if it is negative. 3. If the eigenvalues are real and repeated, then the critical point is either a star or an improper node. If the matrix is a multiple of the unit matrix then it is a star; if not, it is an improper node. If the eigenvalue is positive, the critical point is unstable; if negative, it is stable. In the case of improper nodes, trajectories are tangential to the sole eigenvector. If b c is positive, then motion is clockwise; if negative, anticlockwise. 60

4.5.1

Example

## 1. (a) For the system x = 4 x + k y, y = x + 2 y, show that the eigenvalues are 3 1 k.

(b) Hence, show that for all values of k the critical point is unstable. (c) Find the values of k for which the critical point is (i) (ii) (iii) (iv) an an an an unstable spiral point; unstable improper node; unstable node; saddle.

## (d) What do you think happens at k = 8?

4.6

Affine Systems

Affine systems are the next step up in complexity. Theyre simply linear systems with the addition of a constant: the general autonomous affine system is x = a x + b y + u, y = c x + d y + v. (245) (246)

They work exactly like linear systems except that the single critical point isnt always at the origin. Consider, for example, the affine system x = x 9 y + 11, y = 4 x + y + 7. We first locate the critical point by solving x 9 y + 11 = 0, 4 x + y + 7 = 0, obtaining x = 2, y = 1. Now, our original system can be written X = X 9 Y, Y = 4 X + Y, 61 (251) (252) (249) (250) (247) (248)

1 1

Figure 31: Vector field plot and sample trajectories for the unstable spiral corresponding to the affine system x = x 9 y + 11, y = 4 x + y + 7 where X = x + 2 and Y = y 1. We can solve this system in the normal way: the eigenvalues of 1 9 4 1 are 1 6 i, and we therefore have an unstable spiral at (2, 1). Since b c is negative, the motion is anticlockwise. This is shown in Figure 31.

4.7

Nonlinear Systems

General nonlinear systems may have multiple critical points (or indeed none at all). Locating them proceeds just as for affine systems: to find the critical points of the system x = f1 (x, y), y = f2 (x, y), simply solve f1 (x, y) = 0, f2 (x, y) = 0 (255) (256) (253) (254)

simultaneously. However, classifying them looks far trickier, because there doesnt appear to be any matrix whose eigenvalues we can consider. 62

Taylors Theorem comes to our rescue. Recall that in general f1 (x, y) = f1 (x0 , y0 ) + (x x0 )f1 x (x0 , y0 ) + (y y0 )f1 y (x0 , y0 ) + , (257) and similarly for f2 . Now, suppose weve found a critical point: that is, a point (x0 , y0 ) at which both f1 (x0 , y0 ) and f2 (x0 , y0 ) are zero. We then have that x = (x x0 )f1 x (x0 , y0 ) + (y y0 )f1 y (x0 , y0 ) + , y = (x x0 )f2 x (x0 , y0 ) + (y y0 )f2 y (x0 , y0 ) + . This can be rewritten as X = X f1 x (x0 , y0 ) + Y f1 y (x0 , y0 ) + , Y = X f2 x (x0 , y0 ) + Y f2 y (x0 , y0 ) + , (260) (261) (258) (259)

where X = x x0 and Y = y y0 . This is approximately linear, with exact linearity in the limit as (x, y) approaches (x0 , y0 ). The matrix whose eigenvalues determine the nature of the critical point is f1 x (x0 , y0 ) f1 y (x0 , y0 ) . f2 x (x0 , y0 ) f2 y (x0 , y0 ) This is usually written simply f1 /x f1 /y f2 /x f2 /y ,

and is known as the Jacobian matrix. Were now in a position to put together a fully-fledged technique for sketching the trajectories of general nonlinear systems. To create a trajectory sketch for the nonlinear system x = f1 (x, y), y = f2 (x, y) : Locate all the critical points by solving simultaneously the equations f1 (x, y) = 0, f2 (x, y) = 0. Calculate the Jacobian matrix. Evaluate it at each of the critical points and analyse its eigenvalues to determine the nature of the critical point. 63

If necessary, calculate the curves along which f1 (x, y) = 0 (trajectories vertical) and f2 (x, y) = 0 (trajectories horizontal). Usually, the nature of the diagram will now be clear. (Notice how similar this process is to creating a contour sketch for a surface; this is far from accidental, though we wont go into the deep commonalities these processes share.) Worked Example 4.1 For the system x = x (2 y), y = y (1 x), (262) (263)

determine the nature of the critical points and sketch some typical trajectories. We start by solving simultaneously the equations x (2 y) = 0, y (1 x) = 0. (264) (265)

Equation (264) is satisfied if x = 0 or y = 2, and (265) if y = 0 or x = 1. The critical points are therefore at (0, 0) and (1, 2). The Jacobian matrix is f1 /x f1 /y f2 /x f2 /y ,

## At (0, 0), the value of the Jacobian matrix is 2 0 0 1 .

This has eigenvalues 2 and 1, and is therefore an unstable node. The corresponding eigenvectors are the x and y axes respectively, and all trajectories are therefore tangential to the y axis.

64

y 3

x 1 1 2 3

Figure 32: Critical points of the system x = x (2 y), y = y (1 x). At (1, 2), the value of the Jacobian matrix is 0 1 2 0 This has characteristic equation (266) 2 2 = 0, and the eigenvalues are therefore 2. This critical point is therefore a saddle. To find the corresponding eigenvectors, we solve x 2 1 = 0, (267) y 2 2 2). The traobtaining x 2 y = 0, giving the eigenvectors (1, jectories asymptotically approach the line of the eigenvector (1, 2), which is associated with the positive eigenvalue 2. The information we have so far is shown in Figure 32. This is almost enough on its own, but it may be helpful to note that the trajectories are vertical along x = 0 and y = 2, and horizontal along y = 0 and x = 1. This is shown in Figure 33. We are now ready to complete the sketch, which is shown in Figure 34. 65 .

y 3

x 1 1 2 3

Figure 33: Critical points and points of horizontal and vertical trajectory of the system x = x (2 y), y = y (1 x).

y 3

x 1 1 2 3

Figure 34: Critical points and sample trajectories of the system x = x (2y), y = y (1 x).

66

4.8

Applications

As weve already mentioned, reaction kinetics provides a fertile field for applications of this theory. Some of the more interesting types of system, including the above example, involve autocatalysis. Consider a reaction system involving five reactants, labelled A, B, C, X and Y . The concentrations of A, B and C, which well call a, b and c respectively, are held constant by extraction or topping up, and those of X and Y , which well call x and y, are allowed to vary. The reaction has three components: X is produced from A in a reaction autocatalysed by X itself. Y is produced from B in the same kind of reaction. X and Y react together in equal molar quantities to produce C. The equations for these reactions are A + X 2 X, B + Y 2 Y, X + Y C, with corresponding rate equations dx = k1 a x k3 x y, dt dy = k2 b y k3 x y. dt (268) (269)

The above example is simply this system with k1 a = 2 and k2 b = k3 = 1. The same example is also a model for competing species. Imagine that two species are competing for the same resources. The population of each grows at a rate proportional to its value, but falls at a rate proportional to the product of both populations: dx = a x b x y, dt dy = c y d x y. dt (270) (271)

Set a = 2 and b = c = d = 1 and you have our example. A related example was also developed in the fields of reaction kinetics (by Lotka) and ecology (Volterra). Its called the Lotka-Volterra equation, and is an example of a predator-prey system. 67

Reaction kinetics first. Consider a system involving reactants A and B (whose concentrations are held constant) and X and Y (whose concentrations are allowed to vary). X is produced from A, autocatalysing its own production. Y is produced from X, autocatalysing its own production. Y then spontaneously produces B. We have The equations for these reactions are A + X 2 X, X + Y 2 Y, Y B,

with corresponding rate equations dx = k1 a x k2 x y, (272) dt dy (273) = k2 x y k3 y. dt Now ecology. Consider a population x of hares and a population y of foxes. Hares reproduce at a rate proportional to their numbers, and die in encounters with foxes (and therefore at a rate proportional to the product x y). Foxes have no natural predators and die of natural causes at a rate proportional to their numbers, but thrive in the presence of hares, reproducing at a rate proportional to x y. We therefore have that dx = a x b x y, (274) dt dy = c x y d y. (275) dt The system dx = 2 x x y, (276) dt dy = xy y (277) dt is therefore an example of both the reaction and the predator-prey interaction; this forms our final example. 4.8.1 Example dx = 2 x x y, dt dy = x y y, dt 68

## 1. For the system

y 5

0 0 1 2 3 4 5

Figure 35: Sample trajectories of the Brusselator system x = 1 + x2 y 4 x, y = 3 x x2 y. calculate the position and nature of all critical points and sketch lines along which the trajectories are vertical and horizontal. Assuming without proof that all trajectories in the first quadrant are closed curves, sketch sample trajectories for this system. Interpret this diagram in terms of (a) reaction kinetics; (b) ecology. How would you prove that all trajectories in the first quadrant are closed curves? The final figure, Figure 35, is included purely in order to show that there can be subtleties that our focus on critical points can miss. This is a sketch of trajectories of the so-called Brusselator reaction, an example of autocatalysis. This involves reactants A, B, C, D, X and Y , with concentrations of the first four held constant. X is produced spontaneously from A; one mole of Y becomes X, autocatalysed by two moles of X itself; B and Y react in equal molar quantities to produce equal molar quantities of C and X; and X spontaneously becomes D. The chemical equations are A 2X + Y B+X X 69 X, 3 X, C + Y, D,

## with corresponding rate equations dx = k1 a + k2 x2 y (k3 b + k4 ) x, dt dy = k3 b x k2 x2 y. dt (278) (279)

Figure 35 shows trajectories in the case k1 a = 1, k2 = 1, k3 b = 3, k4 = 1. This limit cycle behaviour isnt detectable through an analysis of critical points, and requires more sophisticated qualitative techniques.

70