# Least square solution to $AXB+CXD=E$

I am trying to find the least-squares solution $X$ of the following matrix equation

$$AXB+CXD=E$$

Of course, I know that this equation can be written in the form

$$(B^T \otimes A+D^T \otimes C) \operatorname{vec} X = \operatorname{vec} E$$

where $\otimes$ denotes the Kronecker product, and we can take the pseudoinverse of the Kronecker product matrix on the LHS to get $X$. However, I wonder whether we can get the answer in terms of the pseudoinverses $A^{+}$, $B^{+}$, $C^{+}$ and $D^{+}$? I know that if we want to find the least-squares solution of $AXB=E$, we have a solution $X=A^{+}EB^{+}$. Can we write in a similar way a solution of the more complicated case? Thanks!

• Are the coefficient matrices square? – Federico Poloni Oct 15 '17 at 9:24

This is the Sylvester equation. A simple explicit solution is possible under certain conditions (no common eigenvalues of the matrices $C^{-1}A$ and $-DB^{-1}$), as explained in the Wikipedia page. There are more complicated general methods, see