Inverse of a matrix
For the inverse of a matrix in MATLAB®, see
MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
inverse(A) returns the inverse of the matrix A.
If the argument does not evaluate to a matrix of one of the
types mentioned above, a symbolic call
normal before returning
results. This additional internal call ensures that the final result
is normalized. This call can be computationally expensive. It also
affects the result returned by
inverse only if
a matrix contains variables or exact expressions, such as
To avoid this additional call, specify
Normal = FALSE.
In this case,
inverse also can return normalized
results, but does not guarantee such normalization. See Example 4.
Compute the inverse of a matrix given by various data types:
A := array(1..2, 1..2, [[1, 2], [3, PI]]); inverse(A)
B := hfarray(1..2, 1..2, [[1, 2], [3, PI]]); inverse(B)
C := matrix(2, 2, [[1, 2], [3, PI]]); inverse(C)
delete A, B, C:
The following matrix is not invertible:
inverse(matrix([[1, 2], [3, 6]]))
If the input does not evaluate to a matrix, then symbolic calls are returned:
delete A, B: inverse(A + 2*B)
Normal can significantly decrease the
inverse. For example, computing
the inverse of this matrix takes a long time:
n := 5: inv5 := inverse(matrix(n, n, [[1/(x[i] + x[j]) $ j = 1..n] $ i = 1..n])):
For better performance, specify
Normal = FALSE:
n := 5: inv5 := inverse(matrix(n, n, [[1/(x[i] + x[j]) $ j = 1..n] $ i = 1..n]), Normal = FALSE):
Option, specified as
Return normalized results. The value
The inverse is returned as a matrix of the same type as the
input matrix. If the matrix is not invertible, then
FAIL is returned. If
the input does not evaluate to a matrix, then a symbolic call of