# First-Order Derivative of Matrix Exponential

**INTRODUCTION**

My work recently involved using Matlab to compute first-order derivative of a matrix exponential. Suppose we have a matrix X which associates with some parameters, say α and β. That means X = X(α, β). Exponentiate X we get a matrix exponential: e^{X}

Now comes the question: how to compute |

The following sections will describe one way to compute this derivative. This post is meant to explain a special case (first order derivative) from the referenced paper (Fung 2004). If you need to compute higher order derivatives, Fung’s work (Fung 2004) will be a great help.

**MATRIX EXPONENTIAL BASIC**

Recall that if x is a scalar, exponential of x can be defined in the form of power series ([2]):

(1) |

Likewise, if X is a square matrix, we can define its matrix exponential as:

(2) |

where *I* denotes identity matrix.

In Matlab, the function expm(X) is used to compute the matrix exponential of X.

**LINEAR DIFFERENTIAL EQUATION SYSTEMS**

Linear differential equation systems are relevant to matrix exponential in the sense that the solutions are often found in the form of matrix exponential.

Given a system of linear ordinary differential equations:

(3) |

it is well-known that the solution is given by:

(4) |

We are going to utilize this relationship in the section follow.

**FIRST ORDER DERIVATIVE**

Suppose A is a square matrix with a parameter α. Let’s say we need to compute the first order derivative of the matrix exponential of A with respect to parameter α.

That is, we need to compute |

Consider the solution (4), at time t = 1 we have:

(5) |

Differentiate both sides of (3) w.r.t. α:

(6) |

define:

(7) | |

(8) |

We can rewrite (6) as:

(9) |

which essentially has the same structure as the system of linear differential equations (3). That means the solution for (9) at t = 1 is given by:

(10) |

Also differentiate both sides of (5) w.r.t. α we get:

(11) |

Using the same notion (7), we can express (11) as:

(12) |

where

(13) |

From (10) and (12), we can see that:

(14) |

That means the first order derivative of e^{A }w.r.t. α can be obtained from the matrix exponential of the augmented matrix Ᾱ.

**Steps to compute**:

1. Set up matrix Ᾱ as described in (8)

2. Calculate the matrix exponential of Ᾱ: . For instance, using function expm in Matlab.

3. Extract the wanted derivative from the upper right portion of the matrix .

**HIGHER ORDER DERIVATIVES**

Higher order derivatives of matrix exponential can be computed in the same way as first order one. For more details, please refer to the paper listed at the bottom of this post (Fung 2004).

**MATLAB PROGRAM**

Below you can find a simple Matlab program that implements the steps described above to compute the first order derivative of the matrix exponential of A.

% Compute first order derivative of the matrix exponential of matrix A

% A: matrix to compute the first order derivative of its matrix exponential

% dA: partial derivative of A

function dexpA = dexp(A,dA)

n = size(A,1);

% Augmented matrix

A_bar = [A dA; zeros(n) A];

% Matrix exponential of A_bar

B_bar = expm(A_bar);

% Extract derivative

dexpA = B_bar(1:n,n+1:2*n);

end

**REFERENCES**

1. **T. C. Fung**, “Computation of the matrix exponential and its derivatives by scaling and squaring”, Int. J. Numer. Meth. Engng 2004; 59:1273–1286 (DOI: 10.1002/nme.909)

2. **Wikipedia**, “Exponential function”, http://en.wikipedia.org/wiki/Exponential_function