The Identity Matrix, Determinant and Inverse of a Matrix#
The Identity Matrix#
The identity matrix (or unit matrix) is a square matrix, which is denoted \(I\), and has 1 along the diagonal (from top left to bottom right) and with 0 in all other positions.
The 2×2 identity matrix is:
The 3×3 identity matrix is:
In general the \(n\times n\) identity matrix is:
The identity matrix has the property that when multipled with another matrix is leaves the other matrix uncharged:
Example
We can show this with Python.
import numpy as np
A = np.array([[3, 4], [8, 9]])
I = np.identity(2)
np.all(A @ I == A) and np.all(A == I @ A)
True
The Transpose of a Matrix#
The transpose of a matrix is denoted \(A^\intercal\) and is obtained by interchanging the rows and columns of a matrix. The rule of a 2×2 matrix \(A\) is:
Example
For the matrix \(A\) below, find \(A^\intercal\).
Solution:
The matrix transpose can be found for a NumPy array as shown below.
A = np.array([[3, 4], [8, 9]])
A.T
array([[3, 8],
[4, 9]])
The Determinant of a Matrix#
The determinant of a matrix is denoted \(|A|\). For finding the determinant of a 2×2 matrix, \(A\), we have the following formula:
A matrix whose determinant is zero, so \(|A|=0\), is said to be singular.
A matrix whose determinant is non-zero, so \(|A|\neq 0\), is said to be non-singular.
Example
Find the determinant of the matrix \(A\):
Solution:
The matrix \(A\) is non-singular.
The NumPy linalg module allows the determinant of a matrix to be found.
A = np.array([[1, -4], [2, 5]])
np.linalg.det(A)
13.0
Inverse of a Matrix#
Only non-singular matrices have an inverse matrix. The inverse of a matrix \(A\) is denoted \(A^{-1}\) and has the following property:
To find the inverse of a 2×2 matrix \(A\), we have the following formula:
Example
Find the inverse \(A^{-1}\) of the matrix \(A\).
Solution: From the previous example on determinants, we know that \(|A|=13\). So the inverse of \(A\) is:
The linalg module can similar find inverses.
np.linalg.inv(A)
array([[ 0.38461538, 0.30769231],
[-0.15384615, 0.07692308]])