# How to Find the Inverse of a Matrix: Special Cases

In this lesson, we show how to find the inverse of a matrix for two special cases: a diagonal matrix and a 2 x 2 matrix. In the next lesson, we show how to find the inverse for any matrix.

## How to Find the Inverse of a Diagonal Matrix

A diagonal matrix matrix is a special kind of symmetric matrix. It is a symmetric matrix with zeros in the off-diagonal elements. Two diagonal matrices are shown below.

A =
 1 0 0 3
B =
 5 0 0 0 3 0 0 0 1

Note that the diagonal of a matrix refers to the elements that run from the upper left corner to the lower right corner.

The inverse of a diagonal matrix is obtained by replacing each element in the diagonal with its reciprocal, as illustrated below for matrix C.

C =
 2 0 0 4
C-1 =
 1/2 0 0 1/4

It is easy to confirm that C-1 is the inverse of C, since

CC-1 = C-1C = I

where I is the identity matrix.

This approach will work for any diagonal matrix, as long as none of the diagonal elements is equal to zero. If any of the diagonal elements are equal to zero, the matrix will be less than full rank, and the matrix will not have an inverse.

## How to Find the Inverse of a 2 x 2 Matrix

Suppose A is a nonsingular matrix 2 x 2 matrix. Then, the inverse of A can be computed from A, as shown below.

 A11 A12 A21 A22

 A22/|A| -A12/|A| -A21/|A| A11/|A|
A A-1

where the determinant of A is |A| = A11A22 - A12A21 .

To illustrate how this works, let's find the inverse of matrix B, which appears below.

B =
 2 1 4 4

First, let's compute the determinant of matrix B.

|B| = B11B22 - B12B21 = 2*4 - 1*4 = 8 - 4 = 4

Then, we can find the inverse, as shown below.

B-1 =
 B22/|B| -B12/|B| -B21/|B| B11/|B|

B-1 =
 4/4 -1/4 -4/4 2/4
=
 1 -1/4 -1 1/2

Warning: If the determinant of a matrix is equal to zero, then the matrix does not have an inverse.

## Test Your Understanding

Problem 1

Find the inverse of matrix A, shown below.

A =
 2 0 0 0

Solution

This was sort of a trick question. Matrix A is a diagonal matrix with a zero element in its diagonal. Therefore, matrix A is singular, and does not have an inverse.

Problem 2

Find the inverse of matrix A, shown below.

A =
 2 0 0 8

Solution

The inverse of a diagonal matrix is obtained by replacing each element in the diagonal with its reciprocal, as shown below.

A-1 =
 1/2 0 0 1/8

Problem 3

Find the inverse of matrix A, shown below.

A =
 3 1 9 4

Solution

First, let's compute the determinant of matrix A.

|A| = A11A22 - A12A21 = 3*4 - 1*9 = 12 - 9 = 3

Then, we can find the inverse, as shown below.

A-1 =
 A22/|A| -A12/|A| -A21/|A| A11/|A|

A-1 =
 4/3 -1/3 -9/3 3/3
=
 4/3 -1/3 -3 1