CHAPTER 04.06: GAUSSIAN ELIMINATION: Round-off Error Issues: Example: Part 1 of 3
In this particular segment, we're going to talk about Gauss elimination with partial pivoting, we're going to look at an example, and we're given three equations, three unknowns.
So the example is as follows, that we're given three equations, three unknowns, so I'm going to write down the equation in the matrix form, because by now you must be familiar with how to do that. So we're given 20, 15, 10, -3, 2.249, 7, 5, 1, 3, x1, x2, x3, 45, 1.751, and 9. So we're given these three equations, three unknowns, and the caveat here is that we are only supposed to do with five significant digits with chopping . . . five significant digits with . . . with chopping. What that means is that for all calculations, intermediate as well as final, all the digits have to be only five significant digits, and you're not going to pay any attention to the sixth digit onwards, what they are. So we want to solve this particular problem by Gauss elimination with partial pivoting. The reason why we are putting this constraint that you're using five significant digits with chopping is because we want to illustrate the difference between Naive Gaussian method and Gauss elimination with partial pivoting to see that how Gauss elimination with partial pivoting reduces the round off error. So let's go ahead and how we're going to conduct the steps of forward elimination and back substitution to be able to solve these three equations, three unknowns. So . . . so the first thing which we're going to do is we are going to do forward elimination. Again, we've got to understand that . . . that since we have three equations, three unknowns, we'll have two steps of forward elimination, so the first step of forward elimination. Now, before we do any of the elimination part of it, or elimination of the elements to make them 0, we have to look at the . . . whether we need to switch any rows. So if you look at the first row, first column, because we are at the first step of forward elimination, so we've got to look at the first column. The elements of the first column are 20, the absolute value of those, -3, and then 5, and the . . . what is the maximum of these? The maximum of this is 20, so we are right there in the first row, first column. So what that means is that we've got to switch . . . we've got to switch row one, because we are at the first step of forward elimination, with row one, because that's where the maximum element is, which is 20. So what that means is that nothing has changed, but I have to, for purposes of procedure, I have to write down what the values of . . . what the coefficient matrix now turns out to be once I have switched row one with row one. So there's 20, 15, 10, 45 here, then -3, 2.249, 7, this is x1, x2, x3, this is 1.751, and then 5, 1, 3, and 9. So that's what I get by switching the rows, in fact, I have not switched anything, but to follow the algorithm, I needed to switch row one with row one. Now what I need to do in the first step of forward elimination is to make this to be 0 and this to be 0, and the way I'm going to make these two elements to be 0 is by I'm going to take the first row, multiply it by -3 divided by 20, and subtract it from here to make this to be 0. Then I'm going to, again, take the first row, divide it by 20, multiply it by 5, and subtract it from here, and make that to be 0. So that will be the first step of forward elimination, where all the elements which are below the first row in the first column will turn out to be 0. So let's go ahead and do that. So what that means is that I have to take the first . . . first row, which is 20 . . . let me write down what the multiplier is. The multiplier will be -3 divided by 20, because divided by 20, multiply by -3 is -0.15. So I'm going to take -0.15, I'm going to multiply it to the first augmented row, which is 20, 15, 10, these are the elements of the first row of the coefficient matrix, this is the right-hand side, 45, and the number which I get is -3, -2.25, -1.5, and -6.75. So this I'm going to subtract from now . . . this thing I'm going to subtract now from the first . . . from the second row. So I have -3, 2.249, then I have 7, and 1.751, this is my second row. So keep in mind this is my second row, or my second equation, and I'm going to subtract whatever I had here, -3, -2.25, -1.5, and -6.75. This one is -2.249, I made a mistake with this, because this is -2.249, so let me go back to the . . . this board right here. This one is supposed to be minus, right here. If you can focus on this part here, so this one is supposed to be minus, then also this one is supposed to be minus, right here, this one. If you can just focus on this part right here, okay, that's -2.249, okay, so we're all set. Now we're going to add to it, I'm going to annotate the YouTube video to show you the correct form, also. This will be 0.001, 8.5, and then here I get 8.501. So that's what the resulting second row turns out to be. Now same thing I'll have to do for the third row, so what is the multiplier? The multiplier will be 5 divided by 20, so 5 divided by 20 is the multiplier, that's 0.25, so I'm going to take the first augmented row, which is 20, 15, 10, 45, I'm going to multiply by my multiplier, which is 0.25, and what do I get from there? I get 5, 3.75, 2.5, and 11.25, and this I'll have to subtract from the third row. So if we look at the third row, what do I have in the third row? I have 5, 1, 3, and 9, and I'm going to subtract whatever I just got here, 5, 3.75, 2.5, 11.25. So when I subtract, what do I get? I get 0, -2.75 . . . -2.75, 0.5, and -2.25, this is what I get as my third row. So you can very well see now that at the end of the first step of forward elimination, I'll have all elements in my first column below the first row to be 0, and this is what it turns out to be, I get 20, 15, 10, that row stays the same, because that was the first row, so the first row will stay the same, the second row has become 0, 0.001, 8.5, 8.501, the third row's going to be 0, -2.75, 0.5, and -2.25, so that's what I get for the . . . at the end of the . . . so this is the end of first step of forward elimination, this is the end of that first step of forward elimination. |