Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MorphingDragon

macrumors 603
Original poster
Mar 27, 2009
5,159
6
The World Inbetween
This isn't really a computing question more of a maths question. For an assignment, we have to make classes that will work with vectors in the form of (i, j, k) and 3x3 matrices. Part of the requirements is a method that will take the product of 3 matrices (just to be really mean) Anyway, I cant remember how to get the product of 3 or more matrices. (Golly) I tried googling it and my maths textbooks are back at the youth hostel. (Its teaching break ATM)

So if A, B, C are matrices, what would the product of them be?
 
This isn't really a computing question more of a maths question. For an assignment, we have to make classes that will work with vectors in the form of (i, j, k) and 3x3 matrices. Part of the requirements is a method that will take the product of 3 matrices (just to be really mean) Anyway, I cant remember how to get the product of 3 or more matrices. (Golly) I tried googling it and my maths textbooks are back at the youth hostel. (Its teaching break ATM)

So if A, B, C are matrices, what would the product of them be?

Well, matrix multiplication is not commutative, so the order of the terms matters. Matrix multiplication is associative, so how you group the terms doesn't matter.

So to calculate A*B*C you could do either (A*B)*C or A*(B*C). So you'd simply take your process for multiplying two matrices and use it twice:

MatrixMultiply(MatrixMultiply(A,B), C)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.