# Integral of matrix exponential

Let $A$ be an $n \times n$ matrix. Then the solution of the initial value problem \begin{align*} \dot{x}(t) = A x(t), \quad x(0) = x_0 \end{align*} is given by $x(t) = \mathrm{e}^{At} x_0$.

I am interested in the following matrix \begin{align*} \int_{0}^T \mathrm{e}^{At}\, dt \end{align*} for some $T>0$. Can one write down a general solution to this without distinguishing cases (e.g. $A$ nonsingular)?

Is this matrix always invertible?

• you can represent matrix exponential by power series – dato datuashvili Jan 31 '14 at 9:52
• en.wikipedia.org/wiki/Matrix_exponential – dato datuashvili Jan 31 '14 at 9:52
• Spectral theorem says that if you take analytical function $f$, apply it to the matrix $A$ (its eigenvaules has to be in the domain of analaticity of $f$), then eigenvalues of $f(A)$ are $f(\text{eigenvalues of } A)$. Exponent is never zero, hence $\exp(A)$ is always invertible, moreover, $\exp(A)^{-1}=\exp(-A)$. – TZakrevskiy Jan 31 '14 at 10:05

Case I. If $A$ is nonsingular, then $$\int_0^T\mathrm{e}^{tA}\,dt=A^{-1}\big(\mathrm{e}^{TA}-I\big),$$ where $I$ is the identity matrix.

Case II. If $A$ is singular, then using the Jordan form we can write $A$ as $$A=U^{-1}\left(\begin{matrix}B&0\\0&C\end{matrix}\right)U,$$ where $C$ is nonsingular, and $B$ is strictly upper triangular. Then $$\mathrm{e}^{tA}=U^{-1}\left(\begin{matrix}\mathrm{e}^{tB}&0\\0&\mathrm{e}^{tC} \end{matrix}\right)U,$$ and $$\int_0^T\mathrm{e}^{tA}\,dt=U^{-1}\left(\begin{matrix}\int_0^T\mathrm{e}^{tB}dt&0\\0&C^{-1}\big(\mathrm{e}^{TC}-I\big) \end{matrix}\right)U$$ But $\int_0^T\mathrm{e}^{tB}dt$ may have different expressions. For example if $$B_1=\left(\begin{matrix}0&0\\0&0\end{matrix}\right), \quad B_2=\left(\begin{matrix}0&1\\0&0\end{matrix}\right),$$ then $$\int_0^T\mathrm{e}^{tB_1}dt=\left(\begin{matrix}T&0\\0&T\end{matrix}\right), \quad \int_0^T\mathrm{e}^{tB_2}dt=\left(\begin{matrix}T&T^2/2\\0&T\end{matrix}\right).$$

• What we will do if we use $A(t)$ instead of $tA$ – Nirvana Oct 6 '14 at 8:06
• There is nothing wrong with that. – Yiorgos S. Smyrlis Oct 6 '14 at 10:22
• @ Yiorgos S. Smyrlis So you are saying even if $A(t)$ and $A^{'}(t)$ are not commutative,this will work – Nirvana Oct 6 '14 at 10:28
• Here A is not a constant matrix. It is a variable matrix – Nirvana Oct 6 '14 at 10:28
• I am talking about $\int e^{A(t)} \ dt$ – Nirvana Oct 6 '14 at 10:33

The general formula is the power series

$$\int_0^T e^{At} dt = T \left( I + \frac{AT}{2!} + \frac{(AT)^2}{3!} + \dots + \frac{(AT)^{n-1}}{n!} + \dots \right)$$

Note that also

$$\left(\int_0^T e^{At} dt \right) A + I = e^{AT}$$

is always satisfied.

A sufficient condition for this matrix to be non-singular is the so-called Kalman-Ho-Narendra Theorem, which states that the matrix $\int_0^T e^{At} dt$ is invertible if

$$T(\mu - \lambda) \neq 2k \pi i$$

for any nonzero integer $k$, where $\lambda$ and $\mu$ are any pair of eigenvalues of $A$.

Note to the interested: This matrix also comes from the discretization of a continuous linear time invariant system. It can also be said that controllability is preserved under discretization if and only if this matrix has an inverse.

• Thank you. This answer looks very promising. Btw, I am looking at this matrix exactly because of what you said about the discretization! – samsa44 Feb 24 '14 at 11:19

## A Python numerical answer

It is surprisingly difficult to find a proper python package for numerical integration of matrix. I know it is not what the question want but I cannot find anywhere else to publish this.

Here, I provide a numerical solution to it. Just call the function

intergral_result = compute_exp_matrix_intergration(A,T)


will be enough

import numpy as np
def compute_exp_matrix_intergration(A,T,nbins=100):
f = lambda x: expm(A*x)
xv = np.linspace(0,T,nbins)
result = np.apply_along_axis(f,0,xv.reshape(1,-1))
return np.trapz(result,xv)

• I get a shape error in result = ... . Also, to whoever it may help: the expm is from scipy.linalg. – anderstood Jan 29 at 14:13

# Another Python implementation

Here is another implementation in Python, if it can be helpful to anyone... (and since ArtificiallyIntelligence's answer returns an error in my setup). The value of the integral is integral and the last line verifies the equality $$\int_0^T e^{At}dt = A^{-1}(e^{tA}-I)$$, provided $$A$$ is nonsingular (which is generically the case for randomly generated matrices).

import numpy as np
N = 5
t = 1
A = np.random.rand(N,N)
taylor = t*np.array([np.linalg.matrix_power(A*t,k)/np.math.factorial(k+1) for k in range(50)])
integral = taylor.sum(axis = 0)

print np.linalg.norm(integral - np.dot(np.linalg.inv(A),scipy.linalg.expm(t*A)-np.identity(N)))


Note that you should adjust the 50 in taylor = ... to check convergence.