Matrix is an ordered rectangular array of numbers.
Inverse of a matrix:
Given a square matrix A, which is non-singular (means the Determinant of A is nonzero); Then there exists a matrix
which is called inverse of matrix A.
The inverse of a matrix is only possible when such properties hold:
- The matrix must be a square matrix.
- The matrix must be a non-singular matrix and,
- There exist an Identity matrix I for which
In general, the inverse of n X n matrix A can be found using this simple formula:
Methods for finding Inverse of Matrix:
Finding the inverse of a 2×2 matrix is a simple task, but for finding the inverse of larger matrix (like 3×3, 4×4, etc) is a tough task, So the following methods can be used:
- Elementary Row Operation (Gauss-Jordan Method) (Efficient)
- Minors, Cofactors and Ad-jugate Method (Inefficient)
Elementary Row Operation (Gauss – Jordan Method):
Gauss-Jordan Method is a variant of Gaussian elimination in which row reduction operation is performed to find the inverse of a matrix.
Steps to find the inverse of a matrix using Gauss-Jordan method:
In order to find the inverse of the matrix following steps need to be followed:
- Form the augmented matrix by the identity matrix.
- Perform the row reduction operation on this augmented matrix to generate a row reduced echelon form of the matrix.
- The following row operations are performed on augmented matrix when required:
- Interchange any two row.
- Multiply each element of row by a non-zero integer.
- Replace a row by the sum of itself and a constant multiple of another row of the matrix.
- Augmented Matrix is formed as A:B
- After applying the Gauss-Jordan elimination method:
Below is the C++ program to find the inverse of a matrix using the Gauss-Jordan method:
=== Matrix === 5 7 9 4 3 8 7 5 6 === Augmented Matrix === 7 5 6 0 0 1 5 7 9 1 0 0 4 3 8 0 1 0 === Inverse Matrix === -0.210 0.029 0.276 0.305 -0.314 -0.038 -0.010 0.229 -0.124
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.
In case you wish to attend live classes with industry experts, please refer Geeks Classes Live