Home»Math Guides»Solving systems of ODEs (ordinary differential equations), real distinct eigenvalues, 2 equations (2 by 2 matrix)
How to solve systems of ordinary differential equations, using eigenvalues, real distinct eigenvalues worked-out example problem
You may be asked to solve systems of ordinary differential equations simultaneously.
You can’t use the old methods you learned from solving one differential equation.
Instead, you need to use tricks from linear algebra, such as forming matrices and finding the eigenvalues and eigenvectors.
Technically, there may be solutions because you can multiply an eigenvector by a multiple, so it’s best to try to keep things simple, for example, use unit vectors whenever possible.
Example problem: Solve the initial value problem: \(x’ = \left[ {\begin{array}{*{20}{c}}1&2\\3&2\end{array}} \right]x\), given initial condition \(x(0) = \left[ {\begin{array}{*{20}{c}}0\\{ – 4}\end{array}} \right]\)
First of all, you may be confused if the system of ODEs are in a matrix. The above is really just a shorter way of writing:
\[\frac{{d{x_1}}}{{dt}} = 1{x_1} + 2{x_2}\]
\[\frac{{d{x_2}}}{{dt}} = 3{x_1} + 2{x_2}\]
Sometimes instead of using \({x_1}\), \({x_2}\), \({x_3}\), your instructor may use x, y, z, which is the same thing, they are all different dependent variables, but the independent variable will be shared, in this case time t.
The first thing to do is find the eigenvalues by using the equation below to get the characteristic polynomial.
\[\det \left( {A – \lambda I} \right) = \left| {\begin{array}{*{20}{c}}{1 – \lambda }&2\\3&{2 – \lambda }\end{array}} \right|\]
\[{\lambda ^2} – 3\lambda – 4\]
\[\left( {\lambda + 1} \right)\left( {\lambda – 4} \right) = 0\]
And solve to get
\[{\lambda _1} = – 1\]
\[{\lambda _2} = 4\]
Substitute \({\lambda _1} = – 1\) into \(\det \left( {A – \lambda I} \right)\), and solve the equations below to get the first eigenvector.
\[\left[ {\begin{array}{*{20}{c}}2&2\\3&3\end{array}} \right]\left[ {\begin{array}{*{20}{c}}{{k_1}}\\{{k_2}}\end{array}} \right] = \left[ {\begin{array}{*{20}{c}}0\\0\end{array}} \right]\]
Let’s look at the first row above
\[2{k_1} + 2{k_2} = 0\]
\[{k_1} = – {k_2}\]
Now, this is why we said there are multiply solutions for the eigenvector, the convention is to just choose something simple so your instructor or marker (and you) won’t get confused, usually 1 or -1, but don’t choose 0 because we don’t want everything to disappear!
We will call the eigenvector capital K.
Let’s set \({k_1} = – 1\), then \({k_2} = 1\)
\[{K_1} = \left[ {\begin{array}{*{20}{c}}{ – 1}\\1\end{array}} \right]\]
Repeat this for the second eigenvalue to get the second eigenvector.
Substitute \({\lambda _2} = 4\) into \(\det \left( {A – \lambda I} \right)\)
\[\left[ {\begin{array}{*{20}{c}}{ – 3}&2\\3&{ – 2}\end{array}} \right]\left[ {\begin{array}{*{20}{c}}{{k_1}}\\{{k_2}}\end{array}} \right] = \left[ {\begin{array}{*{20}{c}}0\\0\end{array}} \right]\]
\[ – 3{k_1} + 2{k_2} = 0\]
\[{k_1} = \frac{2}{3}{k_2}\]
Now choose something simple, if you set \({k_2} = 3\), you can get rid of ugly fractions.
Setting \({k_2} = 3\) you get,
\[{K_2} = \left[ {\begin{array}{*{20}{c}}2\\3\end{array}} \right]\]
We can make the general solution now, it’s e to the power of the eigenvalue, then multiplied by the eigenvector we found. We could’ve used this method if we had 3 ODEs to solve simultaneously.
\[x(t) = {c_1}{e^{ – t}}\left[ {\begin{array}{*{20}{c}}{ – 1}\\1\end{array}} \right] + {c_2}{e^{4t}}\left[ {\begin{array}{*{20}{c}}2\\3\end{array}} \right]\]
You can now use the initial condition, \(x(0) = \left[ {\begin{array}{*{20}{c}}0\\{ – 4}\end{array}} \right]\), to solve for the constants. Remember at the initial condition that t = 0, so e to the power of 0 is just 1.
\[\left[ {\begin{array}{*{20}{c}}0\\{ – 4}\end{array}} \right] = {c_1}{e^0}\left[ {\begin{array}{*{20}{c}}{ – 1}\\1\end{array}} \right] + {c_2}{e^0}\left[ {\begin{array}{*{20}{c}}2\\3\end{array}} \right]\]
It’s just a matrix of 2 equations and 2 unknowns, just manipulate the equations to solve for the constants or use your calculator’s function, DLBMaths on YouTube has an amazing tutorial on how to solve matrices easily on a Casio fx991ES PLUS.
Solving, we get \({c_1} = – \frac{8}{5}\) and \({c_2} = – \frac{4}{5}\).
Our final solution to the system of ODEs will be:
\[x(t) = – \frac{8}{5}{e^{ – t}}\left[ {\begin{array}{*{20}{c}}{ – 1}\\1\end{array}} \right] – \frac{4}{5}{e^{4t}}\left[ {\begin{array}{*{20}{c}}2\\3\end{array}} \right]\]
Remember that, at least in the scope of an ordinary differential equations course, that you will get a number of equations equal to the number of equations in the problem, each ordinary differential equation will have a solution!
Solving the system of ODEs using MATLAB, double check your solution is correct!
Most of the time the answers to these questions will have analytical solutions (you can represent the answers perfectly using equations) if your instructor asked you to do them by hand.
If the system of ODEs have analytical solutions, you can use the symbolic variables in MATLAB and its “dsolve” command to get the answer, you don’t even have to have initial conditions, it will generate constants for you.
You can replace the constants in the matrix with what you have, think of the script as an easy calculator for systems of ODEs. “B” is just a matrix of non-homogeneous terms, if you have those, but here we don’t have that so it’s just a zero vector.
%bai-gaming.com/math-guides
syms x1(t) x2(t)
A = [1 2; 3 2];
B = [0; 0];
Y = [x1; x2];
odes = diff(Y) == A*Y + B
conds = Y(0) == [0; -4];
[x1Sol(t), x2Sol(t)] = dsolve(odes,conds)
x1Sol(t) = simplify(x1Sol(t))
x2Sol(t) = simplify(x2Sol(t))
Try a system of ODEs with repeated real eigenvalues solved problem next!
Try a system of ODEs with complex (real and imaginary) eigenvalues solved problem next!
Try solving some single differential equations next by clicking here!