# Solutions of Matrix Equation $XAX^{T}=A$ for unknown $X$

Given a square, symmetric positive semidefinite matrix $A$, I am looking for solutions to the matrix equation

$XAX^{T}=A$

for unknown $X$ (not necessarily symmetric). Clearly, setting $X$ equal to the identity matrix solves the equation, but I was wondering if there is a systematic procedure for looking for the non-trivial solutions. The only restriction on $X$ is that it is invertible.

Thanks!

• Any matrix $X$ satisfying $AX=XA$ and $XX^T=I$ is a solution. – Mercy King Oct 31 '13 at 22:37

Remove the requirement that $X$ is invertible for the moment. Orthogonally diagonalise $A$ as $QSQ^T$ and let $Y=Q^TXQ$. Then $XAX^T=A$ can be rewritten as $YSY^T = S$. If the nonnegative diagonal matrix $S$ is singular, we can write $S=\operatorname{diag}(D,0)$ for some positive diagonal matrix $D$. Partition $Y$ as $\pmatrix{Y_1&Y_2\\ Y_3&Y_4}$, where the partitioning conforms to the partitioning of $S$ in the block matrix multiplication $YSY^T$. Then $Y_3$ must be zero, $Y_2$ and $Y_4$ are arbitrary and $Y_1DY_1^T=D$, i.e. $D^{-1/2}Y_1D^{1/2}$ is an arbitrary orthogonal matrix.

Therefore, with the requirement that $X$ is invertible, $Y_4$ must be invertible too. In short, $$X=Q\pmatrix{D^{1/2}UD^{-1/2}&Y_2\\ 0&Y_4}Q^T$$ where $U$ is real orthogonal, $Y_2$ is arbitrary and $Y_4$ is invertible.

A slightly different answer from that of user1551.
If A is symmetric, positive demidefinite, then there is an orthogonal matrix t (actually a rotation-matrix), such that $$t' \cdot A \cdot t = D \qquad \text{where also} \qquad t'=t^{-1}$$ where D is diagonal. Then t is also an eigenmatrix of A.

So we can write our problem: search X such that $$X \cdot A \cdot X' = X \cdot (t D t')\cdot X' = A$$ If now X itself is composed from the eigenmatrix t and has a diagonal which in any case needs to be different from the unit-matrix (otherwise $tEt'=I$ is the unwanted trivial solution), such that $$X = t \cdot E \cdot t'$$ then we have $$(t E t') \cdot (t D t')\cdot (t E t')' = A \tag1$$ Now, $(tEt')' = tE't'= tEt'$ and thus (1) becomes $$(t E t') \cdot (t D t')\cdot (t E t') = A \tag2$$ Because $t'=t^{-1}$ the intermediate products, where $t \cdot t'$ occurs cancel and we get $$t E \cdot D \cdot E t' = A \tag3$$ so it is required that $E D E = D$. This means, we need E as a diagonal matrix, whose entries are not all $1$ but whose squares give all $1$, so one example for matrices with size $4\times 4$ is $$E=\operatorname{diag}[1,-1,1,-1] \tag 4$$

Finally, all solutions, where the diagonal entries of E are $e_{k,k} \in (1,-1)$ except the two cases $E = \operatorname{diag}(1,1,1,1)$ and $E = \operatorname{diag}(-1,-1,-1,-1)$ are the nontrivial solutions for X.

Numerical example:

      A :
20.6165     12.5909     17.9791      9.6834
12.5909     15.0880     15.0857     12.8075
17.9791     15.0857     19.2621     13.6685
9.6834     12.8075     13.6685     13.2206

t :
0.5305      0.4722      0.5674      0.4168
-0.7142      0.3846     -0.0782      0.5796
-0.0843     -0.7876      0.3882      0.4711
0.4489     -0.0940     -0.7220      0.5181

D :
58.6643      0.0000      0.0000     -0.0000
0.0000      7.9444      0.0000     -0.0000
-0.0000     -0.0000      1.3392     -0.0000
0.0000      0.0000     -0.0000      0.2393


Then in fact $A = t \cdot D \cdot t'$

      E :
1.0000      0.0000      0.0000      0.0000
0.0000     -1.0000      0.0000      0.0000
0.0000      0.0000      1.0000      0.0000
0.0000      0.0000      0.0000     -1.0000


Then we create $X = t \cdot E \cdot t'$

      X :
-0.4230      0.6337      0.5365      0.3628
0.6337      0.6865     -0.0756     -0.3484
0.5365     -0.0756     -0.0547      0.8387
0.3628     -0.3484      0.8387     -0.2088


Then we build the product $X \cdot A \cdot X' = Z$ and find that in fact $Z = A$

 Z = X * A * X'
Z :
20.6165     12.5909     17.9791      9.6834
12.5909     15.0880     15.0857     12.8075
17.9791     15.0857     19.2621     13.6685
9.6834     12.8075     13.6685     13.2206

err = Z - A
err :
-0.0000     -0.0000     -0.0000      0.0000
-0.0000      0.0000      0.0000      0.0000
-0.0000      0.0000     -0.0000      0.0000
0.0000      0.0000      0.0000      0.0000