TITLE: How to solve this linear matrix equation?
QUESTION [5 upvotes]: How should I solve the following matrix equation? What is the solution for $X$?
$$B X C + B^T X C^T = D$$

REPLY [7 votes]: Rewrite it as a system of linear equations $(C^T\otimes B+C\otimes B^T)\operatorname{vec}(X)=\operatorname{vec}(D)$ (see Wikipedia entries on Kronecker product and vectorisation for the meanings of the symbols $\otimes$ and $\operatorname{vec}$) and solve it.