# How to solve matrix equation $AX+XB=C$ for $X$

How does one solve the matrix equation $AX+XB=C$ for $X$? It doesn't seem too difficult. I tried many times but failed.

I'm an adult student... I am now vexed about Gilbert Strang - An Introduction to Linear Algebra. I don't even understand a single word in Wikipedia: Sylvester equation. If you have ever use some nice workable materials or lecture notes? You can generously upload and share the links of the lecture notes and assignments. Different subjects/ topics are welcome, as long as you deem they are nice and workable.

The problem origins from a system of diff equation, using undetermined coefficients (matrix) to find the particular solution. Try $y_p=X\begin{pmatrix} e^{\alpha t} \\ e^{\beta t} \end{pmatrix}$

$\dot{y}+Ay=C\begin{pmatrix} e^{\alpha t} \\ e^{\beta t}\end{pmatrix}$

$\dot{y_p}=X\begin{pmatrix} \alpha & 0 \\ 0 & \beta \end{pmatrix} \begin{pmatrix}e^{\alpha t} \\ e^{\beta t}\end{pmatrix}$

substitute $\dot{y_p}$ and $y_p$ into the original differential equation..

$X\begin{pmatrix} \alpha & 0 \\ 0 & \beta \end{pmatrix}+AX=C$

-
What you have there is a Sylvester equation for which many solution methods are known. –  Ｊ. Ｍ. Aug 25 '12 at 3:21
Are in interested in solving the matrix equation to solve the differential equation, or in its own right? –  Sasha Aug 25 '12 at 3:22
I think this question was asked here on math.SE before, but I can't find the link. –  user2468 Aug 25 '12 at 3:29
"I don't even understand a single word in Wikipedia" - fine... do you at least know what a Kronecker product is? Or, better yet, what part of the Wiki article do you not understand? –  Ｊ. Ｍ. Aug 25 '12 at 13:27
@JenniferDylan: I think the closest thing is this, but it's not exactly a duplicate, since it has no free term: math.stackexchange.com/questions/39906/… –  tomasz Aug 25 '12 at 15:21

It seems $AX+XB=[A,I_1]X[I_2,B]^T$, where $I_1$ and $I_2$ are identity matrices and subscript 'T' is transpose of a matrix. Thus, the problem becomes how to solve $[A,I_1]X[I_2,B]^T = C$. Obviously, $X=[A,I_1]^\dagger C {[I_2,B]^T}^\dagger$, where subscript '$\dagger$' means the Pseudo-inverse.
This is incorrect. $AX+XB$ is $[A,I]\begin{bmatrix}X\\ &X\end{bmatrix}\begin{bmatrix}I\\ B\end{bmatrix}$, not $[A,I]X[I,B]^T$. Note that $[A,I]X$ is not a legitimate matrix product, as $[A,I]$ has $2n$ columns but $X$ has $n$ rows. –  user1551 Jan 16 at 12:36
Use the superoperator formalism: $$AXB=C \mapsto ( {B}^T\otimes A)\text{vec} X = C$$ (see here for a definition of $\text{vec}(X)\;$ and here for more information: Kronecker product)
Rewrite your equation (using $AXB\to (B^T\otimes A) \text{vec}\;X$) to $$AX+XB=C \to (1\otimes A)\text{vec}\;X + (B^T\otimes 1)\text{vec}\;X=\text{vec}\;C\\ \text{vec}\;X=\left((1\otimes A) + (B^T\otimes 1)\right)^{-1}\text{vec}\;C,$$ assuming that the last inverse exists...