\require{cancel}\newcommand{\nicefrac}[2]{{{}^{#1}}\!/\!{{}_{#2}}} \newcommand{\unitfrac}[3][\!\!]{#1 \,\, {{}^{#2}}\!/\!{{}_{#3}}} \newcommand{\unit}[2][\!\!]{#1 \,\, #2} \newcommand{\noalign}[1]{} \newcommand{\qed}{\qquad \Box} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&}

## Section3.1Introduction to systems of ODEs

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 $y_1\text{,}$ $y_2\text{,}$ , $y_n\text{,}$ then we can have a differential equation involving all of them and their derivatives. For example, $y_1'' = f(y_1',y_2',y_1,y_2,x)\text{.}$ Usually, when we have two dependent variables we have two equations such as

\begin{equation*} \begin{aligned} y_1'' & = f_1(y_1',y_2',y_1,y_2,x) , \\ y_2'' & = f_2(y_1',y_2',y_1,y_2,x) , \end{aligned} \end{equation*}

for some functions $f_1$ and $f_2\text{.}$ We call the above a system of differential equations. More precisely, the above is a second order system of ODEs.

###### Example3.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

\begin{equation*} \begin{aligned} y_1' & = y_1 , \\ y_2' & = y_1 - y_2 , \end{aligned} \end{equation*}

with initial conditions of the form $y_1(0) = 1\text{,}$ $y_2(0) = 2\text{.}$

We note that $y_1 = C_1 e^x$ is the general solution of the first equation. We then plug this $y_1$ into the second equation and get the equation $y_2' = C_1e^x - y_2\text{,}$ which is a linear first order equation that is easily solved for $y_2\text{.}$ By the method of integrating factor we get

\begin{equation*} e^x y_2 = \frac{C_1}{2}e^{2x} + C_2 , \end{equation*}

or $y_2 = \frac{C_1}{2}e^{x} + C_2e^{-x}\text{.}$ The general solution to the system is, therefore,

\begin{equation*} y_1 = C_1 e^x , \qquad y_2 = \frac{C_1}{2}e^{x} + C_2e^{-x} . \end{equation*}

We solve for $C_1$ and $C_2$ given the initial conditions. We substitute $x=0$ and find that $C_1=1$ and $C_2=\nicefrac{3}{2}\text{.}$ Thus the solution is $y_1 = e^x\text{,}$ and $y_2 = (\nicefrac{1}{2}) e^x + (\nicefrac{3}{2}) e^{-x}\text{.}$

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\text{,}$ but two masses $m_1$ and $m_2\text{.}$ 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 $x_2$ 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 $x_2$ measures how far the second cart is from its zero position. The force exerted by the spring on the first cart is $k(x_2-x_1)\text{,}$ since $x_2-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

\begin{equation*} \begin{aligned} m_1 x_1'' & = k(x_2-x_1) , \\ m_2 x_2'' & = - k(x_2-x_1) . \end{aligned} \end{equation*}

In this system we cannot solve for the $x_1$ or $x_2$ variable separately. That we must solve for both $x_1$ 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 $n^{\text{th}}$ order differential equation

\begin{equation*} y^{(n)} = F(y^{(n-1)},\ldots,y',y,x) . \end{equation*}

We define new variables $u_1, u_2, \ldots, u_n$ and write the system

\begin{equation*} \begin{aligned} u_1' & = u_2 , \\ u_2' & = u_3 , \\ & ~\, \vdots \\ u_{n-1}' & = u_n , \\ u_n' & = F(u_n,u_{n-1},\ldots,u_2,u_1,x) . \end{aligned} \end{equation*}

We solve this system for $u_1\text{,}$ $u_2\text{,}$ , $u_n\text{.}$ Once we have solved for the $u$'s, we can discard $u_2$ through $u_n$ and let $y = u_1\text{.}$ We note that this $y$ solves the original equation.

For example, take $x''' = 2x''+ 8x' + x + t\text{.}$ Letting $u_1 = x\text{,}$ $u_2 = x'\text{,}$ $u_3 = x''\text{,}$ we find the system:

\begin{equation*} u_1' = u_2, \qquad u_2' = u_3, \qquad u_3' = 2u_3 + 8u_2 + u_1 + t . \end{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\text{,}$ can be transformed into a first order system of $n \times k$ equations and $n \times k$ unknowns.

###### Example3.1.2

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

\begin{equation*} x' = 2y-x , \qquad y' = x, \end{equation*}

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

If we differentiate the second equation we get $y''=x'\text{.}$ We know what $x'$ is in terms of $x$ and $y\text{,}$ and we know that $x=y'\text{.}$ So,

\begin{equation*} y'' = x' = 2y-x = 2y-y' . \end{equation*}

We now have the equation $y''+y'-2y = 0\text{.}$ We know how to solve this equation and we find that $y = C_1 e^{-2t} + C_2 e^t\text{.}$ Once we have $y$ we use the equation $y' = x$ to get $x\text{.}$

\begin{equation*} x = y' = -2 C_1 e^{-2t} + C_2 e^t . \end{equation*}

We solve for the initial conditions $1 = x(0) = -2 C_1 + C_2$ and $0 = y(0) = C_1 + C_2\text{.}$ Hence, $C_1 = -C_2$ and $1 = 3C_2\text{.}$ So $C_1 = \nicefrac{-1}{3}$ and $C_2 = \nicefrac{1}{3}\text{.}$ Our solution is

\begin{equation*} x = \frac{2e^{-2t} + e^t}{3} ,\qquad y = \frac{-e^{-2t} + e^t}{3} . \end{equation*}
###### Exercise3.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\text{.}$

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\text{,}$ $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 4.1.4.

We can draw a path of the solution in the plane. Suppose the solution is given by $x = f(t)\text{,}$ $y=g(t)\text{.}$ We pick an interval of $t$ (say $0 \leq t \leq 2$ for our example) and plot all the points $\bigl(f(t),g(t)\bigr)$ 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 4.1.5. In the figure the solution starts at $(1,0)$ and travels along the vector field for a distance of 2 units of $t\text{.}$ We solved this system precisely, so we compute $x(2)$ and $y(2)$ to find $x(2) \approx 2.475$ and $y(2) \approx 2.457\text{.}$ This point corresponds to the top right end of the plotted solution curve in the figure.

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.

### Subsection3.1.1Exercises

###### Exercise3.1.2

Find the general solution of $x_1' = x_2 - x_1 + t\text{,}$ $x_2' = x_2\text{.}$

###### Exercise3.1.3

Find the general solution of $x_1' = 3 x_1 - x_2 + e^t\text{,}$ $x_2' = x_1\text{.}$

###### Exercise3.1.4

Write $ay'' + by' + cy = f(x)$ as a first order system of ODEs.

###### Exercise3.1.5

Write $x'' + y^2 y' - x^3 = \sin(t)\text{,}$ $y'' + {(x'+y')}^2 -x = 0$ as a first order system of ODEs.

###### Exercise3.1.101

Find the general solution to $y_1' = 3 y_1\text{,}$ $y_2' = y_1 + y_2\text{,}$ $y_3' = y_1 + y_3\text{.}$

$y_1 = C_1 e^{3x}\text{,}$ $y_2 = y(x) = C_2 e^x+ \frac{C_1}{2} e^{3 x}\text{,}$ $y_3 = y(x) = C_3 e^x+ \frac{C_1}{2} e^{3 x}$

###### Exercise3.1.102

Solve $y'=2x\text{,}$ $x'=x+y\text{,}$ $x(0)=1\text{,}$ $y(0)=3\text{.}$

$x=\frac{5}{3} e^{2t} - \frac{2}{3} e^{-t}\text{,}$ $y=\frac{5}{3} e^{2t} + \frac{4}{3} e^{-t}$

###### Exercise3.1.103

Write $x''' = x+t$ as a first order system.

$x_1' = x_2\text{,}$ $x_2' = x_3\text{,}$ $x_3' = x_1+t$

###### Exercise3.1.104

Write $y_1'' + y_1 + y_2 = t\text{,}$ $y_2'' + y_1 - y_2 = t^2$ as a first order system.

$y_3' + y_1 + y_2 = t\text{,}$ $y_4' + y_1 - y_2 = t^2\text{,}$ $y_1' = y_3\text{,}$ $y_2' = y_4$
Suppose two masses on carts on frictionless surface are at displacements $x_1$ and $x_2$ as in the example of this section. Suppose initial displacement is $x_1(0)=x_2(0)=0\text{,}$ and initial velocity is $x_1'(0) = x_2'(0) = a$ for some number $a\text{.}$ Use your intuition to solve the system, explain your reasoning.
$x_1 = x_2 = at\text{.}$ Explanation of the intuition is left to reader.