This came up in a practical problem involving a state change in a digital filter system.
Find $X$ given $A$ and $K$, where $A,X,K$ are all $n$ x $n$ square matrices:
$$ X - A X A = K $$ I couldn't find a direct way to do this, eventually I realized that it's just $n^2$ linear equations in $n^2$ unknowns, and it can be solved as follows:
- Restate so $X$ and $K$ are column vectors $\vec x$ and $\vec k$, each with $n^2$ elements
- The term $A X A$ becomes $A_L A_R \vec x$, where $A_L, A_R$ are $n^2$ x $n^2$ matrices which perform the equivalent of multiplying by $A$ on the left and right in the original form
- Find $\vec x = \left(I-A_L A_R \right)^{-1} \vec k$ and reorder to get $X$
For $n=3$, for instance, if $$ A = \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix} $$ then $$ A_L = \begin{bmatrix} a & 0 & 0 & b & 0 & 0 & c & 0 & 0 \\ 0 & a & 0 & 0 & b & 0 & 0 & c & 0 \\ 0 & 0 & a & 0 & 0 & b & 0 & 0 & c \\ d & 0 & 0 & e & 0 & 0 & f & 0 & 0 \\ 0 & d & 0 & 0 & e & 0 & 0 & f & 0 \\ 0 & 0 & d & 0 & 0 & e & 0 & 0 & f \\ g & 0 & 0 & h & 0 & 0 & i & 0 & 0 \\ 0 & g & 0 & 0 & h & 0 & 0 & i & 0 \\ 0 & 0 & g & 0 & 0 & h & 0 & 0 & i \end{bmatrix} $$ and (in block form): $$ A_R = \begin{bmatrix} A^T & 0 & 0 \\ 0 & A^T & 0 \\ 0 & 0 & A^T \end{bmatrix} $$
Question is: is there any easier way to solve this? I'm now thinking that the relationship between the $n^2$ variables is such that you can't solve it without this kind of rewriting, but I'd be happy to be proven wrong. Is there a name for the procedure of restating the problem as above? Or a name for the type of the original equation? Perhaps it would be more natural with tensor notation - I'm not that familiar with that area.
One other note: the original equation can be be rewritten as the following two forms:
$$ X = A X A + K $$ and (assuming $A$ is not singular) $$ X = A^{-1} \left( X - K \right) A^{-1} $$ ... and it seems to me that one of these (depending on the properties of $A$) may be usable as a iterator that will converge to the correct value of $X$. In some applications this may easier to work with than the full solution.