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?


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

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

1 Answer 1


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.

  • $\begingroup$ Note that the OP mentioned in comments that their matrices are symbolic. $\endgroup$
    – MarcoB
    Dec 20, 2019 at 20:50
  • $\begingroup$ I assumed that for systems with dimensions $\ge 3 \times 3$ is practically impossible to tackle symbolically this problem. $\endgroup$
    – Cesareo
    Dec 20, 2019 at 20:54
  • $\begingroup$ My system is 3x3 =) $\endgroup$ Dec 20, 2019 at 21:07
  • 1
    $\begingroup$ @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 $\endgroup$
    – MarcoB
    Dec 20, 2019 at 21:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.