Chapter Contents Previous Next
 Language Reference

## INV Function

computes the matrix inverse

INV( matrix)

where matrix is a square nonsingular matrix.

The INV function produces a matrix that is the inverse of matrix, which must be square and nonsingular.

For G = INV(A) the inverse has the properties
GA = AG = identity   .
To solve a system of linear equations AX = B for X, you can use the statement
   x=inv(a)*b;

However, the SOLVE function is more accurate and efficient for this task.

The INV function uses an LU decomposition followed by backsubstitution to solve for the inverse, as described in Forsythe, Malcolm, and Moler (1967).

The INV function (as well as the DET and SOLVE functions) uses the following criterion to decide whether the input matrix, A = [aij]i,j = 1, ... ,n, is singular:
where MACHEPS is the relative machine precision.

All matrix elements less than or equal to sing are now considered rounding errors of the largest matrix elements, so they are taken to be zero. For example, if a diagonal or triangular coefficient matrix has a diagonal value less than or equal to sing, the matrix is considered singular by the DET, inv, and SOLVE functions.

Previously, a much smaller singularity criterion was used, which caused algebraic operations to be performed on values that were essentially floating point error. This occasionally yielded numerically unstable results. The new criterion is much more conservative, and it generates far fewer erroneous results. In some cases, you may need to scale the data to avoid singular matrices. If you think the new criterion is too strong,

• try the GINV function to compute the generalized inverse
• examine the size of the singular values returned by the SVD function. The SVD function can be used to compute a generalized inverse with a user-specified singularity criterion.

 Chapter Contents Previous Next Top