# Inverse Inverse[m]

gives the inverse of a square matrix m.

# Details and Options • Inverse works on both symbolic and numerical matrices.
• For matrices with approximate real or complex numbers, the inverse is generated to the maximum possible precision given the input. A warning is given for illconditioned matrices.
• Inverse[m,Modulus->n] evaluates the inverse modulo n.
• Inverse[m,ZeroTest->test] evaluates test[m[[i,j]]] to determine whether matrix elements are zero. The default setting is .
• A Method option can also be given. Settings for exact and symbolic matrices include "CofactorExpansion", "DivisionFreeRowReduction", and "OneStepRowReduction". The default setting of Automatic switches among these methods depending on the matrix given.

# Examples

open allclose all

## Basic Examples(3)

Inverse of a 2×2 matrix:

Enter the matrix in a grid:

Inverse of a symbolic matrix:

## Scope(12)

### Basic Uses(7)

Find the inverse of a machine-precision matrix:

Invert a complex matrix:

Inverse of an exact matrix:

Inverse of an arbitrary-precision matrix:

Inverse of a symbolic matrix:

Verifying a symbolic inverse may require simplification:

The inversion of large machine-precision matrices is efficient:

### Special Matrices(5)

The inverse of a sparse matrix is returned as a normal matrix:

Format the result:

When possible, the inverse of a structured matrix is returned as another structured matrix:

This is not always possible:

IdentityMatrix is its own inverse:

Inverse of HilbertMatrix:

Visualize the inverses for several matrix sizes:

Compute the inverse of a matrix of univariate polynomials of degree :

## Options(2)

### Modulus(1)

Invert a matrix using arithmetic modulo five:

The inverse using normal arithmetic:

Visualize the two results:

### ZeroTest(1)

The automatic zero test cannot detect that the following matrix is nonsingular: The problem is that machine-precision underflows for the bottom right entry:

The entry is very small but nonzero:

Use a zero test employing arbitrary-precision arithmetic to invert the matrix:

## Applications(10)

### Solving Equations(4)

Solve the system of equations , , . First, form the coefficient matrix and constant vector :

The solution is given by :

Substitute the solution into the original system of equations to verify the solution:

Solve the matrix equation :

Multiplying both sides of the equation on the left by shows :

Confirm the result using LinearSolve:

For numerical and especially sparse systems, LinearSolve can be considerably faster:

Solve the matrix equation :

Multiplying both sides of the equation on the left by shows :

Substitute the solution into the equation for verification:

Solve the system of ODEs , , . First, construct the coefficient matrix for the right-hand side:

Find the eigenvalues and eigenvectors:

Construct a diagonal matrix whose entries are the exponential of :

Construct the matrix whose columns are the corresponding eigenvectors:

The general solution is , for three arbitrary starting values:

Verify the solution using DSolveValue:

### Change of Basis/Coordinates(6)

Express a general vector in as a linear combination of the vectors , and . First, verify the vectors are linearly independent by checking that their null space is empty:

Form the matrix whose columns are the basis vectors:

The coefficients of a general vector are given by :

Verify that does indeed equal the linear combination :

Find the change-of-basis matrix that transforms coordinates with respect to the basis to coordinates with respect to the basis :

The matrix whose columns are the transforms from -coordinates to standard coordinates:

The matrix whose columns are the transforms from -coordinates to standard coordinates:

Its inverse converts from standard coordinates back to -coordinates:

Therefore, converts from -coordinates to -coordinates:

Express the linear operator whose representation in the standard is given by in the basis , , The matrix whose columns are the transforms from -coordinates to standard coordinates:

Its inverse converts from standard coordinates to -coordinates:

Therefore the representation of in -coordinates is:

Inverse can be used to diagonalize a matrix as . Compute 's eigenvalues and eigenvectors:

Construct a diagonal matrix from the eigenvalues and a matrix whose columns are the eigenvectors:

Confirm the identity :

Any function of the matrix can now be computed as . For example, MatrixPower:

Similarly, MatrixExp becomes trivial, requiring only exponentiating the diagonal elements of :

Inverse of a transformation matrix gives the matrix for the reverse operation. For example, consider a translation by :

The inverse of its transformation matrix gives a translation by the opposite motion:

Consider a general affine transformation:

Construct the inverse transformation:

Verify that the two transformations really do undo each other:

For a mapping , the Jacobian of the inverse mapping is given by . Consider the mapping from Cartesian to spherical coordinates:

Compute the Jacobian at the point :

The inverse mapping is the transformation from spherical back to Cartesian coordinates:

Verify the inverse function:

Compute the Jacobian of the inverse mapping at the coordinates corresponding to :

Confirm the identity :

## Properties & Relations(13)

Inverse satisfies the relation for an matrix :

Inverse satisfies the relation :

Inverse satisfies the relation :

A square matrix has an inverse if and only if its determinant is nonzero: Moreover, determinant of the inverse equals :

MatrixPower[m,-1] equals Inverse[m]:

For an invertible matrix , Inverse[a] equals Adjugate[a]/Det[a]:

Inverse[m] equals LinearSolve[m,IdentityMatrix[n]] for an invertible n×n matrix:

The inverse of an orthogonal matrix is given by Transpose:

The inverse of a unitary matrix is given by ConjugateTranspose:

A matrix and its inverse have the same symmetry:

A QuantityArray and its inverse have reciprocal units:

For an invertible matrix , Inverse[a] and coincide:

PseudoInverse extends to singular as well as rectangular matrices:

For an invertible matrix , Inverse[a] and coincide:

DrazinInverse extends to singular square matrices:

## Possible Issues(3)

The inverse may not exist: Typically a pseudo inverse does:

Full inverses do not exist for rectangular matrices:  