Solve matrix equation $\mathbf{X} + \mathbf{X}\mathbf{M} + \mathbf{M}\mathbf{X} = \mathbf{C}$

linear algebramatricesmatrix equations

I'm having some trouble solving the matrix equation

$$\mathbf{X} + \mathbf{X}\mathbf{M} + \mathbf{M}\mathbf{X} = \mathbf{C}$$

for $\mathbf{X}$, where

  1. $M_{ij} = m_im_j$ (and therefore symmetric)
  2. $m_i$ is vector of length $=1$,
  3. $\mathbf{X}$ is symmetric
  4. Trace$(\mathbf{X})=0$
  5. Matrices are $3 \times3$

I've been doing some research, and my post is relatively similar to this post. However, $\mathbf{M}$ seems to have at least one zero eigenvalue, implying the suggested solution in the post will not work.

How can I proceed? (My linear algebra is a bit rusty)

Thank you very much for your time!

Best Answer

With a careful reading of the page on Sylvester's equation, we can apply the vectorization operator to both sides of your equation to obtain $$ \operatorname{vec}(X) + (M \otimes I_3) \operatorname{vec}(X) + (I_3 \otimes M)\operatorname{vec}(X) = \operatorname{vec}(C) \implies\\ [I_9 + M \otimes I_3 + I_3 \otimes M]\operatorname{vec}(X) = \operatorname{vec}(C) $$ which is to say that, at worst, we can obtain the solution by solving 9-variable linear system of equations. Note that, in the above, $\operatorname{vec}(X)$ is the column-vector given by $$ \operatorname{vec}(X) = (x_{11},x_{21},x_{31},x_{12},x_{22},x_{32},x_{13},x_{23},x_{33})^T $$ We can guarantee that the matrix $I_9 + M \otimes I_3 + I_3 \otimes M$ will be invertible since it is positive definite, so we can indeed guarantee the unique solution $$ \operatorname{vec}(X) = [I_9 + M \otimes I_3 + I_3 \otimes M]^{-1} \operatorname{vec}(C) $$ Notably, we have done nothing with the information that $X$ is symmetric and trace free. However, if the above is implemented correctly, then our unique solution $X$ should satisfy these conditions.


Idle observations:

We can easily find an orthogonal matrix $P$ whose first column is $m = (m_1,m_2,m_3)^T$ (or at least have a computer do so). That is, we can find a $P$ which satisfies $Pe_1 = m$ and $P^TP = I$, where $e_1 = (1,0,0)^T$. With that, we can note that $M = mm^T$ and rewrite the equation as $$ X + XM + MX = C \implies\\ X + X(Pe_1)(Pe_1)^T + (Pe_1)(Pe_1)^TX = C \implies\\ X + (XP)(e_1 e_1^T)P^T + P(e_1e_1^T)(P^TX) = C \implies\\ P^TXP + (P^TXP)(e_1 e_1^T) + (e_1e_1^T)(P^TXP) = P^TCP $$ So, if we perform the substitution $Y = P^TXP$, $D = P^TCP$, $N = e_1e_1^T$, then it suffices to solve the system of equations $$ Y + YN + NY = D $$ where in this equation, we always have $$ N = \pmatrix{1&0&0\\0&0&0\\0&0&0} $$