[Notes on Diffy Qs home] [PDF version] [Buy cheap paperback version]

[next] [prev] [prev-tail] [tail] [up]

3.1 Introduction to systems of ODEs

Note: 1 lecture, §4.1 in [EP], §7.1 in [BD]

Often we do not have just one dependent variable and one equation. And as we will see, we may end up with systems of several equations and several dependent variables even if we start with a single equation.

If we have several dependent variables, suppose y1 , y2 , …, yn , then we can have a differential equation involving all of them and their derivatives. For example, y′1′= f (y′1,y′2,y1,y2,x) . Usually, when we have two dependent variables we have two equations such as

y′′1 = f1(y′1,y′2,y1,y2,x), y′′ = f (y′,y′,y ,y ,x), 2 2 1 2 1 2
for some functions f1 and f2 . We call the above a system of differential equations. More precisely, the above is a second order system of ODEs.

Example 3.1.1: Sometimes a system is easy to solve by solving for one variable and then for the second variable. Take the first order system

y′= y1, 1′ y2 = y1 - y2,
with initial conditions of the form y1(0) = 1 , y2(0 ) = 2 .

We note that y1 = C 1ex is the general solution of the first equation. We then plug this y1 into the second equation and get the equation y′2 = C 1ex - y2 , which is a linear first order equation that is easily solved for y2 . By the method of integrating factor we get

 C 1 exy2 =---e2x + C 2, 2

or  C1x -x y2 = 2 e + C2e . The general solution to the system is, therefore,

 x y1 = C1e , C1-x -x y2 = 2 e + C2e .
We solve for C1 and C2 given the initial conditions. We substitute x = 0 and find that C 1 = 1 and C 2 = 3∕2 . Thus the solution is y1 = ex , and y2 = (1∕2)ex + (3∕2)e-x .

Generally, we will not be so lucky to be able to solve for each variable separately as in the example above, and we will have to solve for all variables at once.

PIC

As an example application, let us think of mass and spring systems again. Suppose we have one spring with constant k , but two masses m1 and m2 . We can think of the masses as carts, and we will suppose that they ride along a straight track with no friction. Let x1 be the displacement of the first cart and x2 be the displacement of the second cart. That is, we put the two carts somewhere with no tension on the spring, and we mark the position of the first and second cart and call those the zero positions. Then x 1 measures how far the first cart is from its zero position, and x2 measures how far the second cart is from its zero position. The force exerted by the spring on the first cart is k(x2 - x1) , since x2 - x 1 is how far the string is stretched (or compressed) from the rest position. The force exerted on the second cart is the opposite, thus the same thing with a negative sign. Newton’s second law states that force equals mass times acceleration. So the system of equations governing the setup is

 ′′ m 1x1 = k(x2 - x1), m 2x′′2 = -k(x2 - x1).

In this system we cannot solve for the x1 or x2 variable separately. That we must solve for both x1 and x2 at once is intuitively clear, since where the first cart goes depends exactly on where the second cart goes and vice-versa.

Before we talk about how to handle systems, let us note that in some sense we need only consider first order systems. Let us take an nth order differential equation

y(n) = F (y(n-1),...,y′,y,x).

We define new variables u1,u2,...,un and write the system

 ′ u1 = u2, u′ = u3, 2 ... ′ un-1 = un, u′n = F(un,un-1,...,u 2,u 1,x ).
We solve this system for u 1 , u 2 , …, u n . Once we have solved for the u ’s, we can discard u 2 through u n and let y = u1 . We note that this y solves the original equation.

A similar process can be followed for a system of higher order differential equations. For example, a system of k differential equations in k unknowns, all of order n , can be transformed into a first order system of n × k equations and n × k unknowns.

Example 3.1.2: We can use this idea in reverse as well. Let us consider the system

x ′ = 2y - x, y′ = x,

where the independent variable is t . We wish to solve for the initial conditions x(0) = 1 , y(0) = 0 .

If we differentiate the second equation we get y′′ = x′ . We know what x′ is in terms of x and y , and we know that x = y′ . So,

 ′′ ′ ′ y = x = 2y - x = 2y - y.

We now have the equation y′′ + y′ - 2y = 0 . We know how to solve this equation and we find that y = C 1e-2t + C 2et . Once we have y we use the equation y′ = x to get x .

 ′ -2t t x = y = -2C 1e + C2e .

We solve for the initial conditions 1 = x(0 ) = - 2C1 + C2 and 0 = y(0) = C1 + C2 . Hence, C 1 = - C2 and 1 = 3C 2 . So C1 = -1∕3 and C2 = 1∕3 . Our solution is

 2e-2t + et -e-2t + et x = --------, y = ---------. 3 3

Exercise 3.1.1: Plug in and check that this really is the solution.

It is useful to go back and forth between systems and higher order equations for other reasons. For example, the ODE approximation methods are generally only given as solutions for first order systems. It is not very hard to adapt the code for the Euler method for first order equations to handle first order systems. We essentially just treat the dependent variable not as a number but as a vector. In many mathematical computer languages there is almost no distinction in syntax.

In fact, this is what IODE was doing when you had it solve a second order equation numerically in the IODE Project III if you have done that project.

The above example is what we call a linear first order system, as none of the dependent variables appear in any functions or with any higher powers than one. It is also autonomous as the equations do not depend on the independent variable t .

For autonomous systems we can draw the so-called direction field or vector field. That is, a plot similar to a slope field, but instead of giving a slope at each point, we give a direction (and a magnitude). The previous example x ′ = 2y - x , y′ = x says that at the point (x,y) the direction in which we should travel to satisfy the equations should be the direction of the vector (2y - x,x) with the speed equal to the magnitude of this vector. So we draw the vector (2y - x,x) based at the point (x,y) and we do this for many points on the xy -plane. We may want to scale down the size of our vectors to fit many of them on the same direction field. See Figure 3.1.

We can now draw a path of the solution in the plane. That is, suppose the solution is given by x = f(t) , y = g(t) , then we pick an interval of t (say 0 ≤ t ≤ 2 for our example) and plot all the points ( ) f(t),g (t) for t in the selected range. The resulting picture is called the phase portrait (or phase plane portrait). The particular curve obtained is called the trajectory or solution curve. An example plot is given in Figure 3.2. In this figure the line starts at (1,0) and travels along the vector field for a distance of 2 units of t . Since we solved this system precisely we can compute x (2) and y(2) . We get that x(2) ≈ 2.4 75 and y(2) ≈ 2.457 . This point corresponds to the top right end of the plotted solution curve in the figure.


PIC

Figure 3.1: The direction field for x′ = 2y - x , y′ = x .
PIC
Figure 3.2: The direction field for x′ = 2y - x , y′ = x with the trajectory of the solution starting at (1,0) for 0 ≤ t ≤ 2 .


Notice the similarity to the diagrams we drew for autonomous systems in one dimension. But now note how much more complicated things became when we allowed just one more dimension.

We can draw phase portraits and trajectories in the xy -plane even if the system is not autonomous. In this case however we cannot draw the direction field, since the field changes as t changes. For each t we would get a different direction field.

3.1.1 Exercises

Exercise 3.1.2: Find the general solution of x′ = x - x + t 1 2 1 , x′ = x 2 2 .

Exercise 3.1.3: Find the general solution of  ′ t x1 = 3x1 - x2 + e ,  ′ x2 = x1 .

Exercise 3.1.4: Write ay′′ + by′ + cy = f(x) as a first order system of ODEs.

Exercise 3.1.5: Write x′′ + y2y′ - x3 = sin(t) , y′′ + (x ′ + y′)2 - x = 0 as a first order system of ODEs.

Exercise 3.1.101: Find the general solution to y′1 = 3y1 , y′2 = y1 + y2 , y′3 = y1 + y3 .

Exercise 3.1.102: Solve y′ = 2x , x′ = x + y , x(0 ) = 1 , y(0) = 3 .

Exercise 3.1.103: Write  ′′′ x = x + t as a first order system.

Exercise 3.1.104: Write y′1′+ y1 + y2 = t , y′′2 + y1 - y2 = t2 as a first order system.