# Find a matrix $X$ that block-diagonalizes a particular group of matrices

Essentially, I want to find a single matrix $$X$$ such that conjugation by $$X$$ sends:

$$\begin{bmatrix} 1 & 0 & 0 & 0 & 0 \ 0 & -1 & 0 & 0 & 0 \ 0 & 0 & 1 & 0 & 0 \ 0 & 0 & 0 & -1 & 0 \ 0 & 0 & 0 & 0 & 1 \end{bmatrix} \mapsto \begin{bmatrix} -1 & 0 & 0 & 0 & 0 \ 0 & -1 & 0 & 0 & 0 \ 0 & 0 & 1 & 0 & 0 \ 0 & 0 & 0 & 1 & 0 \ 0 & 0 & 0 & 0 & 1 \ \end{bmatrix}$$ and

$$\frac{1}{2} \begin{bmatrix} -i & -i & 0 & i & i \ \sqrt{\frac{3}{2}} & 0 & -1 & 0 & \sqrt{\frac{3}{2}} \ i & -i & 0 & i & -i \ -\frac{1}{2} & 1 & -\sqrt{\frac{3}{2}} & 1 & -\frac{1}{2} \ \end{bmatrix} \mapsto \begin{bmatrix} 0 & 1 & 0 & 0 & 0 \ 0 & 0 & 1 & 0 & 0 \ 1 & 0 & 0 & 0 & 0 \ 0 & 0 & 0 & e^{\frac{2 i \pi }{3}} & 0 \ 0 & 0 & 0 & 0 & e^{-\frac{1}{3} (2 i \pi )} \ \end{bmatrix}$$

The matrices are unitary and I have a mathematical guarantee this is possible.

Some math details: The two matrices on the left generate the tetrahedral group, and the two matrices on the right also generate the tetrahedral group. The matrices on the left are in the Spin(2) representation of the rotation group (rotation by 180 degrees about the z axis and rotation by 120 degrees about the $$(1,1,1)/\sqrt{3}$$ axis). Through some fancy representation theory (looking at the traces of the matrices on the left), you can show that you have to be able to decompose it into the direct sum of irreducible representations, and those give the matrices on the right.

I was able to get close to solving the problem. If I simply worry about the more complicated 2nd matrix, I can use the eigensystem to ensure the 2nd map is satisfied. The first map is then a mess with the top-left 3×3 block not how I want it. Also, this generalizes poorly to higher dimensions (2 sets of (2n+1)x(2n+1) matrices that I’m guaranteed are similar to other (2n+1)x(2n+1) matrices).

Is there any magic command or simple solution to this problem? I can probably do some sort of iterative procedure that keeps detailed track of all the eigenvectors/values, but that seems like it would be very involved!

This question is similar to Is there a clean way to extract the subspaces invariant under a list of matrices?, but I think my problem is much simpler because I know the invariant subspaces and in detail what I want the output to look like.

{s1,s2}={{{1,0,0,0,0},{0,-1,0,0,0},{0,0,1,0,0},{0,0,0,-1,0},{0,0,0,0,1}},{{-(1/4),-(1/2),-(Sqrt[(3/2)]/2),-(1/2),-(1/4)},{-(I/2),-(I/2),0,I/2,I/2},{Sqrt[3/2]/2,0,-(1/2),0,Sqrt[3/2]/2},{I/2,-(I/2),0,I/2,-(I/2)},{-(1/4),1/2,-(Sqrt[(3/2)]/2),1/2,-(1/4)}}}; {t1,t2}={{{-1,0,0,0,0},{0,-1,0,0,0},{0,0,1,0,0},{0,0,0,1,0},{0,0,0,0,1}},{{0,1,0,0,0},{0,0,1,0,0},{1,0,0,0,0},{0,0,0,E^(2 Pi I/3),0},{0,0,0,0,E^(4 Pi I/3)}}}; ct=ConjugateTranspose; {t2d,t2x}=N@Transpose[SortBy[Transpose[Eigensystem[t2]],Arg[N[#[[1]]]]&]]; t2x=Transpose[Chop[ Orthogonalize[t2x]]]; {s2d,s2x}=N@Transpose[SortBy[Transpose[Eigensystem[s2]],Arg[N[#[[1]]]]&]]; s2x=Transpose[Chop[ Orthogonalize[s2x]]]; X=ct[s2x.ct[t2x]]; MatrixForm[Chop[X.s1.ct[X]]] MatrixForm[Chop[X.s2.ct[X]]]