The Identity Matrix, Determinant and Inverse of a Matrix

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:

\[\begin{split} I_2 = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} \end{split}\]

The 3×3 identity matrix is:

\[\begin{split} I_3 = \begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix} \end{split}\]

In general the \(n\times n\) identity matrix is:

\[\begin{split} I_n = \begin{pmatrix} 1 & 0 & \cdots & 0 \\ 0 & 0 & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & 1 \end{pmatrix} \end{split}\]

The identity matrix has the property that when multipled with another matrix is leaves the other matrix uncharged:

\[ AI = A = IA \]

Example

\[\begin{split} \begin{pmatrix} 3 & 4 \\ 8 & 9 \end{pmatrix} \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} = \begin{pmatrix} 3 & 4 \\ 8 & 9 \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} \begin{pmatrix} 3 & 4 \\ 8 & 9 \end{pmatrix} \end{split}\]

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:

\[\begin{split} A = \begin{pmatrix} a & b \\ c & d \end{pmatrix}\;\;\;A^\intercal = \begin{pmatrix} a & c \\ b & d \end{pmatrix} \end{split}\]

Example

For the matrix \(A\) below, find \(A^\intercal\).

\[\begin{split} A = \begin{pmatrix} 3 & 4 \\ 8 & 9 \end{pmatrix} \end{split}\]

Solution:

\[\begin{split} A^\intercal = \begin{pmatrix} 3 & 8 \\ 4 & 9 \end{pmatrix} \end{split}\]

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:

\[\begin{split} A = \begin{pmatrix} a & b \\ c & d \end{pmatrix} \;\;\; |A| = ad-bc \end{split}\]
  • 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\):

\[\begin{split} A = \begin{pmatrix} 1 & -4 \\ 2 & 5 \end{pmatrix} \end{split}\]

Solution:

\[\begin{split} |A| = \begin{vmatrix} 1 & -4 \\ 2 & 5 \end{vmatrix} = (1 \times 5) - (-4 \times 2) = 13 \end{split}\]

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:

\[ A A^{-1} = A^{-1}A = I \]

To find the inverse of a 2×2 matrix \(A\), we have the following formula:

\[\begin{split} A = \begin{pmatrix} a & b \\ c & d \end{pmatrix} \;\;\; A^{-1} = \frac{1}{|A|}\begin{pmatrix} d & -b \\ -c & a \end{pmatrix} \end{split}\]

Example

Find the inverse \(A^{-1}\) of the matrix \(A\).

\[\begin{split} A = \begin{pmatrix} 1 & -4 \\ 2 & 5 \end{pmatrix} \end{split}\]

Solution: From the previous example on determinants, we know that \(|A|=13\). So the inverse of \(A\) is:

\[\begin{split} A^{-1} = \frac{1}{13}\begin{pmatrix} 5 & 4 \\ -2 & 1 \end{pmatrix} = \begin{pmatrix}\frac{5}{13} & \frac{4}{13} \\ \frac{-2}{13} & \frac{1}{13} \end{pmatrix} \end{split}\]

The linalg module can similar find inverses.

np.linalg.inv(A)
array([[ 0.38461538,  0.30769231],
       [-0.15384615,  0.07692308]])