MATLAB - Inverse of a Matrix

Advertisements


The inverse of a matrix A is denoted by A−1 such that the following relationship holds:

AA−1 = A−1A = 1

The inverse of a matrix does not always exist. If the determinant of the matrix is zero, then the inverse does not exist and the matrix is singular.

In MATLAB, inverse of a matrix is calculated using the inv function. Inverse of a matrix A is given by inv(A).

Example

Create a script file and type the following code:

a = [ 1 2 3; 2 3 4; 1 2 5]
inv(a)

When you run the file, it displays the following result:

a =
     1     2     3
     2     3     4
     1     2     5
ans =
   -3.5000    2.0000    0.5000
    3.0000   -1.0000   -1.0000
   -0.5000         0    0.5000


Advertisements
Advertisements