Home»Math Guides»Solving systems of ODEs (ordinary differential equations), real distinct eigenvalues, 3 equations (3 by 3 matrix)
How to solve systems of ordinary differential equations, using eigenvalues, real distinct eigenvalues, three equations, worked-out example problem
You may be asked to solve systems of ordinary differential equations simultaneously.
We have a system of 3 differential equations we want to solve simultaneously.
In this example problem we will find three distinct eigenvalues from the characteristic polynomial.
Please review our example problem on how to solve a system of 2 ODEs with 2 real, distinct eigenvalues, it will cover what we do here in greater detail and is good practice before you attempt this problem.
Example problem: Solve the following system of equations:
\[\frac{{dx}}{{dt}} = – 4x + y + z\]
\[\frac{{dy}}{{dt}} = x + 5y – z\]
\[\frac{{dz}}{{dt}} = y – 3z\]
If you don’t know, x y and z are dependent variables, and t is the independent variable. It may be your first time seeing multivariable problems. The above could also be written as,
\[\frac{{d{x_1}}}{{dt}} = – 4{x_1} + {x_2} + {x_3}\]
\[\frac{{d{x_2}}}{{dt}} = {x_1} + 5{x_2} – {x_3}\]
\[\frac{{d{x_3}}}{{dt}} = {x_2} – 3{x_3}\]
Our point is that math might start looking more abstract from now on.
Begin as always by finding \(\det \left( {A – \lambda I} \right)\)
\[\det \left( {A – \lambda I} \right) = \left[ {\begin{array}{*{20}{c}}{ – 4 – \lambda }&1&1\\1&{5 – \lambda }&{ – 1}\\0&1&{ – 3 – \lambda }\end{array}} \right]\]
Find the determinant of a 3 by 3 matrix, see our example problems if you need practice.
Remember the cofactor matrix, don’t mess up positive/negative signs by mistake!
\[\left[ {\begin{array}{*{20}{c}} + & – & + \\ – & + & – \\ + & – & + \end{array}} \right]\]
You can take advantage and find the determinant along the third row because it has a 0 term and will reduce our computations significantly.
\[\det \left( {A – \lambda I} \right) = \left( { – 1} \right)\left| {\begin{array}{*{20}{c}}1&1\\{5 – \lambda }&{ – 1}\end{array}} \right| + \left( { – 3 – \lambda } \right)\left| {\begin{array}{*{20}{c}}{ – 4 – \lambda }&1\\1&{5 – \lambda }\end{array}} \right|\]
Now simplify the determinants of 2 by 2 matrices. It is a lot of algebra, but you will eventually find the roots of the characteristic equation above and find the eigenvalues:
\[{\lambda _1} = – 3\]
\[{\lambda _2} = – 4\]
\[{\lambda _3} = 5\]
You will need to plug each eigenvalue into the equation \(\left( {A – \lambda I} \right)K = 0\) to find the eigenvectors. There will be multiple possible eigenvectors, but in general choose simple numbers to make things easier.
Substituting in \({\lambda _1} = – 3\),
\[\left[ {\begin{array}{*{20}{c}}{ – 1}&1&1\\1&8&{ – 1}\\0&1&0\end{array}} \right]\left[ {\begin{array}{*{20}{c}}{{k_1}}\\{{k_2}}\\{{k_3}}\end{array}} \right] = \left[ {\begin{array}{*{20}{c}}0\\0\\0\end{array}} \right]\]
Using the first row, we can set \({k_2} = 0\), then \({k_1} = {k_3} = 1\).
\[{K_1} = \left[ {\begin{array}{*{20}{c}}1\\0\\1\end{array}} \right]\]
Next, use \({\lambda _2} = – 4\)
\[\left[ {\begin{array}{*{20}{c}}0&1&1\\1&9&{ – 1}\\0&1&1\end{array}} \right]\left[ {\begin{array}{*{20}{c}}{{k_1}}\\{{k_2}}\\{{k_3}}\end{array}} \right] = \left[ {\begin{array}{*{20}{c}}0\\0\\0\end{array}} \right]\]
Again, assume one of the k variables, then solve for the other k variables, as long as you check that left-side and right-side checks out, 0 = 0, then you’re fine.
\[{K_2} = \left[ {\begin{array}{*{20}{c}}{10}\\{ – 1}\\1\end{array}} \right]\]
Repeat for \({\lambda _3} = 5\)
\[\left[ {\begin{array}{*{20}{c}}{ – 9}&1&0\\1&0&{ – 1}\\0&1&{ – 8}\end{array}} \right]\left[ {\begin{array}{*{20}{c}}{{k_1}}\\{{k_2}}\\{{k_3}}\end{array}} \right] = \left[ {\begin{array}{*{20}{c}}0\\0\\0\end{array}} \right]\]
You can just use the second row, \({k_1} = {k_3}\), assume \({k_1} = 1\) and you can get,
\[{K_3} = \left[ {\begin{array}{*{20}{c}}1\\9\\1\end{array}} \right]\]
Remember that you can get different eigenvectors and the answer is still correct.
If your instructor wanted you to all get the same answer, they would include an initial condition, the initial condition would allow you to solve for the c constant variables and you make everybody get the exact same answer.
Remember to put the eigenvectors with the e to the power of the eigenvalue you found.
The final solution would be:
\[x(t) = {c_1}\left[ {\begin{array}{*{20}{c}}1\\0\\1\end{array}} \right]{e^{ – 3t}} + {c_2}\left[ {\begin{array}{*{20}{c}}{10}\\{ – 1}\\1\end{array}} \right]{e^{ – 4t}} + {c_3}\left[ {\begin{array}{*{20}{c}}1\\8\\1\end{array}} \right]{e^{5t}}\]
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) x3(t)
A = [-4 1 1; 1 5 -1; 0 1 -3];
B = [0; 0; 0];
Y = [x1; x2; x3];
odes = diff(Y) == A*Y + B
[x1Sol(t), x2Sol(t), x3Sol(t)] = dsolve(odes)
x1Sol(t) = simplify(x1Sol(t))
x2Sol(t) = simplify(x2Sol(t))
x3Sol(t) = simplify(x3Sol(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!