# Arbitrary Matrices Solving

I'm trying to solve some equations with arbitrary matrices. My Problem is that I don't know what way to solve the equation should be taken.

Examples:

1. Solve for $X$. $X,A$ are arbitrary matrices. $XA+A^T = I$

2. Solve for $X$. $X,A,B$ are arbitrary matrices and $C-2A^T$ is invertible. $X^TC = 2 A(X+B)$

I solved the equations for some values (which I randomly chose), but cannot get the grip by doing it for generally.

-
Interestingly the first matrix equation seems to appear rather often, see math.stackexchange.com/q/131393/7266. – Fabian Apr 16 '12 at 21:37
Thanks alot. Yeah the Question appears alot because of a Homework Assignment. But its only the first of five Problems and im more interested in the way of solving this then the solutions itself :-) @Fabian I updated my Question – GnrlKnowledge Apr 17 '12 at 7:59

$$\begin{eqnarray} X^T C-2AX &=& B &(1)\\ C^T X - 2X^T A^T &=& B^T &(2)\\ \end{eqnarray}$$ Now add $(1)$ and $(2)$: $$\begin{eqnarray} X^T\underbrace{\left(C-2A^T\right)}_{D}+\underbrace{\left(C^T-2A\right)}_{D^T}X&=&B+B^T \tag{1+2}.\\ \end{eqnarray}$$ Now let's multiply by $D^{-1}$ from the right: $$X^T + D^T X D^{-1} = \left(B+B^T\right)D^{-1}$$ and use the following (to me known as superoperator formalism) representation of the problem: $$\text{vec}(AXB) = (B^T \otimes A) \text{vec}(X).$$ (see here for a definition of $\text{vec}(X)$...). We get: $$\hat{T}\text{vec}(X) + \left((D^{-1})^T\otimes D \right) \text{vec}(X)=\text{vec}\left((B+B^T)D^{-1}\right),$$ where $\hat{T}$ is the superoperator representation of the transposition operation (essentially a permutation matrix, that is not representable as product $A\otimes B$).
We finally get: $$\text{vec}(X)= \left[\hat{T} + \left((D^{-1})^T\otimes D \right) \right]^{-1}\text{vec}\left((B+B^T)D^{-1}\right)$$