Tip:
Highlight text to annotate it
X
Hello, and welcome to lecture 4 of module 3; we were considering linear, solving linear
algebraic equations using Gauss Elimination, and then we looked at Gauss Jordan and LU
decomposition method. And in the previous lecture, where we left off with, was a question
that if the equations are slightly modified to the following form, what we are going to
obtain, when we solve these equations?
And that form was x plus y sorry or rather x 1 plus x 2 we had, x 1 plus x 2 plus x 3
equal to 4; 2 x 1 plus 2 x 2 plus 3 x 3 equal to 8; and 3 x 1 plus... Let me just check
the equation that I had given, 3 x 1 plus 4 x 2 minus 2 x 3 equal to 9, and this also
number should be 9. So, originally the equations that we had were 2 x 1 plus x 2 plus 3 x 3
equal to 7; instead of that, now I have converted the equation to 2 x 1 plus 2 x 2 plus 3 x
3 equal to 9. This keeps our solution the same, if you recall the solution was x 1 equal
to 1 x 2 equal to 2 and x 3 equal to 1. So, 2 plus 4 plus 3, that is 6 plus 3 - 9, the
same equation satisfies, same solution satisfies these 3 equations as well.
So, let us write down A and b matrices in the typical way, and the matrix A concatenated
with the matrix b is going to be 1 1 1 2 2 3 and 3 4 2, and the last column will be 4
9 9. As we have always been doing in gauss elimination, we will now do the first step,
which is to use row 1 to make this element and this element 0. So, the step 1 is going
to be R 1 sorry R 2 minus 2 R 1 and R 3 minus 3 R1. Remember to put it in the consistent
form, so far we have been writing as R 2 plus negative 2 R 1, and that is because we needed
the alpha values in that form, right now we are not worried about that, so I am I am just
writing it as R 2 minus 2 R 1. So, when we do an R 2 minus 2 R 1, the first
row of course, remains the same, that is 1 1 1 4; the second row in now becomes 2 minus
2 equal to 0 2 minus 2 equal to 0 3 minus 2 equal to 1, and then the final number 9
minus 8 equal to 1 again. And when we do R 3 minus 3 R1, we will we will essentially
get 1 sorry we will get 0 1 2 minus sorry this would be minus 2, so minus 2 minus 3
will be minus 5, and 9 minus 12 will be minus 3 same as before. So, at the end of step 1,
this is what we actually get; and what we see over here is that this element the a 2
2 element, after the first row operation has become 0; as a result of this, we will not
be we able to continue the row operations any further.
And the reason for that is that in step 2, the operation that we will need is, we will
need to compute alpha 3 2, which is a 32 1 divided by a 22 1 and negative of this, that
is the negative of the ratio of the coefficients. And now the 22 value that we have gotten after
our step 1 is 0; as a result, this cannot continue. This cannot continue, because a
22 has become 0. In an example of this sort, what what I have done is taken up a specific
example, so that a 22 actually becomes equal to 0, but often times, what we find is that
a 22 need not necessarily be equal to 0, but if it is a very small number for example,
if we had instead of 2 over here, if we had said 2.0001, and then 1 over here; in that
case when we subtract those two numbers, the difference between the two numbers becomes
a very small number. And what we had seen in the previous previous module is that we
do not want to subtract two numbers that are of a very large magnitude, but very close
to each other. So, that means we want to avoid subtracting 2.000001 minus 2 that kind of
operations we need to avoid. So, this is not just true in the case, where
the diagonal term becomes 0, but a numerical problem in gauss elimination method happen
even under conditions, where the diagonal term is non-zero, but that difference between
the two terms, and sub being much smaller than the value of the two terms itself. And
we had seen this, why how this affects the overall results and the error, during the
error analysis part of this course in module 2. So, this, so what we have done so far was
what is typically called as Naive gauss elimination. For reasons like this, as well as for the
reasons of minimizing the round off error in gauss elimination; this method of Naive
gauss elimination that we have been talking about is not used in the form that we have
discussed so far, instead what we use is gauss elimination with pivoting.
Now, I had referred to what pivot means in one of the earlier lectures in this module.
Pivot is going to be basically the element a ii in the i the step; why it is a pivot,
because at at each i the step, for doing any of the row operations in ii the step; one
of the most important characters playing a role in that is the diagonal element in the
i the row, which is the a ii. This is the element that is going to divide the overall,
the entire... The for the entire row operation, this is the dividend in case of finding this
coefficients alpha 32 alpha 42 alpha 52 and so on and so forth. So, in step 2, the pivot
element is a 22; in step 1, the pivot element is a 11 so on and so forth. So, if we were
to write our matrix at general n-dimensional matrix in the form a 11, a 12 and so on up
to a 1n a 2 1 a 2 2 and so on up to a 2n, and a n1 a n2 and so on up to a nn. So, these
elements are going to be the pivots or during the first step, second step, third step and
so on and so forth. The idea of pivoting or more appropriately,
the idea of partial pivoting comes from the fact that if you have n equations, so in this
particular case, when we had three equations, our labeling these three equation as equation
number 1, 2 and 3 was our choice; we could have a very well called this particular equation
as equation number 2, and this equation as equation number 3; what it means is that if
we were to interchange these rows, so if this was to become row 2, and this was to become
row 3, the solution does not change. So, the row operations under which the solution does
not change, of course are the scalar multiplication of any of the row or taking linear combination
of any of the two rows and replacing the one of the rows with that particular row. So,
that particular operation does not change the result as well as inter changing the two
rows does not change the result. So, in this case, what do we do? What do we
do the first thing, we will do of the add this particular point is realized that this
element is a non-zero element; and because this element is a non-zero element, we will
interchange row 2 and row 3. When we interchange row 2 and row 3, what we will get is 1 1 1
4 0 1 minus 5 minus 3 0 0 1 1. And now, if we look at this, this particular A matrix
is in the upper triangular form, because this matrix is in the upper triangular form, we
can go ahead and start using back substitution at this step. So, what is done that at each
step step is to look at the so for the i eth step, we will look at the entire i eth column;
and the a value that becomes that that has the largest absolute value in the i eth column
that become, that should become the pivot element. That basically means, is in this,
in if a the say a i1 is the largest element amongst all of these rows; the first thing
that we will do in step number 1 is interchange row 1 with row i, that is what we have done
over here in row 2 and row 3. So, the idea in partial pivoting is...
So we will interchange the rows, so that a ii is the term, which has the largest absolute
value in the entire i eth column.
So, in that case for example, in step 1, what we will do is, we will take a look at the
entire i the column a 11 a 21 up to a n1, let us say a 51 is the largest value amongst
of these; in that particular case, we will just interchange row 1 and row 5, so that
the value of the diagonal element becomes the largest; then we will proceed with step
1. Once we finish step 1, we will then once the step 1 is over, we will then reach a and
matrix of the form a 11- 0 a 22 - 1 1 blah blah blah. And this also I am representing
now with superscript 1, because because of the row operation, what might have happened,
we might have ended up interchanging the rows. So, this is the result after after step 1.
In step 2, our a 22 becomes the pivot element, in the sense that now we want the largest
value in this particular column to appear at a 22, we do not look at the rows above
the second row; we will only look at the rows below the second row; keep in mind, what we
do in gauss elimination, we are only interested in eliminating the elements or the coefficients
in the pivot column, we are only interested in eliminating the coefficients in the pivot
column below the diagonal element. So, we are only eliminating a 32 a 42 and so on up
to a n2. So, again in this particular case, we will compare the absolute values in this
column, and then we will do any of the row interchanges that might be in essential in
order to get the highest absolute value in this particular column.
So, now let us go back, and see how our overall procedure will be modified for an example
of this type. So, let us let us write down that example once again; it was 1 1 1 4 2
2 3 9 and 3 4 minus 2 9, so this is our A, b matrix. And our step 1 is partial pivoting;
and in partial pivoting, we will look at the first column; in the first column, the largest
value is this number 3 over here, as a result we will interchange rows 1 and 3, and partial
pivoting, the operation we will do is this row interchange, which basically will lead
us to 3 4 minus 2 9 2 2 3 9 1 1 1 4. After getting this particular matrix, what we need
to do is with the interchange row 1, we will now eliminate the this element, and this element,
which basically means. Then the second set of operations, we will do is R 2 plus minus
2 divided by 3, because this is the element, this divided by this is the alpha value. So,
R 2 plus minus 2 divided by 3 multiplied by R 1 and R 3 plus minus 1 by 3 multiplied by
R 1. So, we will do that particular operation,
and this will end up in 3 4 minus 2 9, and this, we will definitely get get this as 0,
and this will be 2 minus 8 by 3. So, 2 minus 8 by 3 should be minus 2 by 3, and then we
will have 3 plus 4 by 3 that is 9 plus 9 plus 4 13 by 3, and this will will have 9 minus
6, that should be equal to 3. And over here, we will get a 0 over here, and 1 minus...
So, 1 minus 4 by 3 that is minus 1 by 3, then we will get basically 1 minus 1 by 3 that
is really going to be 0 over here, and then sorry 1 minus 1 plus 2 by 3, that is going
to be 3 plus 2 - 5 by 3, and here we will get 4 minus 3 that is going to be equal to
1. So, this is perhaps what we are going to get, unless I have made calculation error
over here, this is what we will end up getting after step 1.
Now, in step 2, what we will do is, again look at the pivot; and now our column 2 is
what we will be interested in, and the largest absolute value is minus 2 by 3, we are not
interested in looking at the sign of the number, we are only interested in the absolute value,
and the largest absolute value is minus 2 by 3, as a result we are not going to do any
row interchange. So, pivoting will result in no row interchange or no row exchange and
then we will do R 3 plus minus negative of minus 1 by 3 divided by 2 by 3 that is 1 by
2, negative 1 by 2 multiplied by R 2. And when we do this particular operation, this
element is going to be equal to 0, and once and we will get a non-zero entity in this
particular element, and we will then be able to solve this equation in order to get the
solution through the back substitution method. So, I would not continue the procedure any
further over here, I will just stop at this particular step, but the whole point over
here was to introduce you to the idea of partial pivoting in gauss elimination. So, in general,
any of the gauss elimination software that you will find available for on online or any
of the partial gauss elimination software that you would write, you will always need
to include the partial pivoting over that; for relatively smaller problems, you need
not do pivoting at each step, you can you may only do the pivoting, if the diagonal
element at any step becomes equal to 0. So, for example, you may actually follow the procedure,
that we used over here; that means, we did not do the pivoting over here initially, what
we actually ended up doing is, we ended up doing the first row operation, first step
with row operation on R 2 and R 3, and when we found R 2 was equal to 0 at that time,
we interchange this row 2 and row 3. We can for smaller size matrices, we can actually
try smaller size matrices, which are well conditioned; we can go ahead and do the naïve
gauss elimination, until we reach a 0 in the diagonal element, in which case we will have
to do the row interchange. But in problem of any practical interest, it is always better
to do pivoting, at the partial pivoting at each step, it is called partial pivoting,
because we are only allowing the row interchanges, it is also possible to do the column interchanges.
So, if you allow both row and column interchanges, so that the largest value at the value at
of the diagonal elements becomes the largest value in either the row or the column, in
that case what we get is, full pivoting. In general, full pivoting has some proven
properties under certain conditions; however, full pivoting is typically not used in gauss
elimination algorithms, simply because the amount of over head required in interchanging
the columns is going to be larger than against that we get doing the full pivoting method.
So, this is what we have to do about the gauss elimination with pivoting; what I will do
is, go to Microsoft excel, and take a few minutes to show to solve an example using
Microsoft excel to for doing gauss elimination. In general excel is not a very good software
for doing eliminations - gauss elimination or such types of a numerical calculations;
it is usually very good, when you want to do, when you want to solve equations in one
variables or two variables, when we have equations in n equations in n variables, excel is not
a very good software. So, let us now go to excel, and then try to
solve the problem, that we are interested. So, although we have used excel before in
the previous module, what I will do is, I will fire up excel, and go through each individual
element again very carefully, so that you guys get comfortable using excel; for the
most part if access to Microsoft excel is not available, you can actually go to Google
documents, so you can log into your Gmail account, and then there will be a link for
Google documents at the top. You can go to the Google documents, and it has nearly the
same functionality as Microsoft excel, you can store them online or you can share those
with your friends as well. And in general, I find that trying to learn these topics along
with a few other likeminded friends is also very good idea to get through this computational
technique type of topics very quickly. So, if Microsoft excel is not available, please
go ahead, go online to Gmail dot com, and then click on the Google documents link, and
use this spread sheets in the Google documents.
So, we will give this particular thing, a title I will select this, and then I will
click on merge and center, and then write gauss elimination example. So, we will take
a 4 by 4 example, and just to just for ease of indication, I will show the columns as
C 1, C 2, C 3 and C 4, standing for column 1, column 2, column 3, column 4; one thing
that you can do in Microsoft excel is, when this particular box is highlighted, you can
go to the right hand corner of this box, and just drag it, and as you will see that as
we drag it, the value C 1keeps increasing to C 2, C 3 and C 4; you can see that in the
thing that is just hanging below the final box.
And when we release the mouse button, we will have the entire row over here filled with
the numbers that we want; same thing we will do for the rows, we will do R 1, and then
just copy it, drag it below R 1, R 2, R 3 and R 4, and then realize the mouse button.
Again to change the width over here, what I will do is, I will take the cursor, take
the mouse cursor over here, now I will click the mouse button, and then just drag this
to the left, and leave it over here, and so that I have change the width of this particular
column. And then I will put my A matrix over here, and I will label that as B.
So, I have just put a blank column, and reduce its width, so that it is easy for us to visualize,
and we can visually separate columns of matrix A with the matrix B. And I will give this
example, so we will use x 1 plus 2 x 2 plus 2 x 3 plus x 4, and equal to 1; the second
equation is going to be 2 x 1 plus 2 x 2 plus 4 x 3 plus 2 x 4 equal to 0; in the third
equation, we will have x 1 plus 3 x 2 plus 2 x 3 plus 5 x 4 equal to 2; and the final
equation, we will have as 2 x 1 plus 6 x 2 plus 5 x 3 plus 8 x 4 equal to 4. So, this
is what we have over here, and then we will make another column for our alpha, and I will
write step 1 over here. So now, the alpha that we need for the second
row, and we will do a Semi-Naive implementation of a gauss elimination, that is we will use
partial pivoting only when the diagonal element become 0; if the diagonal element does not
become 0, we will not do the row interchange. So, now let us look at step 1; for step 1,
we will need alpha 2 1, alpha 2 1 is just negative of the a 22 minus a 21. So, the way
we will write this over here is we will go to the appropriate cell, this this particular
box is called cell in excel, and we will start writing the formula by typing equal to sign.
Once we type equal to sign, excel knows that what we are doing is we are writing the formula
over here. So, the alpha 21 is going to be equal to negative of a 21 divided by a 11.
So, we have written negative of a 21 divided by a 11, we close the bracket, and press enter,
and this becomes our alpha. Now the thing that we can do is, we will be able drag this
particular cell to the cell, the two cells below it, and we will hope to get alpha 2
from alpha 21, we will hope to get alpha 31 and alpha 41.
I will tell you right now that if we just do this dragging naively, what we are going
to get incorrect results, I will just do the dragging, and I will show you what I mean
for that. So, I will go to the right end of this cell, press my mouse button, and then
drag it two rows below, and the formula is immediately recomputed, and we get the alpha
values. Now, if want to check the formula either we can look at this particular formula
bar or we can press the f 2, function key f 2, so that the formula becomes visible.
I prefer the method of function key f 2, because once you press function key f 2, excel will
color all the various cells used in the formula. So, for example, we have this as B5 divided
by B4, B5 is in color blue, that is the column B and the row 5, and the B4 element is in
green color. Now, we have a problem over here; why because
our alpha 31 is defined as a 33 sorry a 31 divided by a 11; however, when we have dragged
and dropped this formula, what does happen is, when we dragged and dropped it, excel
recomputed it, assuming that you want to change all the cells appropriately as you want, as
we go below. So, for example, what we had over here is the formula was B4 divided by
the element in B3. So, when we drag it, so instead of B4 divided by B3, when we drag
it B4 below, we will get B4 B5 divided by B4, if we drag it one more row below, we will
get B6 divided by B5 that is what we get in this particular element.
Now, excel provides one more functionality is the dollar sign, what dollar sign tells
excel is that, that particular column or row should not change. So, in this particular
case, what we want to do is when we drag this, we want our row to remain at B3 itself. So,
when we drag this below, we do not want this to the B3 to change to B4, B5 and B6. We wanted
to remain B3, so that means, what I will do is, I will put a dollar sign over here. So,
when I drag this particular element below, what happens that the number that was under
the dollar sign does not change, so when I have dragged this from, so this was B4 divided
by B dollar 3; what that means is when I drag this below one row below, we will convert
this equation will convert to B5 divided by B4 it will try to do, but then it comes across
this dollar sign, and then it is says oh, well; I do not have to change this number
3, I have to keep this number 3 as constant. So, instead of having B5 by B4, we will have
B5 divided by B3, when we drag and drop this over here. So, we will drag and drop, and
click f 2, this is exactly what we get B5 divided by B dollar 3. When I drag and drop
this below once again, we will get this as B5 divided by we have B6 divided by b dollar
3, which we can confirm by clicking f 2 we get B6 divided by B dollar 3. So, now we have
gotten gotten our alpha values, what we need to do is basically, we need to do row 2 plus
alpha into row 1, likewise row 3 plus alpha 31 into row 2 row 1 and row 4 plus alpha into
row 1. So, I will write this row 1, row 2, row 3, row 4 again, and at the end of step
1, what we should be getting is so this particular element that the row 1 does not get change
in the first operation. So, I will just write this as equal to the top row; and I will just
drag it horizontally, so that the entire top row is available to us.
And what we see is when I drag this over this empty cell over here, the formula that we
have got is this number is going to be equal to f 3, and whenever it come comes across
a null number in the equation, it will replace that null number with 0; and we do not want
that, so we will just clear this, and that that should do it. So, in step 1, row 1 does
not change, and that is what we have over here. What happens in step 2 is, we are going
to do is this element is going to be equal to 0, and likewise this element is 0, this
element is 0 also, we are not doing these computation; keep in mind that we know for
a fact by choice of alpha 21 alpha 31 and alpha 41, these numbers are not going to be
equal to... Are going to be definitely equal to 0.
Now, what we have is, we have row 2 plus alpha multiplied by row 1, so we have row 2 plus
alpha multiplied by row 1. So, this is the result for the second row. Now, there what
we have we will be doing in excel is that we will be taking this element, and dragging
it column wise in that same row, we will drag it towards the right, in order to get get
the result. So, what will happen is that when we drag this, this particular element should
be dragged, this particular element also should be dragged towards the left, towards the right
sorry, but alpha should not be dragged. So, the alpha should not go from i to j, j to
k and so on. As a result, alpha will need a dollar sign over here. So, we will put the
dollar over there, and press enter, and we should be fine, and now we can drag this towards
the left. Now, let us see what we have, we get over
here by clicking, we want to confirm that the equation that we have over here is correct.
So, we will highlight that, and press the key f 2, and when we press the key f 2, we
indeed get this as D4, that is this element plus alpha multiplied by the element, the
corresponding element in row 1. So, we are correct over there, likewise when we check
this particular number, we will find that we have done it correctly over here also,
it is E 4 that is so this, so the element in row 2 minus the plus the correspond element
in corresponding element in row 1 multiplied by B value alpha. So, that thing is okay,
and this particular number is also going to be okay. So that is row 2 plus alpha into
row 1, what we want to do next is row 3 plus alpha into row 1, where alpha is now replaced
by alpha 31. Now, same thing as I was dragging it in the
right direction, I will drag it downwards; again the same problems that we had when dragging
it downwards will appear. So, when we drag this downwards in fact, we should not just
be alpha, I will put this as alpha (2,1) over here, and likewise I will put this as f 2
and alpha (3,1). So, I will just drag this, and when I drag this, we are still not done
the complete thing that we require to do in order to get the correct formula and I will
first drag it, and then I will tell you why this formula is actually going to be going
to be in correct. What we need to do is, we need to do row 3 is going to be equal to row
3 plus alpha 31 multiplied by row 1. So, when we dragged from row 2 to row 3, everything
that is 2 will change to 3 in the rows, nothing in the columns is going to change, and everything
that is in the rows is going to increment by 1, because we have not put any dollars
in front of the numbers over here. So what we have over here is row 2 plus alpha 21 into
row 1. So, when we drag it downwards, 2 will change to 3, this 2 will change to 3, and
this 1 will change to 2; this is not what we want by just dragging, so we need to add
1 more dollar sign over here. I will show you what exactly I mean, by clicking,
by going to that particular cell and clicking on f 2. What we want to do in order to get
row 3 plus alpha multiplied by row 1 is that this element should be added to this guy multiplied
by this particular guy, this is not what happens over here, and the reason why it not does
not happen is, now we have to just to look at this purple box; this, when we drag this
downwards, the blue box and the green box were correct, it was the purple box that was
incorrect. So, this purple box has to go up. So, what has to happen is if we look at changing
this purple box, what you will see in the formula is that C 3 is changing to C 4, and
C 4 is changing to C 3. So, let us go back to the original formula, and see what should
not be changed; what should not be changed is row 1.
So, every time we do this row operation from row 2, row 3, rows 4, what should not change
is the number 3 in this element over here. So, I will put a dollar sign in front of number
3, I do not put dollar sign in front of C, because the columns, because we are dragging
it vertically downwards, there is nothing to do about the columns, we have to do when
we are dragging it vertically downwards, you only have to look at the rows. So, row 2 plus
alpha 21 multiplied by row 3, this is what we have over here. As a result, when we have
to drag it to row 3 plus alpha 31 into row 1, in that case, the row 1 element should
not change, but row 2 should change to row 3, row 2 should change to row 3 again.
As a result, this equation does not have a dollar over here, does not have a dollar in
front of this 4, but has a dollar in front of this 3. So let us delete this result, and
let us drag it downwards, and see what we get? We click on f 2, I am sorry this dollar
did not register; I have to click enter, and now this dollar will register over here, and
now I will drag and drop it over here. And then click on f 2, what we will get is row
3 is going to be row the new row 3 is going to be equal to the old row 3 plus alpha 31
multiplied by row 1 element over here. And now, I will just drag this horizontally as
we have done before, and I will just check let say this number, so this is the for column
4, we have the row 3 plus alpha 31 multiplied by the element in column 4 of row 1. So, this
equation is correct over here. And then we can basically select this entire
row, and just drag it below, and we will get the actual result. So, this is how what we
get at the end of step one. So, this is row 4 plus alpha (4,1) multiplied by row 1, and
these are the results, we get after step 1. I will just highlight all of this, and just
drag it, I can I can go to the edge of the box, and then click my mouse, and then this
drag, this row below, and that works, the row gets dragged below. And I will write this,
I will change the font size to 18, result after step 1, and now just color this as red.
Now, we need to do step 2. So, we will do exact similar things that we have done before;
the first thing, we need to do is to calculate our alpha value. So, I will take these two
alpha values, copy them, and then paste them in the next column over here; and let us see
what happens, because of that. And so now, this is alpha for row 3, I should be copying
here, and then pasting it over here. So, for step 2, what we need to first do, for what
we need to do first is to calculate alpha (3,2), and calculate alpha (4,2); alpha (3,2)
is going to be, it is going to be equal to this sorry it is going to be equal to this
guy divided by this guy, negative of that. So, we will go to this particular element,
and click on f 2. So, this is C 11 divided by now C dollar 3 that we get. Remember that
we had put this dollar over here, so that the results do not change, when we drag this;
that is exactly what has been retained over here. So, now the best way to do this is to
go up, and just click on your mouse, and drag this over here. We need that dollar sign at
each step, when we are doing this computation. So, now, what if we do f 2, what we have as
alpha (3,2) is a (3,2) divided by a (2,2), because we have put a dollar sign, we can
just go ahead, and drag it below, and that should be no problem, because now we have
alpha (4,2) is a (4,2) divided by a (2,2) negative of that. So, its negative 2 divided
by minus 2 so, that should be equal to 1, and that is exactly what we get over here.
And now, we will do the row operations as before, so I will just copy and paste this
below. Now, the row operations should be... So, the
row should row 1 should not no change, row 2 should have no change, also row 3 row should
be row 3 plus alpha (3,2) into row 2, and row 4 should be row 4 plus alpha (4,2) into
row 2. We will delete this particular row, completely we will delete this particular
row completely, and we will delete this also. We will just do f 2 over here, and we have
seen that this result is the same, because previous step also we did not change row 1;
again we do not have to change row2, so row 2 is equal to the value in row 2, and we will
just drag and drop it over here like thing. Now, because of the row operations, so these
two elements are not going to change, the reason why they would not change is because
we have 0, in this particular column. So, these two elements will not change; these
two elements we know are going to be equal to 0, because of our choice of because of
our choice of alpha (3,2) and alpha (4,2). This element, there is a possibility of changing;
now this will not change we know, because this value is zero, but in general, this value
need not be 0, this value can be a non-zero number. So, we have to do that calculation,
so I will just go to row 3 over here, I will do control c and control v, copy and paste.
Again this number is not going to be correct, so I will go ahead, and check what that number
is once again. I will check this by doing f 2. So, we needed
row 3 plus alpha (3,2) multiplied by row 2. So, this is this is row 3 divided plus alpha
(3,2), we see that this is not alpha (3,2). So, I will just drag this over here, so this
will be alpha 3 comma 2 and. So, row 3 plus alpha 3 commas 2 into row 2, but because of
this dollar sign, we do not get this as the correct result. So, we will just go up, and
we will just drag this to the appropriate row. So, I have drag this, if you notice to
now row 2, this is the row 2, I have just drag that element over here, and I press enter,
and we will get the correct result. Again I will click f 2, and just recheck, we have
row 3 is going to be equal to row 3 plus alpha multiplied by the corresponding element in
row 2. And now we can drag this horizontally, and
we can drag this vertically as well. And this will be the result after our step 2, we can
just click f 2, and just confirm row 4 is going to be equal to row 4 plus alpha (4,2)
multiplied by R 2. So, our equation is correct at this step. So, this is what we have obtained
over here, and now what we need to do is we need to we need to write down this is result
after step 2. So, this is going to be the result of after step 2, and we will delete
this unnecessary numbers.
And now, we will go on to step 3. Now, in step 3, what we have to do is we have to use
row 3 to change row 4, but we find that this pivot element in row 3 is 0. As a result,
step 3 dot 1 is going to be row interchange. So, the first the first part in step 3 is
going to be row interchange, so I will copy this over here, the first two rows, there
is no problem, I will just paste it, and I can just drag it, and I can just drag it below;
and that should not be a problem; row 3 because of row interchange should be equal to what
was previously row 4, and then I can just drag it without having to worry anything,
and as you see this row 3 row 4 has now appeared in place of row 3, and row the new row 4 should
be what was a previously row 3. So, I will just click this and I will just drag this
over here sorry I will just drag here, and then we will get this result. And then we
can check this that the new new row the old row 4 now old row 3 now becomes the new row
4. So, now we have done step 3 dot 1, which is
row exchange step 3 dot 2 is we need to compute. And that again we will need R 1, R 2, R 3,
R 4, and we will be computing the alpha; R1, R 2 and R 3 will remain unchanged. So, these
will remain unchanged, so I can just drag this below over here, and then drag this horizontally
R 1, R 2, R 3 will remain unchanged; R 4 we will basically be getting 0, 0 and 0 in this
first three elements over here; and this element will be changed and this element will be changed;
the alpha that we will need in order to do this change is going to be a... I will make
this font size eighteen also; this alpha is going to be equal to... So, this is alpha
(4,3). So, alpha (4,3) is going to be equal to again font size alpha (4,3) is going to
be equal to a (4,3) divided by a (3,3) negative of that. So, negative of a (4,3) divided by
a (3,3), I will press that as enter, and I will get this alpha value equal to 0.
Now, what I have to do is keep in mind that although this alpha value, we have obtained
it as 0, this is for this particular problem only. Computer does not know beforehand that
this value is going to be 0 or this value is going to be non-zero. As a result rather
than adding one if statement or to check whether this result is going to be 0 or non-zero,
we actually go ahead, and do this computation, and that computation is row 4 equal to row
4 plus alpha multiplied by row 3, and for that alpha we will put a dollar sign in front
of K; and we will then just copy this and paste this over here.
So, at the end of three steps, we have now obtained an upper triangular matrix over here;
and we have covered the main parts of the gauss eliminations specifically, we have done
the gauss eliminations steps over here, and we have done the partial pivoting step over
here. Keep in mind that I did not do the... I did not go the full blast, because the partial
pivoting at this step should have resulted in row interchange between R 1 and R 2, I
did not bother doing that simply because this was a relatively small problem that I knew
we will get an appropriate solution. Now once we obtain this, we will go ahead, and do back
substitution back substitution.
And back substitution we have x 4, x 3, x 2 and x 1; x 4 is going to be just this guy
divided by this guy; x 3, for x 3 we will it will be this minus this multiplied by the
result; and that should be it, and it should be divided by by this element So, x 4 is 0,
x 3 is 0, x 2 is again going to be this element minus 0 minus 0 divided by minus 2. So, x
2 in this case is just going to be this element divided by this element, and x 1 again is
going to be equal to this element minus 1 multiplied by 0 minus 2 multiplied by 0 minus
2 multiplied by 1. So, minus 2 multiplied by 1 whole thing has to be divided by this
particular element, and I need to put these guys into brackets over here, and this is
going to be our result. So, our results therefore, is minus 1 1 0 0 as x 1, x 2, x 3 and x 4.
So, that is pretty much it about doing the gauss elimination method. So, what we have
done in this particular lecture is covered the idea of pivoting in gauss elimination,
and then we took an example in Microsoft excel. So, for I finish off this lecture over here,
what we will cover in next lecture is to consider one specific example of interest to chemical
engineers that is a plug flow reactors, and I will convert that into a linear system of
equations, we will get; that equations in a specific form called tridiagonal matrix
form, and we will talk about one more solution method called tridiagonal matrix algorithm.
So, that is what we will cover in the next lecture; thank you and see you in the next
lecture.