---
title: "First-Order Linear Systems of ODEs"
source: https://www.jemoka.com/posts/kbhsystems_of_odes/
---

Consider the case where there are two functions interacting with each other:
\begin{equation} y_1(t) \dots y_{2}(t) \end{equation}
So we have more than one dependent function, with functions \(y_1, y_1&rsquo;, y_2, y_2&rsquo;\) and so forth. To deal with this, we simply make it into a matrix system:
\begin{equation} y(t) = \mqty(y_1(t) \\ \dots \\ y_{n}(t)) \end{equation}
For instance, should we have:
\begin{equation} \begin{cases} y_1&rsquo; = 3y_1 - 2y_2 \\ y_2&rsquo; = -y_1 + 5y_2 \end{cases} \end{equation}
We can write this system in a matrix like such:
\begin{equation} y&rsquo;(t) = \mqty(3 &amp; -2 \\ -1 &amp; 5) y(t) \end{equation}
Meaning:
\begin{equation} y&rsquo; = Ay \end{equation}
which is a single linear equation.
Recall that we had:
\begin{equation} y&rsquo; = Ay \end{equation}
Let \(v\) be an eigenvector of \(A\) with \(\lambda\) be an eigenvalue. Let us guess that \(y = e^{\lambda t} v\) is a solution.
Plugging this in, we have:
\begin{equation} y&rsquo; = Ay = A(e^{\lambda t} v) = e^{\lambda t} Av = \lambda e^{\lambda t} v \end{equation}
Of course, \(y&rsquo; = \lambda e^{\lambda t} v\).
Meaning this is a solution of our system. Recall finding eigenvalues with actual numbers, so we want some \(\lambda\) for which \(det(A-\lambda I)=0\).
Plugging the eigenvalues back, and recalling the superposition principle, we are left with some:
\begin{equation} y(t) = c_1 e^{\lambda_{1}} v_1 + \dots + c_{n} e^{\lambda_{n}} v_{n} \end{equation}
This is true if we have enough eigenvalues which forms a basis. Now, at \(y(0)\), we have some \(y_0 = c_1v_1 + &hellip; + c_{n}v_{n}\).
This yields a system \(y_{0} = \mqty[v_1 &amp; \dots &amp; v_{n}] \mqty[c_1 \\ \dots \\ c_{n}]\).
We call this matrix written in terms of eigenvectors \(E\), that is:
\begin{equation} E = \mqty[v_1 &amp; \dots &amp; v_{n}] \end{equation}
Finally, we have:
\begin{equation} \mqty[c_1 \\ \dots \\ c_{n}] = E^{-1} y_0 \end{equation}
This method works for cases where we have enough independent eigenvectors to admit enough initial conditions. Otherwise, matrix exponentiation.
Special Cases 2x2 with \(\lambda_{2} = \bar{\lambda_{1}}\) For any two by two system, where there the eigenvalues are conjugates of each other, we can formulate a solution in the form:
\begin{equation} y(t) = c_1 Re(e^{\lambda t} v) + c_2 Im(e^{\lambda t}v) \end{equation}
if the matrix representing the system admits two eigenvalues, \(\lambda\) and \(\bar{\lambda}\). We can obtain this by rephrasing one solution as \(e^{\lambda t} = e^{a + ib} e^{t} = e^{a+t}(\cos b + i\sin b)\).
Tips and Tricks Changing higher order system into lower orders We can actually write higher order linear system this way too:
\begin{equation} y&rsquo;&rsquo; + ay&rsquo; + by = 0 \end{equation}
we can actually construct:
\begin{align} &amp; y_1(t) = y(t) \\ &amp; y_2(t) = y&rsquo;(t) \end{align}
And therefore, we can construct:
\begin{equation} \mqty(y_1 \\ y_2)&rsquo; = \mqty(y_2 \\ -by1 - ay2) = \mqty(0 &amp; 1 \\ -b &amp;-a) \mqty(y_1 \\ y_2) \end{equation}
