# Lyapunov equation but with one extra term

In my research, I need to solve a matrix equation very similar to Lyapunov equation but with one extra term.

The equation is X+DXD-WXW=A, where X is the unknown n*n matrix. W, D and A is known. W is a symmetric n*n matrix, A is not symmetric. D is an diagonal matrix, and D and W cannot commute. So DXD is an extra term the original Lyapunov equation.

So may I ask whether this equation or its analogue has been studied in the literature? My difficulty is since D and W cannot commute, I cannot perform a simultanenous triangularization for D and W.

Thank you very much for your help!

-
Check also the literature for " Generalized Sylvester Equations", you might find something useful. – Manos Oct 30 '12 at 21:33

You can bring this equation to the standard form of a linear system of equations using vectorization. Vectorization is the process of stacking the columns of a matrix into a vector with a particular order. So if $A$ is an $n \times n$ matrix, $vec(A)$ is the vector $[A_1; A_2; \cdots, A_n]$, where $A_i$ is the $i^{th}$ column of $A$ and and "$;$" denotes change of row. We have the result $vec(ABC) = (C^T \otimes A) vec(B)$. Using this, your equation becomes $(I_{n^2} + D^T \otimes D - W^T \otimes W) vec(X) = vec(A)$. Now you can check whether this standard linear system of equations admits a solution.