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

[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′′= f (y′,y′,y1,y2,x) 1 1 2 . Usually, when we have two dependent variables we have two equations such as

y′′ = f1(y′,y′,y1,y2,x), 1′′ 1′ 2′ y2 = f2(y1,y2,y1,y2,x),
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′1 = y1, ′ 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′= C 1ex − y2 2 , which is a linear first order equation that is easily solved for y 2 . By the method of integrating factor we get

exy = C1e2x + C , 2 2 2

or y2 = C1ex + C2e−x 2 . The general solution to the system is, therefore,

y = C ex, y = C1ex + C e−x. 1 1 2 2 2

We solve for C 1 and C 2 given the initial conditions. We substitute x = 0 and find that C 1 = 1 and C = 3∕2 2 . Thus the solution is y = ex 1 , and y = (1∕2)ex + (3∕2)e−x 2 .

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.


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 x 1 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 x1 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(x − x ) 2 1 , since x − x 2 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 1x′′1 = k(x2 − x1), ′′ m 2x2 = −k(x2 − x1).

In this system we cannot solve for the x1 or x2 variable separately. That we must solve for both x1 and x 2 at once is intuitively clear, since where the first cart goes depends on exactly 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

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

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

 u′1 = u2, u′ = u , 2 3 ... ′ un−1 = un, u′ = F(un,un−1,...,u 2,u 1,x ). n
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.

For example, take x′′′ = 2x′′ + 8x′ + x + t . Letting u1 = x , u2 = x′ , u3 = x′′ , we find the system:

 ′ ′ ′ u 1 = u2, u2 = u 3, u3 = 2u3 + 8u 2 + u1 + t.

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 .

x = y′ = −2C e−2t + C et. 1 2

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 = 3 , y = 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.

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 draw a path of the solution in the plane. Suppose the solution is given by x = f (t) , y = g(t) . 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. See an example plot in Figure 3.2. In the figure the solution starts at (1,0) and travels along the vector field for a distance of 2 units of t . We solved this system precisely, so we compute x(2) and y(2) to find x(2 ) ≈ 2.475 and y(2) ≈ 2.4 57 . This point corresponds to the top right end of the plotted solution curve in the figure.


Figure 3.1: The direction field for x′ = 2y − x , y′ = x .
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 note how much more complicated things become when we allow just one extra 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  ′ x1 = x2 − x1 + t ,  ′ x2 = x2 .

Exercise 3.1.3: Find the general solution of x′ = 3x1 − x2 + et 1 , x′ = x1 2 .

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  ′ y1 = 3y1 ,  ′ y2 = y1 + y2 ,  ′ y3 = 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  ′′ y1 + y1 + y2 = t ,  ′′ 2 y2 + y1 − y2 = t as a first order system.

Exercise 3.1.105: Suppose two masses on carts on frictionless surface are at displacements x1 and x 2 as in the example of this section. Suppose initial displacement is x (0) = x (0) = 0 1 2 , and initial velocity is  ′ ′ x 1(0) = x2(0) = a for some number a . Use your intuition to solve the system, explain your reasoning.