# Doubt about the best way to calculate the inverse matrix in my case

**URL:** <https://root-forum.cern.ch/t/doubt-about-the-best-way-to-calculate-the-inverse-matrix-in-my-case/56158>\
**Category:** Newbie\
**Created:** [August 26, 2023, 6:24pm UTC](https://root-forum.cern.ch/t/doubt-about-the-best-way-to-calculate-the-inverse-matrix-in-my-case/56158 "2023-08-26T18:24:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![guilherme\_morett](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/g/edb3f5/32.png) [@guilherme\_morett](https://root-forum.cern.ch/u/guilherme_morett)\
**Post date:** [August 26, 2023, 6:24pm UTC](https://root-forum.cern.ch/t/doubt-about-the-best-way-to-calculate-the-inverse-matrix-in-my-case/56158/1 "2023-08-26T18:24:54Z")

</div>

Hi! During my calculus, I have to solve a matricial equation of the type Ax=b.  
I thought to simple obtain the inverse of matrix A (10 x 10) to calculate the vector x. First, I used the A.Invert() command, but there is a more direct way to solve the equation without calculating the inverse matrix?  
I read the page [ROOT: tutorials/matrix/invertMatrix.C Source File](https://root.cern/doc/master/invertMatrix_8C_source.html) and I realized there are several manners to calculate the inverse matrix. I`am using the LU decomposition and I tested the results by the definition of the inverse matrix (A\*A^{-1} = A^{-1}\*A = Identity). The outcome is OK!

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [August 28, 2023, 9:03am UTC](https://root-forum.cern.ch/t/doubt-about-the-best-way-to-calculate-the-inverse-matrix-in-my-case/56158/2 "2023-08-28T09:03:58Z")

</div>

I guess @moneta can help.

---

<div class="post-metadata">

**Author:** ![Eddy\_Offermann](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eddy_offermann/32/25079_2.png) [@Eddy\_Offermann](https://root-forum.cern.ch/u/Eddy_Offermann)\
**Post date:** [August 28, 2023, 3:21pm UTC](https://root-forum.cern.ch/t/doubt-about-the-best-way-to-calculate-the-inverse-matrix-in-my-case/56158/3 "2023-08-28T15:21:44Z")

</div>

Have a look at [solveLinear.C](https://root.cern/doc/master/solveLinear_8C.html) and the Solve methods available in all the [decompose](https://root.cern/doc/master/classTDecompBase.html) classes
