# Solving ODE-systems with Matrix exponential is wrong?

Originally I've learned that the solution of a systems of coupled ODE:

$$\underbrace{\left[\begin{array}{cc}{y_1}'(x)\\ \vdots \\{y_n}'(x)\end{array}\right]}_{y'(x)}= \underbrace{\left[\begin{array}{cccc}&a_{1\,1} &\cdots &a_{1\,n} \\ &\vdots \quad &&\vdots \\ &a_{n\,1}&\cdots&a_{n\,n}\end{array}\right]}_{A}\, \underbrace{\left[\begin{array}{cc}{y_1}(x)\\ \vdots \\{y_n}(x)\end{array}\right]}_{y(x)}$$

is determined by: $$y(x) = \exp(A\,x)\,C$$ where $$C$$ is a vector with constants $$\left[\begin{array}{cc}C_1\\ \vdots \\C_n\end{array}\right]$$ and $$\exp(A\,x)$$ the matrix exponential, that can be at best calculated by: $$\exp(A\,x) = V^{-1}\,\exp(\Lambda\,x)\,V$$ where $$V$$ is a vector full of Eigenvectors: $$\left[\begin{array}{cc}v_1&\cdots&v_n\end{array}\right]$$

and $$\Lambda$$ a matrix full of Eigenvalues on its main diagonal: $$\left[\begin{array}{ccc}\lambda_1&\\ &\ddots\\&&v_n\end{array}\right]$$

Now apparently this leads to another solution compared to: $$y(x) = c_1\,v_1\,\exp(\lambda_1\,x)+\cdots+c_n\,v_n\,\exp(\lambda_n\,x)$$

Even if one told me both solutions were to solve a system of ODE

For example consider the system:

$$\left(\begin{array}{cc}{y_1}'(x) \\ {y_2}'(x)\end{array}\right) = \left(\begin{array}{cc} 4 & 10\\ 8 & 2 \end{array}\right)\,\left(\begin{array}{cc}{y_1}(x) \\ {y_2}(x)\end{array}\right)$$ with Eigenvalues $$\lambda_1 = 12, \lambda_2 = -6$$ and Eigenvectors: $$v_1 = \left(\begin{array}{cc}1 \\ 8/10\end{array}\right), v_2 = \left(\begin{array}{cc}1 \\ -1\end{array}\right)$$

According to the second plain solution process I'd obtain:

$$\left(\begin{array}{cc}{y_1}(x) \\ {y_2}(x)\end{array}\right) = \left(\begin{array}{cc}1 \\ 8/10\end{array}\right)\,\exp(12\,x)+\left(\begin{array}{cc}1 \\ -1\end{array}\right)\,\exp(-6\,x)$$

However the matrix exponential spits:

$$\left(\begin{array}{cc}{y_1}(x) \\ {y_2}(x)\end{array}\right) = C\,\left(\begin{array}{cc} \frac{4\,{\mathrm{e}}^{-6\,x}}{9}+\frac{5\,{\mathrm{e}}^{12\,x}}{9} & \frac{5\,{\mathrm{e}}^{12\,x}}{9}-\frac{5\,{\mathrm{e}}^{-6\,x}}{9}\\ \frac{4\,{\mathrm{e}}^{12\,x}}{9}-\frac{4\,{\mathrm{e}}^{-6\,x}}{9} & \frac{5\,{\mathrm{e}}^{-6\,x}}{9}+\frac{4\,{\mathrm{e}}^{12\,x}}{9} \end{array}\right)\,$$

Probably those two are inconvenient, because the constants are set differently. In fact the second approach is independent of constants somehow. So how's that all in relation with each other?

• Note that it should be $\exp(A\,x) = V^{-1}\,e^{\Lambda x}\,V$. Also it should be $e^{Ax} C$ instead of $C e^{Ax}$. – Arctic Char Jun 10 at 19:23
• Also, your "another solution" is wrong: it should be $y(x) = c_1 v_1\,\exp(\lambda_1\,x)+\cdots+c_nv_n\,\exp(\lambda_n\,x)$. – Arctic Char Jun 10 at 19:24
• Now I read it again: it should be $A = V \Lambda V^{-1}$ (since $AV = V\Lambda$). – Arctic Char Jun 10 at 20:17

We have

$$\left(\begin{array}{cc}{y_1}'(x) \\ {y_2}'(x)\end{array}\right) = \left(\begin{array}{cc} 4 & 10\\ 8 & 2 \end{array}\right)\,\left(\begin{array}{cc}{y_1}(x) \\ {y_2}(x)\end{array}\right)$$

The eigenvalues are

$$\lambda_1 = 12, ~~\lambda_2 = -6$$

The eigenvectors are

$$v_1 = \begin{pmatrix} 5 \\ 4 \end{pmatrix}, ~~v_2 = \begin{pmatrix} -1 \\ 1 \end{pmatrix}$$

The solution can written as

$$y(x) = c_1 e^{\lambda_1 x} v_1 + c_2 e^{\lambda_2 x} v_2 = c_1 e^{12 x}\begin{pmatrix} 5 \\ 4 \end{pmatrix} + c_2 e^{-6x}\begin{pmatrix} -1 \\ 1 \end{pmatrix}$$

We can also use the matrix exponential

$$e^{A x} = P e^{Dx} P^{-1} = \begin{pmatrix} 5 & -1 \\ 4 & 1 \end{pmatrix}\begin{pmatrix} e^{12x} &0 \\ 0 & e^{-6x} \end{pmatrix} \begin{pmatrix} \dfrac{1}{9} & \dfrac{1}{9} \\ -\dfrac{4}{9} & \dfrac{5}{9} \\ \end{pmatrix} = \begin{pmatrix} \dfrac{4 e^{-6 x}}{9}+\dfrac{5 e^{12 x}}{9} & \dfrac{-5}{9} e^{-6 x}+\dfrac{5 e^{12 x}}{9} \\ \dfrac{-4}{9} e^{-6 x}+\dfrac{4 e^{12 x}}{9} & \dfrac{5 e^{-6 x}}{9}+\dfrac{4 e^{12 x}}{9} \\ \end{pmatrix}$$

The solution using the matrix exponential is given by

$$y(x) = e^{Ax} c = \left( \begin{array}{c} c_1 \left(\dfrac{4 e^{-6 x}}{9}+\dfrac{5 e^{12 x}}{9}\right)+c_2 \left(\dfrac{-5}{9}e^{-6 x}+\dfrac{5 e^{12 x}}{9}\right) \\ c_1 \left(\dfrac{-4}{9} e^{-6 x}+\dfrac{4 e^{12 x}}{9}\right)+c_2 \left(\dfrac{5 e^{-6 x}}{9}+\dfrac{4 e^{12 x}}{9}\right) \\ \end{array} \right)$$

Compare the two results while noting that you can combine constants because they are arbitrary.

Also, if you choose an initial condition, both methods produce exactly the same result.

• Thanks for writing it all out. I feel like I'm almost there of being convinced, if I just would find a way of how to combine the constants. E.g. in the first column I could factor: $(c_1\,\dfrac{4}{9}+c_2\,\dfrac{-5}{9})\,\exp(-6\,x)+(c_1\,\dfrac{5}{9}+c_2\,\dfrac{5}{9})\,\exp(-12\,x)$ What wouldn't equal the first line of the others method. Only by looking at $c_1 = c_2 = 1$ – Leon Jun 10 at 21:17
• Try it this way, let $y_1(0) = 1, y_2(0) = 1$ and solve for the constants in each method. What do you get? – Moo Jun 10 at 21:31
• Well, I'll get ... $y_1: \quad 1 = c_1\,\dfrac{4}{9}+\dfrac{5}{9}+c_2 \dfrac{-5}{9}+\dfrac{5}{9} \Rightarrow c_1 = 1$ Likewise for $y_2$ I'll get $1$ ? What is this telling me? If I set to $0$ the other one we have: $1 = c_1\,5-c_2; \quad 1 = 4\,c_1 + c_2$. Doing these calculations quickly I still receive no confirmation, even if I sense the direction in which you want me to go. – Leon Jun 10 at 21:42
• If you finish the calculations in both, you get exactly the same result of $$y_1(x) = \dfrac{10 e^{12 x}}{9}-\frac{1}{9} e^{-6 x},y_2(x) = \frac{e^{-6 x}}{9}+\frac{8 e^{12 x}}{9}$$ – Moo Jun 10 at 21:45
• Ahh, now I see them, those sneaky little patterns. They were really hidden for my prying eyes! Thank you for highlighting them. – Leon Jun 10 at 21:52

There are two expressions $$\tag{1} y(x) = \exp(Ax) C,$$ and $$\tag{2} y(x) = c_1 v_1\exp(\lambda _1 x) + \cdots + c_n v_n \exp(\lambda _n x),$$ where $$C = \begin{pmatrix} C_1 \\ \vdots \\ C_n\end{pmatrix}$$ and we write $$c = \begin{pmatrix} c_1 \\ \vdots \\ c_n\end{pmatrix}$$.

Since we know $$\exp(Ax) = V \exp(\Lambda x) V^{-1}$$,

\begin{align} \exp(Ax) C &= V \exp(\Lambda x) V^{-1} C \\ &=\begin{pmatrix} v_1 & \cdots & v_n\end{pmatrix} \begin{pmatrix} \exp(\lambda_1 x) & & \\ & \ddots & \\ & & \exp(\lambda_n x) \end{pmatrix} V^{-1}C \\ &= \begin{pmatrix} \exp(\lambda_1 x) v_1 & \cdots & \exp(\lambda_n x)v_n\end{pmatrix} V^{-1}C \end{align}

since (2) can be written as $$\begin{pmatrix} \exp(\lambda_1 x) v_1 & \cdots & \exp(\lambda_n x)v_n\end{pmatrix} c$$, we see that $$C$$ and $$c$$ has a simple relation $$C = Vc.$$

• Thank you, this specifies the pattern I have been detecting: $c = V^{-1}\,C$ – Leon Jun 14 at 20:34