CHAPTER 04.07: LU DECOMPOSITION: Finding Inverse of a Matrix Using LU Decomposition: Example   In this segment, we're going to talk about LU decomposition method, and we'll take an example to find inverse of A . . . to find inverse of A, of an n-by-n matrix, we are trying to find the inverse of it, we're going to take an example of this.  So let's take an example here of that we want to find the inverse of 25, 5, 1, 64, 8, 1, 144, 12, 1.  So let's suppose somebody's giving us a 3-by-3 matrix and what's us to find out the inverse of this particular matrix by using the LU decomposition method. How do we go about doing that is that first we need to know what the L and the U of this particular matrix is, and the L and the U decomposition of this matrix is 1, 0, 0, 2.56, 1, 0, 5.76, 3.5, and 1, and this is 25, 5, 1, 0, -4.8, -1.56, 0, 0, 0.7, so that is the L and the U decomposition of the A matrix which we're going to use to our advantage to find out the inverse of a matrix. This decomposition of this particular matrix into L times U is shown in a separate segment.  So how are we going to find out what the inverse of a matrix is? So let's suppose if the inverse of the . . . let's suppose B is the inverse of A, so let's suppose this is A, if B is inverse of A, then it will be denoted by the individual terms as b11, b12, b13, b21, b22, b23, b31, b32, and b33.  So we've got these three . . . 3-by-3 matrix which we are trying to find, and now we know that if I want to find out the first column of the inverse matrix, then all I have to do is multiply it to the A matrix, and it will be equal to the identity matrix . . . first column of the identity matrix, because if you look at my identity matrix, it will be 1, 0, 0, 0, 1, 0, 0, 0, 1, so if I want to find out the first column of the inverse of the matrix, then the right-hand side will be equal to 1, 0, 0. So that's what I want to be able to do.  So what that means is that I have my original matrix of which I want to find inverse, 25, 5, 1, 64, 8, 1, 144, 12, 1, and if this is the first column of the . . . if this is the first column of the inverse of the matrix, b11, b21, b31, then the right-hand side will be, of course, 1, 0, 0, first column of the inverse of the matrix, then this has to be the first column of the identity matrix, and I'm going to use my LU decomposition method.  So I'll have L times Z will be equal to C, so that's the lower triangular matrix multiplied by Z which I want to find, C is this, the first column of the identity matrix in this case, and then when I find out Z, I'll put Z as the right-hand side, U is the upper triangular matrix, and X will give me the first column of the . . . of the inverse matrix.  So what I'm going to do is I'm going to write down my L times Z, which is z1, z2, and z3 in this case, and the C matrix is 1, 0, 0, okay?  C matrix is 1, 0, 0. The L matrix, I already showed you the decomposition of it, 1, 2.56, 1, 0, 5.76, 3.5, and 1, so I have that. So you can very well see this is just doing forward substitution now here to find out what z1, z2, and z3 are.  So I'm not going to show you the steps of how to find z1, z2, and z3, because those have been shown elsewhere in a separate segment. So I'm going to find out what z1, z2, and z3 are by using forward substitution.  So let me write down what that step is so that you have a reference to it.    So forward substitution steps of . . . of LU decomposition method are going to give me the values of z1, z2, and z3, which will be 1, -2.56, and 3.2, and that's what you're going to get for z1, z2, and z3.  So once you have those values, you have basically solved this equation here, L times Z is equal to C, by using forward substitution, you have found this, and now you're going to take the values of Z which you just found, put them in here, use the upper triangular matrix of the LU decomposition which you have . . . which has already been given to you, and you will find out what the value of X is.  So let's go about doing that.  Now my U matrix which is given to me, which is 25, 5, 1, 0, -4.8, -1.56, 0, 0, and 0.7, and this one is x1, x2, x3, will be equal to the Z matrix, which I just found, which is 1, -2.56, and 3.2. So I'm going to now solve, this is U times X equal to Z, I'm going to solve this set of equations by using the back substitution part of the algorithm of LU decomposition method.  Again, I'm not going to show you the steps of this, because it has been shown elsewhere for another segment for a similar problem. And so the values of x1, x2, and x3 in this case will turn out to be 4.571, -0.9524, and . . . sorry, because it's back substitution, so I'll be filling in x3 first, which turns out to be 4.571, so you're going to get 4.571 from this last equation, then you're going to get -0.9524 for x2, and for the first one you're going to get 0.04762.  So in fact, this is nothing but the first column of your B matrix, of the inverse matrix, which is b11, b21, and b31.  So that's how you find out the first column of the inverse of the matrix, and you're going to do the same thing for finding the inverse of the other . . . the other columns of the inverse matrix, and if you do this completely, this is what you're going to get.    So I'm going to leave the rest of it as homework, that you're going to take . . . for the second, let me write this down here, for the second column . . . for the second column, what you're going to do is you're going to basically solve this set of equations, 25, 5, 1, 64, 8, 1, 144, 12, 1, and this will be the second column, which will be first row, second column, second row, second column, third row, second column, and that will be equal to the second column of the identity matrix.  So that's how you're going to find the second column, by solving that, taking the LU decomposition of it, and then using forward substitution and back substitution to find out what this unknown vector is.  Third column, you're going to do the same thing, your coefficient matrix is the same, because you're trying to find its inverse, 64, 8, 1, 144, 12, 1, and this will be the third column of the B matrix, or of the . . . what we are calling as the inverse matrix, and this will be equal to the third column of the identity matrix, 0, 0, 1.  So, again, you're going to do forward substitution and back substitution after the LU decomposition method to find out this. So eventually the B matrix, which is same as the inverse of the A matrix, what you're going to get is the three columns, so you're going to write down the three columns which you just found out.  So if you look at the first column which we just found out completely, which is 0.04762, -0.9524, and 4.571.  And for the sake of completion, I'm going to write down the rest of the two columns, and that will be part of your homework, and you should get the following, you get 0.08333, 1.417, and -5.00, that's what you're going to get for the second column.  The third column you're going to get 0.0357, 0.4643, minus, and you get 1.429.  So that will be the total inverse of the A matrix.  This is the first column which we just found out completely, and then I asked you to do this as your homework and this as your homework there.  And that's the end of this segment.