Search

Search papers and lessons

Matrix Exponential

Level 3 · 12 min read

The matrix exponential e^A is the power series of e^x with a square matrix in place of x, and it solves linear systems of differential equations x' = Ax.

On this page

  • Colour = topic mix
  • Linear algebra
  • Discrete math
  • Sign in to see your progress

TL;DR

The exponential of a number, exe^x, can be written as a power series: 1+x+x2/2!+x3/3!+⋯1 + x + x^2/2! + x^3/3! + \cdots. The matrix exponential eAe^A uses the same series with a square matrix AA in place of xx. The result is another square matrix of the same size.

Its main job is to solve linear systems of differential equations. If a vector x\mathbf{x} changes according to x′=Ax\mathbf{x}' = A\mathbf{x}, then x(t)=etAx(0)\mathbf{x}(t) = e^{tA}\mathbf{x}(0).

Where you'll see it: in continuous-time Markov chains and population models, in linear control systems, and in quantum mechanics, where the time evolution of a state is e−iHt/ℏe^{-iHt/\hbar}.

Intuition

Growth that is a matrix

Start with a scalar. The equation x′=axx' = ax says the quantity grows at a rate proportional to itself, and its solution is x(t)=eatx(0)x(t) = e^{at}x(0). The number eate^{at} is a multiplier: after time tt, the value is scaled by that factor.

Now suppose you have several quantities that feed into each other. Each one changes at a rate that depends on the others. Write them as a vector x\mathbf{x}, and the rule becomes x′=Ax\mathbf{x}' = A\mathbf{x} with a matrix AA that records who feeds whom. The scalar multiplier eate^{at} has to become a matrix multiplier, and that matrix is etAe^{tA}. The matrix exponential is exactly the object that does for systems what eate^{at} does for a single quantity.

Why a power series? Because it is the one definition that needs nothing but multiplication and addition. Matrices cannot be plugged into exe^x directly, but they can be multiplied and added, so the series makes sense. Summing the series gives a matrix that behaves like exe^x in the ways that matter.

00.511.5200.20.40.60.81tstate
  • x₂(t) = e^(-2t)
  • x₁(t) = e^(-t) - e^(-2t)
Both components of the solution to the system in Worked example 3. Each one decays, and the coupled one first rises and then falls.

The math

Definition: Matrix exponential

For a square matrix AA of size n×nn \times n, the matrix exponential is

eA=∑k=0∞Akk!=I+A+A22!+A33!+⋯e^{A} = \sum_{k=0}^{\infty} \frac{A^{k}}{k!} = I + A + \frac{A^{2}}{2!} + \frac{A^{3}}{3!} + \cdots

where A0=IA^{0} = I is the identity matrix and k!k! is the factorial of kk. The series converges for every square matrix AA, and eAe^{A} is an n×nn \times n matrix.

Each term Ak/k!A^k/k! is a matrix. The sum is taken entry by entry: for each position in the grid, you add up the corresponding entries of all the terms. The terms shrink fast, because k!k! grows much faster than ∥A∥k\|A\|^k for any fixed size of AA, so a handful of terms is often enough for a small matrix.

Basic properties

These follow directly from the series, and you will use them constantly.

  1. e0=Ie^{0} = I, the identity matrix. The zero matrix in the exponent gives the identity back.
  2. (eA)−1=e−A(e^{A})^{-1} = e^{-A}. So eAe^{A} is always invertible, even when AA is not.
  3. If AB=BAAB = BA (the two matrices commute), then eA+B=eAeBe^{A+B} = e^{A}e^{B}.
  4. For scalars ss and tt, e(s+t)A=esAetAe^{(s+t)A} = e^{sA}e^{tA}, because sAsA and tAtA commute. This is the time-stepping rule: evolving for time ss and then for time tt is the same as evolving for s+ts+t.

Property 3 needs commuting matrices. Without it, the identity fails, and Worked example 2 shows a concrete failure.

The time derivative

Differentiate the series term by term, with tt inside: ddtetA=∑k≥1ktk−1Akk!=A∑k≥1(tA)k−1(k−1)!=A etA\frac{d}{dt}e^{tA} = \sum_{k \ge 1} \frac{k t^{k-1} A^{k}}{k!} = A\sum_{k \ge 1}\frac{(tA)^{k-1}}{(k-1)!} = A\,e^{tA}. Since AA commutes with etAe^{tA} (both are built from powers of AA), the same result holds in either order. This is the key fact:

So the function x(t)=etAx0\mathbf{x}(t) = e^{tA}\mathbf{x}_0 satisfies x′(t)=A x(t)\mathbf{x}'(t) = A\,\mathbf{x}(t) and x(0)=x0\mathbf{x}(0) = \mathbf{x}_0. Because the solution of such a linear system is unique, this is the solution.

Diagonal and diagonalizable matrices

Computing the series term by term is slow. If AA can be diagonalised, the work becomes much smaller. Suppose A=VDV−1A = V D V^{-1}, where DD is diagonal with the eigenvalues λ1,…,λn\lambda_1, \dots, \lambda_n on its diagonal and VV holds the eigenvectors as columns. Then Ak=VDkV−1A^{k} = V D^{k} V^{-1}, because the middle factors cancel. Substituting into the series:

eA=V eD V−1,eD=diag⁡(eλ1,…,eλn).e^{A} = V\,e^{D}\,V^{-1}, \qquad e^{D} = \operatorname{diag}\left(e^{\lambda_1}, \dots, e^{\lambda_n}\right).

Exponentiating a diagonal matrix only exponentiates each entry. The hard part is then just finding VV, which is the eigenvector problem.

Nilpotent matrices

A matrix NN is nilpotent if Nm=0N^{m} = 0 for some mm. Then the series stops after finitely many terms, and eNe^{N} is a polynomial in NN. The simplest case is N2=0N^2 = 0, where eN=I+Ne^{N} = I + N exactly.

Worked examples

Example
1. A diagonal matrix, by hand

Let A=(1002)A = \begin{pmatrix} 1 & 0 \\ 0 & 2 \end{pmatrix}. Find eAe^{A}.

  1. Powers of a diagonal matrix are diagonal with entries raised to that power: Ak=(1002k)A^{k} = \begin{pmatrix} 1 & 0 \\ 0 & 2^{k} \end{pmatrix}.
  2. Plug into the series, entry by entry. The top-left entry is ∑k1k/k!=e\sum_k 1^k/k! = e. The bottom-right entry is ∑k2k/k!=e2\sum_k 2^k/k! = e^{2}.
  3. So eA=(e00e2)≈(2.718007.389)e^{A} = \begin{pmatrix} e & 0 \\ 0 & e^{2} \end{pmatrix} \approx \begin{pmatrix} 2.718 & 0 \\ 0 & 7.389 \end{pmatrix}.

Interpretation: each direction of the system gets its own growth factor, ee along the first axis and e2e^2 along the second. Nothing mixes between directions, because the matrix is diagonal.

Example
2. Why commuting matters

Let A=(0100)A = \begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix} and B=(0010)B = \begin{pmatrix} 0 & 0 \\ 1 & 0 \end{pmatrix}. These do not commute, since AB=(1000)AB = \begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix} but BA=(0001)BA = \begin{pmatrix} 0 & 0 \\ 0 & 1 \end{pmatrix}.

  1. Both AA and BB are nilpotent, with A2=B2=0A^2 = B^2 = 0. So eA=I+A=(1101)e^{A} = I + A = \begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix} and eB=I+B=(1011)e^{B} = I + B = \begin{pmatrix} 1 & 0 \\ 1 & 1 \end{pmatrix}.
  2. The product is eAeB=(2111)e^{A}e^{B} = \begin{pmatrix} 2 & 1 \\ 1 & 1 \end{pmatrix}.
  3. Now compute A+B=(0110)A + B = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}. Its eigenvalues are ±1\pm 1, and the series gives eA+B=cosh⁡(1) I+sinh⁡(1)(0110)≈(1.5431.1751.1751.543)e^{A+B} = \cosh(1)\,I + \sinh(1)\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} \approx \begin{pmatrix} 1.543 & 1.175 \\ 1.175 & 1.543 \end{pmatrix}.
  4. Compare: eA+B≠eAeBe^{A+B} \neq e^{A}e^{B}. The difference is exactly the failure of commutativity.

Interpretation: you cannot split a matrix exponential into a product of pieces unless the pieces commute. Most of the difficulty in quantum simulation comes from this gap.

Example
3. A coupled system, realistic setting

Two tanks exchange fluid. Let x1x_1 and x2x_2 be the amounts in each, and let the rates be given by

(x1′x2′)=(−110−2)(x1x2).\begin{pmatrix} x_1' \\ x_2' \end{pmatrix} = \begin{pmatrix} -1 & 1 \\ 0 & -2 \end{pmatrix}\begin{pmatrix} x_1 \\ x_2 \end{pmatrix}.

Start with x1(0)=0x_1(0) = 0 and x2(0)=1x_2(0) = 1. Find the state at t=1t = 1.

  1. The matrix is upper triangular, so the second equation stands alone: x2′=−2x2x_2' = -2x_2, giving x2(t)=e−2tx_2(t) = e^{-2t}.
  2. Substitute into the first: x1′=−x1+e−2tx_1' = -x_1 + e^{-2t}. Try a particular solution ae−2ta e^{-2t}. Substituting gives −2a=−a+1-2a = -a + 1, so a=−1a = -1. The general solution is x1=Ce−t−e−2tx_1 = C e^{-t} - e^{-2t}.
  3. The starting condition x1(0)=0x_1(0) = 0 gives C−1=0C - 1 = 0, so C=1C = 1 and x1(t)=e−t−e−2tx_1(t) = e^{-t} - e^{-2t}.
  4. At t=1t = 1: x1(1)=0.3679−0.1353=0.2325x_1(1) = 0.3679 - 0.1353 = 0.2325 and x2(1)=0.1353x_2(1) = 0.1353.
  5. Check against the matrix form: the state at t=1t = 1 is eA (0,1)Te^{A}\,(0, 1)^{\mathsf T}, which is the second column of eAe^{A}. That column is (0.2325,0.1353)T(0.2325, 0.1353)^{\mathsf T}, matching step 4.

Interpretation: fluid moves from tank 2 into tank 1, and both tanks drain over time. The matrix exponential packages all of this into one object, so the same etAe^{tA} answers the question for every starting state.

Tradeoffs and failure modes

The matrix exponential is the right tool for linear constant-coefficient systems. It is slow or fragile in several situations, and each one has a standard fix.

SituationProblemBetter choice
Large ∥A∥\|A\|The raw series needs many terms and loses precision through cancellationScaling and squaring: compute eA/2se^{A/2^s} with a small ss, then square ss times
Defective matrix (not diagonalizable)The VDV−1VDV^{-1} formula does not existJordan form, or a Padé approximation
Numerical stability for a general matrixEigen-based formulas can be ill-conditionedPadé approximation with scaling and squaring, the approach used by most numerical libraries
Time-varying A(t)A(t)e∫Ae^{\int A} is wrong unless the matrices commute at different timesTime-ordered exponentials, or a numerical ODE solver
Very large sparse systemsForming the full matrix is too expensiveKrylov subspace methods that apply etAe^{tA} to one vector at a time

A common mistake is to write eAe^{A} as "exponentiate each entry". That gives a different matrix, and it is wrong. The rule is always the series, or one of the formulas that follows from it.

Another mistake is to use eA+B=eAeBe^{A+B} = e^{A}e^{B} without checking that AA and BB commute. Worked example 2 is the test case to remember.

History

Matrices as a named mathematical object were developed in the 1850s. Arthur Cayley published a memoir on the theory of matrices in 1858, which set out the algebra of matrix multiplication and inverses.

The exponential function itself is much older, and Euler's work in the 18th century made the power series for exe^x standard. Once matrices had their own multiplication, it was natural to put a matrix into that series. The step is simple to write down, so the hard part was never the definition. It was computing the result reliably.

By the middle of the 20th century, matrix exponentials were standard in differential equations, control theory and quantum mechanics. A well-known 1978 survey by Cleve Moler and Charles Van Loan, "Nineteen Dubious Ways to Compute the Exponential of a Matrix," listed many methods and showed that most of the obvious ones fail in practice. Their point is still the right one: the definition is easy, and good algorithms are not.

Check yourself

QuestionWhat is e0e^{0} when 00 is the zero matrix? Explain why in terms of the series.Show answer

It is the identity matrix II. In the series ∑k0k/k!\sum_k 0^k/k!, every term with k≥1k \ge 1 is the zero matrix, and the k=0k = 0 term is 00=I0^0 = I by convention. So only II remains.

QuestionLet A=(300−1)A = \begin{pmatrix} 3 & 0 \\ 0 & -1 \end{pmatrix}. Compute eAe^{A} and state the result as diagonal entries.Show answer

Since AA is diagonal, exponentiate each entry: e3≈20.09e^{3}\approx 20.09 and e−1≈0.3679e^{-1}\approx 0.3679. So eA=diag⁡(20.09, 0.3679)e^{A} = \operatorname{diag}(20.09,\ 0.3679).

QuestionWhy does eA+B=eAeBe^{A+B} = e^{A}e^{B} fail for the matrices in Worked example 2, even though it holds for ordinary numbers?Show answer

For numbers, multiplication is commutative, so the cross terms in the series for eA+Be^{A+B} match those in eAeBe^{A}e^{B}. For matrices, AB≠BAAB \neq BA, so the terms that mix AA and BB in different orders do not cancel the way they need to. Worked example 2 shows the two sides differ, with eAeB≈(2111)e^{A}e^{B}\approx\begin{pmatrix}2 & 1\\ 1 & 1\end{pmatrix} and eA+B≈(1.5431.1751.1751.543)e^{A+B}\approx\begin{pmatrix}1.543 & 1.175\\ 1.175 & 1.543\end{pmatrix}.

QuestionA system x′=Ax\mathbf{x}' = A\mathbf{x} starts at x(0)=(2,0)T\mathbf{x}(0) = (2, 0)^{\mathsf T}. Write the solution at time tt in terms of etAe^{tA}.Show answer

The solution is x(t)=etAx(0)=etA(2,0)T\mathbf{x}(t) = e^{tA}\mathbf{x}(0) = e^{tA}(2, 0)^{\mathsf T}, which is 22 times the first column of etAe^{tA}. Because x(0)\mathbf{x}(0) is fixed, only one column of the matrix exponential is needed.

QuestionYou need etAe^{tA} for a matrix with a norm of about 500, and the plain series gives results that disagree when you change the number of terms. What would you change, and why?Show answer

The plain series suffers from cancellation when ∥A∥\|A\| is large: the early terms are big and nearly cancel, so rounding errors dominate. A better approach is scaling and squaring. Compute eA/2se^{A/2^{s}} for a large enough ss so that ∥A/2s∥\|A/2^{s}\| is small, approximate it with a short series or Padé approximant, and square the result ss times. The scaling makes the series converge quickly, and the squarings are stable.

Sources