If $D$ is diagonal matrix, then why $e^{D}$ turns out to be like this... If $D$ is a diagonal matrix, for instance $D=\begin{pmatrix}a&0\\0&b\end{pmatrix}$. Im wondering why $e^{D}=\begin{pmatrix} e^{a} &0\\0& e^{b} \end{pmatrix}$. I already know that $e^{x}= \sum_{n=0}^{\infty}\frac{x^{n}}{n!}$. Therefore, $$e^{D}= \sum_{n=0}^{\infty}\frac{D^{n}}{n!}.$$
Of course, $\frac{D^{n}}{n!}$ is a diagonal matrix  for every $n$,so this is a series of diagonal matrix.  But I cannot figure it out why this series, $\sum_{n=0}^{\infty}\frac{D^{n}}{n!}$, turns out to be $\begin{pmatrix} e^{a} &0\\0& e^{b} \end{pmatrix}$.  I cannot see the trick. Thanks.

We have that $$e^{D}= \sum_{n=0}^{\infty}\frac{D^{n}}{n!}.$$ And since $\frac{D^{n}}{n!}=\begin{pmatrix} \frac{a^{n}}{n!} &0\\0& \frac{b^{n}}{n!} \end{pmatrix}$ for every $n$, then $\sum_{n=0}^{\infty}\frac{D^{n}}{n!}= \begin{pmatrix} \sum_{n=0}^{\infty} \frac{a^{n}}{n!} &0\\0&  \sum_{n=0}^{\infty} \frac{b^{n}}{n!} \end{pmatrix}=\begin{pmatrix} e^a &0\\0& e^{b} \end{pmatrix}$.
