 Now let's use these inverses to solve today a system of linear equations. I'm going to cheat again. I'm going to choose my x to be 2. My y is 3. I have two unknowns. I have two equations. You see the solution there. So that is what's done beforehand. I translate that into 1 times x plus 2 times y is 8. 2 times x minus y equals 1. So imagine that is the problem that you are given and you're saying solve this. Well, remember we can have the augmented matrix 1 and 2 and 8 and 2 and negative 1 and 1. It is my augmented matrix. I can use elementary row operations and I could solve this. But I want to show you the inverse. I want to show you the inverse. Let's just rewrite this in a slightly different form. Let's write the matrix A to just be the matrix of coefficients 1, 2, 2 and negative 1. 2 by 2 matrix. And I'm going to have this column vector x. And this column vector x is going to have x and y in its two rows. Two rows, one column. And let me do this multiplication or let me do the following. Let me write just the x's here. That was 1 and 2. And imagine I multiplied that by a scalar. And we saw a scalar times a vector. I'm just going to do the vector times the scalar. So I'm going to put it there. And I have 2 and negative 1. 2 and negative 1 times y and that equals 8 and 1. Well, remember what happened here. If I take a scalar and multiply it by a vector, it's just 1x and 2x and 2y and negative y. So I get exactly the same thing. I get this set of equations. I just get them back by writing my x's here as a column vector. And that is a column vector, which also means I can write the following. A times x. And we've seen that a matrix times a vector. Let's do that. Let's have 1. What was it? 1 and 2. And 2 and negative 1. And I multiply it by x and y. Remember that's how I showed you to do it. That's 2 by 2 and 2 by 1. So the resultant is going to be a 2 by 1. And that's what we have here. x plus 2y. x plus 2y. And I have 2x, 2x minus y. 2x minus y. And that is going to equal this vector 8, 1. So these are just different ways of writing the exact same thing, but this gives us a very beautiful way of writing this. This gives us this very beautiful way of writing this. A times x. And if I let this equal my column vector y, I have the following fact that if I take a matrix, I'm multiplied by my vector of unknowns, it's going to give me my vector of solutions. That's a very beautiful thing. And I remember something else. That if I took a inverse and I multiplied by a, and this is still multiplied by x, what I do to the left-hand side, I've got to do to the right-hand side. And what we saw before, remember, this, when we have these matrices, the multiplication does not commute. So I started off on the left-hand side by multiplying by the inverse of a, so I better start that on the right-hand side as well. The negative, the inverse of, the a inverse of y. This gives me the identity matrix. We saw that, so we can just leave that out. So I have that my solution I'm after. My vector x is going to equal a inverse times my vector y. Now please don't confuse this vector x with this x that is here. The vector x, the vector x is x and y. This is both those. In textbooks you might see this is x of 1 and x of 2, so it's not to get this confusion between the vector x. The vector x is the x and y, my two unknowns. Please don't confuse those two. It's really not that difficult. But only thing that now remains is for us to compute that a inverse. Because if I had a inverse and I multiplied by y, I would get my solution for x and my solution for y. Now in class you are going to be shown probably two ways of doing this. The one is through just your normal row operations and the other one is going to involve intermediate matrices. Now both of these I think are, they're just mental exercises. You're never going to use them once you graduate. Probably never going to use them. But there are nice mental exercises. I'm going to show you just the one way of doing it. But then we're going to go to Mathematica and just do it the way that we would do it in real life if I can use those terms. The one way is to write my matrix of coefficients, 1, 2, 2 and minus 1. So that's a 2 by 2 matrix. I might have a 3 by 3 matrix. But I'm going to extend it to the right with a similar sized identity matrix. 1, 0, 0, 1. And that becomes my new matrix. That becomes, please remember that my solution is x equals 2, x equals 2 and y equals 3. Let's have a quick look. We've got to remember that. And now we're just going to do use this and we're going to use elementary row operations on that. Remember that y was 8 and 1. 8 and 1. It was my matrix y on the right hand side. Again, that's got nothing to do with the y of the x and y. It's actually terrible to do this. First thing I can do, let's go the long way. Let's do, we swap the rows. 1 minus 1, 0 and 1. And I have 1 and 2, 1 and 2, and 1 and 0. So that's, I'm going to multiply this one out by, if I got that right, 2, negative 1, 0 and 1, 1, 2, 1 and 0. Okay, so let's multiply the second row out by, because I want a leading 0. So let's say it's my first row still. I'm going to multiply this by negative 2. That gives me negative 2, negative 4, negative 2 and 0. And now I'm going to add these two to each other. So it's still 2 minus 1, 0 and 1. 2 plus negative 2 is 0. So I have my leading 0. That gives me a negative 5. That gives me a negative 2. And that gives me a 1. So that's fine. Now, don't convert these to fractions. If you have to do this in class, if you're so unfortunate that you're forced to do this, don't go to fractions immediately. Just keep them there. So I need this to be 0. So to add these two, what do I add to negative 5 to give me a 0? Well, I've got to add 5. So I better turn this into a 5. So I'm going to multiply 3 out by negative 5 this first row, which gives me negative 10, 5, 0, minus 5. And I still have 0, minus 5, minus 2 and 1. So let's add negative 10 and 0 leaves me still with a negative 10. I have minus 5 and plus 5 leaves me with a 0 there, which is what I want. That leaves me with a negative 2. And that leaves me with a negative 4. And I still have 0. And I still have negative 5, negative 2 and 1. Now, I can change this first. So this becomes a 1. And then this becomes a 1. So I've got to multiply throughout by 1 over negative 10, which leaves me with a 1. A 0 minus 2 over minus 10 is a 5th. Minus 4 over minus 10 is 2 over 5. 2 over 5. I'll have a 0. I'll have a 1 minus 2. That'll be a 5th. And 1 divided by minus 5 is negative a 5th. And lo and behold, on the left-hand side I now have an identity matrix. On the right-hand side I have a inverse. Isn't that a thing of beauty? I have a inverse. Now let's test it. I have 1 5th. I have 2 5ths. I have 1 5th. I have negative 1 5th. And I'm multiplying that by 8 and 1 to give me my x and y. My y, which remember is now my x. So this is a inverse multiplied by the vector x. A inverse multiplied by y. What am I writing? Because I'm looking for my vector x. So this is a inverse times y. So I have 1 5th times 8. So that's going to be 8 5ths plus 2 5ths. And that's 10 5ths, which is 2. And that's what I wanted. x is indeed 2. And for this one I'm going to have 8 5ths. Where are we now? Let me just see. This one was supposed to be 2 over 5. What am I doing? I hope you got that. That was 2 over 5. 2 over 5 because minus 2 divided by minus 5 is 2 over 5 and minus 1 over 5. So that must be a 2. See why I don't think one should do this. Anyway, 2 over 5, so that gives me 8 times 2 is 16 over 5. Minus 1 over 5. That is 15 over 5 and that equals 3. And lo and behold, y equals 3. So I've shown that if I can get to a inverse, if I can get to a inverse and multiply it by y, I'm going to get my solution, which is my vector x that I'm looking for. And that is 2 and 3. Exactly what I wanted. And if I want to now write 8 times the x, that is indeed going to equal y as we had right in the beginning. So that is the use of the inverse. If we can get the inverse of the inverse of the matrix of coefficients, I can solve my system of linear equations using that inverse. So here we are in Mathematica. Let's calculate the inverse of a matrix. Let's create the same matrix as we had in our example. Remember that it was 1, 2 and we had in the second row 2, negative 1. There we go. Let's just print that to the screen in matrix form with the post-fix notation matrix form and we see our matrix of coefficients there. It was x plus 2y and 2x minus y. That's what we had. We can do the inverse of that very quickly by using the inverse function and I'm just going to say the inverse of a and there we have. Let's have it as a matrix form. So I'm just going to use the post-fix notation matrix form and as we had on the board a 5th, 2 5ths and 2 5ths and negative 1 5. Let's make our matrix y. Remember our matrix y. That was just going to be 8 and 1. Let's have 8 and 1 and let's multiply the inverse of that. There we go. Let's multiply the inverse of that, the inverse of a with that and see if we get our results. There we go 2 and 3. Remember it is a dot notation. Let's do that inverse of a, inverse of a dot y and let's do that in matrix form and we see our matrix, our solution was, our x vector was x equals 2 and y equals 3. Really as simple as that to get the inverse of a matrix, n in the Mathematica is very, very easy indeed by the use of the inverse function.