{"id":37,"date":"2013-11-08T15:46:23","date_gmt":"2013-11-08T15:46:23","guid":{"rendered":"\/\/3dbym.ru\/2013\/11\/matrix-multiplication\/"},"modified":"2013-11-08T15:46:23","modified_gmt":"2013-11-08T15:46:23","slug":"matrix-multiplication","status":"publish","type":"post","link":"https:\/\/3dbym.ru\/2013\/11\/matrix-multiplication\/","title":{"rendered":"Matrix Multiplication"},"content":{"rendered":"

Okay, on to matrix multiplication! Lots of people get confused when it comes to multiplying matrices. In reality, however, it really isn\u2019t that hard. The first thing you need to do is determine whether the matrices are conformable. Lets say you have two matrices, A and B, that have the dimensions mxn and pxq. The matrices are conformable only if n=p. For instance, a 3×3 matrix and a 3×7 matrix can be multiplied to\u00adgether, but a 3×2 and a 4×5 matrix cannot. If your two matrices satisfy this requirement, you can move to the next step.<\/p>\n

The resulting matrix will have the dimensions mxq. That means in the previous example, a 3×3 and a 3×7 matrix multiplied together would produce a 3×7 matrix. The nice thing about 3D graphics is that the matrices you use are usually square. When you multiply two square<\/p>\n

<\/p>\n

matrices together, you guessed it, you get a square matrix of the same size, so a 4×4 matrix multiplied by another 4×4 matrix will give you a final matrix with dimensions 4×4.<\/p>\n

But just how do you multiply them together you ask? Well the idea is pretty simple. You take the first row of the first matrix and multiply it by the first column of the second matrix. This results in a single num\u00adber that goes in the first row and first column of the result. The second element of the result is the first row of the first matrix times the sec\u00adond column of the second matrix, and so on. Sound confusing? Maybe you need to look at it a little differently.<\/p>\n

Consider two 3×3 matrices, A and B, which are multiplied together to form C. You know that the first row of A contains the elements An, A12, and A, D. The first column of B contains Bn, B21, and B31. In order to get<\/p>\n

13′<\/p>\n

Cn you take (An x B11) + (A12 x B21) + (A13 x B31). You do that a total of nine times to get all the elements for the 3×3 result. Let\u2019s try multiply\u00ading one in Figure 1.6.<\/p>\n\n\n\n\n
\n

3<\/p>\n<\/td>\n

\n

5<\/p>\n<\/td>\n

\n

0<\/p>\n<\/td>\n

\n

2<\/p>\n<\/td>\n

\n

5<\/p>\n<\/td>\n

\n

2<\/p>\n<\/td>\n

\n<\/td>\n\n

3X2+5X7+0X4<\/p>\n<\/td>\n

\n

3X5+5X3+0X5<\/p>\n<\/td>\n

\n

3X2+5X1+0X9<\/p>\n<\/td>\n

\n<\/td>\n\n

41<\/p>\n<\/td>\n

\n

30<\/p>\n<\/td>\n

\n

11<\/p>\n<\/td>\n<\/tr>\n

\n

4<\/p>\n<\/td>\n

\n

4<\/p>\n<\/td>\n

\n

8<\/p>\n<\/td>\n

\n

7<\/p>\n<\/td>\n

\n

3<\/p>\n<\/td>\n

\n

1<\/p>\n<\/td>\n

\n

=<\/p>\n<\/td>\n

\n

4×2+4×7+8×4<\/p>\n<\/td>\n

\n

4×5+4×3+8×5<\/p>\n<\/td>\n

\n

4×2+4×1+8×9<\/p>\n<\/td>\n

\n

=<\/p>\n<\/td>\n

\n

68<\/p>\n<\/td>\n

\n

72<\/p>\n<\/td>\n

\n

CO<\/p>\n<\/td>\n<\/tr>\n

\n

9<\/p>\n<\/td>\n

\n

6<\/p>\n<\/td>\n

\n

1<\/p>\n<\/td>\n

\n

4<\/p>\n<\/td>\n

\n

5<\/p>\n<\/td>\n

\n

9<\/p>\n<\/td>\n

\n<\/td>\n\n

9X2+6X7+1X4<\/p>\n<\/td>\n

\n

9X5+6X3+1×5<\/p>\n<\/td>\n

\n

9X2+6X1+1X9<\/p>\n<\/td>\n

\n<\/td>\n\n

64<\/p>\n<\/td>\n

\n

68<\/p>\n<\/td>\n

\n

33<\/p>\n<\/td>\n<\/tr>\n<\/table>\n\n\n
\n

Figure 1.6 Multiplying two matrices together. When multiplying matrices, you take the first row of A times the first row of B, the second row of A times the second column of B, and so on.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n

<\/p>\n

CAUTION<\/a><\/p>\n\n\n
\n

)<\/p>\n<\/td>\n<\/tr>\n<\/table>\n

Matrix multiplication is not commutative, meaning that unlike real numbers, the order in which you multiply two matrices does make a difference. If you have two matrices, A and B, multiplying A by B will not give you the same result as multiplying B by A (AB \u0424 BA). Go ahead and try it with the matrices in Figure 1.6; the result is shown here:<\/p>\n\n\n\n\n
\n

44<\/p>\n<\/td>\n

\n

42<\/p>\n<\/td>\n

\n

42<\/p>\n<\/td>\n<\/tr>\n

\n

42<\/p>\n<\/td>\n

\n

53<\/p>\n<\/td>\n

\n

25<\/p>\n<\/td>\n<\/tr>\n

\n

113<\/p>\n<\/td>\n

\n

94 \u20141\u20141\u2014<\/p>\n<\/td>\n

\n

49<\/p>\n<\/td>\n<\/tr>\n<\/table>\n

<\/p>\n<\/p>\n

<\/p>\n

<\/p>\n","protected":false},"excerpt":{"rendered":"

Okay, on to matrix multiplication! Lots of people get confused when it comes to multiplying matrices. In reality, however, it really isn\u2019t that hard. The first thing you need to do is determine whether the matrices are conformable. Lets say you have two matrices, A and B, that have the dimensions mxn and pxq. The […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/posts\/37"}],"collection":[{"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/comments?post=37"}],"version-history":[{"count":0,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/posts\/37\/revisions"}],"wp:attachment":[{"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/media?parent=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/categories?post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/tags?post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}