Stat Trek

Teach yourself statistics

Stat Trek

Teach yourself statistics


How to Find the Inverse for Any Square Matrix

In this lesson, we describe a method for finding the inverse of any square matrix; and we demonstrate the method step-by-step with examples.

Prerequisites: This material assumes familiarity with elementary matrix operations and echelon transformations.

How to Find the Inverse of an n x n Matrix

Let A be an n x n matrix. To find the inverse of matrix A, we follow these steps:

  1. Using elementary operators, transform matrix A to its reduced row echelon form, Arref.
  2. Inspect Arref to determine if matrix A has an inverse.
    • If Arref is equal to the identity matrix, then matrix A is full rank; and matrix A has an inverse.
    • If the last row of Arref is all zeros, then matrix A is not full rank; and matrix A does not have an inverse.
  3. If A is full rank, then the inverse of matrix A is equal to the product of the elementary operators that produced Arref , as shown below.

A-1 = Er Er-1 . . . E2 E1

where

A-1 = inverse of matrix A
r = Number of elementary row operations required to transform A to Arref
Ei = ith elementary row operator used to transform A to Arref

Note that the order in which elementary row operators are multiplied is important, because Ei Ej is not necessarily equal to Ej Ei.

An Example of Finding the Inverse

Let's use the above method to find the inverse of matrix A, shown below.

A   =   
1 2 2
2 2 2
2 2 1

The first step is to transform matrix A into its reduced row echelon form, Arref, using a series of elementary row operators Ei. We show the transformation steps below for each elementary row operator.

  1. Multiply row 1 of A by -2 and add the result to row 2 of A. This can be accomplished by pre-multiplying A by the elementary row operator E1, which produces A1.
E1 = 
1 0 0
-2 1 0
0 0 1
A1 = E1A = 
1 2 2
0 -2 -2
2 2 1
  1. Multiply row 1 of A1 by -2 and add the result to row 3 of A1.
E2 = 
1 0 0
0 1 0
-2 0 1
A2 = E2A1 = 
1 2 2
0 -2 -2
0 -2 -3
  1. Multiply row 3 of A2 by -1 and add row 2 of A2 to row 3 of A2.
E3 = 
1 0 0
0 1 0
0 1 -1
A3 = E3A2 = 
1 2 2
0 -2 -2
0 0 1
  1. Add row 2 of A3 to row 1 of A3.
E4 = 
1 1 0
0 1 0
0 0 1
A4 = E4A3 = 
1 0 0
0 -2 -2
0 0 1
  1. Multiply row 2 of A4 by -0.5.
E5 = 
1 0 0
0 -0.5 0
0 0 1
A5 = E5A4 = 
1 0 0
0 1 1
0 0 1
  1. Multiply row 3 of A5 by -1 and add the result to row 2 of A5.
E6 = 
1 0 0
0 1 -1
0 0 1
Arref = E6A5 = 
1 0 0
0 1 0
0 0 1

Note: If the operations and/or notation shown above are unclear, please review elementary matrix operations and echelon transformations.

The last matrix in Step 6 of the above table is Arref, the reduced row echelon form for matrix A. Since Arref is equal to the identity matrix, we know that A is full rank. And because A is full rank, we know that A has an inverse.

If A were less than full rank, Arref would have all zeros in the last row; and A would not have an inverse.

We find the inverse of matrix A by computing the product of the elementary operators that produced Arref , as shown below.

A-1 = E6 E5 E4 E3 E2 E1

A-1 = 
-1 1 0
1 -1.5 1
0 1 -1

In this example, we used a 3 x 3 matrix to show how to find a matrix inverse. The same process will work on a square matrix of any size.

Test Your Understanding

Problem

Find the inverse of matrix A, shown below.

A =    
1 0
2 2

Solution

The first step is to transform matrix A into its reduced row echelon form, Arref, using elementary row operators Ei to perform elementary row operations, as shown below.

  1. Multiply row 1 of A by -2 and add the result to row 2 of A.
E1 = 
1 0
-2 1
A1 = E1A = 
1 0
0 2
  1. Multiply row 2 of A1 by 0.5..
E2 = 
1 0
0 0.5
Arref = E2A1 = 
1 0
0 1

The last transformed matrix in the above table is Arref, the reduced row echelon form for matrix A. Since the reduced row echelon form is equal to the identity matrix, we know that A is full rank. And because A is full rank, we know that A has an inverse.

We find the inverse by computing the product of the elementary operators that produced Arref , as shown below.

A-1  =   E2 E1  =  
1 0
0 0.5
1 0
-2 1
E2 E1

A-1  =  
1   0
-1   0.5

Note: In a previous lesson, we described a "shortcut" for finding the inverse of a 2 x 2 matrix.