Given $10 \times 10$ matrices $A$ and $B$, I would like to find $10 \times 10$ matrix $X$ such that


$$A = X B X^T \tag{1}$$


$$B = X A X^T \tag{2}$$


How can I solve the issue? if there is a way to solve only equation (1) or (2) that is ok also.


If anyone can already solve this and show me the way it's fine too.


Matrix $A$:



```
   [[0.125+0.03125i,0,0,0,0,-0.0625,-0.0625,-0.03125,0,0],      
    [0,0.0625,0,0,0,0,-0.0625,0,0,0],
    [0,0,0.0625,0,0,0,0,-0.0625,0,0],
    [0,0,0,0.15625,0,0,-0.03125i,0,-0.0625,-0.0625],
    [0,0,0,0,0.0625,0,0,0,0,-0.0625],
    [-0.0625,0,0,0,0,0.0625,0,0,0,0],
    [-0.0625,-0.0625,0,-0.03125i,0,0,0.125+0.03125i,0,0,0],
    [-0.03125,0,-0.0625,0,0,0,0,0.15625,0,0],
    [0,0,0,-0.0625,0,0,0,0,0.0625,0],
    [0,0,0,-0.0625,-0.0625,0,0,0,0,0.125]]

```

Matrix $B$:



```
   [[0.15625,0,0,0,0,-0.0625,-0.0625,-0.03125i,0,0],        
    [0,0.0625,0,0,0,0,-0.0625,0,0,0],
    [0,0,0.0625,0,0,0,0,-0.0625,0,0],
    [0,0,0,0.125+0.03125i,0,0,-0.03125,0,-0.0625,-0.0625],
    [0,0,0,0,0.0625,0,0,0,0,-0.0625],
    [-0.0625,0,0,0,0,0.0625,0,0,0,0],
    [-0.0625,-0.0625,0,-0.03125,0,0,0.125+0.03125i,0,0,0],
    [-0.03125i,0,-0.0625,0,0,0,0,0.09375,0,0],
    [0,0,0,-0.0625,0,0,0,0,0.0625,0],
    [0,0,0,-0.0625,-0.0625,0,0,0,0,0.125]]

```

Thanks!



Solving two quadratic matrix equations
I calculated the determinant of your two matrices:


I find $\det A=7.95808\cdot 10^{-13} \, i$ while $\det B=-4.54747\cdot 10^{-13} + 2.27374\cdot 10^{-13} i$. If your equations (1) and (2) hold, then $\det A=(\det C)^2\det B$ and $\det B=(\det C)^2\det A$, so $(\det A)/(\det B)=(\det B)/(\det A)$, which fails.


Hence there is no solution of both equations $A=XBX^{T}$ and $B=XAX^T$.




---


Now for the solution of a single equation, say $A=XBX^T$. The matrix $X^T$ is the transpose of $X$, so $X\_{nm}=X\_{mn}$. Both matrices $A$ and $B$ are complex symmetric, $A\_{nm}=A\_{mn}$ and $B\_{nm}=B\_{mn}$. Both matrices are also invertible. Then each has a unique complex symmetric square root, $A^{1/2}$ and $B^{1/2}$, see [this MO posting](https://mathoverflow.net/q/376970/11260) . A solution to $A=XBX^T$ is given by
$$X=A^{1/2}B^{-1/2}.$$
The solution is not unique, any matrix $A^{1/2}OB^{-1/2}$ with $O$ real orthogonal (so $OO^T=1$) is also a solution.


I tried this for the matrices $A$ and $B$ listed above, with Mathematica. The output is very lengthy, you can download it from [here](https://www.ilorentz.org/beenakker/MO/sqrtasqrtb.txt) and here is the [evidence](https://www.ilorentz.org/beenakker/MO/sqrtasqrtb.png) that it works as it should.




---


The $10\times 10$ matrix in the OP is cumbersome, let me illustrate how this works for a $2\times 2$ matrix:


$$a=\left(
\begin{array}{cc}
 i & 1 \\
 1 & i \\
\end{array}
\right),\;\;b=\left(
\begin{array}{cc}
 0 & 1 \\
 1 & 0 \\
\end{array}
\right),$$
$$a^{1/2}=\left(
\begin{array}{cc}
 \frac{\sqrt{-1+i}}{2}+\frac{\sqrt{1+i}}{2} & \frac{\sqrt{1+i}}{2}-\frac{\sqrt{-1+i}}{2} \\
 \frac{\sqrt{1+i}}{2}-\frac{\sqrt{-1+i}}{2} & \frac{\sqrt{-1+i}}{2}+\frac{\sqrt{1+i}}{2} \\
\end{array}
\right),\;\;b^{1/2}=\left(
\begin{array}{cc}
 \frac{1}{2}+\frac{i}{2} & \frac{1}{2}-\frac{i}{2} \\
 \frac{1}{2}-\frac{i}{2} & \frac{1}{2}+\frac{i}{2} \\
\end{array}
\right),$$
$$x=a^{1/2}b^{-1/2}=\left(
\begin{array}{cc}
 \sqrt{\frac{1}{2}+\frac{1}{\sqrt{2}}} & i \sqrt{\frac{1}{\sqrt{2}}-\frac{1}{2}} \\
 i \sqrt{\frac{1}{\sqrt{2}}-\frac{1}{2}} & \sqrt{\frac{1}{2}+\frac{1}{\sqrt{2}}} \\
\end{array}\right),$$

and you can readily check that $xbx^T=a$. In this particular example the matrix $x$ is symmetric, but in general it is not.


