 # Silly problem with the inverse of a Matrix

Hello,

I am just calculating the inverse of a matrix D

D=

-0.85857329 -0.28590100 0.25616156
0.81476410 -0.069523359 -0.18653899
0.095632463 2.1536929 -0.38059121

as inv(D)=

-2.6360355e+16 -2.7263698e+16 -4.3794153e+15
-1.7991012e+16 -1.8607546e+16 -2.9889626e+15
-1.0843135e+17 -1.1214719e+17 -1.8014399e+16

But

inv(D)*D=

1.0625000 0.0000000 0.75000000
-3.5625000 0.0000000 1.5000000
0.0000000 0.0000000 5.0000000

Why is that? What can I do?

0

Based on the size of the elements in the inverse result that you print, it appears that the matrix is singular.

Here is what I get in GAUSS 22:

``````d = { -0.85857329 -0.28590100 0.25616156,
0.81476410 -0.069523359 -0.18653899,
0.095632463 2.1536929 -0.38059121 };

print inv(d);``````
```  -2.0507245e+08   -2.1210007e+08       -34070005.
-1.3996249e+08   -1.4475886e+08       -23252868.
-8.4355022e+08   -8.7245784e+08   -1.4014442e+08 ```
``print inv(d)*d;``
```       1.0000000    1.4901161e-08   -1.6763806e-08
1.3504177e-08        1.0000000   -7.4505806e-09
1.8626451e-07    5.9604645e-08       0.99999998 ```

I suspect that if I had all 16 digits for the matrix, I would get the same results that you are getting.

You can use the `detl` function to check to see if the matrix was singular after the inverse call like this:

``````d = { -0.85857329 -0.28590100 0.25616156,
0.81476410 -0.069523359 -0.18653899,
0.095632463 2.1536929 -0.38059121 };

d_i = inv(d);
d_det = detl();

thresh = 1e-12;
if d_det < thresh;
print "matrix is nearly singular";
// other code to handle the situation
endif;``````

You can read more on our blog about diagnosing a singular matrix.

Feel free to post the full precision matrix and/or let us know more about the situation (for example where did the matrix come from). aptech
1,728

### Have a Specific Question?

Get a real answer from a real person

### Need Support?

Get help from our friendly experts.