Hello and welcome to the Postcard Professor, where we take complex ideas and explain them in the space of a postcard. This video will be a review of basic matrix operations. We're going to cover four different operations here, and then on top of that, I just want to have a small note on how we define these.
So for matrix definition, let's say we have some matrix. This matrix has a number of rows. and a number of columns. And with these two pieces of information, we define the shape of the matrix.
This is a 2 by 3 matrix, just from the two rows and three columns. If we have a matrix that is three rows and one column, this is just a 3 by 1 matrix. Now the first operation we're going to talk about is called the matrix transpose.
And all the matrix transpose does is change the shape of the matrix by flipping it. So if we have our same matrix as before, which is a 2x3, we can transpose that matrix in order to end up with a 3x2 matrix. So the way this works, the first element stays the same, but then for the second element in the row, we actually look to the second element in the column. And so we get the 1 and the 2. Then we get the three and the four, and then finally the two and the seven.
And this is now a three by two matrix. So three rows and two columns. So next, let's look at addition and subtraction.
These are essentially the same thing, of course, but the basic idea is that for addition and subtraction, we just look element by element. So we have to add and subtract matrices that have the exact same shape. meaning that if this matrix here is a 2x3, the matrix that we're adding to it also has to be a 2x3. And we're going to end up with a 2x3.
And to get the values here, we just add the first element to the first element. So 1 plus 0 is 1, 3 plus 1 is 4, 2 plus 5 is 7, and so on. Now the next one is multiplication, and this might be the most important.
But with multiplication, we have some stronger rules as to... what matrices we can actually multiply together. So let's take that same matrix as before, and we're going to multiply it by the transpose of the same second matrix as before. So the rule here is that if we have a 2x3 matrix, we have to match that with a 3-by-something matrix. So the important part of that is the number of columns of the first matrix.
has to match the number of rows of the second matrix. The three by three here, these must match. And what we end up with is a two by two matrix. And really what you end up with is whatever's left over from these two is going to be the shape of the new matrix. Now, as for what's in these elements, let's start with the first element.
The way we work this is we take the elements of our first row and our first column and we multiply each of those elements together. That's why these values must match. We're going to take these three and then just push them over and lay them on top of these top three.
So we're going to end up with zero times one, because that's this first element, plus one times three, and then finally plus five times two. So the end result there, we get 3 plus 10 is 13. For the next one, we look at the row. We're still in the first row. So we're going to keep to the first row for the first matrix.
But then we're in the second column now. And so we're going to look at the second column of our second matrix. So now what we end up with is 3 times 1 minus 2 times 3 plus 2 times 8 plus 8 times 2. So we have 16. Minus 6 is 10 plus 3 is 13 and so we end up with 13 again. For the bottom left now we're looking at the second row and the first column. So we end up with 0 times 2 which is 0. 1 times 4 is 4 and then 7 times 5 is 35. So we end up with 39 for that.
So we end up with 39 for that element. Then finally we're looking at the second row in the second column. So we have three times two is six.
Negative two times four is negative eight. And then 8 times 7 is 56. So we end up there with 54. The final operation I want to talk about is the inverse of a matrix. Now, there are operations that we can reasonably perform for 2x2 and 3x3 matrices. But honestly, it's probably easier just to use substitution for those matrices if you're going to be doing it by hand.
Really. what you'll be doing is using some computational tool such as python or matlab in order to invert the matrix if we have a matrix right let's say we have a matrix and i'm going to call this matrix a this this stands for a square matrix which means that the number of rows equals the number of columns the matrix inverse multiplied by the matrix becomes the identity matrix. And if you take the identity matrix and multiply it by a vector or another matrix, then it just disappears.
This identity matrix is going to be equal to just ones on the diagonal and zeros everywhere else. And that will continue on forever. But let's say that this is a four by four. And so we end up with ones on the diagonal and then zeros everywhere else.
And the reason we use this so much is that we end up with systems of equations, which we'll cover in the next video. And we need to get rid of some matrix that's pre-multiplying a vector. And so we'll multiply by the inverse to get rid of it.
So that's a quick overview of matrix operations. We'll go in more in depth a little bit as we get into the system of equations and matrix form. Because what we're actually going to be doing there is using these inverses in order to solve a system of equations. So we're going to be using multiplication and inverse directly there. In any case, I hope this was informative and I will catch you next time.