CHAPTER 04.06: GAUSSIAN ELIMINATION: Gaussian Elimination With Partial Pivoting: Example: Part 1 of 3 (Forward Elimination)

 

In this segment, we're going to take an example of Gaussian elimination with partial pivoting, and I'm going to show you the steps of forward elimination here in this example. So Gauss elimination with partial pivoting is a numerical method used to solve simultaneous linear equations. 

 

So the example which we are asked to solve is as follows, it's the same example which we took for the Naive Gaussian method, so it would be good for you to review that first before you start looking at Gauss elimination with partial pivoting, if you have not already done so. So this is the coefficient matrix which is given to us, and we have . . . we have three unknowns, a1, a2, a3, and the right-hand side is given as 106.8, 177.2, and 279.2.  So what we want to be able to do is we want to show how we can solve this particular example by using Gauss elimination with partial pivoting. So the first thing which you have to realize is that there are two steps in doing Gauss elimination with partial pivoting, one is . . . the first step is forward elimination, and the second step is back substitution.  Now, within forward elimination, there are n-minus-1 steps themselves.  So there are n-minus-1 steps, where n is the number of equations which you have, so in this case, since we have three equations, it'll be 3 minus 1, so we'll have two steps of forward elimination. 

 

And what we mean by two steps of forward elimination is that we'll have to make the element which will be here and here to be 0 in the first step, and the element here to be 0 in the next step, and we'll go through that process as we . . . as we go ahead and solve this particular problem.  Now, so let's look at the first step.  Now, if we are looking at the first step of forward elimination, the first thing which we have to do, which is different from the Gauss . . . different from the Naive Gaussian method is that we have to look at . . . first step is that we've got to look at the first row, first column.  So this one is the first row, first column, this forms the pivot equation, but in Gauss elimination with partial pivoting what you have to do is before you start doing that, you have to look at the whole first column.  So you're at the first step of forward elimination, you're going to look at the first column . . . first column the coefficient matrix, which is 25, 64, and 144.  So you're going to take the absolute value of 25, absolute value of 64, absolute value of 144, so basically what you are doing is you are taking the absolute value of all the elements which are in the first column, which turn out to be 25, 64, and 144.  So the value which you are obtaining as the absolute values are 25, 64, and 144, and then you have to look at which one is the maximum.  This one is the maximum, 144 is the maximum out of 25, 64, and 144.  So what that means is that since 144 is here and this is the first step of forward elimination, what we have to do is we have to switch row one and row three.  So we're going to . . . when we're going to make the switch of row one with row three is that we're going to switch the whole . . . whole equation, so keep in mind that when you are switching row three with row one, because that's where the maximum absolute element is in the first column, that you do switch the right-hand side also, otherwise the equations will not stay the same.  So let's go ahead and do that and see what the resulting equations are.  So we have a1, a2, a3, and we get now the third equation is the first equation now, I get 144, 12, 1, and keep in mind, again, that the right-hand side also has to be switched.  The second equation stays the same, because the switch is only taking place between row one and row three. So we have this, and then we have 25, 5, 1, and 106.8.  Now I have to follow the steps of the Naive Gaussian method, which means that in the first step of forward elimination, I'm going to make everything below the first row in the first column to be 0, that means that this element, 64, and this element, 25, need to be converted to 0 in the first step of forward elimination.  So what that means is that I'll take the first . . . I have to find the multiplier, which will allow me to make, let's suppose the second row, first column to be 0.  So the multiplier for this will be that I'll divide the first row by 144 and multiply it by 64, and then subtract it from equation 2, that will make this to be 0.  So the multiplier will be 64 divided by 144, divide the first equation by 144, multiply the first equation by 64, then.  This multiplier turns out to be 0.4444.  I'm only using four significant digits in showing the calculations, if you take more significant digits, you are going to get a slightly different answer.  Now what I'm going to do is I'm going to take this multiplier 0.4444, and multiply it to the first row, which is 144, 12, 1, and 279.2, and the value which I get here is 63.99, 5.333, 0.4444, and 124.1, that's what I get by multiplying the first row by 0.4444.  Now what I'm going to do is I'm going to subtract whatever result I get from the first row from the second row here, so that means I have 64, 8, 1, 177.2, this is my second row, second equation. So the multiple of first row is right here, 5.333, 0.4444, and 124.1, and I'm going to subtract it.  Now, this is 64 and 63.99, I'm going to say this is 0, because that's how it's going to be treated. In fact, when you're writing a program for Gauss elimination, whether Naive Gaussian method or Gauss elimination with partial pivoting, we don't even calculate this value, because it's automatically going to be 0, but when we're doing hand calculations we show it as 0 even if there's going to be some round off error, the reason why it's not exactly 64 is because of round off error, but we put it as 0, because that's what it would have been, now 8 minus 5.333 is 2.667, this one is 0.5556, and 53.1, so that's what I get as the . . . as the second row, so . . . .