CHAPTER 04.06: GAUSSIAN ELIMINATION: Naive Gauss Elimination: Round-off Error Issues: Example: Part 3 of 3
In this segment, we're going to take the example which we just solved by using forward elimination, we're going to do the Naive Gauss elimination and show the back substitution steps. And, again, keep in mind that in this example we are using five significant digits with chopping, which means that all calculations which you are doing, intermediate as well as final, they all have to be with five significant digits with chopping.
So the . . . this is what we obtained at the end of the forward elimination steps, by using five significant digits with chopping, as our answer, we got 20, 15, 10, 0, 0.001, 8.5, 0, 0, 23375, so that's what we obtained as the coefficient matrix, which of course is an upper triangular matrix, we've got x1, x2, x3 as our unknowns, the right-hand side vector which we obtained was 45, 8.501, and 23374. So now we need to find out what x1, x2, x3 is by using the back substitution steps, so we're going to start from the last equation, because that's what we do, and I'm going to show you all the intermediate steps, because that's what we need to be careful about in order to be able to illustrate the issue of round off error with Naive Gaussian method. So the last equation I get is 23375 x3 is equal to 23374, as is the case right here. So x3 turns out to be 23374 divided by 23375, so that's the numerator divided by denominator, and that value up to five significant digits with chopping is 0.99995, that's what I get. That's what we get for x3. So now let's go ahead and take this number and find out what x2 we get. So the second-last equation which we have is 0.001 x2, plus 8.5 x3 is equal to 8.501. So, I'm going to write down this equation the way it's algorithmically solved by using back substitution, it will be like this, 8.501, minus 8.5 x3, divided by 0.001. So we got 8.501 minus 8.5, x3 is 0.99995, divided by 0.001. So, the value which I get here is 8.501 minus 8.5 times this quantity is 8.4995. Again, we are doing this multiplication . . . we have to show each intermediate calculation separately, so we're taking this number, multiplying this number, and this is the number which we will get up to five significant digits with chopping, and then divided by 0.001. Now I subtract these two numbers, and what do I get from there? It's 0.0015 divided by 0.001. Now I do the division, and I get 1.5, so that's the the value of x2 which I get . . . get from there. Now let's go ahead and see what we get for x1. The x1 will be calculated from the first equation, or the third-last equation as we are going backwards, 20 x1, plus 15 x2, plus 10 x3 is equal to 45, that's the equation which I have. So that means that x1 can be calculated at 45, minus 15 x2, minus 10 x3, divided by 20. So minus 15, what is x2? x2 I just obtained as 1.5, and x3 is 0.99995, four nines, five, and divided by 20. Now, again, each of these calculations has to be done separately, we cannot do them one at . . . all of them at the same time, like put them in the calculator and write down the final answer, that's not correct, because your calculator is taking more significant digits than what we are allowed to use here, which is five with chopping, so from here, this calculation I get 22.5, and from here I get 9.9995, divided by 20. Again, I don't do all these subtractions at the same time, I'll first do this and this, I get 22.5 minus 9.9995, divided by 20. Now I do this calculation, and I get 12.5 divided by 20, and that gives me 0.625, okay? So that's, again, this is 12.5 up to five significant digits, so I get 12.500 divided by 20, you get 0.625. So the answer which I am getting for the Naive Gaussian elimination and using five significant digits with chopping for this one, I get x1 x2, x3, x1 is turning out to be 0.625, x2 is turning out to be 1.5, and x3 is turning out to be 0.99995, so this is with five significant digits with chopping. Now, if you were going to do the same problem by using six significant digits with chopping, you will get a different answer, and that's the whole point of doing this exercise was to show you that . . . that Naive Gaussian method has a problem with round off errors. So if you use six significant digits, you would get 0.9625, 1.05, and 0.999995, and this is the answer which you get with six significant digits with chopping. So you do have a big difference between what you get with six significant digits with chopping and five significant digits with chopping, just look at the numbers for x2, 1.05 here, 1.5 here, x1, 0.9625 here, 0.625 here.
Now somebody might say, hey, which one do you know is better than the other one? You can clearly see that which one is better because I'm going to give you the exact solution, the exact solution for this problem is 1, 1, 1. So that is the exact solution. So you can very well see that by using less significant digits, you are able to illustrate how the Naive Gaussian method is giving you results which are quite far away from the exact result. Now somebody might say, hey, does Gauss elimination with partial pivoting, which we will take in a separate example, does that give better results? Yes it does give better results, and we'll see that in a separate example. And this is the end of this segment.