MatrixInverse - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


LinearAlgebra

  

MatrixInverse

  

compute the inverse of a square Matrix or the Moore-Penrose pseudo-inverse of a Matrix

 

Calling Sequence

Parameters

Description

Examples

References

Calling Sequence

MatrixInverse(A, m, mopts, c, out, options)

Parameters

A

-

Matrix or list

m

-

(optional) equation of the form method = name where name is one of 'LU', 'Cholesky', 'subs', 'integer', 'univar', 'polynom', 'complex', 'rational', 'pseudo', or 'none'; method used to factorize the inverse of A

mopts

-

(optional) equation of the form methodoptions=list where the list contains options for specific methods

c

-

(optional) equation of the form conjugate=true or false; specifies whether to use the Hermitian transpose in the case of prefactored input from a Cholesky decomposition

out

-

(optional) equation of the form output=obj where obj is 'inverse' or 'proviso' or a list containing one or more of these names; selects the result objects to compute

options

-

(optional); constructor options for the result object

Description

• 

The MatrixInverse(A) function, where A is a nonsingular square Matrix, returns the Matrix inverse A-1.  If A is recognized as a singular Matrix, an error message is returned.  If A is non-square, the Moore-Penrose pseudo-inverse is returned.

• 

If A is a nonsingular nxn Matrix, the inverse A-1 is computed such that A·A-1=I, where I is the nxn identity Matrix.

• 

If A is a non-square mxn Matrix, or if the option method = pseudo is specified, then the Moore-Penrose pseudo-inverse X is computed such that the following identities hold:

  

A·X·A=A

  

X·A·X=X

  

HermitianTransposeA·X=A·X

  

HermitianTransposeX·A=X·A

• 

If m is included in the calling sequence, then the specified method is used to compute the inverse (except for 1x1, 2x2 and 3x3 Matrices where the calculation of the inverse is hard-coded for efficiency).

  

The complex and rational methods augment the input Matrix with a copy of the identity Matrix and then convert the system to reduced row echelon form.

  

The integer method calls `Adjoint/integer` and divides it by the determinant.

  

The univar method uses an evaluation method to reduce the Matrix to a Matrix of integers, then uses `Adjoint/integer`, and then uses genpoly to convert back to univariate polynomials.

  

The polynom method uses an implementation of fraction-free Gaussian elimination.

  

The LU and Cholesky methods use the corresponding LUDecomposition method on the input Matrix (if not already prefactored) and then use forward and back substitution with a copy of the identity Matrix as a right-hand side.

• 

The subs method indicates that the input is already triangular, so only the appropriate forward or back substitution is done.

• 

If the first argument in the calling sequence is a list, then the elements of the list are taken as the Matrix factors of the Matrix A, due to some prefactorization. These factors are in the form of returned values from LUDecomposition. That is, the list items may be:

– 

A list of a Vector and Matrix, ipiv,LU, for an LU decomposition. The first member is taken as the pivot Vector and the second member as the superimposed unit-lower and upper triangular LU factors (these are the default values returned from LUDecomposition when the method=NAG option is given to that routine). The implied option is method=LU.

– 

A list of 3 Matrices, P,L,U, the PLU decomposition of a Matrix (these are the values returned from LUDecomposition when the output=['P','L','U'] option is given to that routine). The inverse is U-1·L-1·P-1, each component of which can be inexpensively computed (compared to the cost of obtaining the factors). The implied option is method=LU.

– 

A list of a single Matrix, [L], for a Cholesky decomposition (as obtained from the LUDecomposition routine when the method=Cholesky option is specified). The data is taken as the lower triangle of the Matrix. The implied option is method=Cholesky.

  

Thus, prefactored data supplied for the Matrix argument uniquely determines the computation scheme. The method=name option, if specified with prefactored data, must be in agreement.

• 

The methodoptions=list option can be used to specify options to a particular method.  This pertains only to the pseudo-inverse method. The method specific option specified in the list can be of the form tolerance = <value>, where <value> is a positive number. This number, usually small, is used in the case of a floating-point Matrix as the tolerance for accepting a singular value as being effectively nonzero, for use in the pseudo-inverse computation.

• 

The conjugate option specifies whether to use the Hermitian transpose when A is a list of a single Matrix from a symbolic Cholesky decomposition. The default is true. The conjugate=true condition can be abbreviated as conjugate.

• 

The output=obj option can be used to specify the objects returned. The two possible outputs are inverse and proviso. The proviso is relevant only to the Moore-Penrose pseudo-inverse computation. In the floating-point case, it is the ratio of the largest singular value accepted as nonzero to the first singular value. In the exact symbolic case, it is the determinant of the Matrix. If this proviso is zero, in the exact case, or close to zero in the floating-point case, then the four identities given will not necessarily hold.

• 

If you want to compute a single product A-1·B, for a Vector or Matrix B, it is typically more efficient to use the command LinearAlgebraLinearSolveA&comma;B than computing the inverse of A and then the product. If you need to do this many times with the same floating-point Matrix A, then you can obtain fast and accurate results by computing its LU decomposition or QR decomposition, and passing that to LinearAlgebra[LinearSolve]. See the LinearSolve help page for more details.

• 

The constructor options provide additional information (readonly, shape, storage, order, datatype, and attributes) to the Matrix constructor that builds the result. These options may also be provided in the form outputoptions=[...], where [...] represents a Maple list.  If a constructor option is provided in both the calling sequence directly and in an outputoptions option, the latter takes precedence (regardless of the order).

• 

This function is part of the LinearAlgebra package, and so it can be used in the form MatrixInverse(..) only after executing the command with(LinearAlgebra). However, it can always be accessed through the long form of the command by using LinearAlgebra[MatrixInverse](..).

• 

This function has an equivalent shortcut notation, A-1, for square Matrices A.

Examples

withLinearAlgebra&colon;

MatrixInversea&comma;c|b&comma;d

dadbcbadbccadbcaadbc

(1)

MatrixInverse1&comma;2&comma;3&comma;4|2&comma;3&comma;4&comma;0|3&comma;4&comma;0&comma;0|4&comma;0&comma;0&comma;0&comma;method=integer

000140014316014316164143161645256

(2)

A23&comma;13&comma;13|13&comma;23&comma;13|13&comma;13&comma;23&colon;

A has rank 2 and, hence, is singular:

MatrixInverseA

Error, (in MatrixInverse) singular matrix

B1&comma;0&comma;0&comma;0|1&comma;1&comma;0&comma;0|1&comma;1&comma;1&comma;0|1&comma;1&comma;1&comma;1&colon;

MatrixInverseB&comma;method=subs

1−10001−10001−10001

(3)

CMatrix16&comma;30&comma;21&comma;25&comma;16&comma;68&comma;42&comma;52&comma;36&comma;36&comma;37&comma;24&comma;53&comma;30&comma;20&comma;scan=triangularupper&comma;shape=symmetric&comma;datatype=float&colon;

GLUDecompositionC&comma;method=Cholesky&colon;

C1MatrixInverseG

C10.629757785467128−0.410034602076124−0.204152249134948−0.1557093425605540.712802768166090−0.4100346020761240.6557093425605530.1851211072664360.192041522491349−1.36245674740484−0.2041522491349480.1851211072664360.2145328719723180.0449826989619377−0.494809688581315−0.1557093425605540.1920415224913490.04498269896193770.186851211072664−0.5553633217993080.712802768166090−1.36245674740484−0.494809688581315−0.5553633217993083.35899653979239

(4)

mapfnormal&comma;C1·C

1.−0.−0.−0.−0.0.1.0000000000.0.0.0.0.1.0000000000.0.0.0.0.1.0000000000.0.−0.0.−0.1.000000000

(5)

p,luLUDecompositionC&comma;output=NAG&colon;

C2MatrixInversep&comma;lu

C20.629757785467128−0.410034602076125−0.204152249134948−0.1557093425605540.712802768166091−0.4100346020761250.6557093425605540.1851211072664360.192041522491350−1.36245674740485−0.2041522491349480.1851211072664360.2145328719723180.0449826989619378−0.494809688581315−0.1557093425605540.1920415224913500.04498269896193780.186851211072664−0.5553633217993080.712802768166091−1.36245674740485−0.494809688581315−0.5553633217993083.35899653979239

(6)

mapfnormal&comma;C·C2

1.0.−0.0.0.0.1.000000000−0.0.−0.0.0.1.0000000000.0.−0.0.−0.1.000000000−0.−0.0.−0.0.1.

(7)

M1&comma;3

M13

(8)

MiMatrixInverseM&comma;method=pseudo

Mi110310

(9)

NormM·Mi·MM

0

(10)

NormMi·M·MiMi

0

(11)

NormHermitianTransposeMi·MMi·M

0

(12)

NormHermitianTransposeM·MiM·Mi

0

(13)

M2.0&comma;1.0&comma;1.0|0.&comma;3.0&comma;1.0

M2.00.1.03.01.01.0

(14)

MatrixInverseM&comma;method=pseudo&comma;methodoptions=tolerance=5.×10−6&comma;output=inverse&comma;proviso

0.454545454545455−0.04545454545454540.136363636363636−0.1818181818181820.3181818181818180.0454545454545455,0.531845515847812

(15)

References

  

de Boor, Carl. "An Empty Exercise." ACM SIGNUM Newsletter, Vol. 25 Iss. 2. (1990): 2-6.

See Also

genpoly

LinearAlgebra[Adjoint]

LinearAlgebra[LinearSolve]

LinearAlgebra[LUDecomposition]

LinearAlgebra[QRDecomposition]

Matrix

Testzero