Calculating the exponential of an upper triangular matrix 
Find the matrix exponential $e^A$ for
$$ A = \begin{bmatrix}
2 & 1 & 1\\
0 & 2 & 1\\
0 & 0 & 2\\
\end{bmatrix}.$$

I think we should use the proberty

If $AB = BA$ then $e^{A+B} = e^A e^B$.

We can use that
$$\begin{bmatrix}
2 & 1 & 1\\
0 & 2 & 1\\
0 & 0 & 2\\
\end{bmatrix} 
=\begin{bmatrix}
1 & 0 & 0\\
0 & 1 & 0\\
0 & 0 & 1\\
\end{bmatrix} 
+\begin{bmatrix}
1 & 1 & 1\\
0 & 1 & 1\\
0 & 0 & 1\\
\end{bmatrix}$$
Both matrices obviously commute. But I dont know how to calculate the exponential of
$$\begin{bmatrix}
1 & 1 & 1\\
0 & 1 & 1\\
0 & 0 & 1\\
\end{bmatrix}.$$
Could you help me?
 A: We may use Cayley Hamilton theorem to find the exponential of $$ M=\begin{bmatrix}
1 & 1 & 1\\
0 & 1 & 1\\
0 & 0 & 1\\
\end{bmatrix}.$$
Note that the eigenvalues of $M$ are $1,1,1$
We write $$e^{tM} = \alpha (t)I+ \beta (t)M+ \gamma (t) M^2.$$
To find the  coefficient functions we replace $M$ with $\lambda$ and solve the resulting system.
$$e^{t\lambda} = \alpha (t)I+ \beta (t)\lambda + \gamma (t) \lambda ^2.$$
Differentiating with respect to $\lambda $ we get $$te^{\lambda t}=\beta + 2\lambda \gamma$$
Differentiating again, we get $$t^2 e^{\lambda t }=2\gamma$$
With t=1 and $\lambda =1$ we get $$\alpha = e/2, \beta =0, \gamma = e/2$$
with these values we find $$e^M =e \begin{bmatrix}
1 & 1 & 3/2\\
0 & 1 & 1\\
0 & 0 & 1\\
\end{bmatrix}. $$
Apply the same method with $\lambda =2$ we get $$e^N =e^2 \begin{bmatrix}
1 & 1 & 3/2\\
0 & 1 & 1\\
0 & 0 & 1\\
\end{bmatrix}. $$
for the original matrix $$N=\begin{bmatrix}
2 & 1 & 1\\
0 & 2 & 1\\
0 & 0 & 2\\
\end{bmatrix}$$
A: Edit: As pointed out by @XTChen there is a much easier way to do this but I detail evaluation of the requested exponential nonetheless.
Note that
$$\pmatrix{1&1&1\\0&1&1\\0&0&1}^n=\pmatrix{1&n&n(n+1)/2\\0&1&n\\0&0&1}$$
\begin{align}
\sum_{n=0}^\infty & \frac1{n!}\pmatrix{1&1&1\\0&1&1\\0&0&1}^n  \\
&=\sum_{n=0}^\infty\frac1{n!}\pmatrix{1&n&n(n+1)/2\\0&1&n\\0&0&1}\\
&=\pmatrix{1&0&0\\0&1&0\\0&0&1}+\sum_{n=1}^\infty\pmatrix{1/n!&1/(n-1)!&(n+1)/(2(n-1)!)\\0&1/n!&1/(n-1)!\\0&0&1/n!}\\
&=\pmatrix{1&0&0\\0&1&0\\0&0&1}+\pmatrix{e-1&e&3e/2\\0&e-1&e\\0&0&e-1}\\
&=\pmatrix{e&e&3e/2\\0&e&e\\0&0&e}\\
&=\frac12e\pmatrix{2&2&3\\0&2&2\\0&0&2}\\
\end{align}
A: You should decompose your matrix like this
$$\begin{equation}
 \begin{pmatrix}
  2 & 1 & 1 \\
  0 & 2 & 1\\
  0 & 0 & 2 
 \end{pmatrix}
=
\begin{pmatrix}
 2 & 0 & 0\\
 0 & 2 & 0\\
 0 & 0 & 2
\end{pmatrix}
+
\begin{pmatrix}
0 & 1 & 1\\
0 & 0 & 1\\
0 & 0 & 0
\end{pmatrix}
\end{equation}
$$
The left one commutes with the right one and the right one is nilpotent. So it is easy to compute.
