# Find a matrix that are unitarily equal to the given matrix

I have four $$5\times 5$$ matrices, $$P_i, Q_i$$ ($$i=1, 2$$) as follows: $$P_1=\begin{pmatrix} 1 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & -1 \\ 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 0 \\ \end{pmatrix}$$, $$P_2=\begin{pmatrix} 0 & 0 & 0 & 0 & 0 \\ \sqrt{2} & 0 & \sqrt{2} & 0 & 0 \\ 0 & 0 & 0 & \sqrt{2} & 0 \\ 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & -\sqrt{2} & 0 \\ \end{pmatrix}$$, $$Q_1=\begin{pmatrix} 0 & -1 & 0 & 0 & 0 \\ 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 \\ \end{pmatrix}$$, $$Q_2=\begin{pmatrix} \sqrt{2} & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 \\ -\sqrt{2} & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & \sqrt{2} & 0 & \sqrt{2} \\ \end{pmatrix}$$.

How do I find two $$5\times 5$$ matrices $$R_1, R_2$$, and a unitary matrix $$U$$, such that $$UR_iR_jU^{\dagger}=P_iQ_j$$ in Mathematica? I tried Solve by brute force, but the equations are too heavy to solve. I wonder if there is a better way. Thanks in advance!

For your convenience, the codes for the matrices are attached:

P1={{1, 0, 0, 0, 0}, {0, 1, 0, 0, 0}, {0, 0, 0, 0, -1}, {0, 0, 0, 1, 0}, {0, 0, 0, 0, 0}}
P2={{0, 0, 0, 0, 0}, {Sqrt[2], 0, Sqrt[2], 0, 0}, {0, 0, 0, Sqrt[2], 0}, {0, 0, 0, 0, 0}, {0, 0, 0, -Sqrt[2], 0}}
Q1={{0, -1, 0, 0, 0}, {1, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 1, 0, 0}, {0, 0, 0, 1, 0}}
Q2={{Sqrt[2], 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {-Sqrt[2], 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, Sqrt[2], 0, Sqrt[2]}}

• Copyable code for the matrices please... – Henrik Schumacher Nov 28 '18 at 20:19
• @HenrikSchumacher Thanks for the reminder. The codes are attached. – user34104 Nov 28 '18 at 20:26
• – kglr Nov 28 '18 at 20:41
• @kglr, HessenbergDecomposition allows us to find $U, H$ satisfying $UHU^{\dagger}=P$ for given $P$. But here the difficulty is that we have multiple given matrices, i.e., $P_1Q_1, P_1Q_2, P_2Q_1, P_2Q_2$ which is unitarily equal to $R_1R_1, R_1R_2, R_2R_1, R_2R_2$ respectively, via the same U (NOT different U's). I am not sure how to use HessenbergDecomposition to tackle this. – user34104 Nov 28 '18 at 20:57