TITLE: How can I solve an orthogonal-constrained Sylvester equation?
QUESTION [5 upvotes]: I am currently facing a Sylvester equation
$AX+XB = C$
where $A$, $B$, $C$ are all symmetric and a special constraint here is that $X$ should be orthogonal. The Sylvester equation itself may not hold perfectly and hence the least-square solution is also ok.

REPLY [2 votes]: Let me assume that $A$ and $-B$ have no common eigenvalues. Without the orthogonality constraint there is then a unique solution $Y$ of the Sylvester equation $AY+YB=C$, which you can find using known methods. Let $Y$ have the singular value decomposition $Y=U\Sigma V^T$. Then $X=UV^T$ is the orthogonal matrix that minimizes $\sum_{ij}(X_{ij}-Y_{ij})^2$. (For a proof, see here.)