 Good, that's part two, introduction to matrices. What we're going to do here is solve linear systems using gas Jordan elimination, Jordan elimination. So that's both exciting and ultimately boring. Now, for most of you, if you take a first course in linear algebra, it's probably going to start with solving linear systems or systems of linear equations to use the longer term. And boy, oh boy, is that boring stuff. Well, it's exciting in the first hand. But in the end, it's never something that you're going to do by hand. You're going to ask a computer to do it. And it's useful because to gain a deeper understanding of the mathematical properties of a matrix as a mathematical object, you need to be able to do gas Jordan elimination, but type the values into computer and spits it out and end of story. But yeah, you're probably going to have to pass a test on exam, and you've got to do these. And listen, there's no substitution for sitting down and doing a bunch of these by hand or standing up on a board, whatever takes your fancy, how you do your exercises. But yeah, exercise here is the key. You've got to do these, a bunch of these. And they frustrate you because the tiniest little arithmetical error, which is very easy to make, and says nothing about your intelligence or your abilities. We all make little arithmetical errors. And then the whole thing goes pear-shaped. And then you have to do the whole thing again. It's just laborious and long. And I'm going to show you how to do it quick and easy using Julia. So if you're doing this for reals, you're going to just use the code. If you're practicing these for an exam or test or whatever the situation is, at least you've got Julia here or Python or the Wolfram language or whatever, just to check your work. And that's the beauty of what I'm trying to teach you here and of course. And our instance here, we're using what is a beautiful language called Julia. So in the Jupyter Network, as always, all these files, of course, on GitHub and links in the description down below, this is part two of this. I think it's going to be about nine parts just on matrices. Whereas the first part was just on vectors and I did that all, just in one go. Just this, what I've created here for matrices, that's just way too long for one video. So I'm breaking it up this time round. So to use Julia, we're going to extend its capabilities by loading some packages that excellent, wonderful, salt of the earth type people who sit down and use their time to develop open source packages. These are the saints and the heroes of the modern world. And we've got to thank them for their work and support them in any way that we can. And so we can use some of these packages. Two ones plots and the others, one's called row echelon form. But to do that, it lives inside of an environment that I created specifically for this course. And if I remember, I'll put a link in the description down below if you want to know how to set up an environment because every project that you work on in Julia just created a separate environment for it. Don't ever work in your base Julia installation. If that makes no sense, as I said, if I remember I'll put the link in the description down below or just search my videos, you'll find one about environments inside of Julia. And then also how to use Pluto notebooks. I hope I don't repeat all of this throughout these nine or so videos for this one. Anyway, I'm creating a computer variable there called file and I'm assigning that, remember equals is not equals as a mathematics, it's an assignment operator. And I'm assigning whatever's to the right of it to whatever's to its left. So on the left is a computer variable name, a little name that you secure a piece of memory in your computer's, a little space in your computer's memory. And you call it something so that you can retrieve that information in your computer's RAM. And what I'm assigning to that is a string object and that string is a reference to a file on my internal drive here on this Mac. And it does see the whole address to that and what we're interested in is the project.toml file that contains together with a manifest.toml file information about the environment, this Julia environment. If it makes no sense, as I say, search my YouTube channel or check the links below. So from that we're gonna import the PKG, the Julia package manager. And in that package manager, we're gonna use the activate file. So we're gonna activate this environment. So we're just passing this file, the string to this file, to this functions and argument. And then inside of this environment, I've got at least these three packages, linear algebra, well that's built into Julia when you install it. Then plots which I've installed and then the row echelon, row echelon package, really neat little package to do a gas Jordan elimination for us. And you'll see gas Jordan, my pronunciation. Okay, and because we're using plots, plots is gonna create some very nice looking plots for us. And my personal preference is for the plotly back end search for plotly on the internet. It's a wonderful ecosystem for developing interactive plotting. That's the one, but plots, this plots function, the plots package, it supports a lot of back ends. The back end is what actually generates the plot here on your browser. So I'm gonna use the plotly back end. So I'm just calling plotly open close parentheses after importing the plots function at the plots library. So we can use the plotly function there by GR or there's a bunch of other back ends that it uses to. So solving linear systems or systems of linear equations. And this is what a system in equation one is a system of linear equations. So you see there are three equations and there's three unknowns. So instead of X, Y and Z, I've just used X sub one, X sub two, X sub three doesn't matter. Three equations, three unknowns. And the thing about a linear system, what makes it a system is there are values for X one, X two and X three that solve all three of those or how many ever you have simultaneously. So I'm not just looking for values for these three variables to solve one of them. The same set of variables must solve all three at one time. So here's an example of one of the solutions. We see X one can be three, X two can be two and X three can be two as well. So if I plug those in, I see it solves five, four, 10 on the right hand side. It solves all three of them in one go. So that's what we're looking for. And then by the by, I think I do it in this courses. If you don't have enough exercise material, just generate your own. So you have your coefficients, the one, the three, the negative two, the two, the negative two and the one and the two, two, zero. So do that, generate some random coefficients and then plug in a solution that you're looking for and then get the right hand side answers and then just hide them with the X one, X two and X three or whatever the case may be and just try to get back to these values three, two, two. See if you can find them again. So you can just generate your own homework basically or your own exercises. You don't need the books ones. But what are we talking about here? We've got these linear systems. We're all familiar with algebra and this is at school how you taught to write these linear equations. Okay, if there's only two equations, you are gonna write Y equals three plus X. But usually in linear algebra, we bring them all to the one side and leave the constant on the right hand side. So Y equals X plus two will become minus X plus Y equals two basically. We bring them all up to the one side but that's algebra then equation one. That's what I'm trying to say. But what we're gonna do in linear algebra we're going to just rewrite those three equations in a very succinct way. And then a succinct way of writing it and working with it is to write it as a matrix. So just a little reminder because everything boils down to vectors. Remember what a vector is. Here we see the vector two, three. Right up there, the X value is two, the Y value is three and you can see this is a plotly generated one because it's all interactive when I hover over it or I can take things away and I can zoom in and I can go back home to see the whole thing. You'll see later on we're gonna use plotly. So this is not a course on how to generate plots. I do have videos out on the use of plotly for various languages because you can use it in Python other languages as well. This is how to generate that. That's not all that about it. Just wanted to remind you of what a vector is. So, you know, it's this values two comma three in this instance. So from zero comma zero, it's always a position of vector. So it starts at the tail of zero comma zero and goes to the point that you're doing because rewriting this equation one towards the linear algebra thing. If you think about what's happening here is just this equation three. I've taken out the coefficients. Look there, one, two, two, three, negative two, two, negative two, one, zero. And there they are, one, two, two, three, negative two, two, negative two, one, zero. And on the right hand side, five, four, 10. And I've written them in a different way. And the way that we've written them here is you'll notice that they're four column vectors here. And that's why we started with vectors because everything comes back to vectors. So you notice that they're these three column vectors. Now, I've just got a, we're going to do matrix algebra, how to do algebra with matrices. That's coming, but as a sneak peek, that's why I think I told you before that in the previous video that there's some things you need to know to work with this, but to need this, you need to know that. There's kind of chicken and egg thing going on here. So before we get to that proper, I just want to tell you, and actually it is a reminder, I think we spoke about it in the, definitely spoke about it in the video on vectors, the first video in the series. A scalar times a vector, just means you take that scalar and you multiply it by each one of the elements in the vector. And so in equation four, you see what matrix vector, scalar vector multiplications all about. And that's exactly what we have here. Scalar times a vector. And if I multiply this first vector, each element by x one, I have one times x sub one, two times x sub one, three times, two times x sub one. And the same there. So if I multiply all these out, I'm actually just left with that. So then when you see these for the first time, it's nothing special, nothing special is going on here. We're just rewriting things in a different language basically. We're just using the language of, instead of algebra, we're using the language of linear algebra. So, and now we see something very beautiful come out here. I mean, this is profound if you think about it. The system of linear equations, a linear system is a combination of vectors. That's profound. A linear system, if I have a bunch of equations here that I need to solve all at once, is actually a linear combination, linear combination, remember that term. I'm just summing up constant multiples of vectors to reach another vector. Yeah, it's quite interesting. That's profound. That's what the crux of this whole matter is. So I've got problem one here for you. Create a column vector and multiply it with a scalar, just in a little bit of exercise again. So what we've done here is create a computer variable called vector underscore one, and we are assigning to that whatever's on the right-hand side. And on the right-hand side is an array. I've just used a different way of creating an array here. I'm using the reshape function. And the reshape function takes in this instance three arguments. The first argument is an array of values, one comma two comma three, and I'm saying reshape this as something that has three rows and a single column. And summing with a single column, that's a column vector. So there's my column vector, three times one column vector of 64 bit integers. And in this instance, it said multiplied by any scalar. So I've multiplied it by three years. So the scalar three times the vector one, and that just each element is multiplied by three. So from one to three, we go to three, six, nine. One times three is three, two times three is six, three times three is nine. Simple as that, or this is something I want to show you. So in the last step of this language transformation or translation, I'm translating things from the language of algebra into the language of linear algebra, which basically means the notation, is this is the last way, the last step. Now we're not gonna work with this form just yet, it's coming. But what I have here, instead of writing it this way, which makes intuitive sense now, I'm hoping, is this sort of weird way. I have a matrix of only the coefficients, then a vector of the unknowns, and that equals the vector of the right-hand sides. And in matrix form, this is A, this is my matrix A, this bold. So if we look at the code here, the large tick code, it's backslash math BF, stands for math boldface B, and there's a math boldface X. So it doesn't print out well on the screen here in Pluto, but that X is actually in bold. So if you use Microsoft Word and you highlight something and you hit the B, little button to turn it bold, like this equation one is up here is bold and matrix of coefficients is bold. So what we have here is so that X and B must be bold, it just doesn't print out so nice and boldly here in large tick, but anyway, maybe they'll change it. AX equals B. So I have a matrix of coefficients, a vector of unknowns, and the vector of the right-hand side. And I can go even one step further and create this thing called an augmented matrix. Well, let's go in here and let me show you. So it says the augmented matrix. Let's make that bold by putting two underscores before and after. And if we run that cell, it'll take a while to run because they were all pre-rendered. Now augmented matrix is in bold. Okay, because I put matrix of coefficients there. So that's the matrix of coefficients A there, but this is the matrix, the augmented matrix. And what we've done here is we just dropped all superfluous writing. I don't write X sub ones, X sub twos anymore. I just have the matrix of coefficients on the left-hand side here, these three by three here and on the right here. So this becomes a three times four matrix and that's the augmented matrix where I include the coefficients and the right-hand side. And that's the one that we're gonna work with. Now that's a proper matrix and we're going to do something to this matrix to solve our linear system. We're gonna get back to those results. These ones up here were there three for X one, two for X two, two for X three. We're gonna get back to them by working on this augmented matrix. So you take your linear system, doesn't matter how many rows, how many equations, how many unknowns you write it as an augmented matrix. And I hope you can clearly see the coefficients and the right-hand side. Some of your lectures might even want you to draw, I hope you can see the pointer, the mouse pointer on the screen, a little line down here to separate these two from each other, because they really want you to understand that on the left-hand side is your coefficients and this last vector here, column vector here, is the right-hand side. But you needn't do that. That's, you know, as long as you're, I mean, of course you've got a brain between your ears, you understand what's going on here, but you know, if you're forced to do it, just do it. And what we're gonna do is we're going to do these three things. We're gonna, what we call elementary row operations. Now the column operations as well, and they work exactly the same, but the easiest way to understand this and the way that you're gonna be introduced to it, most probably is to do these row operations. Now what I wanna show you just, if you scroll right down to the bottom, so we're not gonna discuss this here, but I've put this little appendix here at the bottom. And what I'm trying to do with this appendix is to show you that what you did in algebra class in school was exactly elementary row operations. You just kept it in the notation of algebra. You kept it in algebra and you tried to isolate one of the unknowns so that you can back substitute. But what you did was really what we call elementary row operations. So all this stuff you did in algebra, the only thing that we're gonna do here is we're just writing it in a different way so it's shorter to write. And we're going to do these algebraic things just in a slightly different way because it's easier because we're writing things in a more succinct way. But all you're doing in this guys is the good old fashioned algebraic manipulation in solving more than one unknown and more than one equation. That's all you're doing. There's no difference. There's no magic going on here. There's nothing untoward going on here or some weird thing. That we're writing things in a different way. That's all. So read that appendix there. If you want some intuition or just this proper feeling of moving from having done it in school algebra form to doing it in the linear algebra form. So the three elementary row operations that we have, that's what we call them, elementary row operations are interchanging rows, multiplying a row by a constant and adding a constant multiple of one row to another. So that first one is very easy. I mean if you write a bunch of equations in a system you can write them in any order and you can just swap them around. That doesn't, you know, that's not gonna change anything. The order in which you write those three equations there that doesn't matter. Multiply a row by a constant. Now all you're doing is if you say multiply a row by a constant, all that is is you're just multiplying both sides of an equation by a constant. If you have an equation y equals x plus two and you multiply both sides by three it becomes three y equals three x plus six. What you do to the left-hand side, you do to the right-hand side and that's what it means. Multiply a row by a constant. So if you've written it in this very succinct form of equation six, this augmented matrix, if I take any one row here and I multiply throughout by three all you've done is you've taken that single equation and you multiply both sides by three. That equation which is now represented by a row, hence we call it elementary row operation and the row operation is multiply a row by a constant. Okay, and then the last one is a bit more, it's probably a bit more difficult. You're adding a constant multiple of a row to another and that I explain in the penics also I think quite thoroughly and think about it. What does an equation mean? Equation means the left-hand side equals the right-hand side. So again if you have your equation y equals x plus two and you multiply the left-hand side by three you also multiply the right-hand side by three. If you added the three to the left-hand side you add three to the right-hand side. Okay, then the thing is still in equation. It's still equal on both sides. As long as you do to the one side what you do to the other side. Now if you have another equation of course the left-hand side looks slightly different from the right-hand side, but they're both equal. So I can add those two different things which are actually still the same thing because they're part of an equation, left-hand side, right-hand side. I can add it separately to two sides of another equation but because those two things are exactly the same they're like plus three on one side, plus three on the other side even though the side has x plus three and the other side has four on it, whatever they still equal to each other. So I can take the left-hand side of one and add it to the left-hand side of the other and the right-hand side of the one to the right-hand side of the other. I have not changed the equation at all because I'm adding to both sides something that is equal to each other anyway. So I hope that made a bit of sense. So add a constant multiple of one row to a constant multiple of another row. So what I'm saying is we're going to take one of the rows and we're going to multiply throughout by a constant so that means I'm doing to the left-hand side is what I'm doing to the right-hand side and then I'm going to add it to another row. So let's go through an example and it's going to make sense. Where are we going to end up? What we want ultimately, so I'm just going to show you what we ultimately want. We want this sort of thing. That is a matrix in what is called reduced row echelon form. So believe you me, we're going to go from this one using these three elementary row operations to this one. We have these, look at it, we have this sort of pyramid scheme going on here with ones going down this diagonal. Below every leading, and these are called leading ones or pivots, we're going to call them pivots. Below them is all zeros and above them is all zeros. But because remember these are coefficients. And what this, so let's take that first row for instance, that's going to read one times x1 plus zero times x2 plus zero times x sub three equals x sub one. So we're going to have actual values here and that means we can just read it off. That's going to be the three solutions here on the right-hand side. And what I've done is I've eliminated in school algebra, that's what you try to do. You try to eliminate one of the variables so that you have it isolated so that you can do back substitution. So this is the ultimate formula that we're aiming for. So here in equation eight now, this is going to be slightly difficult. I mean, it's probably best to write this on a board or by hand and record that. And if you really want me to do that or do a bunch of them, I'll make it. I mean, it's actually fun. I mean, as I say, it's boring and fun at the same time. One of those weird things to do these. And I'll make some of those videos. So this is purely for your reference. I'm going to go through it and I hope just it translates sort of what's going on the screen here and it being the static. This is really more for reading, but I'm going to go through it. Anyway, so let's look at this one. I'm going to jump back and forth. Look at this first one. So what we're trying to do, you see that leading one there? Remember, one of the things is we can just rewrite the three rows in any order we want. But one of the ones we've got a leading one there, so quite happy. I'm going to drop some tricks, tip some tricks here on you, the most important one that you can ever, okay, let me start here. There's not only one way to do this. There are many roads leading to Rome when it comes to elementary row operations. You can do this in so many ways. And you're still going to end up, if you don't do a little simple, a little arithmetical error along the way, let's assume that you don't. You're going to land up at the same solution. So there are infinitely many ways to do this. One little tip is never, never do fractions right until the end, because one of your answers might be fraction. But then introduce fractions, because that just makes it 10 times more likely, well, that's just a thumbs up value, more likely to make an arithmetical error. So don't do that, just remember that tip, whenever you work with these, work with integers, never, ever, delve down while you're doing this to the level of rationals, fractions. Okay, so I see this leading one, and remember what I want, I want zeros below this. So I've got to get rid of that two, and I've got to get rid of that two. In the parlance of algebra, I'm trying to isolate for each one of these equations a single variable, so that I can just read off the answer on the right-hand side, because of the coefficients of the other two are zero, then they're out the game, you know? That's what we're trying to do, and that's why we're trying to get these two zeroes. So what I can do, one thing I can do is what I've done in equation eight. That first row, we've multiplied out by negative two. So let's look at it here. I hope you can see the mouse, otherwise this is gonna be weird. So if I multiply this by negative two, one times negative two is negative two. Three times negative two is negative six. Negative two times negative two is positive four. Five times negative two is negative 10, and that's what we have there. So I've multiplied that first row out by negative two. So in effect, remember, this is just short-hand notation for that original linear system, so I'm just a simpler way of writing this. So I've multiplied the left-hand side of the equation, these first three coefficients by negative two, and I've multiplied the right-hand side by negative two, and that's what I'm left with, negative two, negative six, four, and 10. So I've done an elementary row operation. I've multiplied one of my rows out by constant. Now in the next step, what I'm gonna do is I'm gonna add a constant multiple of the one row, which we've just done, a constant multiple, to one of the other rows. And that's exactly what we're doing here, because if I take row one, remember these first three values, that's the left-hand side, and as I said, that's why some lecturers want you to draw a line there to mind you of that. As I said, you've got a brain, you understand what's going on. So this is the left-hand side, and that's why I said these two things are exactly still the same. The negative two, negative six, four, equals the negative 10. That's an equation still, and it still has a left-hand side and right-hand side, and they're the same, it's an equation. So if I take these first three ones on the left-hand side and I add it to the left-hand side of another equation, and I take the right-hand side and add that to the right-hand side of another equation, that equation to which I'm doing these things, that's still legit, because I've done to the left-hand side what I do to the right-hand side. I've added equal, equal values to both sides, even though they're written differently. So if I do that, remember, the first coefficient is x1. So if I have negative 2x1 plus 2x1, I can add those two, remember this is algebra here. So I can say 3x plus 3x, I can add the x's because the 3x plus 3x equals 6x because you can add variables or unknowns that way. So they're neatly written in nice columns here. So negative 2 plus 2, now, before I go there. C row number one, I've just jumped back to the original form of it. So even though I've changed it here in equation two, so what I usually do in paper is I would write this negative 2, negative 6, 4, negative 10 on the side here and keep the 1, 3, negative 2, 5 in the original form. You can also think of between these two steps, equation eight and equation nine here, I've multiplied row one by negative of a half. If I multiply row one by negative of a half, I'm back to 1, 3, negative 2, 5 as it was originally. So I'm just doing two things in one go here because I'm lazy that way. Okay, and you're gonna get like, do a bunch of these, when you do enough of these, you're just gonna do a lot of things on each step. So aim for that, you'll naturally end there anyway. And of course, some of you are so clever you're gonna do that right off the bat. So negative 2 plus 2, I can do that because they're both x sub one. That leaves me with a zero. The negative 6 and negative 2, that leaves me with a negative 8. So I'm just jumping between equation eight and nine here. The four and the one gives me five and the negative 10 plus four gives me negative six. So I've added the second row represents an equation with three on the left-hand side and one element on the right-hand side. And I've added to its left-hand side exactly the same that I'm doing to its right-hand side even though they're different things. But the equation one year, row one, they're still in equation. Both sides are the same thing. So it's all legit, legitimate. So now I'm also going to do that to row three in one step again because I'm lazy. So negative two and two is zero. Negative six and two is negative four. Four and zero is four. Negative 10 and 10 is zero. So look, I mean, we're getting there at least now under this leading one, I've got zero zeros. So in equation two, row two and row three here, in equation nine, I've just left with two unknowns. I've eliminated x1 from both of those. Okay, let's try and eliminate this negative four here. And as I say, that's why there's many ways to go about this. You can do these in any orders. What we're trying to always do though is work from the top to the bottom. Always work from the top to the bottom and eventually you'll see we get to the bottom and then we work our way back up. So what we're trying to do is to get these zeros underneath. So I'm very fortunate in this one and of course I designed it this way so it's easy. Is the zeros in one go underneath? So the next one will be this negative eight and it eventually must turn into a one but we're not gonna do that now otherwise we're gonna deal with fractions, keep these whole numbers. I've gotta make this negative four. I've gotta turn that into a zero. And one way I can very quickly see is if I make this an eight, I can add the second row to this third row and negative eight plus positive eight is gonna leave me with a zero. So to get this negative four into a positive eight, what do I do? I multiply by negative two. If I take this row three and I multiply by negative two, I'm left with zero, eight, negative eight, zero. And that's exactly what we have here. And now I'm going to add row two to row three. Oh, now I've got to tell you this. I like to do addition and many of your lectures are going to try to make you do subtraction. So they're gonna say subtract one row from another row. And I think that makes it needlessly difficult. I didn't like that at all. That's just, you know, just increases your likelihood of, as far as I'm concerned or for me, let's just be very mathematical about this. There's one example for whom it makes it more difficult. I like the addition, but just watch out. So I'll make you rather do subtraction. I like that. So if I take the second one and add it to the third now, I have zero and zero is zero. Negative eight and eight is zero. Five and negative eight is negative three and zero and negative six, negative six and zero is negative six. And there we go. I have under this leading one, I've got all zeros and this negative eight is not a one yet, but at least under that is a zero. And look at row number three there. Boy, oh boy, we've eliminated two unknowns. We've only got a single unknown left. And what we can obviously just do there is multiply that by negative one over three. If I take row three and I multiply by negative one over three, I'm left with this, zero, zero, negative three divided by negative three is one, negative three divided by negative three is two. And I can need a solution here, my first solution, because it says zero times it's except one plus zero times except two plus one times except three equals two. In other words, except three equals two. I've already got one solution. And remember how we designed this thing? I showed you one of the solutions before and two, what's one of the, is the solution. So if I eliminated things by getting towards this reduced row echelon form, and what we actually have here, it's just called row echelon form. So row echelon means I've got starting at this position one, one. Now I can go down a diagonal there and I'll have values there that needn't all be one, but below all of those pivots. So that one is a pivot, negative eight is a pivot, one is a pivot, below each of them, of course this last one doesn't have anything below it, but below the negative eight there's a zero, below the one there's a zero, zero. This is called row echelon form, and the process that we followed through the use of these elementary row operations is called gas elimination. It's called gas elimination to get it to this form. And now that you have a value, you can actually just back substitute because you know now what except three is you can jump back to the world of algebra, but that's not what we're about. We're gonna continue with the linear algebra thing. And as I said, we're gonna move back up and the way to move back up is to start getting zeros above these pivots. Now that first one doesn't have a equation above it, so that's not of concern, but we're going to work our way in reverse back up. So in reverse meaning this leading one here, I want to make that five is zero and that negative two is zero. So how can we make that five is zero? Well, we can take this row number three and we can multiply it by negative five. And then I'll get enough written that you have to use zero, zero, negative five, 10, which I'm now going to add to row number two. So there we go. That zero plus this zero is zero, negative eight plus zero is still negative eight. The five plus the negative five is zero and the negative six plus negative 10 is negative 16. So I've got a zero on top of it there. And I can also now quickly see that row two is looking very promising because I've eliminated both x one and x sub three. And if I multiply this by negative one over eight, negative an eighth, I get this, zero, one, zero, two. And that's very beautiful because now I know x sub two is equal to two. Zero times x sub one plus x sub two plus zero times x sub three equals two means x sub two equals two. That's a thing of beauty. And what we need to do now is to get rid of the other value on top of this last pivot, that negative two. And I think you know how to do that. We're going to take, again, row three, we're going to multiply it out by two, which means we get zero, zero, two, four. That is zero, zero, two, four. And we're going to add that to row number one. So one plus zero is one. Three times zero is three. Three plus zero is three. Negative two plus positive two is zero and five plus four is nine. So there we go. We have a zero above it now. But we've still got these two unknowns, x sub one and x sub two and row number one. So now we move to the next pivot up. We're working our way back up. And above it, we need a zero as well. And I think you know how to do that. We're going to take this row two and multiply it out by negative three to get zero, negative three, zero, negative six. And we add that to row one. So one plus zero is one. Negative three plus positive three is zero. Zero plus zero is zero. And negative six plus nine is three. And lo and behold, I told you what we're going to aim for. We have this reduced row echelon form. And on the right hand side here, this last column vector, and we're going to get to, it's actually just four column vectors, but that's a bit later. What we have there is our solution. X sub one is three. X sub two is two. X sub one is two. X sub three is two. And I'm just going to go in reverse because what we have now here is a constant multiple of a column vector plus a constant multiple of another column vector plus a constant multiple of a third column vector equals the solution. And that's what we have here. If we plugged in X sub one is three and X sub two is two and X sub three is two and we do that. We do the column, we do the scalar vector multiplication and we know how to add three vectors we are going to get to three, two, two. And there's something very deep going on here which we won't get to now but I'm pretty sure you're going to know what I'm talking about. Anyway, we'll get to it proper. So I have this constant multiple of these three vectors giving me the solution vector and that's exactly what we were after. Three, two, two is the solution that I showed you above. So we've done the hard work now as I said sit on your behind stand in front of your board whatever takes your fancy whatever's comfortable for you where you do all these just create your own. Show you how easy it is to create them and just solve them. You've got to practice this over and over and what now comes the fun part in what I would call more in the modern world's reality not doing it pen and paper but just writing some code. So in the row echelon package.jl package there's a function called RREF reduced row echelon form is what it stands for and we just pass the matrix. Now I showed you how to create a matrix as an array. We pass it to the function RREF and it spits it out there. We see a reduced row echelon form and on the right hand side we see the solutions X1 is three X2 is two and X3 is two as well. So it's the real way we do it by using just a line of computer code but if you still have to pass your test and exams you just want to check your work. It's just as simple as that. Now though, just do a bunch of them get familiar with them and then I'll pass your test and your exam and then from there and it's all computer code. Not going to do this by hand again. I want to show you some interesting stuff though. We had a system, a linear system, a system of linear equations and three equations and three unknowns. That made things very easy. Let's add a fourth equation and see what happens because this is the source of all confusion here as if you have more unknowns and then equations or less unknowns and then equations. That's where all the problems come in. So now I'm just going to add another one X1 minus X2 plus two times X3 is five and that three to two is still a solution to this one. So it's still part of this linear system but now I've got four equations and three unknowns. If you do Gauss-Jordan elimination on that and instead of doing it with a pencil and paper or chalkboard and chalkboard or whatever, it takes your fancy as I say. If I do that, this is what I'm going to end up with. This last row is all zeros because it's redundant. It didn't add anything. I had three unknowns in a proper system and I'm just going to use the word in quotation marks here, the proper and the proper system. If I've got three equations, three unknowns, I only need three equations to solve the system and that fourth one is now redundant. It hasn't added anything. And if you do Gauss-Jordan elimination until a reduced row echelon form, you're going to get all zeros in that extra one, the one that doesn't add anything. So just remember that. So let's just delve a little bit deeper into this idea of more equations than unknown or the other way around. So what you, you know, let's start and for simplicity's sake, I'm going to start, I'm going to stick to two equations and two unknowns because that just makes my life easier. And again, as I say, I'm lazy that way. And I'm going to start with how you see it at school. You're going to see y equals ax plus b and y equals cx plus d. Remember, in any algebra, we bring all the equation, all the unknowns on one side, so that's going to come, become ax minus y equals negative b and as I write cx minus y equals minus d and we write the coefficients as an augmented matrix. So the a negative one, negative b, c negative one, negative d. So just remember that little equation because in your test and exam, you're probably going to get this as, you know, school algebra equations. You've got to sort of transform that into all the unknowns on one side and from that, you're going to create this augmented matrix. And so if you just keep this little equation 18 year in mind, you won't ever make a mistake. So let's do in problem four. So what we see in problem four here is two equations and two unknowns and I've already bought them all to one side, but you do realize that that first one is just y equals x because if I take the two x to the other side, it becomes negative two y equals negative two x and divide by or multiply by negative half, it becomes y equals x. So that's just a straight line y equals x and you see the second one there. If it is two equations there and two unknowns, remember an equation with two unknowns, that's a straight line here. We're dealing with linear and linear algebra, meaning that we're not talking about x squared. We're not talking about x times y or the sine of x and the log of y, you know, these are linear equations. So there we do, I've drawn the two of them here with some code and you can look at the code there. But if I have two equations and two unknowns and they both, you know, the two unknowns meaning it's straight lines. If the three equations we're talking about planes in three dimensional space, but as I said I'm gonna keep it easy, they intersect some way and where they intersect is the solution to the linear system because I've got two values, you know, a value for x and a value for y that solves both of those together. That's what it means. So I want you to have that intuitive understanding about these linear systems as well. It's lines or planes or hyperplanes if we go to higher dimensions that intersect some way and if they intersect at a point, that point which is actually a vector if you think about it because I can go from 0.0 to that solution point and there's a vector pointing there. That's also, again, everything boils down to vectors and we'll get to that as well. So if I have a linear system and it intersects like this, remembering that the physical representation of my linear system is just this graph, then I'm going to get, again, I'm gonna call this a proper one because I'm gonna get a single solution. And that's the solution for this linear system. So if I write that as an augmented matrix that negative two, the two x plus negative two y equals zero, there's my right here. I'm doing a row reduced echelon form of that. And I see that I end up with one, one, zero is above and below it. So that's reduced to our echelon form and I can read my solution on the right-hand side, one, one. So x equals one, y equals one, it's a solution to that. And the reason why we have this one specific solution is because this linear system represented two lines that have a single point of intersection. So let's look at problem number five here. I have a linear system again, x plus y equals two and two x plus two y equals four. And if you're very quick, you can see the second one is just a constant multiple of the first. So what they really are, if I plot them, is two lines that are coincident upon each other. And if they coincident upon each other, you can see both of them there. You can take the one away by clicking on it, then just the blue one is there. You can take the blue one away as well, there's nothing there. So add the blue one and then let's add the red one again. They're right on top of each other because in disguise that's the same equation they just written twice. But this linear system has these two equations and later on we'll see is they're not independent of each other. One is a constant multiple of these other. But what you can clearly see from the graph of this is we have infinitely many solutions. There are infinitely many x's and y's that I can plug into the system that will solve the system because the two lines are coincident. No matter what x I choose, there's going to be a y that solves the system. So in the end, there's going to be infinite many solutions. It's going to go off to positive and negative infinity on both axes. And if I do this, gas Jordan elimination, this is what you're going to end up with. Again, this last one being all zeros because it was redundant. And on the first one, we can read off the fact that this is a straight line because it says x plus y equals 2 or y equals negative x plus 2. And that means whatever x I plug in, I'm going to get a y indicating the fact that there's infinitely many solutions. And then here in problem 6 is the fact that I have two parallel lines. So this is a linear system where the lines never intersect. We're talking of cladian space here, nothing special. And there's no solution to this. They never intersect. So what would that look like if we do gas Jordan elimination using elementary row operations? What is that going to look like? Well, it becomes nonsensical because look at the reducer echelon form here using the RREF function. I shouldn't hide it there. RREF of this augmented matrix. You see that this second row says 0 times x sub 1. I've used x and y. So let's stick to that. 0 times x plus 0 times y gives me a non-zero number. And that's nonsense. I mean, if you add two things that you've multiplied by 0, they both be 0 and 0 plus 0 is 0. So the right-hand side can't be a non-zero value. That is nonsensical. And that tells you that this system has no solutions. There's no solutions to the system. It's an inconsistent linear system is what we call it. OK, so go off, do good work, create a bunch of your own, or get them out of your textbook. And if your textbook doesn't show you all the solutions, create your own because then you know what the solutions are. And then, more importantly, and much more fun, come check your results just using RREF. It's as simple as that. But I want you to have this deeper into it. Start developing this deeper intuition of what's going on here. Many of you are going to start linear algebra by looking at solving linear systems. They're exciting. They're boring. Once you know how to do them, you pass your exam, you get your little rubber stamp, or little gold star, which is what I want most in life for you is to do well. And enjoy linear algebra and see the usefulness of it and go out and use it because it's used everywhere. Linear algebra, for me, is perhaps more important than calculus. Anyway, that's a different story. So what we're doing here is starting to develop this intuition that it's not only good for solving linear systems, matrices are these mathematical objects in their own right. Just as a number is a real number, or a complex number, or an integer, or an irrational number, it's a mathematical object. And just like those numbers are, a matrix is also a mathematical object. And it is so useful, and it is so powerful, and it's so much fun. I mean, it's the greatest amount of fun you can have probably one of the in mathematics. So it's important to develop this love and this deep understanding of it so you can see what absolute power is hidden inside of a matrix. And we'll certainly try and get to all of those in this first two sections. The first one was on vectors, the second one now matrices, but I'm splitting the second one up, as I said, into multiple videos. So I hope you enjoyed that one. Leave a comment to ask me to make some other things, or these notebooks are going to be available to you on GitHub. Also, if I remember, put a link down below to show you how to install Julia and create an environment and use Pluto as we've done here. I've made videos on those. Many people have watched those. So hope you found this one helpful. Leave a comment. Please leave a comment. As important, subscribe if you haven't already done so. Leave a like. And as people make fun, proper YouTubers, not like me, but make fun. If you don't like it, hit the downward arrow's thumb or unlike the video twice. It's a little silly fun. Anyway, subscribe, leave a comment and ask me to do, if you want me to do something else. Let me know.