Find a matrix for a unitary transform between matrices or prove that there is none

hermitian-matriceslinear algebramatrices

I have hermitian matrices $A,\,B$ and would like to find a unitary matrix $U$ such that
$$UAU^\dagger=B$$
or show that there is no such matrix.

Example:
For
$$
A=\begin{pmatrix}
0 & 1 & 0 & 0\\
1 & 0 & 0 & 0\\
0 & 0 & 0 & -1\\
0 & 0 & -1 & 0
\end{pmatrix},\,
B=\begin{pmatrix}
0 & 0 & -1 & 0\\
0 & 0 & 0 & 1\\
-1 & 0 & 0 & 0\\
0 & 1 & 0 & 0
\end{pmatrix}
$$

we find
$$
U=\begin{pmatrix}
1 & 0 & 0 & 0\\
0 & 0 & -1 & 0 \\
0 & -1 & 0 & 0\\
0 & 0 & 0 & 1
\end{pmatrix}
$$

by guesswork. A constructive method would be useful.

Next example, where I assume that no such $U$ exists, but do not know how to show it:
$$
A=\begin{pmatrix}
b & d & c & a\\
d & – b & a & – c\\
c & a & – b & – d\\
a & – c & – d & b
\end{pmatrix}
=a\cdot\sigma_x\otimes\tau_x + b\cdot\sigma_z\otimes\tau_z
+ c\cdot\sigma_x\otimes\tau_z + d\cdot\sigma_z\otimes\tau_x\\
B=\begin{pmatrix}
– b & d & – c & – a\\
d & b & – a & c\\
– c & – a & b & – d
\\- a & c & – d & – b\end{pmatrix}
=-a\cdot\sigma_x\otimes\tau_x – b\cdot\sigma_z\otimes\tau_z
– c\cdot\sigma_x\otimes\tau_z + d\cdot\sigma_z\otimes\tau_x
$$

where $\sigma_x,\,\sigma_z,\,\tau_x,\,\tau_z$ denote the Pauli matrices
$$
\sigma_0 = \tau_0 =
\begin{pmatrix}
1 & 0\\
0 & 1
\end{pmatrix},\,
\sigma_x = \tau_x =
\begin{pmatrix}
0 & 1\\
1 & 0
\end{pmatrix},\,
\sigma_y = \tau_y =
\begin{pmatrix}
0 & -i\\
i & 0
\end{pmatrix},\,
\sigma_z = \tau_z =
\begin{pmatrix}
1 & 0\\
0 & -1
\end{pmatrix}
$$

Note: I am mostly interested in $4\times4$ matrices, but $8\times8$ would be nice, too.
EDIT: Thanks to the answer of Kurt G.. Assume $a,\,b,\,c,\,d\in\mathbb{R}\backslash\{0\}$. I was aware that a solution for $d=0$ exists. I specifically included $d$ to avoid a simple solution of the form $\sigma_a\otimes\tau_b$. When $d=0$, then a solution exists independently of the other values, for example $U=\sigma_0\otimes\tau_y$

Best Answer

I think for the existence of a unitary $U$ s.t. $UAU^\dagger=B$ it is necessary and sufficient that $A$ and $B$ have the same eigenvalues. Let $\lambda$ be an eigenvalue of $B$ with eigenvector $v\,.$ Then $Bv=\lambda v$ and so $UAU^\dagger v=\lambda v\,.$ Setting $w=U^\dagger v$ gives $UAw=\lambda Uw\,.$ Therefore $Aw=\lambda w\,.$ This shows that every eigenvalue of $B$ is an eigenvalue of $A\,.$ Conversely, being square and hermitian, both, $A$ and $B$ are diagonalizable by unitary matrices $U_1,U_2\,:$ $$ D_1=U_1AU_1^\dagger\,,~~D_2=U_2BU_2^\dagger\,. $$ If $A$ and $B$ have the same eigenvalues then the diagonal elements of $D_1$ and $D_2$ agree. Doing a permutation (which is an unitary operation) we can assume that $D_1=D_2\,.$ Then, $$ A=U_1^\dagger D_1U_1=U_1^\dagger D_2U_1=U_1^\dagger U_2BU_2^\dagger U_1 $$ and we can take $U=U_1^\dagger U_2\,.$

In your example where you believe that there is no solution I think you must require that $a,b,c,d$ are not zero. Checking in python shows that for $a=6,b=4,c=3,d=0$ the eigenvalues of $A$ and $B$ are the same. So there should exist a $U$.

Related Question