Skip to main content
1 of 2

A case for matrix multiplication (a.b).c unequal to a.(b.c) in mathematica 12.0.0.0, why?

The motivation of my calculation is to get the inverse for the following matrix

c={{806187941679782.0, 218884444558405.0, -44574352.7996484, 
  263790009.291711, -7043899062155.16 , 101619269971218.0},
 {218884444558405.0, 59429013469996.9, -12139526.3237759, 
  71717183.1728141, -1913730353321.76, 27580785304831.0},
 {-44574352.7996484, -12139526.3237759, 
  5.06604715779434, -20.0242999918957, 
  455028.9823731, -5189609.42411989},
 {263790009.291711, 71717183.1728141, -20.0242999918957, 
  100.006624596537, -2482688.13923785, 31962666.0977317},
 {-7043899062155.16, -1913730353321.76, 
  455028.9823731, -2482688.13923785 , 
  63930635211.802, -869762434934.025},
 {101619269971218.0, 27580785304831.0, -5189609.42411989, 
  31962666.0977317, -869762434934.025, 12957503435300.3}}

A direct "b=Inverse[m]" gives the following warning

Inverse::luc: Result for Inverse of badly conditioned matrix (<<1>>) may contain significant numerical errors.

Not surprisingly, the diverge of "b.c" from the identity matrix is large. Then I try to use the matrix

a=Inverse[Inverse[m].m]

as a correction. The new Inverse is "a.b". When I test the new inverse, Mathematica gives the following results enter image description here

which are obviously different.

Why do this happen? Besides, is there any better way to perform the matrix inversion in this case?