# Different inverse for almost equal matrices

**URL:** <https://discourse.julialang.org/t/different-inverse-for-almost-equal-matrices/81028>\
**Category:** General Usage\
**Tags:** question, linearalgebra, matrices\
**Created:** [May 13, 2022, 3:31pm UTC](https://discourse.julialang.org/t/different-inverse-for-almost-equal-matrices/81028 "2022-05-13T15:31:31Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [May 13, 2022, 4:05pm UTC](https://discourse.julialang.org/t/different-inverse-for-almost-equal-matrices/81028/3 "2022-05-13T16:05:06Z")

</div>

> [@shce](#):
>
> result is completely different:
> 
> ```julia
> norm(inv(A)-inv(B),Inf)) = 0.5606764699332416
> 
> ```

Is `0.56` a big or a small difference? You always need to ask **compared to what**? Here, the relevant comparison is probably to the norm of the inverse, i.e. you want to know the **relative error** :

```julia
norm(inv(A)-inv(B),Inf)) / norm(inv(A),Inf)

```

What is it?

As @Oscar_Smith writes, the relative error could still be large if your matrices are badly conditioned, and generally you want to avoid computing explicit inverses to begin with. But looking at [absolute errors is a common mistake](https://discourse.julialang.org/t/sum-1-0-1e100-1-0-1e100-fails/76502/10).

---

_[View the full topic](https://discourse.julialang.org/t/different-inverse-for-almost-equal-matrices/81028)._
