Dynamical Systems:
Matrix Exponential
Table of Contents
1. Matrix Exponential¶
The matrix exponential provides a powerful tool for solving systems of linear differential equations, generalizing the familiar scalar exponential function.
Scalar Case: A Starting Point
Consider the first-order linear scalar differential equation:
$$ \dot{u}(t) = a u(t). $$
Its solution is:
$$ u(t) = e^{at} u(0). $$
Extension to Vector Case (Matrix)
For a linear system of ODEs:
$$ \dot{\vec{u}}(t) = A \vec{u}(t), $$
the solution is:
$$ \vec{u}(t) = e^{A t} \vec{u}(0), $$
where $e^{A t}$ is the matrix exponential.
1.1. Matrix Exponential¶
Matrix Exponential of a Diagonal Matrix (Intuition)
If $A = \Lambda$ is diagonal:
$$ \Lambda = \begin{bmatrix} \lambda_1 & & \\ & \ddots & \\ & & \lambda_n \end{bmatrix}, $$
then:
$$ e^{\Lambda t} = \begin{bmatrix} e^{\lambda_1 t} & & 0 \\ & \ddots & \\ 0 & & e^{\lambda_n t} \end{bmatrix}. $$
Diagonalization and Similarity
If $A$ is diagonalizable, we have:
$$ A = S \Lambda S^{-1}, \quad \text{where } \Lambda \text{ is diagonal}, S \text{ contains eigenvectors}. $$
Thus:
$$ e^{A t} = S e^{\Lambda t} S^{-1}. $$
The Exponential Function
Recall the scalar exponential series:
$$ e^x = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \cdots. $$
The derivative satisfies:
$$ \frac{d}{dx} e^x = e^x, $$
which is why $e^x$ solves $\dot{y} = y$.
The Matrix Exponential Series
Similarly, for matrices:
$$ e^A = I + A + \frac{A^2}{2!} + \frac{A^3}{3!} + \cdots, $$
and:
$$ e^{A t} = I + A t + \frac{A^2 t^2}{2!} + \frac{A^3 t^3}{3!} + \cdots. $$
Differentiating the matrix exponential with respect to $t$:
$$ \frac{d}{dt} e^{A t} = A e^{A t}. $$
Similarity Transformation of Exponentials
If $A = S \Lambda S^{-1}$, then:
$$ \begin{align*} e^{A} &= e^{S \Lambda S^{-1}} \\ &= I + S \Lambda S^{-1} + \frac{S \Lambda^2 S^{-1}}{2!} + \cdots \\ &= S \left( I + \Lambda + \frac{\Lambda^2}{2!} + \cdots \right) S^{-1} \\ &= S e^{\Lambda} S^{-1}. \end{align*} $$
Similarly:
$$ e^{A t} = S e^{\Lambda t} S^{-1}. $$
This framework connects solutions of linear systems, eigenvalues, and eigenvectors, and leads naturally to applications such as system stability analysis, modal decomposition, and control design.
1.2. Examples of Matrix Exponential¶
We now illustrate matrix exponentials with explicit examples.
Example 1: Diagonal Matrix
Let:
$$ A = \begin{bmatrix} 2 & 0 \\ 0 & -1 \end{bmatrix}. $$
Since $A$ is diagonal, its exponential is:
$$ e^{A t} = \begin{bmatrix} e^{2t} & 0 \\ 0 & e^{-t} \end{bmatrix}. $$
Thus, the solution of:
$$ \dot{\vec{u}} = A \vec{u}, \quad \vec{u}(0) = \begin{bmatrix} u_1(0) \\ u_2(0) \end{bmatrix}, $$
is:
$$ \vec{u}(t) = \begin{bmatrix} e^{2t} u_1(0) \\ e^{-t} u_2(0) \end{bmatrix}. $$
Example 2: Non-Diagonalizable Matrix
Let:
$$ A = \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix}. $$
Compute:
$$ A^2 = \begin{bmatrix} 0 & 0 \\ 0 & 0 \end{bmatrix}. $$
Thus:
$$ e^{A t} = I + A t = \begin{bmatrix} 1 & t \\ 0 & 1 \end{bmatrix}. $$
The system:
$$ \dot{\vec{u}} = A \vec{u}, \quad \vec{u}(0) = \begin{bmatrix} u_1(0) \\ u_2(0) \end{bmatrix}, $$
has solution:
$$ \vec{u}(t) = \begin{bmatrix} u_1(0) + t u_2(0) \\ u_2(0) \end{bmatrix}. $$
Example 3: Diagonalizable Matrix
Let:
$$ A = \begin{bmatrix} 3 & 1 \\ 0 & 2 \end{bmatrix}. $$
Find eigenvalues: $\lambda_1=3$, $\lambda_2=2$.
Eigenvectors:
$$ \vec{x}_1 = \begin{bmatrix} 1 \\ 0 \end{bmatrix}, \quad \vec{x}_2 = \begin{bmatrix} 1 \\ -1 \end{bmatrix}. $$
Thus:
$$ S = \begin{bmatrix} 1 & 1 \\ 0 & -1 \end{bmatrix}, \quad \Lambda = \begin{bmatrix} 3 & 0 \\ 0 & 2 \end{bmatrix}. $$
We can compute:
$$ S^{-1} = \begin{bmatrix} 1 & 1 \\ 0 & -1 \end{bmatrix}^{-1} = \begin{bmatrix} 1 & 1 \\ 0 & -1 \end{bmatrix}^{-1} = \frac{1}{-1} \begin{bmatrix} -1 & -1 \\ 0 & 1 \end{bmatrix}. $$
Then:
$$ e^{A t} = S e^{\Lambda t} S^{-1} = \begin{bmatrix} 1 & 1 \\ 0 & -1 \end{bmatrix} \begin{bmatrix} e^{3t} & 0 \\ 0 & e^{2t} \end{bmatrix} S^{-1}. $$
2. MATLAB Implementation¶
Consider the state-space system:
$$ \begin{align*} \left[ {\begin{matrix} \dot{x}_1 \\ \dot{x}_2 \\ \end{matrix} } \right] &= \left[ {\begin{matrix} 0 & 1 \\ -\omega_n^2 & -2\zeta \omega_n \\ \end{matrix} } \right] \left[ {\begin{array}{cc} x_1 \\ x_2 \\ \end{array} } \right] \\ \\y & = \left[ {\begin{matrix} 1 & 0 \end{matrix} } \right] \left[ {\begin{array}{cc} x_1 \\ x_2 \\ \end{array} } \right] \end{align*} $$
With parameters: $\omega_n = 2$, and $\zeta = 0.1$
MATLAB Code
% method 1: use expm (matrix exponential)
wn = 2; zeta = 0.1;
A = [0 1;-wn^2 -2*zeta*wn];
x0 = [1; 0];
t = linspace(0,20,200);
x = [];
for i = 1:length(t)
x = [x, expm(A*t(i))*x0];
end
plot(t,x(1,:),t,zeros(size(t)),'--k')
Other Lectures
from IPython.display import YouTubeVideo
YouTubeVideo('IZqwi0wJovM?start=1755', width = "560", height = "315")
from IPython.display import YouTubeVideo
YouTubeVideo('qbyeQum8qTE', width = "560", height = "315")
from IPython.display import YouTubeVideo
YouTubeVideo('dZfdKXxhnTM', width = "560", height = "315")
%%javascript
$.getScript('https://kmahelona.github.io/ipython_notebook_goodies/ipython_notebook_toc.js')