Main content

## Linear algebra

### Course: Linear algebra > Unit 2

Lesson 5: Finding inverses and determinants# Example of finding matrix inverse

Example of calculating the inverse of a matrix. Created by Sal Khan.

## Want to join the conversation?

- how we can fined the inverse of a matrices of LU decomposition?(20 votes)
- What would you do if matrix A didn't begin with 1? How would you transform it to the identity matrix?(5 votes)
- Assuming it doesn't begin with 0, divide every value in the augmented matrix's first row by the first number to get 1. Then, without actually changing the first row, take the first row multiplied by the negative of the first value of a row below it, and add it to that row, so that every value under the first 1 is a zero. Repeat this process for the second element in the second row, the third in the third row, and so on. When you get to the last element of the last row, start this process backwards so that the values above become 0s until you have the identity matrix.(8 votes)

- What does he say at1:11? Row etch-a-long form? What is "row etch-a-long form"?

Thanks,(2 votes)- He says 'row echelon form.' Put any lines of all zeros on the bottom of the matrix, make the first entry in each row a one, and each entry in each row to the right of the first entry in the row above it. In form it is easy to see the solution to the equation.(6 votes)

- What do you do if the matrix starts with 0?(3 votes)
- If the top-left entry of the matrix is 0, you swap the top row with the bottom row (or whichever row is lowest down and has a non-zero first entry).(2 votes)

- Is it even possible to find inverse for a 5x5 matrix by the ref?(2 votes)
- A bit late, but sure, why wouldn't it be possible?(2 votes)

- You say in the beginning of the video that we know this matrix has the identy matrix when we get A to rref. Do we always have to check if a matrix has the Identity Matrix in the rref before we find the Inverse Matrix?(0 votes)
- nevermind, You'll of course find out in the process...(10 votes)

- Determining the equation of a line perpendicular to another(1 vote)
- Sal talks about perpendicular subspaces when he talks about the orthogonal complement at https://www.khanacademy.org/math/linear-algebra/alternate_bases/othogonal_complements/v/linear-algebra-orthogonal-complements.(2 votes)

- I keep on messing up my inverses, and the only change I do from other ways is I use R1 - R2, rather than -1 X R1 + R2. Is there a problem with that?(1 vote)
- They aren't the same, but both can be used to replace R1, or R2, if that helps reduce the matrix.(1 vote)

- Is this the only way to reduce to find the inverse. I am not talk about a different method but I mean is there only on possible inverse for each Matrix if there is an inverse.(0 votes)
- inverse matrices are unique, provided it's invertible to begin with(3 votes)

- IS this the same as Gauss??? x1+x2+x3=y1

... = y2

and then ....=y3(1 vote)- Yes, if you have a nxn matrix you "add" the identity matrix (nxn) on the right side so you can get the matrix which is now nx2n into rref (but I believe it also work if you put it on the left side).

Assuming the determinant is not 0, you can now perform the row-operations until the identity matrix pops up on the left side, the right side is then the inverse.(1 vote)

## Video transcript

In the last video, we stumbled
upon a way to figure out the inverse for an invertible
matrix. So, let's actually use
that method in this video right here. I'm going to use the same matrix
that we started off with in the last video. It seems like a fairly
good matrix. We know that it's reduced row
echelon form is the identity matrix, so we know
it's invertable. So, let's find its inverse. The technique is pretty
straightforward. You literally just apply the
same transformations you would apply to this guy to get you
to the identity matrix, and you would apply those same
transformations to the identity matrix. That's because the collection
of those transformations, if you represent them as matrixes,
are really just the inverse of this guy. Let's just do it. So I'll create an augmented
matrix here. Maybe I'll do it right here. Let me make it a little
bit neater. First, I'll write a. It's 1, minus 1, 1. And then minus 1, 2, 1. Minus 1, 3, 4. And then I'll augment it with
the identity matrix, with 1, 0, 0, 0, 1, 0, 0, 0, 1. Now, if I want to get a into
reduced row echelon form, maybe I'll replace
the second row. I'll keep the first row
the same for now. Let me just draw it like this. The entire first row:
1, minus 1, minus 1. It's going to be augmented
with 1, 0, 0. Keep the whole first
row the same. Let's replace the second
row with the second row plus the first row. Minus 1 plus 1 is 0. 2 plus minus 1 is 1. 3 plus minus 1 is 2. 0 plus 1 is 0. 1 plus-- oh, sorry. That was a tricky one. 0 plus 1 is 1. 1 plus 0 is 1. 0 plus 0 is 0. All I did is I added
these two rows up. Now, this third row. Let me replace-- I want
to get a zero here. Let me replace the third
row with the third row minus the first row. 1 minus 1 is 0. 1 minus minus 1 is 2. 4 minus minus 1 is 5. 0 minus 1 is minus 1. 0 minus 0 is 0. And then 1 minus 0 is 1. Just like that. Now, what do we want to do? Well, we've gotten this far. We want to zero out that
guy and that guy. Let's keep our second
row the same. Let me write it down here. It's 0, 1, 2, and then you
augmented it with 1, 1, 0. Just like that. And let's replace my first row
with the first row plus the second row. 1 plus 0 is 1. Minus 1 plus 1 is 0. That's why I did that,
to get a zero there. Minus 1 plus 2 is 1. 1 plus 1 is 2. 0 plus 1 is 1. 0 plus 0 is 0. And now, I also want to zero
out this guy right here. Let's replace the third row
with the third row minus 2 times the second row. 0 minus 2 times 0 is 0. 2 minus 2 times 1 is 0. 5 minus 2 times 2 is 5
minus 4, that's 1. Minus 1 minus 2 times 1--
that's minus 1 minus 2-- is minus 3. 0 minus 2 times 1,
that's minus 2. And then, 1 minus 2 times
0 is just 1 again. All right, home stretch. Now, I just want to zero out
these guys right here. All right, so just let me keep
my third row the same. Let me switch colors, keep
things colorful. It's 0, 0, 1. We're going to augment it with
minus 3, minus 2, and 1. Now, let's replace our first row
with the first row minus the third row. 1 minus 0 is 1. 0 minus 0 is 0. 1 minus 1 is 0. 2 minus minus 3, that's 5. 1 minus minus 2 is 3. 0 minus 1 is minus 1. Now, let's replace the second
row with the second row minus 2 times the third row. 0 minus 2 times 0 is 0. 1 minus 2 times 0 is 0. 2 minus 2 times 1 is-- I'm
sorry, I just-- oh, whoops. Let me-- we have to be very
careful not to make any careless mistakes. 0 minus 2 times 0 is 0. 1 minus 2 times 0 is 1. It's not 0. 2 minus 2 times 1 is 0. 1 minus 2 times minus
3-- that is 1 plus 2 times 3-- that is 7. 1 minus 2 times minus 2, that's
1 plus 4, which is 5. And then, 0 minus 2 times
1, so that's minus 2. And just like that, we've
gotten the A part of our augmented matrix into reduced
row echelon form. This is the reduced row
echelon form of A. And when you apply those exact
same transformations-- because if you think about it, that
series of matrix products that got you from this to the
identity matrix-- that, by definition, is the
identity matrix. So you apply those same
transformations to the identity matrix, you're going
to get the inverse of A. This right here is A inverse. And we have solved for the
inverse, and it actually wasn't too painful.