To show how matrix multiplication is implemented, here are two matrixes:
Ú ¿ Ú ¿ ³ a b c ³ ³ j k l ³ ³ d e f ³ * ³ m n o ³ ³ g h i ³ ³ p q r ³ À Ù À ÙThe multiplication of these two matrixes produces a value for each of the nine elements of the resulting matrix:
Ú ¿ ³ element1 element2 element3 ³ ³ element4 element5 element6 ³ ³ element7 element8 element9 ³ À ÙTo produce element 1 of the matrix, element a is multiplied by element j, element b is multiplied by element m, and element c is multiplied by element p. That is:
element1 = (a x j) + (b x m) + (c x p)
To produce element 2 of the matrix, element a is multiplied by element k, element b is multiplied by element n, and element c is multiplied by element q. To produce element 3 of the matrix, elements a, b, and c are multiplied by their corresponding elements (l, o, and r) in the third vertical line of the second matrix. To produce element 4 of the matrix, you move down a row in the first matrix. That is, element d is multiplied by element j, element e is multiplied by element m, and element f is multiplied by element p. You continue the multiplication in this way until each of the nine elements has a value. The complete workings for this example are as follows:
element1 = (a x j) + (b x m) + (c x p)
element2 = (a x k) + (b x n) + (c x q)
element3 = (a x l) + (b x o) + (c x r)
element4 = (d x j) + (e x m) + (f x p)
element5 = (d x k) + (e x n) + (f x q)
element6 = (d x l) + (e x o) + (f x r)
element7 = (g x j) + (h x m) + (i x p)
element8 = (g x k) + (h x n) + (i x q)
element9 = (g x l) + (h x o) + (i x r)
Note that if the order of the two matrixes is reversed, the results of the multiplication are different.
Here is a simple example in which an object is scaled by a factor of 3, and then translated by (5,4):
Ú ¿ Ú ¿ Ú ¿ ³ 3 0 0 ³ ³ 1 0 0 ³ ³ 3 0 0 ³ ³ 0 3 0 ³ * ³ 0 1 0 ³ = ³ 0 3 0 ³ ³ 0 0 1 ³ ³ 5 4 1 ³ ³ 5 4 1 ³ À Ù À Ù À Ù
You can multiply together as many transformation matrixes as you require.