Unitary transformation I have a matrix in following form
$$A=\begin{bmatrix}
1&0&0&0&0&0&0&0\\
0&-1&0&0&0&0&0&0\\
0&0&1&0&0&0&0&0\\
0&0&0&-1&0&0&0&0\\
0&0&0&0&1&0&0&0\\
0&0&0&0&0&-1&0&0\\
0&0&0&0&0&0&1&0\\
0&0&0&0&0&0&0&-1\\
\end{bmatrix}$$
I need some help to reduce the matrix in following form using unitary transformation
$$C=\begin{bmatrix}
1&0&0&0&0&0&0&0\\
0&1&0&0&0&0&0&0\\
0&0&1&0&0&0&0&0\\
0&0&0&1&0&0&0&0\\
0&0&0&0&-1&0&0&0\\
0&0&0&0&0&-1&0&0\\
0&0&0&0&0&0&-1&0\\
0&0&0&0&0&0&0&-1\\
\end{bmatrix}$$
I have used the unitary matrix transformation$UAU^*$ method but the result always come in following form
$$UAU^*=\begin{bmatrix}
1&0&0&0&0&0&0&0\\
0&1&0&0&0&0&0&0\\
0&0&-1&0&0&0&0&0\\
0&0&0&-1&0&0&0&0\\
0&0&0&0&1&0&0&0\\
0&0&0&0&0&1&0&0\\
0&0&0&0&0&0&-1&0\\
0&0&0&0&0&0&0&-1\\
\end{bmatrix}$$
 A: Let $e_1 = (1,0,\dots,0)^T, e_2 = (0,1,0,\dots,0)^T$, and so on.  One $U$ that works here is the $U$ whose columns are
$$
U = [e_1\quad e_3 \quad e_5 \quad e_7 \quad 
e_2 \quad e_4 \quad e_6 \quad e_8]
$$
Notice that this $U$ is a permutation matrix.
A: Denote by $e_i$ the standard basis for $\mathbb{C}^8$. You are given a matrix $A$ such that
$$ Ae_i = \begin{cases} e_i & i \text{ is odd}, \\
-e_i & i \text{ is even}. \end{cases} $$
and you look for a unitary matrix $U \in M_{8}(\mathbb{C})$ such that
$$ UAU^{*}(e_i) = \begin{cases} e_i & 1 \leq i \leq 4, \\
-e_i & 5 \leq i \leq 8. \end{cases} $$
We can achieve this by letting $U^{*}$ (and hence also $U$) be a permutation matrix that rearranges the $e_i$'s. If we define $U^{*}$ by
$$ U^{*}e_1 = e_1, U^{*}e_2 = e_3, U^{*}e_3 = e_5, U^{*}e_4 = e_7, U^{*}e_5 = e_2, U^{*}e_6 = e_4, U^{*}e_7 = e_6, U^{*}e_8 = e_8 $$
then you can check that $U^{*}$ is unitary and $U = U^{-1}$ acts on the standard basis vectors by
$$ Ue_1 = e_1, Ue_2 = e_5, Ue_3 = e_2, Ue_4 = e_6, Ue_5 = e_3, Ue_6 = e_7, Ue_7 = e_4, Ue_8 = e_8. $$
Calculating explicitly, we have
$$ UAU^{*}(e_i) = \begin{cases}
UAU^{*}(e_1) = UAe_1 = Ue_1 = e_1 & i = 1, \\
UAU^{*}(e_2) = UAe_3 = Ue_3 = e_2 & i = 2, \\
UAU^{*}(e_3) = UAe_5 = Ue_5 = e_3 & i = 3, \\
\ldots \\
UAU^{*}(e_8) = UAe_8 = U(-e_8) = -e_8 & i = 8.
\end{cases} $$
as required and
$$ U = \begin{pmatrix} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
                       0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\
                       0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\
                       0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\
                       0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\
                       0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\
                       0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\
                       0 & 0 & 0 & 0 & 0 & 0 & 0 & 1
\end{pmatrix}. $$
