What is matrix?
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
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
- Program for Gauss-Jordan Elimination Method
- Finding the maximum square sub-matrix with all equal elements
- Decimal Equivalent of Gray Code and its Inverse
- Print a given matrix in spiral form using direction tracking method
- Minimum number of steps to convert a given matrix into Upper Hessenberg matrix
- Minimum steps required to convert the matrix into lower hessenberg matrix
- Minimum number of steps to convert a given matrix into Diagonally Dominant Matrix
- Check if matrix can be converted to another matrix by transposing square sub-matrices
- std::gcd | C++ inbuilt function for finding GCD
- Program to check diagonal matrix and scalar matrix
- Circular Matrix (Construct a matrix with numbers 1 to m*n in spiral way)
- Finding the best fit rectangle that covers a given point
- Finding the Parity of a number Efficiently
- Finding sum of digits of a number until sum becomes single digit
- Finding Floor and Ceil of a Sorted Array using C++ STL
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.