# Math Help - Multiplying three matrices together

1. ## Multiplying three matrices together

How do I do this? Say for example:

A = [a b] x [e f] x [i j]
[c d] [g h] [k l]

Or do I just multiply the first two matrices together to get a 2x2 matrix, then multiply that with the third matrix on the end?

2. Originally Posted by Denny Crane
How do I do this? Say for example:

A = [a b] x [e f] x [i j]
[c d] [g h] [k l]

Or do I just multiply the first two matrices together to get a 2x2 matrix, then multiply that with the third matrix on the end?
Suppose we want to calculate A = XYZ

Matrix multiplication is associative, so the above statement is unambiguous. We can either calculate

A = (XY)Z

or

A = X(YZ)

There is a related optimisation problem known as Matrix chain multiplication, which asks which order is the most efficient.