Main Content

inv

Inverse of symbolic matrix

Syntax

Description

example

inv(A) returns the inverse of the symbolic matrix A.

Examples

collapse all

Compute the inverse of the following matrix of symbolic numbers.

A = sym([2 -1 0; -1 2 -1; 0 -1 2]);
inv(A)
ans =
[ 3/4, 1/2, 1/4]
[ 1/2,   1, 1/2]
[ 1/4, 1/2, 3/4]

Compute the inverse of the following symbolic matrix.

syms a b c d
A = [a b; c d];
inv(A)
ans =
[  d/(a*d - b*c), -b/(a*d - b*c)]
[ -c/(a*d - b*c),  a/(a*d - b*c)]

Compute the inverse of the symbolic Hilbert matrix.

inv(sym(hilb(4)))
ans =
[   16,  -120,   240,  -140]
[ -120,  1200, -2700,  1680]
[  240, -2700,  6480, -4200]
[ -140,  1680, -4200,  2800]

Input Arguments

collapse all

Matrix, specified as a symbolic matrix.

Limitations

Matrix computations involving many symbolic variables can be slow. To increase the computational speed, reduce the number of symbolic variables by substituting the given values for some variables.

See Also

| |

Introduced before R2006a