NotesByLex

Matrix Inverse

The inverse of a Matrix Transformation is a matrix that reverses the transformation.

For example, if our matrix transform did a 90° anticlockwise rotation, the inverse matrix would do a 90° clockwise rotation.

Inverse transformation example

We represent the inverse of a matrix AA as A−1A^{-1}.

When you multiply a matrix by its inverse, you get the Identity Matrix back: A⋅A−1=IA \cdot A^{-1} = I

It's the equivalent of the reciprocal of a number in scalar math, ie 10∗110=110 * \frac{1}{10} = 1 or 10⋅10−1=110 \cdot 10^{-1} = 1

For a 2×22 \times 2 matrix, we calculate the inverse as follows:

[abcd]−1=1ad−bc[d−b−ca]\begin{bmatrix}a & b \\ c & d\end{bmatrix}^{-1} = \frac{1}{ad-bc} \begin{bmatrix}d & -b \\ -c & a\end{bmatrix}

For example:

[1324]−1=11×4−3×2[4−3−21]=−12[4−3−21]=[−21.51−0.5]\begin{bmatrix}1 & 3 \\ 2 & 4\end{bmatrix}^{-1} = \frac{1}{1 \times 4 - 3 \times 2} \begin{bmatrix}4 & -3 \\ -2 & 1\end{bmatrix} = -\frac{1}{2} \begin{bmatrix}4 & -3 \\ -2 & 1\end{bmatrix} = \begin{bmatrix}-2 & 1.5 \\ 1 & -0.5\end{bmatrix}

We can do a matrix multiplication to confirm the identity matrix is returned:

[1324][−21.51−0.5]=[1001]\begin{bmatrix}1 & 3 \\ 2 & 4 \end{bmatrix} \begin{bmatrix}-2 & 1.5 \\ 1 & -0.5\end{bmatrix} = \begin{bmatrix}1 & 0 \\ 0 & 1 \end{bmatrix}

We can also use the np.linalg.inv method in Numpy to find the inverse.

{% notebook permanent/notebooks/matrix-inverse.ipynb %}

The ad−bcad-bc part of the expression is the Matrix Determinate.

For a larger matrix, we can use Gaussian Elimination to invert a matrix.

(Dye et al., 2018)

A matrix with a determinate of 0: ∣A∣=0|A| = 0 is referred to as a Singular Matrix and has no inverse.

We can only calculate the inverse of a square matrix.

(KhanAcademyLabs, 2008)

References

David Dye, Sam Cooper, and Freddie Page. Mathematics for Machine Learning: Linear Algebra - Home. 2018. ↩

Khan Academy Labs. Introduction to matrix inverses. June 2008. ↩