Inverse of a Square Matrix
Learn about invertibility, the properties of inverse matrices, and how to create an algorithm to generate the inverse of a matrix.
Definition
The inverse of a square matrix is another matrix, of the same size that converts to identity, , upon multiplication. Mathematically,
The matrix, , has an opposite effect to that of . Whatever does, undoes.
The Python code to calculate the inverse of a square matrix is as follows:
Press + to interact
import numpy as npmat = np.array([[1, 0, 0],[0, 1, 0],[0, 0, 2]])print(mat)inv = np.linalg.inv(mat)print(f"""The inverse of the matrix is\n{inv}""")
Example
For example, the elimination matrix represents two operations, and :
The inverse of this matrix, , is a matrix that does the reverse operations, and :
We can verify whether we have the correct inverse by checking if the following equation is true:
...