The matrix exponential function
- What is the matrix exponential?
- How do I use the matrix exponential to solve a linear system?
- How do I use the matrix exponential to solve state space models?
What is the matrix exponential?
The matrix exponential of a square matrix $M$ is the infinite series
\[e^M = I + M + \frac{1}{2}M^2 + \frac{1}{6}M^3 + \dotsm = \sum_{k=0}^{\infty} \dfrac{1}{k !} M^k\]where $I$ is the identity matrix. This series converges for any square matrix $M$.
How do I use the matrix exponential to solve a linear system?
The solution to the set of linear ODEs
\[\dot{x} = Fx\]with the initial condition
\[x(t_0) = x_0\]is
\[x(t) = e^{F (t - t_0)} x_0.\]How do we know that this solution is correct? First, let’s check that this solution satisfies the ODEs:
\[\begin{aligned} \dot{x} &= \frac{d}{dt} \left( e^{F (t - t_0)} x_0 \right) \\ &= \frac{d}{dt} \left( \left( I + F(t-t_0) + \frac{1}{2} F^2(t-t_0)^2 + \frac{1}{6} F^2(t-t_0)^3 + \dotsm \right) x_0 \right) \\ &= \frac{d}{dt} \left( I + F(t-t_0) + \frac{1}{2} F^2(t-t_0)^2 + \frac{1}{6} F^3(t-t_0)^3 + \dotsm \right) x_0 \\ &= \left( \frac{d}{dt} \left( I \right) + \frac{d}{dt} \left( F(t-t_0) \right) + \frac{d}{dt} \left( \frac{1}{2} F^2(t-t_0)^2 \right) + \frac{d}{dt} \left( \frac{1}{6} F^3(t-t_0)^3 \right) \dotsm \right) x_0 \\ &= \left( 0 + F + F^2(t-t_0) + \frac{1}{2} F^3(t-t_0) + \dotsm \right) x_0 \\ &= F \left(I + F(t-t_0) + \frac{1}{2} F^2(t-t_0)^2 + \dotsm \right) x_0 \\ &= F e^{F(t-t_0)} x_0 \end{aligned}\]Apparently, it does. Second, let’s check that this solution satisfies the initial condition:
\[\begin{aligned} x(t_0) &= e^{F(t_0 - t_0)} x_0 \\ &= e^0 x_0 \\ &= I x_0 \\ &= x_0 \end{aligned}\]Again, it does. (We might wonder if this is the only solution to the original ODEs — it is, although a proof would require more work.)
How do I use the matrix exponential to solve state space models?
Consider the state space model
\[\dot{x} = Ax + Bu\]This model does not look the same as
\[\dot{x} = Fx\]Indeed, without specifying $u$, we cannot solve for $x$ as a function of time. However, particular choices of $u$ allow us to simplify the state space model. For example, if we choose $u = 0$, then we can write
\[\begin{aligned} \dot{x} &= Ax+Bu \\ &= Ax + B \cdot (0) \\ &= Ax + 0 \\ &= Ax \end{aligned}\]and so we are right back at a linear system that can be solved with the matrix exponential. Another common choice of $u$ is
\[u = -Kx\]for some constant matrix $K$. (What would the size of $K$ have to be for us to define $u$ in this way?) This choice of $u$ is called state feedback, since the input depends on the state. If we plug this choice into our state space model, then we can write
\[\begin{aligned} \dot{x} &= Ax + Bu \\ &= Ax + B(-Kx) \\ &= (A - BK) x \end{aligned}\]and so — just like before — we are right back at a linear system that can be solved with the matrix exponential. Although this result will get us a long way, we will see how to solve state space models for other choices of input later on.
Given the state-space model
\[\dot{x} = Ax + Bu\]it is standard to call the system
\[\dot{x} = Ax\]that results from the application of zero input $u=0$ the open-loop system. Similarly, it is standard to call the system
\[\dot{x} = (A - BK) x\]that results from the application of linear state feedback $u = -Kx$ the closed-loop system. Remember that “zero input” is not necessarily the same as “zero actuator commands.” When linearizing equations of motion to derive a state space model, we defined
\[u = n - n_e\]where $n$ was the set of actuator commands and $n_e$ was the value of these commands at equilibrium. So,
\[u = 0\]actually means
\[n = n_e.\]Similarly,
\[u = -Kx\]actually means
\[n = n_e - Kx = n_e - K(m - m_e).\]The term $n_e$ is typically referred to as feedforward and the term $-K(m - m_e)$ is typically referred to as feedback.