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
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.
- Program for Gauss-Jordan Elimination Method
- How to inverse a matrix using NumPy
- Inverse of Matrix in R
- Decimal Equivalent of Gray Code and its Inverse
- Inverse functions and composition of functions
- Finding the maximum square sub-matrix with all equal elements
- Finding the converging element of the diagonals in a square matrix
- Finding the Frobenius Norm of a given matrix
- Finding Floor and Ceil of a Sorted Array using C++ STL
- Finding Median of unsorted Array in linear time using C++ STL
- Finding the probability of a state at a given time in a Markov chain | Set 2
- Finding number of digits in n'th Fibonacci number
- Finding sum of digits of a number until sum becomes single digit
- std::gcd | C++ inbuilt function for finding GCD
- Finding the best fit rectangle that covers a given point
- Finding a Non Transitive Coprime Triplet in a Range
- Finding the Parity of a number Efficiently
- Finding Mean, Median, Mode in Python without libraries
- Finding minimum and maximum element of a Collection in Java
- Check if a number is perfect square without finding square root
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.