From a pedagogical point of view, examples of matrix inversion are invariably coupled with the use of the determinant
and 3x3 matrices.
From a numerical analysis
point of view, it is almost never desirable to actually compute the inverse of a matrix. On a practical level, the inverse of a matrix is almost never what you want to compute for "real" matrices. The reasons are as follows:
- The determinant will overflow IEEE754 doubles for "real" sized matrices
- The inversion of a matrix takes O(n3) operations. One typically wants to solve for a vector x=A-1b or matrix C=A-1B. In this case, multiplying by the inverse is far more computationally expensive than performing an LU factorisation, followed by right hand solves.
There are instances where a generalized matrix inversion is unavoidable. In this case, one should still avoid the use of the determinant
. As suggested by koala
's post, one can perform a factorisation (LU
, for example), and employ the columns of the identity matrix
as multiple right hand sides.