Multiplying Matrices and Identifying DimensionalityDate: 07/16/2003 at 13:03:39 From: Rick Subject: Multiplying Matrices and Identifying Dimensionality I understand adding and subtracting matrices, but not multiplying them. I have this question, how do I do this? [-2 4 -6] [1 -1 1] [ 1 -1 0] [3 0 -2] [ 0 2 5] [4 -6 7] Also, how can I find the dimensionality of the following matrix? [2] [4] [3 1 7] [8] would 3x1 and 1x3 be correct and therefore they cannot be multiplied because the inner dimensionalities are different? Thank you very much, Rick Date: 07/16/2003 at 23:11:39 From: Doctor Peterson Subject: Re: Multiplying Matrices and Identifying Dimensionality Hi, Rick. Your second example is a 3x1 times a 1x3, so the inner dimensions ARE the same (both 1), and they CAN be multiplied. Just take each row of the first and multiply it by each column of the second; in this case each is just a single pair of numbers: [ 3 1 7 ] [2] [2*3 2*1 2*7] [ 6 2 14] [4] [4*3 4*1 4*7] = [12 4 28] [8] [8*3 8*1 8*7] [24 8 56] Do you see how I did it? In this case, it looks like a multiplication table, each row and column of the product being the product of the number in that row of the first matrix and the number in that column of the second matrix, which I wrote above for clarity. To multiply matrices with more than one column, you have to multiply and add, rather than just multiply. For a simple example, look at [1 2] [5 3] [3 4] [2 4] I can write them as above, [ 5 3 ] [ 2 4 ] [1 2] [1*5+2*2 1*3+2*4] [ 9 11] [3 4] [3*5+4*2 3*3+4*4] = [23 25] Here I "multiplied" the row [1 2] by the column [5,2] by multiplying corresponding pairs and adding the products: 1*5 + 2*2. Repeat that for all pairs of row and column, and you're done. Note that the inner dimensions have to agree, or you can't pair up numbers to multiply. Here is a site that covers matrices nicely, which may help you when your book isn't clear: S.O.S. Math - Matrix Algebra http://www.sosmath.com/matrix/matrix.html If you have any further questions, feel free to write back. - Doctor Peterson, The Math Forum http://mathforum.org/dr.math/ Date: 07/17/2003 at 09:26:47 From: Rick Subject: Multiplying Matrices and Identifying Dimensionality This makes sense now, but one more question. Would I do this one below the same way as my second one I showed you last time? [1] [5] [2 5 9] [4] Would it be.... 2*1 2*5 2*4 5*1 5*5 5*4 9*1 9*5 9*4 Would this above be the correct way to do it? And then multiply the numbers of course. Thanks. Date: 07/17/2003 at 09:36:53 From: Doctor Peterson Subject: Re: Multiplying Matrices and Identifying Dimensionality Hi, Rick. You multiplied in the wrong order. (Matrix multiplication is NOT commutative.) When you multiply a 1x3 and a 3x1, you get a 1x1; you multiplied the 3x1 and the 1x3 and got a 3x3. Here is the correct work: +-----------[1] | +---------[5] | | +-------[4] | | | [2 5 9] [2*1+5*5+9*4] = [63] - Doctor Peterson, The Math Forum http://mathforum.org/dr.math/ |
Search the Dr. Math Library: |
[Privacy Policy] [Terms of Use]
Ask Dr. Math^{TM}
© 1994-2013 The Math Forum
http://mathforum.org/dr.math/