Transcript for:
Linear System Solving Methods

and by doing so what is next for us to do you and I will leverage on other direct method the first example that you and I will look at is the elimination method the elimination method how it works based on what we learned or we saw in our high school we give an equation say 2x + y = 6 and x + 2 y = 1 how then do we solve this technically we'll try to convert this into 21 1 2 with xy = 61 in high school it's not done this way instead we try to multiply through equation one by two so that we'll be able to eliminate the first guy here at the end of the day you notice that this guy will be the one to vanish so by doing so once I delete this guy I'll end up getting a triangular matrix what do you observe you observe that for a 2x2 matrix we end up obtaining one step in clearing our X but how then do we solve for the y you and I in our high school again is to solve for y when you are done you substitute into the equation and proceed the step you carried in taking off the x is called the elimination method the step you carried out in computing your y and getting the answer the backward substitution method so therefore some other method proposed by goss is being used and how do we observe we observe that at the of the first process ofation we end up getting a triangular matrix and to be specific an triangular matrix and then we invoke substitution to solve for which is the unknown unfortunately you observe that this guy we have a process for doing so that process depends on the pivot the pivot is found so all elements are called the pivot element the pivot element this pivot element used to the elimination pro so therefore the guy under or the guy here off found under a pivot for 3x3 matrix one 1 2 2 1 1 1 z you realize these guys are ele one and this guy is under the element one as his pivot so our job is to take out the two here the one here and the one here and move them to zero when we are done we say we have achieved the elimination process what do you observe the moment able to move two one and one to zero by then guy may have changed into a number we don't know yet according to observe that X Y and Z number says one and one it's obvious that the number here * Z is equal to the numbers here this will be * Y * Z is = 1 this will be X and Z= to two so now for the input of make our life much easier very soon okay then that throwing out these guys into your pivot end up being zero which means you might and that's dangerous division by Z is not possible this is why we make use of the pivoting strategy pivoting rules the rule says that if you enter a pivot being zero then you must perform a swap because we are unable to perform the elimination process as usual we advise you to put your name and ID in the chat for attendance as you can see on the main platform we are over 100 students and over 150 represent class so take your attendance by tapping into so that you will not be denied your attendance score so you continue this is why we make use of the pivot rule to avoid issue of division by secondly the element so on the pivot in that case you yourself sensitivity in your value don't forget is going to be done computer for that reason the computer works with partition the computer cannot keep fractions in memory instead a floating and a floating point cannot be stored in precision so there mindful of what are to avoid messing up solution okay so encounter is we perform an interchange there are two type of in we had a partial pivoting and a full pivoting the pivoting says that interchange the complete or the full says that interchange row and your column we shall observe them soon and how they this is what I spoke to you earlier issue of runoff ination computer cannot keep a very long number it keep up to 16 32 bit and that's the end but you and I know that numbers very very long for example can be very very in the compute not that so what do we do we are forced to round off and by rounding off our accuracy also compromised so take of that reasons why we do pivot and of course an example will life much easier and better for all of us remember that we have to multiply the row the first second row by two so that be able to perform elimination process this is called the the scaling all what I to you right now is called a process it's a process the elimination the elimination and the argument is how then make use of this interface but before I into an example I am forced to explain one more method which is a combination of the work and the work of becoming the go Jordan method so let's go through and see what happens before I move in Jordan I want to emphasize something to you what is it at the end of the gian elimination two things are being obtained a solution to the problem two a triagonal a sorry a triangular matrix is also been obtained and what do you observe you observe that this triangular matrix produces nothing but a determinant determinant okay so if this guy produce a determinant what will this guy produce and very soon we shall realize that it produces nothing but an inverse an inverse and from high school we know that our inverse depends on our determinant so therefore if our determinant is equal to zero we say our matrix our matrix is singular and if your matrix is singular it also means that the inverse does not exist does not exist this from algebra recap from algebra so take note of that so how that go Jordan jordan works goss jordan requires two things and for it to work it requires that perform what you call the augmented metrics and in fact in this method we also need to do augmentation and what are all these fancy words we shall see an example and all will be okay with us okay so we proceed i have a given A as a matrix 1 2 2 2 1 1 1 1 2 as a matrix our job is to solve for X Y Z where our B is say 201 okay in the go Jordan approach this what we are doing just as we saw in the gshian gshian says that move this guy to zero but gojan says that move this guy to zero when you are done move these guys also to zero in the diagonal but the diagonal should be equal to one one one this simply means that conver your a into a diagonal matrix But a special one called identity transform your identity you observe you observe that if I have all these guys being one one 0 0 0 automatically this correspond to X to Y and to Z immediately we need not perform a backward sub we saw in the previous example first one says that do forward elimination when you are done do backward substitution this one says that just do all elimination without doing backward substitution and so therefore your answer is found on a diagonal now this is what people normally do how do you find inverse over here to find an inverse we augment the A to an identity when we are done we convert or transform this into I A inverse where A becomes I and I here becomes A inverse so at the day whatever we get here is the inverse of the matrix A this how the go Jordan works and once you understand how God's elimination work automatically the rule is applied here for go so here we are so pass in an A and I at the end get I and A inverse and don't forget that we observe in a previous meeting that A * A inverse or A * B not the same as B * A however there are instances where this is true and that's only when B is equal to A inverse so therefore a * a inverse is equal to a inverse * a= to i is equal to i this is something to pay attention to it's a concept okay the next one that we also observe is the inverse method which we saw during our seminar session solve a s= b to do so we know that we can easily say s= b / a unfortunately in algebra this is not possible because we cannot divide a vector with a matrix it's not possible so therefore we perform a very useful operation take for example B = 3 by 1 vector we expect our X to be 3 by 1 vector this will mean that A must be 3x3 matrix so if I can divide 3 by 1 on 3 by 3 then in the same algebra I know for sure that I can convert this into B A inverse my argument here is is this correct i can only answer this through the process b is 3 by 1 a is 3 by 3 so there's way I can do this myself because inner element can't agree now what I here is saying 3 is equal to 2 * 3 inverse in numbers is allowed in vectors and matrices so therefore the best way to write this is first B which as 3 by 3 and then by one so they cancel out and I'll get 3 by one which is the answer we see in MATLAB this told you that the backward slash the backslash WhatsApp okay so we proceed from there i told you earlier on that if the is singular then our must be equal to zero if zero means that your inverse does not exist doesn't exist your system will not have a unique solution in many solutions this then bring up the idea of what the RAM audio that very soon and how to use so I've explained to you the method and I give an example as well i've explained to you the goshian which you I've explained to you the go which I'm an example then I've now explained to you the metric inversion method which you saw in our seminar a second seminar is happening next week I'm sure by Now who already follow LinkedIn have seen it applied for it okay before I take you to next method the earlyization I'll show an example with you so let us start okay so I'm going to show that screen and then quickly we move there if you can board a thumbs up then from there yes thank you thank you yeah thank you so let's now and see what and how to do it the examples are very attention okay we have a system of and this is what we are going to expense i'll use a 3x to make life flexible as compared to metric which is too simplified i'm only hoping the example I'll choose for you actually is singular okay so 2x + 3 y + z = 1 x + 2 + z = 1 a x + y + 2 z = 2 i have this example to be sure that the determinant exist we demonstrate if truly exist so the question will be solve system this solve this linear system of equation solve this continuous equation they all the same in the in we don't solve them bying x can we do y and z instead convert them into notation the matrix notation where a is equal to 2 1 A 3 2 1 1 1 and our B = 1 1 2 and we have to solve for X= X remember the word X doesn't mean this X I'm the whole vector X solve this using the was the goshation method this method says that this guy to true to zero now we won't pay attention to zero for now but the moment we see a zero immediately we move away from the normal G naive the naive method to the pivot method so examination if you ask to solve this using go elimination we are referring to the naive method if we say solve with partial pivoting what the rule says is that in partial pivot your pivot must be the biggest on the row so solve this with passive pivoting we have to interchange row one and row three so that the pivot here become the largest but now I'm only doing the naive emination process so we observe to do so we are saying that this guy and this guy must go to zero in our high school we perform scaling to do that in the university we use what to call the permutation matrix so the row elementary matrix the row elementary matrix you see as the row echelon form the row echelon form they the same thing okay so here we are to move this guy to a zero we have to multiply this guy by two and this guy by one and subtract from each other we will not do that anyway but instead we shall define our row elimination scalar value so here we are we shall call it M1 and M1 is defined as the one that must go to zero over it pivot so 1 / 2 1 / 2 and this element is multiplied to the pivot row to a pivot row okay i say if you have a question just raise your hand and then we'll attend to you i'm not sure what request this person is making okay so let's continue we proceed i can't see any content there unfortunately okay so let's continue so this particular element here is multiplied or multiply this element the first row the pivot row the pivot row the pivot row is our row one so therefore our row one is equal to M1 * R1 when we are done we now subtract from it the following row two so let me do this very well for you row one now becomes this when we are done we subtract from that row one to get our new row two so therefore row two is now equal to our new row one minus row two okay so we start so our one now becomes nothing but half * 2 now becomes 1 half * 3 now become 3 / 2 at this point you are urged to keep your calculator by you let me see if I can find mine otherwise you must Okay I've seen mine okay I'm not concerned about how correct the answer is but the steps the steps so 1 times the following also have but there's one thing we've taken out which is the B the B the B must be augmented must be augmented which mean you must add it so one over here it becomes just put a line here one one two so here I have my one / two one and then two where one by two here means 1 / 2 * that value okay here we are they now have 1 2 1 and then 3 1 2 and I tell students that going this approach or this route is a waste of time so therefore you spend time to do all the things here remember that the remember that The pivot row does not change its value so our new matrix A is equal to nothing but 2 3 1 with one then now can look for the answer for the second row which is coming from this guide so instead stay here and put your value don't do this to waste your time stay here and do it so our row one now becomes nothing but one 3 on two half row two is one 2 one and one subtract find a difference so it becomes 0 0 now three on two minus 2 becomes -0.5 followed by half - 1 also -0.5 and half - one also -0.5 5 this is our new value so become 0 and a 0.5 and a 0.5 and a 0.5 when we are done the same is down to row three but the value of row three is not one but instead three so now define our new m which is m_sub_2 let any new color m2 is equal to nothing but the number that must go to zero over the pivot which is two okay I don't want to convert into into a decimal let's keep it as it is so therefore our pivot row now becomes m_sub_2 r1 and that value is 3 / 2 * 2 becomes 3 3 / 2 * 3 now becomes 9 / 2 3 / 2 * 1 9 becomes 3 / 2 * 1 3 / 2 so here we add then we subtract from it the row that must go to zero 1 2 2 1 2 2 So we underline as usual then once you subtract and the first guy here fails to go to zero you're in trouble it simply means you're doing the wrong thing the wrong thing is been done okay so you proceed so 9 / 2 - 1 becomes 3.5 3 / 2 - 2 becomes -0.5 and here becomes -0.5 so therefore it becomes 0 3.5 - 0.5 and then 0 - 0.5 this then bring us to the end of the first elimination process the first elimination process but what did you observe you observe that the value here is still not zero so now continue and the pivot for this guy is the diagonal element here so we going to move to the M3 so M3 I'll use a blue color oh sorry okay a blue color okay black color rather since the blue has failed to appear a black color thread to be equal to nothing but the guy which must go to the zero divide by the pivot so 3.5 over our pivot - 0.5 - 0.5 so our new row over here becomes our R sorry so our R2 is equal to our M3 time our R2 so what do we do multiply this your pivot row and by so doing we expect that it become the same as this guide so this times this by default we know the answer is 3.5 this time this also gives us 3.5 this time this also gives us 3.5 okay i only hope we not put ourselves in trouble so let's continue which I foresee it coming anyway so here we are subtract from it 3.5 0.5 okay it won't happen and the min is 0.5 so immediately this guy go to zero if your first guy fail to go to zero simply means the wrong thing has been done so here 3.5 - 0.5 it becomes nothing but the number four the same here four so therefore we replace this row now with our new answer so our new a now becomes 2 3 1 augment by one 0 - 0.5 - 0.5 - 0.5 then 0 4 sorry 0 0 4 this becomes our new matrix our new matrix because there's no element on our diagonal which is equal to zero we are convinced that our determinant of a is not equal to zero therefore the inverse of a exist and determinant is computed as 2 * -0.5 * 4 so 2 * -0 5 * 4 and answer is -4 this is our determinant based on the upper triangular matrix but we not have to solve determinance we have to find the solution to this guy but we have to do this because this will tell us if we have a unique solution or an infinite solution and behold because there's an answer for determinant we are convinced that the answer we are going to get is a unique solution not an infinite not an infinite okay so how do you find a solution this is the end of the elimination process let's now go into the solution using the backward substitution method that says that let's come to our equation and start from bottom up bottom up what do we see here is and why do we even do bottom up we do so because the first two are zero so 0 * x 0 * y then 4 * z so this will go to zero so it becomes 4 Z = 4 this means Z = 1 because 4 is 1 now go upstairs one more step up that this guy which now becomes 0 * X is 0 so -0.5 y -0.5 z is equal to -0.5 however the value of z is known to be the one here so therefore -0.5 * 1 = -0.5 how do you observe the answer is zero why why because -0.5 y = -0.5 + 0.5 which is equal to z here so divide two by this y = So now second answer is obtained and here the last row so 2 x + 3 y + z is equal to 1 but the value of z is zero so it's one the value of y is zero so 2x = 1 minus our z which is 1 minus our 0 here 3 * 0 which is 0 and this is also equal to z so our x is also equal to 0 therefore our answer to the problem is x = 0001 x = 0 01 how do we convince ourel that the right thing is obtained or the right answer is obtained this where I'll open up my MATLAB and then showcase something small for you okay and what I'll showcase right now is something that we are going to see anyway in our next seminar session okay so let me write down this equation and then we solve it with MATLAB so here a is equal to 2 3 1 1 2 1 3 1 2 and b is = 1 1 2 z determinant was found to be minus4 and our answer x is found to be 0 01 01 Okay so I have a mat lab now showing okay I see a question let me quickly respond to it please proceed proceed okay sir we can't see your M live screen i'm not there yet is that all okay that's Benedict proceed proceed okay so we continue so I'm going to share my math lab screen and then we'll see how that also works over there more of such examples will be done at the seminar section hopefully in this time okay so oh sorry sorry sorry sorry i've long screen how come my club is missing a moment i have too many things opened okay okay so this is my MATLAB screen so just as you saw at the seminar session we have a matrix A and that A is defined as 2 3 1 1 2 1 and then 3 1 2 this is our matrix A and our B vector B is and again we learned all these things at the seminar session crime here's our B and I'm sure you know what crime stands for based on the seminar session okay so let's even demonstrate the first response with the inversion method so X is equal to A / B here we are 001 this tells us that you are doing a superb a superb work 01 you have confirmed our solution okay using the goshian process and this was possible because the terminant exist so what is our determinant we got minus4 sorry we got minus4 so the depth of a is the following so we have over here four now when we ask why do we have four here and minus four there in the first place remember that the sign only tells us our direction doesn't have a direct impact and terminant is something the distance from the origin so the sign over there doesn't make any difference so the answer remains as it is okay so we are convinced that what we have solved as x being 0 01 and not being four is exactly what we have obtained over here okay good so we proceed from there so let me take you back to the drawing board and then Okay so we now continue this is the end of the gshian elimination process however I've just explained to you that we also have the go Jordan the go Jordan the Jordan says that sorry jordan says that we must also move this guy and this guy and this guy also to sorry also to zero so 2 3 1 1 0 0.5 - 0 0.5 - 0.5 004 4 Let's now proce with that and see how or saw the same thing is the go approach that our met ended as the following 2 3 1 0 - 0 5 - 0 augmented by 1 - 0.5 4 L 0 so go Jordan has gosh is go Jordan will continue I first move this guy to Z this is pivot that supports that guy so you continue our was M3 so now M4 equal to nothing but nothing but the to 0 over the pivot and the pivot row which is row three [Music] and obviously if I multiply two by this I'll get nothing but the following 0 0 - 0 - 0.5 then subtract from it row row 0 - 0.5 - 0.5 just as we saw on by doing so this remains a zero this remains 0.5 this remains a zero remains a zero cuz - we have the following okay okay so we put from there 0 - 0 0 + 0.5 - 0.5 + 0.5 so we're going to replace this row by that so it becomes let me get a new color but color here 0 don't forget for the go down going up this brought us down this will take up so 0 04 for the pivot row does not change followed by 0 0 this what we get for ourself once we are we now move on to this guy which must also go to zero our M5 is equal to 1 / pivot row four this is what you be programming in MATLAB as part of your assignment so therefore our M row 3 now becomes M5 row which then gives us nothing but 0 1 1 we multiply this through this by the following 2 3 1 here becomes -2 here becomes - 3comes zero that's required here it becomes as well therefore we come here and - 2 - 3 0 All what we are doing for our y without doing substitution like we did in the go so now here we are the next thing is to eliminate following this guy to a zero to a zero so now move on a six to the value of it pivot so therefore row two is equal m6 row because time to solve this why it's taking of time if I'm doing alone taking more than 2 minutes to finish this but because we are learning so looks a bit so make sure the video time and get used okay so now my row two will be 0 this will multiply to give minus 10 0 0 then the row - 2 - 3 0 0 I put a brack because of the confusion so 0 - - becomes 2 3 - becomes 0 0 - 0 0 - 0 so therefore our final data becomes two 0 augment 0 0.5 0 04 but that now this a I should move into I a inverse so this must all move into an identity so we divide by our to make one so be one 0 0 unfortunately because all the are still zero so 0 1 0 0 0 1 1 / what you see all we are saying is that our row are our var y so x = x = 0 y = 0 and z= one this is the to the go or gosh elimination the answer or either the inversion method the metric method which I did in lab the same answer was obtained but the beauty here is that instead of doing the beauty that we can't use this guy to find emance but can this guy to find and how do we do that to find in our B is this but instead we say that augment your with Sorry 1 0 0 0 1 0 0 0 1 so it becomes a B which means I ending here I would have add to it the Z 0 to it ending here added one Z and also it by time I'll be done numbers will change their numbers all values and will become like this so the answer you get here is called inverse the a and I've told you you do one vector if you want more work also do is coming the b with 0 when you are done with all these long the last one 0 0 and then put answers together the XY Z put all becomes your in your so all the things what you want to this will chance solve question okay go back to this okay so back to the slide back to the slide the inversion method is what in MATLAB we use because we cannot find invest in a very simple way so we'll not be doing this anyway in practice so there's no way as to do invest method examination it's not practical is not practical in life so do go Jordan you do elimination as well and the worst case the Krema rule the KMA rule okay now what do you observe you observe that I always augment my matrix into a bar b to get my answer to x what if this is not of importance to me all I need is the manipulations done on it and then can use that manipulation to perform all my exes so for example those of you who meet me in machine learning class 311 or data science class and your badge data science prompt to be very very different from all your other colleagues at the same time do more demanding than your other colleagues but do for life so feel free and come only a few normally comes into my class we have over 20 people in year two in year three it scaled down all the way to 60 or even 40 the max so far was around 17 then year four is it scaled down completely to around 13 depending on what happens in 311 and that's quite surprising but the future now is about 311 and 405 so why do you want to run away from it so you are welcome to that class if you really want to do it okay so back to business i want to be able to understand what happens to my x for various vectors b so for example 2x + our 3 y + z x + 2 y + z = 1 = 1 then 3x + y + 2 z = 2 now I have a new b say 0 01 011 i am forced to go through all this long proce again which is highly inconvenient for that matter a new approach is being used called the factoriization method where we shall decompose this guy into U and L the beauty here is that you don't have to hustle to get the U and L the U is obtained from the gshian elimination you saw me writing M M1 M2 M3 those M1 M2 M3 they will form the L so this means that while solving for your u through g elimination which I've explained to you you are automatically getting your l as well this is why I don't teach student to go multiply by two here and divide and continue and continue and because student will go and do divide and continue most of my examination will be on lu so then you are forced to now learn how the GE works and how the GS work so for LU you can't cut corners but for G E and GS you can cut corners if you dare cut corners in the G to get your U trust me you can never get your L so you'll be in trouble you'll be in trouble so please try and play video and get access to the method very well so I'll show you how it works already you know what U is and what L is but how do you use L U to find the solution to the problem don't forget that L * U is equal to 8 and this a comes with x= a b this then means that my ax= b now becomes l ux = b but I know that our system must always be in the form a x + b this means that we are forced to let the guy here become like a y so ux is equal to y this looks like the guy here unfortunately we have no idea what y is so we cannot solve here for our x but when we say ux= y it also means that l y = b simply by replacing the u x here by the y here the y here so you now get another equation so now there are two equations ux = y which have the x but we don't know y so you cannot solve and second one is lx = b l x sorry l y = b this also looks like a x= b these two equations are used to find the answer so use this guy to find y to find y that y is now pushed here to find to find x this is how we use the lu to solve for our x let us try and see with the example but before then let's go through what it is so de compose your a into b and c where b is a lower matrix and c is an upper matrix such that when we multiply them we get our a back okay now the process of getting the process of ensuring that sorry your L your L matrix your L matrix is diagonal with unity is called the DL method the DL method okay now if you are constraining your you to be your unity is called a crow method the crow method but you and I will learn the do little method why because the gosh elimination promise to give us our U and our U is not is not having on it diagonal one the G doesn't have one on the diagonal is the G S have diagonal on the U but but the U is equal to I so it's not really U it was 1 0 0 0 1 0 0 0 1 this does not qualify to be a U unfortunately which means that we can leverage on what we know i always want to teach by going progressive what you know we add on this is why missing a class is very dangerous don't see there a video so you can go and watch again just stay here spend a time and listen in put aside all your phones and all your gadgets beside and then pay attention okay so we going to build on on the previous knowledge because G promise us a U we stay in the U and rather make our L unity unity I mean our diagonal of our U unity so therefore it's best to adopt do little method than the CL method okay how do we use this to solve our problem don't forget I told you earlier on that to get our U we shall use our elimination process from the gosh elimination but how do we get L i told you earlier on that the mm will help us the multipliers the multipliers they are used to get that but how do we get our X so here we are which I'll not spend time going through again i spend time doing that in a very simplified manner here just some few steps to get it as compared this long process and this long process is what you have in your book anyway which I've simplified for you now okay so your first assignment is here to use the CLA rule go without pivoting which I've explained to you in today's class the go Jordan the LU I'm going to s the with you now then you can now say that you are good enough to continue from there compare your answers with the MATLAB I've done that with you anyway and we know so you can go and do this in MATLAB yourself and see your XY Z this assignment is due in our next meeting which is next week sorry next week Wednesday we'll think through whether we want to submit it on Sakai or submit it in the office before the class 12 p.m 12 noon before the class but whether to be in person submission or online submission we'll let you know we'll let you know okay so let's go back to solve the example using the LU and see if the answer we will get are the same of course we should expect to be the same based on what we now know in today's class okay so we continue so let's observe carefully what we got i have to go back i have to come back come back to this okay and let me write down okay i have it already so over here I know my U i know my U and my U is what I see here remember the U doesn't contain the B the B is not part of it okay and then my M1 my M1 is half so M1 is half my M2 is 3 / 2 2 is 3 / 2 and my M3 my M3 is 3.5 over - 0.5 - 0.5 okay which is nothing but a seven a seven so - 7 is the answer so this thing is same as -7 okay so now let's continue to look at how to use it i've now finished writing down let's go to our next page okay so here I'll document my U again u is equal to 2 3 1 without a B 0 - 0.5 - 0.5 without the B 0004 without the B this is our upper triangular matrix and our lower triangle matrix the rule says that build for yourself an identity an identity so 1 1 1 0 0 0 because we are saying that it must be a lower triangular matrix there must be a value here a value here and a value here the beauty is that we use M1 to elimate this guy we use M2 to eliminate and M3 to eliminate this what we have for ourself okay so therefore if I multiply this to our U we should get our A back so you observe this one this one will multiply this guy i'm showing some just try and pay attention this first row here this first row here this first row here or multiply the first oh it's this way rather don't forget LU and L U not the same as U very important so this row here multiply this so everything here multiply everything here which gives us a two everything here we multiply everything here that will give us nothing but something around 2 by m1 m1 * 2 1 * 0 0 * 0 I'll get 2 m1 and the value here is equal to whatever I get over here now pay attention carefully our m1 was nothing but a half M1 was nothing but a half so half * this is equal to 1 and don't forget our matrix A was 2 3 1 1 2 1 3 1 2 and we got this one coming out so therefore our L is equal to 1 0 0 half 1 0 3 / 2 - 7 1 is our error is our error so therefore how do you confirm that the answer we have here is operative let's now go use MATLAB to perform our modification so I share the following okay so we know what CLC means in our seminar class so U is equal to the following our u is equal to 2 3 1 follow 0 - 0.5 - 0.5 followed by 0 04 because we want to see we not suppress it so here we are and our L is equal to an identity with the following 1 0 0 and then you can actually use manipulations which you saw in our seminar session as well so m1 is half half 0 and then our m2 is 3 / 2 3 / 2 followed by m3 - 7 followed by 1 matrix so if I multiply L to U don't forget dur class we saw that there are two type of multiplication the matrix version and the element wise version so we want the matrix version is equal to let's see if indeed we are correct what do we observe we observe not the same answer and the argument is what has gone wrong what has gone wrong and that's what you and I will want to pay attention to okay we have M1 to be nothing but Okay let me try i think it should be negative value of our M the negation of the M negation of the M negation the M let me just confirm quickly if that's what is causing Okay yeah a moment I think I missed something so one negation one overation indication one over if it doesn't check why that is happening and then our original a was supposed to be or there's something really wrong with our values use oh sorry i've multiplied yet so L* something has gone wrong with our computation the T is have you observed anything funny then we can quickly observe together something has gone wrong in our L yes I think um let's look at the way we form the L again do you found the L or the L the L so the L I know our M1 was supposed to be a half our m2 was supposed to be let me see 3.5 over so -0.5 is a - 7 yeah go ahead i'm listening so from the um the original matrix we have um so for the L is the main the major diagonal is supposed to be exactly one one on the top zero and then the ones below the major diagonal is supposed to be the opposite direction so what opposite here means because I know here should be m1 m2 and m3 yes so I think there supposed to be negative m1 negative we have to negate it yeah which I did over here so this m1 used to be half or m1 was half right and then m_sub_2 here was 3 / 2 which gives us nothing but nothing but - 1.5 over here right we got 32 is 1.5 and of a minus symbol which is a seven 3.5 - 12.5 is -7 gives us this thing yes so we have half half which is - half here yes and then we have 3 / 2 - 1.5 here then -7 which is + 7 here no the actual thing is + 7 so it's supposed to be minus oh really yes i see then let's try and see if that's a part because but that is what we already done here so let's change our values it was half here so minus half 0.5 I a one and then a zero then semicolon we negate 1.5 to - 1.5 1.5 here followed by a 7 be negated to -7 and then followed by one if indeed this is correct then multiply it to u we should get our a back our a back if we still don't get the answer we have to pause it and continue and then I'll share the whatever went wrong in the calculation we will share with you on the main platform on the main platform so let's try for the last time we cannot spend all the time on this so A is equal to nothing but L * U L * you okay to you so we nearly got dead but as Yeah so the second one I saw supposed to be negative it's supposed to be positive we have one this one should be 1 0 0 should be what is supposed to be um positive 3 /2 positive on that's the one here this one you mean you mean this one if you want it okay so this simply means I wrote my M1 M2 wrongly on my paper here doesn't mean it oh okay doesn't mean it yeah so to the class as you can see the error was about transferring the data to my paper so let's try again for the last Fine i think there's something rather wrong this one gives us a wrong answer mhm okay so we'll get back to the class on the computation of the M but the answers are found in the M's M1 M2 M3 so to be sure that you're correct multiply your L back to your U if the A don't come out it simply means your U is wrong your U is wrong okay so take note of that as well okay so let's continue from there and some of this will be done again at the seminar sessions it is time to solve them again so again here is your first assignment for the semester okay let's continue with the second note for the semester okay so this is the next thing we are going to look at okay i hope you can see my screen if so give me a thumbs up and then we'll continue from there great thank you thank you so we continue and as usual all these slides are already on the platform for you to have access to we'll share them also on the on the Sakai to also go in there and then get it everything you need is available the video also also been uploaded immediately after class to go and check them out so try and then practice them numea methods require stud group it requires consistent practice to be able to catch up otherwise you'll be in trouble you'll be in trouble so take note of that as well okay good i think before I even move into this I am forced to most likely tell you something here instead before we proceed that is the following the MATLAB session how do we do LU in MATLAB in MATLAB okay I'm sure you can see MATLAB window okay so the function for doing L in MATLAB is called LU if you have no idea how LU works just type help L to tell you that LU is nothing but a factor a factorization method which takes on the A and gives you both L and U and it can also give you a pivoting rule if there was a pivoting being done to tell you so our A was this matrix oh no this not the A the A was supposed to be the following one sorry 2 3 1 followed by 1 2 1 follow by 3 1 2 this is my A the original one we're using so I just say square bracket L comm u is equal to LU is equal to LU the following or the following a I hit enter as you can see we have on a diagonal are the following this simply means that look at this guy carefully we have one here we have one there we have one here all it tells us is that a permutation has occurred in our matrix so how do you know our permutation you come here and add your P ideally it should have been one one in the diagonal 11 one diagonal okay and then for some reason you can see 0 01 which means there is an M which resulted in a zero in their case the matrix looks like this and again there could be some movement or some changes over here so hit enter so here we are the matrix was the following one here two one here one here one there and this was a passive pivoting the matrix given a P * A P * A should take the data that you're looking at so it can the A that was being used behind the scene so you observe you observe that the three has come here so the second column became the first column and then this guy remains as it is so what really happened since we cannot move columns columns can only move for complete pivoting but passing the row rather moves so instead the row three has moved to row one which became our 312 followed by the number 2 31 followed by the one to one the one to one we shall explain this further on later on to see how the P is being used the multiplier or the permutation matrix okay just by the way so we continue with our content okay so I pick my pen and then we sail straight to looking at what is next for us the next 20 minutes okay so here we are with a very important concept in our first day of class we spoke about triagonal matrix a matrix in which diagonal the subdiagonals are not zero they are not zero for such metrics you and I can solve it using the gshian process the gshian emission process but the danger is that you are wasting your time doing so therefore Thomas brought an algorithm called the Thomas algorithm which help us to solve a triagonal matrix without stress so instead of we going through all those processes and going through one by one don't forget is a triagonal matrix one element here one zero so x here x here x here x here the rest are zero these are trigonometries so you observe that all the zeros here have no effect on our data so we can now convert this guy into a new matrix called t and that t you observe that the diagonal is stronger than the rest so diagonal become the one in the middle diagonal then a subdiagonal comes here which is which is going to start from the following from here and then it will end somewhere here because there's no element here and then this also starts in the middle here or the end the super diagonal super diagonal so the the T algorithm says that there are easy ways of doing it based on the behavior of the gshian eination process and what is it so here we are tri diagonal all the major diagonals followed by the sub the super so end we have to transform our our A to a special matrix called the T so as to be able to solve for our X but you think you had a time to solve it manually with your hand going through gian elimination no problem but Thomas have given us something more more more relevant something more simple that make life much easier for us okay so here we are we will not go through this process and why why because of we knowing what is happening here by by sorry the gosh elimination process don't forget this what we are seeing what do you see you see them doing R2 minus the following we are doing R1 minus the following i've always told students that the order doesn't really matter but the signs will change so you can feel free and also do R2 minus the following this what I'll call the M1 i first multiply my M1 to my R and then multiply the final take out from this guide the following R2 what do you observe because A minus B not the same as B minus A there will be a sign a sign change to take note of this should explain to you why our determinant was min -4 but the computer give us four give us four okay now this guy is called the multiplier which again you know and this one came from the second element so what did you observe you observe that everyone will have only one direct element take out this into zero if you're going gosh elimination take out this under this into zero there's one under this guy take it out one under 44 take it out one under five so there's only one job to do the job is that we we already know that you you are zero so we not waste time on you what is left is just one item all these are zero zero zero there's just only one item to work with so therefore we know that our EM is nothing but A21 for example over A11 a32 over A 22 this will now mean that our J does not change but our I is reduced by one so therefore a 7 therefore a77 will give us nothing but a 87 if which means a7 must go to zero a32 must go to z a2 must go to zero in that order think like a programmer to make life easier for you if that's the case then simply means that our P M is equal to A I I and above becomes A I + 1 comma I if you're programming it a I + 1 comma I over A I I okay this is the motivation that we shall see for ourself okay now you observe over here they are not they are using I - 1 I is I + 1 so observe carefully mine was I I here and here become I + 1 I they using I - 1 I - one so therefore plus + one on this guy becomes I and this guy remains the same the same okay this is the formula we are going to use to create our new diagonal why the case the case is that only our diagonal elements will change and all the guys below will be zero so we don't care all we care is the change in our in our diagonal and that's what we see here tell us how the diagram should look like if you observe carefully it's nothing but the element on the pivot row minus the permutation that happened at that level so this is what you must keep in memory about the first step in the Thomas algorithm converting our diagonals to a new form and our B must also change the B the first one is written as the following B2 minus the following the B okay B2 is written as this if I want to write it in a programming form it becomes B I = B I so if I am I here it also be I which also means that minus into bracket a I comma I - one over here all over a I I b I - one B I - one will be the answer over here but what if the book want to use I - one here that is also allowed in that case you must note that we shall use a different representation over here to get in oh here becomes IUS one sorry so it's I - one because it's one and I - one and this will not confform to the guy here don't forget this is how augmentation actually works if I say a augment b it simply means that whatever you do to a must happen to b so here we are so this is the same as what I wrote earlier on as 2 x maybe 2 4 5 3 2 4 7 2 this is the B part you are seeing here so be it comes the element here minus it permutation elements okay this is just about the go elimination not part of it algorithm so let's now go into looking at how it works we must translate our matrix T to a new matrix that new matrix is written as follow the diagonal element which I told you earlier on followed by the subdagonal subdagonal which is shorter this way and the super diagonal which is shorter that way but the argument here is that this is just a representation of our triagonal matrix so what does And let's see how that really works okay the B element unfortunately are not being kept here so they are being treated differently however the same process holds so the B1 element remains B1 but any other B goes through this process or this formula this formula so the B2 the B3 the B4 to BN they go through this formula the arguments here will be where from this value this value comes from the third columns so I3 I3 I3 I3 I3 and these guys are called I1 I1 I1 I1 so take note of that so the I1's are the ones we see here the I3 are the ones we see here if the value of I1 and I3 does not exist then simply means we are using the original values in the A or in the T in the T okay so after knowing our B and knowing our new A how do we find our solution and the formula is the one we see here so our last element don't forget the back substitution is being used starting from the bottom XN is equal to the original BN which is found in the B matrix or the new B matrix divided by a given I2 and I2 here refers to the last element in a diagonal element and subsequent ones are obtained through the following so in programming this is a for loop and a for loop is something which I treat in the next seminar in terms of MATLAB how do you observe you observe that the new metrics here are destroyed the behavior of pivot term the behavior of pivot term have been destroyed because we have collapsed the whole matrix into just three columns into just three columns this is something that you have to observe unfortunately time can permit us to look at an example now but in our next week class an example will help us so whilst waiting for an example for next week let's now discuss some pitfalls of the method of elimination that's the goshian elimination the go Jordan go Jordan method these two guys and just today as well the one for the triagonal matrix in fact don't forget this is a method Because the trigonometric is being reduced using one of this method and the to algorithm depends on this guy the to algorithm depends on this guy for the answer so what are the pitfalls the first pit for is division by zero division by zero what happens if your pivot is zero second thing is the roundoff error what happens if you are working with positions okay so here we are the issue with the issue of the run of error can come in and that's more dangerous for us and once you keep on it over time the error compounds for a very long time it gets so big that you can't control it again and two the ill conditioned system we say you are ill if and only if I perturb you small a small change a small change in the value of b the value of a results in a very big change in our x what does it mean a x= b let's assume that a is 2 1 4 x Y B is 1 2 Let's assume that as a soling for this guy you got X to be one and then Y to be say five then I now change the A to 2.5 1 4.01 01 my new a is now this time x y to get one and two and now the new answer I'm getting is 1 = 100 y = -200 just a small change here and the value you're getting is far away from what we had we say you are ill conditioned you are air conditioned one expect that oh that Small change over here should have resulted in say x= maybe 0.9 and y= say 5.2 this is reasonable when this happens we say that you are well conditioned you are well conditioned so how do we avoid the issue of runoff and ill systems this is where we used a method called I treat improvement the first one shall look at is called a Jacobi second is called a goal and the S these are the three methods we shall be looking at hopefully in our next meeting but before I do that I'll first take you through how to how to compute what makes you ill and what makes you well the condition number the condition number so our time is up so therefore see you hopefully next week for us to continue from there have a wonderful stage and expect a video to be uploaded to your portal right after the class see you hopefully next week goodbye