Product of more than two matrices

Discussion in 'Mac Programming' started by MorphingDragon, Sep 2, 2010.

  1. macrumors 603

    MorphingDragon

    Joined:
    Mar 27, 2009
    Location:
    The World Inbetween
    #1
    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?
     
  2. LPZ
    macrumors 65816

    Joined:
    Jul 11, 2006
    #2
    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)
     
  3. thread starter macrumors 603

    MorphingDragon

    Joined:
    Mar 27, 2009
    Location:
    The World Inbetween
    #3
    Thanks
     

Share This Page