# Inverse of a matrix by Gauss-Jordan elimination

By Murray Bourne, 11 Jan 2011

Matrices are very important in mathematics, since they are a convenient way to represent large systems that involve many variables. Matrices are used in cryptography, economics, statics, climate modelling, probability, suspension systems and electronics. Even Google's search engine uses matrices!

Most students struggle with so-called "elementary row operations" when solving systems of equations and when finding the inverse of a matrix.

Why? Because there are many choices (do I multiply this line, or subtract this line from that line...?) and many places to get lost - and worse - many places to make mistakes).

My strong feeling is that we should let computers do such mundane things. However, many math courses still require students to do it by hand (usually only up to 3×3, but even that can have enough complications). Also, *someone* needs to know how to find inverses of matrices from scratch, otherwise how will the programmers of the future write code to solve problems like the ones listed above?

I added a new section to the Matrices chapter, Inverse of a matrix by Gauss-Jordan elimination.

You can see examples of how to find the inverse of 2×2, 3×3, and 4×4 matrices using a method which will always get you there.

## Our method

We write the given matrix on the left and the Identity matrix on its right (forming an augmented matrix). Our aim is to do row operations to produce the identity matrix on the left. We proceed as follows:

- We divide the first row by the number in the top-left position, to produce a "1" in that position.
- Then we do row operations to get zeroes down the rest of the first column.
- Then we divide the second row by the number in the 2nd row, 2nd column, giving us a "1" in that position.
- Next, we get zeroes in the rest of that column.

We continue on like this until we get "1" in the diagonal and zeroes elsewhere - in other words, the identity matrix. Our required inverse matrix is what is left on the right.

You can see as many examples as you like by refreshing the page (when you get there).

The link again: Inverse of a matrix by Gauss-Jordan elimination

What do you think of this method? Does it make sense?

[For the technically-minded: I wrote the code for the page in PHP. The output uses text and tables, not images, making for quicker load times.]

See the 3 Comments below.