|
In this segment, we're going to take an example of how you do LU decomposition of a square matrix.
So this is not example of the LU decomposition method itself, but how do you decompose A is equal to L times U, because that's what you need in order to be able to do the LU decomposition method, you first need to decompose your A into L times U.
I mentioned in a separate segment, one of the ways to find out A is equal to L times U is by following the same steps of forward elimination as given in the Naive Gaussian method. So if you follow the steps of the Naive Gaussian method, the forward elimination steps, you'll be able to determine what L and U should be. So let's go ahead and see that how do we go about doing that through an example.
So let's suppose somebody says that, hey, I'm going to give you this 3-by-3, three equations, three unknowns, 25, 5, 1, 64, 8, and 1, and 144, 12, and 1. Now, what I want you to do is, I want you to write it as a lower triangular matrix multiplied by an upper triangular matrix.
So what we're going to do is, on this we're going to do the forward elimination Steps of Naive Gaussian method, that's what we're going to do.
So we're going to follow the Naive Gaussian method forward elimination steps to be able to find out what the L times U of this quantity here is. So if you recall how forward elimination is done in Naive Gaussian method is that you want to, so in the first step, what you want to do is you want to take this particular row, and make this particular column here to be 0 below the first row. So you're taking the first row, and you want to make this to be 0 and you want to make this to be 0, and in the second step you will try to make this to be 0, so as to convert this into an upper triangular matrix, so that's what we're going to do.
So if you look at the first step, what you have to keep track of is that what the multipliers are which are going to make this to be 0, this to be 0, and this to be 0, and that's how we'll be able to figure out what the L times U is. So what I'm going to do is, in order to be able to make this to be 0, I'll have to multiply this row by 64 and divide it by 25.
So first I will divide it by 25, multiply by 64, and subtract it from there. So if I have the first row, which is 25, 5, and 1, I need to multiply it by 64 and divided it by 25, which is same as 2.56. So remember this, that what I'm doing is in order to be able to make this to be 0, I'll have to take the first row and multiply it by 2.56.
The reason why I'm asking you to remember this is because this is going to show up in your lower triangular matrix at the place which is trying to make this to be 0, because what's going to happen is that 64, this is what we are trying to make 0 by using this multiplier, so this multiplier is going to show up at second row, first column in the lower triangular matrix, exactly at the same place where you are trying to make this to be 0. So because you are using this first step to make this to be 0, that's where the multiplier's going to show up in your lower triangular matrix. So once I multiply this, I get 64, 12.8, and 2.56. I subtract it from second row, which is 64, 8, and 1, and I subtract 64, 12.8, and 2.56.
And if I subtract that, I'll get 0, -4.8, and -1.56, that's what I will get if I subtract this row from that row. So this becomes my second row of the coefficient matrix now, with this being a 0. So same thing I'm going to do here, in order to make this to be 0, I'll have to make this to be 0, I'll have to divide this first row by 25 and multiply by 144, and, again, remember the multiplier which I'm going to get in order to make this to be 0. So I have the first row, which is 25, 5, 1, and I'm going to multiply it by 144 divided by 25, which is 5.76.
So when I multiply by 5.76, this number turns out to be 144, because it should, because I want to make that to be 0, and this is what I will get for after I multiply the first row by 5.76.
Now I've got to take my third row, which is 144, 12, and 1, that's my third row, and I'm going to subtract 144, 28.8, and 5.76, and what am I going to get from there? It will be 0, because this will cancel with this, -16.8, and -4.76, that's what I'm going to get by doing subtraction. Now, remember this, this 5.76, the multiplier was used to make this to be 0, which is the third row, first column become 0, so this will correspond to third row, first column in the lower triangular matrix, the value of 5.76.
So if you look at the end of first step of forward elimination, what I have is that I'll have a matrix which looks like this, I will have 25, 5, 1, then I'll have a 0 here, -4.8 here, and -1.56 here, and then I'll have a 0 here, -16.8 here, and -4.76 here.
So this has become 0, this has become 0 by doing the proper multiplication and subtractions based on what we have in the first row. And also what I've established is that the second row, first column of the lower triangular matrix is 2.56, and the third row, first column is 5.76. So those are the things which I have obtained by doing this LU decomposition method here, or to find the LU decomposition. But I'm not done here, because I need to reduce this to an upper triangular matrix, do all the steps of forward elimination. So let's go ahead and do that. So now what I will have is that I'll have -4.8 right here, and I'll use that to make this to be 0. So I'll have to divide the row two by -4.8 and multiply by 16.8 to be able to make this to be 0. So I'm going to write down the second row, which is 0, -4.8, and -1.56, and I'm going to multiply it by -16.8, and I'm going to divide by -4.8, and this is going to give me what? It's going to give me 0, -16.8, -5.46, that's what I'm going to get by multiplication, and now what I have to do is I have to subtract this from the third row. I'll have 0, -16.8, -4.76, and I'll have to subtract 0, -16.8, and -5.46, and what I'm going to get is 0, 0, and 0.7. So this -16.8 divided by -4.8 is nothing but 3.5.
So this number, 3.5, will be actually my third row, second column, because it made this third row, second column to be 0, that's why that corresponds to l32. So at the end of second step, which is the last step of forward elimination, because I always conduct n-minus-1 steps of forward elimination, I'll get what follows, I'll get 25, 5, 1, first row stays the same, second row stays the same, and the third row would be 0, 0, 0.7, and from here I'm getting l32 is equal to 3.5, okay? Third row, second column of the lower triangular matrix is 3.5. So, having said this, this is, at the end of the forward elimination steps, this is in fact your U matrix, which you are looking for in your LU decomposition. The upper triangular matrix which you get at the end of the forward elimination steps is actually your U matrix, and how do establish your L matrix? Your L matrix will be, which is a lower triangular matrix, will be established by a 3-by-3, of course, and you will have, of course, 0 here, 0 here, 0 here, because that's part of being a lower triangular matrix. You're going to put 1s in the diagonal like this, 1, 1, 1.
And then in order to be able to fill this in and this in and this in, we have already established what those are. Like, for example, we said l21 is 2.56, because that is the multiplier which made that term to be 0 in the U matrix, and this l31 is 5.76, and this l32, which we just found out, is 3.5. So that's how you are able to establish what the lower triangular elements will be in the lower triangular matrix.
So if I would write down what my LU decomposition is, I'll write it as this, that, hey, this is my A, and this will be my L times U. So A is 25, 5, 1, 64, 8, 1, 144, 12, 1, so this is my original A matrix, and what is the L times U decomposition? This will be my L, with 1s in the diagonal, 0s above the diagonal, and the multipliers, corresponding multipliers at the proper places in the below the diagonal. The U matrix is the same which I got at the end of the forward elimination steps, so that's 25, 1, 0, -4.8, and -1.56, and 0, 0, and 0.7. And you can verify by multiplying this matrix to this matrix, this is my L matrix and this is my U matrix, and go ahead and use multiplication of matrix operation to find out, to verify whether this L times U gives you back this A matrix right here. And that's how you do the LU decomposition of a square matrix. And that's the end of this segment. |