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 ZeroTest->Automatic.
  • 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  (11)

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:

TraditionalForm formatting:

Special Matrices  (4)

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:

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 TemplateBox[{a}, Inverse].b:

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 TemplateBox[{m}, Inverse] shows x=TemplateBox[{m}, Inverse].b:

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 TemplateBox[{m}, Inverse] shows x=TemplateBox[{m}, Inverse].y:

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 p.d.TemplateBox[{p}, Inverse].{TemplateBox[{1}, CTraditional],TemplateBox[{2}, CTraditional],TemplateBox[{3}, CTraditional]}, for three arbitrary starting values:

Verify the solution using DSolveValue:

Change of Basis/Coordinates  (6)

Express a general vector in TemplateBox[{}, Reals]^3 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 TemplateBox[{p}, Inverse].v:

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, TemplateBox[{q}, Inverse].p 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 m=p.d.TemplateBox[{p}, Inverse]. Compute 's eigenvalues and eigenvectors:

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

Confirm the identity m=p.d.TemplateBox[{p}, Inverse]:

Any function of the matrix can now be computed as f(m)=p.f(d).TemplateBox[{p}, Inverse]. 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 f:x in TemplateBox[{}, Reals]^n->y in TemplateBox[{}, Reals]^n, the Jacobian of the inverse mapping TemplateBox[{{f, ^, {(, {(, {-, 1}, )}, )}}, y}, Grad] is given by TemplateBox[{{(, TemplateBox[{f, x}, Grad, SyntaxForm -> Del], )}}, Inverse]. 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 TemplateBox[{{f, ^, {(, {(, {-, 1}, )}, )}}, y}, Grad]=TemplateBox[{{(, TemplateBox[{f, x}, Grad, SyntaxForm -> Del], )}}, Inverse]:

Properties & Relations  (13)

Inverse satisfies the relation a.TemplateBox[{a}, Inverse]=TemplateBox[{a}, Inverse].a=IdentityMatrix[n] for an matrix :

Inverse satisfies the relation TemplateBox[{{(, {a, ., b}, )}}, Inverse]=TemplateBox[{b}, Inverse].TemplateBox[{a}, Inverse]:

Inverse satisfies the relation TemplateBox[{{(, TemplateBox[{a}, Transpose], )}}, Inverse]=TemplateBox[{{(, TemplateBox[{a}, Inverse], )}}, Transpose]:

A square matrix has an inverse if and only if its determinant is nonzero:

Moreover, determinant of the inverse TemplateBox[{TemplateBox[{a}, Inverse, SyntaxForm -> SuperscriptBox]}, Det] equals 1/(TemplateBox[{a}, Det]):

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 PseudoInverse[a] coincide:

PseudoInverse extends to singular as well as rectangular matrices:

For an invertible matrix , Inverse[a] and DrazinInverse[a] 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:

Use PseudoInverse instead:

Accurate inverses cannot be found for ill-conditioned machine-precision numerical matrices:

Exact result:

Arbitrary-precision result:

Wolfram Research (1988), Inverse, Wolfram Language function, https://reference.wolfram.com/language/ref/Inverse.html (updated 1996).

Text

Wolfram Research (1988), Inverse, Wolfram Language function, https://reference.wolfram.com/language/ref/Inverse.html (updated 1996).

CMS

Wolfram Language. 1988. "Inverse." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 1996. https://reference.wolfram.com/language/ref/Inverse.html.

APA

Wolfram Language. (1988). Inverse. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Inverse.html

BibTeX

@misc{reference.wolfram_2022_inverse, author="Wolfram Research", title="{Inverse}", year="1996", howpublished="\url{https://reference.wolfram.com/language/ref/Inverse.html}", note=[Accessed: 05-July-2022 ]}

BibLaTeX

@online{reference.wolfram_2022_inverse, organization={Wolfram Research}, title={Inverse}, year={1996}, url={https://reference.wolfram.com/language/ref/Inverse.html}, note=[Accessed: 05-July-2022 ]}