# linear algebra – Why is Matlabs inv slow and inaccurate?

## linear algebra – Why is Matlabs inv slow and inaccurate?

The inaccuracy I mentioned is with the method INV, not MATLABs implementation of it. You should be using QR, LU, or other methods to solve systems of equations since these methods dont typically require squaring the condition number of the system in question. Using inv typically requires an operation that loses accuracy by squaring the condition number of the original system.

–Loren

I think the point of Lorens blog is not that MATLABs `inv`

function is particularly slower or more inaccurate than any other numerical implementation of computing a matrix inverse; rather, that in most cases the inverse itself is not needed, and you can proceed by other means (such as solving a linear system using ` – the backslash operator – rather than computing an inverse).`

#### linear algebra – Why is Matlabs inv slow and inaccurate?

`inv()`

is certainly slower than ` unless you have multiple right hand side vectors to solve for. However, the advice from MathWorks regarding inaccuracy is due to a overly conservative bound in a numerical linear algebra result. In other words, `

`inv()`

is NOT inaccurate. The link elaborates further : http://arxiv.org/abs/1201.6035

Several widely-used textbooks lead the reader to believe that solving a linear system of equations Ax = b by multiplying the vector b by a computed inverse inv(A) is inaccurate. Virtually all other textbooks on numerical analysis and numerical linear algebra advise against using computed inverses without stating whether this is accurate or not. In fact, under reasonable assumptions on how the inverse is computed, x = inv(A)*b is as accurate as the solution computed by the best backward-stable solvers.