<s>[INST] Calculating series expansions within a matrix: matrix exponential I have a $(3 \times 3)$ matrix $$ Y = \begin{pmatrix} 0 & - e^{-i \theta} & 0 \\ e^{i \theta} & 0 & - e^{-i \theta} \\ 0 & e^{i \theta} & 0 \end{pmatrix} $$ for which I would like to calculate the matrix exponential $\exp(t Y) = I + t Y + \frac{t^2 Y^2}{2!} + \ldots $ If I let $z : = e^{i \theta}$, I have $$ Y^2 = \begin{pmatrix} - |z|^2 & 0 & |z|^2 \\ 0 & -2 |z|^2 & 0 \\ |z|^2 & 0 & - |z|^2 \end{pmatrix} \\ Y^3 = \begin{pmatrix} 0 & 2 \overline{z} |z|^2 & 0 \\ |z|^2 (-z - \overline{z}) & 0 & |z|^2 (z + \overline{z}) \\ 0 & -2z |z|^2 & 0 \end{pmatrix} $$ and $$ Y^4 = \begin{pmatrix} - \overline{z} |z|^2 (-z - \overline{z}) & 0 & - \overline{z} |z|^2 (z + \overline{z}) \\ 0 & 4 |z|^4 & 0 \\ z |z|^2 (-z- \overline{z}) & 0 & z |z|^2 (z+ \overline{z}) \end{pmatrix}. $$ Setting $|z| = 1$ and calculating the matrix exponential above up the fifth power $Y^5$, I got $$ \begin{pmatrix} 1 - \frac{t^2}{2!} + \frac{t^4}{4!} \overline{z} (z + \overline{z}) + \ldots & - t \overline{z} + \frac{t^3}{3!} (2 \overline{z}) - \frac{t^5}{5!} 4 \overline{z} + \ldots & \frac{t^2}{2!} - \frac{t^4}{4!} \overline{z} (z + \overline{z}) + \ldots \\ tz - \frac{t^3}{3!} (z + \overline{z}) + \frac{t^5}{5!} 2 (z + \overline{z}) + \ldots & 1 - \frac{2 t^2}{2!} + \frac{t^4}{4!} 4 + \ldots & - t \overline{z} + \frac{t^3}{3!} (z + \overline{z}) - \frac{t^5}{5!} 2 ( z+ \overline{z}) + \ldots \\ \frac{t^2}{2!} - \frac{t^4}{4!} z (z + \overline{z}) + \ldots & tz - \frac{t^3}{3!} 2 z + \frac{t^5}{5!} 4 z + \ldots & 1 - \frac{t^2}{2!} + \frac{t^4}{4!} z (z + \overline{z}) + \ldots
 \end{pmatrix} $$
I think I must be able to rewrite this with the help of $\sin(x) = x - \frac{x^3}{3!} + \frac{x^5}{5!} - \ldots$ and $\cos(x) = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \ldots$.
For example, if I look at the $a_{22}$ term above, I see that it is almost $\cos(t)$, except the numerical factors that don't work out. Also, the $a_{11}$ term is almost $\cos(t)$, except there appears a term $\overline{z} (z+ z)$ from the fourth power onwards, and the same happens for the $a_{33}$ term with $z$ and $\overline{z}$ switched. The $a_{32}$ term seems to be $z \sin(t)$, but again the numerical coefficients don't work out.
Question: Does anyone recognize the pattern in these entries (i.e. the series) and is able to calculate the matrix exponential $e^{tY}$ in closed form?
Also, what would be matrix exponential $\exp(tZ)$ of the 'generalization' $$Z = \begin{pmatrix} 0 & - \overline{z} & - \overline{z} \\ z & 0 & - \overline{z} \\ z & z & 0 \end{pmatrix} $$ with $z = e^{i \theta}$ again?
 [/INST] Setting $z  = e^{i \theta}$ is a good idea. It becomes a bit clearer if $(- e^{-i \theta})$ is replaced by $-1/z$ instead of $-\overline z$ (and it makes the result correct even for complex $\theta$).
So we have
$$
Y = \begin{pmatrix}
 0 & -1/z & 0 \\
 z &  0   & -1/z \\
 0 &  z   & 0
\end{pmatrix}
$$
and the first powers are
$$
Y^2 = \begin{pmatrix}
 -1 & 0 & 1/z^2 \\
 0 &  -2   & 0 \\
 z^2 &  0   & -1
\end{pmatrix}\, , \,
Y^3 = \begin{pmatrix}
 0 & 2/z & 0 \\
 -2z &  0   & 2/z \\
 0 &  -2z   & 0
\end{pmatrix}\,. \\
$$
One can see that $\boxed{Y^3 = -2Y}$, which allows to compute all powers $Y^n$ in terms of $Y$ or $Y^2$:
$$
 Y^{2k+1} = (-2)^{k} Y \\
 Y^{2k+2} = (-2)^{k} Y^2
$$
for $k \ge 1$. Therefore
$$
\begin{align}
\exp(tY) &= I + \left(t-\frac{2t^3}{3!} + \frac{2^2t^5}{5!} - \frac{2^3t^7}{7!} + \ldots\right)Y
\\ &\quad + \left(\frac{t^2}{2!} - \frac{2t^4}{4!} + \frac{2^2t^6}{6!} - \frac{2^3t^8}{8!} + \ldots \right)Y^2 \\
&= I +  \frac{\sin(\sqrt 2 t)}{\sqrt 2}Y +  \frac 12 \left(1- \cos(\sqrt 2 t)\right)Y^2 \, .
\end{align}
$$
The general case is described in Computing the Matrix Exponential The Cayley-Hamilton Method: If $A$ is an $n$-dimensional square matrix and $\lambda_1, \ldots, \lambda_n$ the zeros of the characteristic equation $\det(\lambda I - A) = 0$, then
$$
 \exp(tA) = \sum_{k_0}^{n-1} \alpha_k A^k
$$
where $\alpha_0, \ldots, \alpha_{n-1}$ are the solutions of the linear equation system
$$
 e^{\lambda_i t} = \sum_{k_0}^{n-1} \alpha_k \lambda_i^k \, , \,
1 \le i \le n \, .
$$
In our case $\det(\lambda I - Y) = \lambda^3 + 2 = 0$ has the zeros $\lambda_1 = 0$, $\lambda_2 = i\sqrt 2$, $\lambda_3 = -i \sqrt 2$. The linear equation system is
$$
\begin{align}
 1 &= \alpha_0 \\
e^{i\sqrt 2 t} &= \alpha_0 + i \sqrt 2 \alpha_1 - 2 \alpha_2 \\
e^{-i\sqrt 2 t} &= \alpha_0 - i \sqrt 2 \alpha_1 - 2 \alpha_2 
\end{align} \, .
$$
The solution is
$$
 \alpha_0 = 1, \, \alpha_1 = \frac{\sin(\sqrt 2 t)}{\sqrt 2}, \, 
\alpha_2 = \frac 12 \left(1- \cos(\sqrt 2 t)\right)
$$
confirming the result for $\exp(tY)$ that we obtained above.
</s>