Matrix Laboratory or Matlab is designed to work mainly with arrays and matrices. All the Matlab variables, irrespective of their data type, are multidirectional arrays and all matrices are two-dimensional arrays.
A matrix is a two-dimensional array that can be easily created using Matlab. In its true mathematical sense, a Matrix is an arrangement of several rows and columns, and this number also defines it. An ‘m-by-n’ or ‘m X n’ matrix means that the matrix has m-rows and n-columns, where m and n are the dimensions. Consider an example of dimensions 3×4, meaning that there are three rows and four columns in this matrix.
In this article, we will understand what does the inverse of a matrix mean in its mathematical terms and how it can be implemented in MATLAB.
Inverse of a matrix
Mathematically, the inverse of a matrix A is denoted by A-1. Finding the inverse of a matrix requires the determinant and the adjoint of the same, which is calculated with respect to the cofactors of the elements.
The cofactor of an element is the multiplication of the minor of the element with -1 raised to the exponent of the sum of the rows and columns. The minor is the determinant obtained after eliminating the rows and columns of that specific element. The determinant is the summation of the product of the elements and its cofactors. The adjoint matrix is the transpose of the cofactor matrix. The inverse of a given matrix is the adjoint matrix divided by the determinant of the matrix.
Also read: How to plot multiple lines in Matlab?
Inverse of a Matrix in MATLAB
In MATLAB, there is a direct function, inv. The function syntax for the function is inv followed by the matrix name.
An alternate method, without using the inbuilt function inv, is by using the mathematical denotation A-1 literally. The inverse of the matrix will be the matrix raised to the exponent of -1.
To verify the inverse of a matrix, we use the property of matrices, which is the multiplication of a matrix and its inverse always gives an identity matrix. The diagonal elements of the identity matrix are 1, while all the other elements are 0.
Also read: How to make a table in MATLAB?
A creative nerd, TT player, an avid reader, and an engineering student.