# 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:

The randomly-generated example appears below.

## Example

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

A = |
5 | 9 | 7 | ||

2 | 6 | 11 | |||

10 | 3 | 13 |

### 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.

5 | 9 | 7 | |

2 | 6 | 11 | |

10 | 3 | 13 |

1 | 0 | 0 | Row[1] | |

0 | 1 | 0 | Row[2] | |

0 | 0 | 1 | Row[3] |

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[1] | |

? | ? | ? | Row[2] | |

? | ? | ? | Row[3] |

(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:

- We get a "1" in the top left corner by dividing the first row
- Then we get "0" in the rest of the first column
- Then we need to get "1" in the second row, second column
- 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

We start with:

5 | 9 | 7 | |

2 | 6 | 11 | |

10 | 3 | 13 |

1 | 0 | 0 | Row[1] | |

0 | 1 | 0 | Row[2] | |

0 | 0 | 1 | Row[3] |

### New Row [1]

**Divide Row [1] by 5** (to give us a "1" in the desired position):

This gives us:

1 | 1.8 | 1.4 | |

2 | 6 | 11 | |

10 | 3 | 13 |

0.2 | 0 | 0 | Row[1] | |

0 | 1 | 0 | Row[2] | |

0 | 0 | 1 | Row[3] |

### New Row [2]

**Row[2] − 2 × Row[1]** (to give us 0 in the desired position):

2 − 2 × 1 = 0

6 − 2 × 1.8 = 2.4

11 − 2 × 1.4 = 8.2

0 − 2 × 0.2 = -0.4

1 − 2 × 0 = 1

0 − 2 × 0 = 0

This gives us our new Row [2]:

1 | 1.8 | 1.4 | |

0 | 2.4 | 8.2 | |

10 | 3 | 13 |

0.2 | 0 | 0 | Row[1] | |

-0.4 | 1 | 0 | Row[2] | |

0 | 0 | 1 | Row[3] |

### New Row [3]

**Row[3] − 10 × Row[1]** (to give us 0 in the desired position):

10 − 10 × 1 = 0

3 − 10 × 1.8 = -15

13 − 10 × 1.4 = -1

0 − 10 × 0.2 = -2

0 − 10 × 0 = 0

1 − 10 × 0 = 1

This gives us our new Row [3]:

1 | 1.8 | 1.4 | |

0 | 2.4 | 8.2 | |

0 | -15 | -1 |

0.2 | 0 | 0 | Row[1] | |

-0.4 | 1 | 0 | Row[2] | |

-2 | 0 | 1 | Row[3] |

### New Row [2]

**Divide Row [2] by 2.4** (to give us a "1" in the desired position):

This gives us:

1 | 1.8 | 1.4 | |

0 | 1 | 3.4167 | |

0 | -15 | -1 |

0.2 | 0 | 0 | Row[1] | |

-0.1667 | 0.4167 | 0 | Row[2] | |

-2 | 0 | 1 | Row[3] |

### New Row [1]

**Row[1] − 1.8 × Row[2]** (to give us 0 in the desired position):

1 − 1.8 × 0 = 1

1.8 − 1.8 × 1 = 0

1.4 − 1.8 × 3.4167 = -4.75

0.2 − 1.8 × -0.1667 = 0.5

0 − 1.8 × 0.4167 = -0.75

0 − 1.8 × 0 = 0

This gives us our new Row [1]:

1 | 0 | -4.75 | |

0 | 1 | 3.4167 | |

0 | -15 | -1 |

0.5 | -0.75 | 0 | Row[1] | |

-0.1667 | 0.4167 | 0 | Row[2] | |

-2 | 0 | 1 | Row[3] |

### New Row [3]

**Row[3] − -15 × Row[2]** (to give us 0 in the desired position):

0 − -15 × 0 = 0

-15 − -15 × 1 = 0

-1 − -15 × 3.4167 = 50.25

-2 − -15 × -0.1667 = -4.5

0 − -15 × 0.4167 = 6.25

1 − -15 × 0 = 1

This gives us our new Row [3]:

1 | 0 | -4.75 | |

0 | 1 | 3.4167 | |

0 | 0 | 50.25 |

0.5 | -0.75 | 0 | Row[1] | |

-0.1667 | 0.4167 | 0 | Row[2] | |

-4.5 | 6.25 | 1 | Row[3] |

### New Row [3]

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

This gives us:

1 | 0 | -4.75 | |

0 | 1 | 3.4167 | |

0 | 0 | 1 |

0.5 | -0.75 | 0 | Row[1] | |

-0.1667 | 0.4167 | 0 | Row[2] | |

-0.0896 | 0.1244 | 0.0199 | Row[3] |

### New Row [1]

**Row[1] − -4.75 × Row[3]** (to give us 0 in the desired position):

1 − -4.75 × 0 = 1

0 − -4.75 × 0 = 0

-4.75 − -4.75 × 1 = 0

0.5 − -4.75 × -0.0896 = 0.0746

-0.75 − -4.75 × 0.1244 = -0.1592

0 − -4.75 × 0.0199 = 0.0945

This gives us our new Row [1]:

1 | 0 | 0 | |

0 | 1 | 3.4167 | |

0 | 0 | 1 |

0.0746 | -0.1592 | 0.0945 | Row[1] | |

-0.1667 | 0.4167 | 0 | Row[2] | |

-0.0896 | 0.1244 | 0.0199 | Row[3] |

### New Row [2]

**Row[2] − 3.4167 × Row[3]** (to give us 0 in the desired position):

0 − 3.4167 × 0 = 0

1 − 3.4167 × 0 = 1

3.4167 − 3.4167 × 1 = 0

-0.1667 − 3.4167 × -0.0896 = 0.1393

0.4167 − 3.4167 × 0.1244 = -0.0083

0 − 3.4167 × 0.0199 = -0.068

This gives us our new Row [2]:

1 | 0 | 0 | |

0 | 1 | 0 | |

0 | 0 | 1 |

0.0746 | -0.1592 | 0.0945 | Row[1] | |

0.1393 | -0.0083 | -0.068 | Row[2] | |

-0.0896 | 0.1244 | 0.0199 | Row[3] |

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.0746 | -0.1592 | 0.0945 | ||

0.1393 | -0.0083 | -0.068 | |||

-0.0896 | 0.1244 | 0.0199 |

### Things to Note

- 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.
- Always write down what you are doing in each step - it is very easy to get lost!
- 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.) - 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, blog and Forum

### Online Algebra Solver

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

Go to: Online algebra solver

### Algebra Lessons on DVD

Easy to understand algebra lessons on DVD. See samples before you commit.

More info: Algebra videos

### The IntMath Newsletter

Sign up for the free **IntMath Newsletter**. Get math study tips, information, news and updates each fortnight. Join thousands of satisfied students, teachers and parents!