Could somebody explain to me, in a way I’d actually understand, how to (remember how to) go about multiplying a pair of matrixes? I’ve looked at Wikipedia, I’ve read linear algebra books up to where they supposedly explain matrixes, and I keep bouncing up against a mental wall where I can’t seem to remember how to figure out how to get the answer.
1 The mental image I have, which may or may not be helpful to anyone else, is of a row of the LH matrix sliding over and rotating clockwise until it matches a column of the RH matrix.
2 If you don’t mind working it out from scratch and have a more “algebraic” than “geometric” brain, the following considerations may help:
Matrices are indexed row first, then column (think “reading order”: if you think of the indices as numbers, then as you read along rows like reading a book they increase monotonically).
When you multiply matrices, what happens is that “middle indices match”: element (i,k) of the product is sum over j of left[i,j] right[j,k]. See how the j’s match up and “cancel out”.
3 The product matrix is an array of inner products of rows from the LH factor and columns from the RH factor.
I make no guarantee that any of those will help, but if any of them seems to be heading in the right direction but not getting there I’m happy to try to adapt further...
Low confidence that this will help, but my approach: I mentally move the right-hand matrix up, so that the space “in between” them (right of the first, below the second) is the right shape for the result. Each value of the result is the dot product of the vectors to the left and above it. (I don’t have a trick for dot products, I just know how to calculate them.)
. . . . g h i
a b c * j k l
d e f . m n o
“becomes”
. . . g h i
. . . j k l
. . . m n o
. . . -----
a b c|S T W
d e f|X Y Z
and e.g. S is (a b c) dot (g j m), Y is (d e f) dot (h k n).
Perhaps explicitly thinking of them as systems of equations (or transformations on a vector) would be helpful.
As an example, suppose you are asked to multiply matrices A and B, where A is [1 2, 0 4, −1 2] (the commas represent the end of a row) and B is [2 1 0, 3 1 2]. Start out by taking the rightmost matrix (B in this case) and converting it into a series of equations, one for each row. So since the first row is 2 1 0, the relevant equation will be 2x + 1y + 0z. Assign each of these equations to some other variable. So we now have
X = 2x + y
Y = 3x + y + 2z
Now do the same thing with the matrix on the left, except this time use the new variables you’ve introduced (X and Y), so the three equations you end up with (one for each row) will be
X + 2Y
4Y
-X + 2Y
Now that you have these formulae, substitute in the values of X and Y based on your earlier equations. You get
(2x + y) + 2(3x + y + 2z)
4(3x + y + 2z)
-(2x + y) + 2(3x + y + 2z)
Simplifying, you get
8x + 3y + 4z
12x + 4y + 8z
4x + y + 4z
The coefficients of these equations are the result of the multiplication. So the product of the two matrices is [8 3 4, 12 4 8, 4 1 4].
I’ll admit this is not the quickest way to go about multiplying matrices, but it might be easier for you to remember since it doesn’t seem as arbitrary. And maybe once you get used to thinking about multiplication this way, the usual visual rule will start making more sense to you.
I suggest physically tracing through the matrices with one finger from each hand. As you would multiply If you do it the right way enough times, doing it the wrong way will feel weird.
Also, the canonical example is y=Ax, with A a matrix, and x,y as vertical vectors. If you can at least remember that one goes vertically, and one horizontally, Ax will show that it is the one on the right that goes vertically.
Matrix multiplication
Could somebody explain to me, in a way I’d actually understand, how to (remember how to) go about multiplying a pair of matrixes? I’ve looked at Wikipedia, I’ve read linear algebra books up to where they supposedly explain matrixes, and I keep bouncing up against a mental wall where I can’t seem to remember how to figure out how to get the answer.
1 The mental image I have, which may or may not be helpful to anyone else, is of a row of the LH matrix sliding over and rotating clockwise until it matches a column of the RH matrix.
2 If you don’t mind working it out from scratch and have a more “algebraic” than “geometric” brain, the following considerations may help:
Matrices are indexed row first, then column (think “reading order”: if you think of the indices as numbers, then as you read along rows like reading a book they increase monotonically).
When you multiply matrices, what happens is that “middle indices match”: element (i,k) of the product is sum over j of left[i,j] right[j,k]. See how the j’s match up and “cancel out”.
3 The product matrix is an array of inner products of rows from the LH factor and columns from the RH factor.
I make no guarantee that any of those will help, but if any of them seems to be heading in the right direction but not getting there I’m happy to try to adapt further...
Low confidence that this will help, but my approach: I mentally move the right-hand matrix up, so that the space “in between” them (right of the first, below the second) is the right shape for the result. Each value of the result is the dot product of the vectors to the left and above it. (I don’t have a trick for dot products, I just know how to calculate them.)
“becomes”
and e.g. S is (a b c) dot (g j m), Y is (d e f) dot (h k n).
By Juniper, I think this is the one. It’s simple enough that I can actually remember this, and I can solve arbitrary matrixes with this approach.
Feel free to have an internet cookie in thanks. :)
I use exactly the same approach! When you position the matrices this way, it becomes completely obvious.
Perhaps explicitly thinking of them as systems of equations (or transformations on a vector) would be helpful.
As an example, suppose you are asked to multiply matrices A and B, where A is [1 2, 0 4, −1 2] (the commas represent the end of a row) and B is [2 1 0, 3 1 2]. Start out by taking the rightmost matrix (B in this case) and converting it into a series of equations, one for each row. So since the first row is 2 1 0, the relevant equation will be 2x + 1y + 0z. Assign each of these equations to some other variable. So we now have
X = 2x + y
Y = 3x + y + 2z
Now do the same thing with the matrix on the left, except this time use the new variables you’ve introduced (X and Y), so the three equations you end up with (one for each row) will be
X + 2Y
4Y
-X + 2Y
Now that you have these formulae, substitute in the values of X and Y based on your earlier equations. You get
(2x + y) + 2(3x + y + 2z)
4(3x + y + 2z)
-(2x + y) + 2(3x + y + 2z)
Simplifying, you get
8x + 3y + 4z
12x + 4y + 8z
4x + y + 4z
The coefficients of these equations are the result of the multiplication. So the product of the two matrices is [8 3 4, 12 4 8, 4 1 4].
I’ll admit this is not the quickest way to go about multiplying matrices, but it might be easier for you to remember since it doesn’t seem as arbitrary. And maybe once you get used to thinking about multiplication this way, the usual visual rule will start making more sense to you.
Maybe this will help
https://www.chilimath.com/algebra/advanced/matops/images2/ex2.gif
These videos are really good: https://www.khanacademy.org/math/linear-algebra/eola-topic
It’s a 50-50 arbitrary convention.
I suggest physically tracing through the matrices with one finger from each hand. As you would multiply If you do it the right way enough times, doing it the wrong way will feel weird.
Also, the canonical example is y=Ax, with A a matrix, and x,y as vertical vectors. If you can at least remember that one goes vertically, and one horizontally, Ax will show that it is the one on the right that goes vertically.