# How to solve for Transpose[X] A X = B

I need to find a transformation matrix of the metric tensor but I don't know how to solve for X from

Transpose[X]*A*X=B

• Try DiscreteRiccatiSolve – bill s Jan 12 at 15:33
• Just noting that * does not denote matrix multiplication in Mathematica. . does. – Szabolcs Jan 12 at 15:34
• @bills How would you use DiscreteRiccatiSolve to solve for X? I'm not familiar with control-systems lingo, but it doesn't seem possible. There's no $x^\dagger$ in the Riccati equation. The closest thing is $(r+b^\dagger.x.b)^{-1}$. – Michael E2 Jan 12 at 16:41
• Please post a specific example with the explicit A and B matrices. – Daniel Lichtblau Jan 12 at 16:51
• There may not be a general solution unless A and B satisfy some further conditions. – Roman Jan 12 at 18:56

It may be possible using RiccatiSolve which can solve an equation of the form

$$a^{T }.x+x.a-x.b.r^{-1}.b^{T }.x+q=0$$

If we assume $$x=x^T$$ and then choose values $$a=0$$, $$b=I$$, $$r=A^{-1}$$, and $$q=B$$, the above equation becomes

$$0^{T }.x+x.0-x^T.I.(A^{-1})^{-1}.I^{T }.x+B=0$$

$$x^T.A.x=B$$

The assumption $$x=x^T$$ specifies conditions that the matrices $$A$$ and $$B$$ must satisfy. You can see them in the details section of RiccatiSolve.

Here is a small concocted example.

q = IdentityMatrix;
r = {{5, 1}, {1, 5}};
x = RiccatiSolve[{ConstantArray[0, {2, 2}], IdentityMatrix}, {q, r}]


{{1/2 (2 + Sqrt), 1/2 (-2 + Sqrt)}, {1/2 (-2 + Sqrt), 1/2 (2 + Sqrt)}}

With[{A = Inverse[r], B = q}, Transpose[x].A.x - B] // Simplify


{{0, 0}, {0, 0}}