# Solving the matrix quadratic equation: A.X.X + B.X + C == 0 analytically

I'm having difficulty figuring out how to solve a matrix quadratic of the form, $$AXX + BX = -C$$ analytically for $$X$$. Where $$A$$, $$X$$, $$B$$, and $$C$$ are $$N \times N$$ matrices.

I tried using Solve, but got a message saying the system cannot be solved with methods available to Solvep. Is there any other way?

# Edit

If no analytical solution exists, it is possible to derive conditions on when the numerical solution exists?

• Are you trying to solve it symbolically or do your matrices have values in them? Please show your matrices if you can. Dec 20, 2019 at 17:46
• The matrices are symbolic. Will update. Dec 20, 2019 at 17:48
• Have a look at discrete-time algebraic Riccati equations and specifically DiscreteRiccatiSolve Dec 20, 2019 at 19:08

You can try

n = 3;
X = Array[x, {n, n}];
a = RandomReal[{-1, 1}, {n, n}];
b = RandomReal[{-1, 1}, {n, n}];
c = RandomReal[{-1, 1}, {n, n}];
f = (a.X + b).X + c;
sol = FindRoot[Thread[Flatten[f] == 0], Table[{Flatten[X][[i]], 0 }, {i, 1, n n}]]
f /. sol


Depending on the generated matrices, the result could be wordless. Some systems may not have real solutions.

• Note that the OP mentioned in comments that their matrices are symbolic. Dec 20, 2019 at 20:50
• I assumed that for systems with dimensions $\ge 3 \times 3$ is practically impossible to tackle symbolically this problem. Dec 20, 2019 at 20:54
• My system is 3x3 =) Dec 20, 2019 at 21:07
• @hipHopMetropolisHastings yeah so Cesareo is right. A symbolic solution would be practically impossible. Would Cesareo's solution work for you? Otherwise, please specify your problem better Dec 20, 2019 at 21:28