Solving a matrix equation $AX=XB$ in a CAS

2.5k Views Asked by At

I have the following computational problem. Let $N$ be a positive integer and $A\in \mathbb{C}^{2N\times 2N}$, $X\in \mathbb{C}^{2N\times 4}$ and $B\in \mathbb{C}^{4\times 4}$. I want to solve the following equation for the matrix $X$ $$ A\cdot X= X\cdot B. $$ I found the following paper online (http://www.jstor.org/stable/2099652) but I haven't been able to implement it in Maple or Magma and I don't know what I should be looking for. Does someone know if it is implemented somewhere already?

1

There are 1 best solutions below

2
On BEST ANSWER

This is a Sylvester equation, $AX-XB = 0$. This can be solved in Maple by SylvesterSolve and in Matlab by lyap and in Mathematica by LyapunovSolve.

In general, you can get $X$ in a vectorized form by solving $$((I_4 \otimes A) - (B^T \otimes I_{2n})) \operatorname{vec} X = 0$$ for example by Gaussian elimination. $\otimes$ is the Kronecker product and $\operatorname{vec} X$ is the columns of $X$ put on top of each other in a vector.