# How to compute the trace of an exponential and diagonal matrix?

I would like to understand how to compute the trace of an exponential and diagonal matrix. For instance, what is: $$\mathrm{Tr}\left[ \exp \begin{pmatrix} 5 & 0 \\ 0 & 8 \end{pmatrix} \right] = \; ?$$ I've tried to Google it, but couldn't find anything that answers this question.

• It is 3129.4 (obtained using octave) – mvw Feb 17 '15 at 20:09

Fortunately our matrix to exponentiate is diagonal simplifying matters considerably, as we have $$\mathrm{Tr}\left[ \exp \begin{pmatrix} 5 & 0 \\ 0 & 8 \end{pmatrix} \right] = \mathrm{Tr}\left[ \begin{pmatrix} \sum_{k=0}^\infty\frac{1}{k!}5^k & 0 \\ 0 & \sum_{k=0}^\infty\frac{1}{k!}8^k \end{pmatrix} \right] = e^5+e^8$$ where the exponential of a matrix $A$ is defined as $$\exp(A)=\sum_{k=0}^{\infty}\frac{1}{k!}A^k$$
In general for complex $m \times m$ matrices, if $f$ is defined by a power series $\sum a_nz^n$, the disk of convergence of which contains all eigenvalues $\lambda_1,...,\lambda_m$ of $A$, then
$$\mathrm{Tr}(f(A)) = \sum_{j =1}^mf(\lambda_i)$$
Where $f(A)$ is defined as $\sum a_nA^n$. This fact is fairly clear for diagonalizable matrices, and can be seen in general either by density or by Jordan canonical form.