I have a set of matrices $A_i$ that represent the generators of a finite group within a certain basis, and $B_i$ represent the same operators in a different basis.

How can I find a unitary transformation $U$ that performs this change of basis, so that $U A_i U^{-1} = B_i$ for all $i$? All I have are the matrices $A_i$ and $B_i$ and I need $U$.

For a single pair $A_1$ and $B_1$ it would be easy [(as discussed here)][1]:

> Let $P$ and $S$ be unitary matrices that diagonalize $A_1$ and $B_1$. Then $U A_1 U^{-1} = B_1$ is solved for $U=SP^{-1}$.

But this does not guarantee that the same $U$ will do the trick for all $A_i$ and $B_i$.

  [1]: https://mathematica.stackexchange.com/questions/98514/finding-a-unitary-matrix-in-mathematica