# Inverse of a Matrix using Gauss-Jordan Elimination

by M. Bourne

In this section we see how Gauss-Jordan Elimination works using examples.

You can re-load this page as many times as you like and get a new set of numbers each time. You can also choose a different size matrix (at the bottom of the page).

(If you need some background first, go back to the Introduction to Matrices).

Choose the matrix size you are interested in and then click the button.

Matrix A:

2×2 matrix
3×3 matrix
4×4 matrix
5×5 matrix

The randomly-generated example appears below.

### Phone users NOTE: If you're on a phone, you can scroll any wide matrices on this page to the right or left to see the whole expression.

## Example (3 × 3)

Find the inverse of the matrix A using Gauss-Jordan elimination.

 A = 3 11 10 6 8 9 13 4 5

### Our Procedure

We write matrix A on the left and the Identity matrix I on its right separated with a dotted line, as follows. The result is called an augmented matrix.

We include row numbers to make it clearer.

 3 11 10 6 8 9 13 4 5
 1 0 0 Row 0 1 0 Row 0 0 1 Row

Next we do several row operations on the 2 matrices and our aim is to end up with the identity matrix on the left, like this:

 1 0 0 0 1 0 0 0 1
 ? ? ? Row ? ? ? Row ? ? ? Row

(Technically, we are reducing matrix A to reduced row echelon form, also called row canonical form).

The resulting matrix on the right will be the inverse matrix of A.

Our row operations procedure is as follows:

1. We get a "1" in the top left corner by dividing the first row
2. Then we get "0" in the rest of the first column
3. Then we need to get "1" in the second row, second column
4. Then we make all the other entries in the second column "0".

We keep going like this until we are left with the identity matrix on the left.

Let's now go ahead and find the inverse.

### Solution

 3 11 10 6 8 9 13 4 5
 1 0 0 Row 0 1 0 Row 0 0 1 Row

### New Row 

Divide Row  by 3 (to give us a "1" in the desired position):

This gives us:

 1 3.6667 3.3333 6 8 9 13 4 5
 0.3333 0 0 Row 0 1 0 Row 0 0 1 Row

### New Row 

Row − 6 × Row (to give us 0 in the desired position):

6 − 6 × 1 = 0
8 − 6 × 3.6667 = -14
9 − 6 × 3.3333 = -11
0 − 6 × 0.3333 = -2
1 − 6 × 0 = 1
0 − 6 × 0 = 0

This gives us our new Row :

 1 3.6667 3.3333 0 -14 -11 13 4 5
 0.3333 0 0 Row -2 1 0 Row 0 0 1 Row

### New Row 

Row − 13 × Row (to give us 0 in the desired position):

13 − 13 × 1 = 0
4 − 13 × 3.6667 = -43.667
5 − 13 × 3.3333 = -38.333
0 − 13 × 0.3333 = -4.3333
0 − 13 × 0 = 0
1 − 13 × 0 = 1

This gives us our new Row :

 1 3.6667 3.3333 0 -14 -11 0 -43.667 -38.333
 0.3333 0 0 Row -2 1 0 Row -4.3333 0 1 Row

### New Row 

Divide Row  by -14 (to give us a "1" in the desired position):

This gives us:

 1 3.6667 3.3333 0 1 0.7857 0 -43.667 -38.333
 0.3333 0 0 Row 0.1429 -0.0714 0 Row -4.3333 0 1 Row

### New Row 

Row − 3.6667 × Row (to give us 0 in the desired position):

1 − 3.6667 × 0 = 1
3.6667 − 3.6667 × 1 = 0
3.3333 − 3.6667 × 0.7857 = 0.4524
0.3333 − 3.6667 × 0.1429 = -0.1905
0 − 3.6667 × -0.0714 = 0.2619
0 − 3.6667 × 0 = 0

This gives us our new Row :

 1 0 0.4524 0 1 0.7857 0 -43.667 -38.333
 -0.1905 0.2619 0 Row 0.1429 -0.0714 0 Row -4.3333 0 1 Row

### New Row 

Row − -43.667 × Row (to give us 0 in the desired position):

0 − -43.667 × 0 = 0
-43.667 − -43.667 × 1 = 0
-38.333 − -43.667 × 0.7857 = -4.0238
-4.3333 − -43.667 × 0.1429 = 1.9048
0 − -43.667 × -0.0714 = -3.119
1 − -43.667 × 0 = 1

This gives us our new Row :

 1 0 0.4524 0 1 0.7857 0 0 -4.0238
 -0.1905 0.2619 0 Row 0.1429 -0.0714 0 Row 1.9048 -3.119 1 Row

### New Row 

Divide Row  by -4.0238 (to give us a "1" in the desired position):

This gives us:

 1 0 0.4524 0 1 0.7857 0 0 1
 -0.1905 0.2619 0 Row 0.1429 -0.0714 0 Row -0.4734 0.7751 -0.2485 Row

### New Row 

Row − 0.4524 × Row (to give us 0 in the desired position):

1 − 0.4524 × 0 = 1
0 − 0.4524 × 0 = 0
0.4524 − 0.4524 × 1 = 0
-0.1905 − 0.4524 × -0.4734 = 0.0237
0.2619 − 0.4524 × 0.7751 = -0.0888
0 − 0.4524 × -0.2485 = 0.1124

This gives us our new Row :

 1 0 0 0 1 0.7857 0 0 1
 0.0237 -0.0888 0.1124 Row 0.1429 -0.0714 0 Row -0.4734 0.7751 -0.2485 Row

### New Row 

Row − 0.7857 × Row (to give us 0 in the desired position):

0 − 0.7857 × 0 = 0
1 − 0.7857 × 0 = 1
0.7857 − 0.7857 × 1 = 0
0.1429 − 0.7857 × -0.4734 = 0.5148
-0.0714 − 0.7857 × 0.7751 = -0.6805
0 − 0.7857 × -0.2485 = 0.1953

This gives us our new Row :

 1 0 0 0 1 0 0 0 1
 0.0237 -0.0888 0.1124 Row 0.5148 -0.6805 0.1953 Row -0.4734 0.7751 -0.2485 Row

We have achieved our goal of producing the Identity matrix on the left. So we can conclude the inverse of the matrix A is the right hand portion of the augmented matrix:

 A−1 = 0.0237 -0.0888 0.1124 0.5148 -0.6805 0.1953 -0.4734 0.7751 -0.2485

### Things to Note

1. The above explanation shows all steps. A human can usually take a few shortcuts. Also, sometimes there is already a "1" or a "0" in the correct position, and in those cases, we would not need to do anything for that step.
2. Always write down what you are doing in each step - it is very easy to get lost!
3. I have shown results correct to 4 decimal place, but best possible accuracy was used throughout. Be aware that small errors from rounding will accumulate throughout the problem. Always use full calculator accuracy! (Make full use of your calculator's memory.)
4. Very occasionally there are strange results because of the computer's internal representation of numbers. That is, it may store "1" as 0.999999999872.

### See another?

You can go back up to the top of the page and choose another example.

Search IntMath

### Online Algebra Solver

This algebra solver can solve a wide range of math problems.

## Subscribe

* indicates required