Is there a formula for the product of 3 matrices? That is, if A in RR^(m xx n),B in RR^(n xx n), and C in RR^(n xx p), and I want the (i,j) entry of the product D=ABC, how can I write D_(i,j)?

acapotivigl

acapotivigl

Answered question

2022-09-13

Is there a formula for the product of 3 matrices? That is, if A R m × n , B R n × n ,, and C R n × p , and I want the (i,j) entry of the product D=ABC, how can I write D i , j ? I know ( A B ) i , j = k = 1 n a i k b k j , but I'm not sure if this can be generalized to more than 2 matrices.

Answer & Explanation

Annie Wells

Annie Wells

Beginner2022-09-14Added 17 answers

You can done it for a arbritary number of matrices, the case of tree matrices goes
( A B ) i , j = k A i , k B k , j
With some renaming we reach
( X Y ) a , b = c X a , c Y c , b
So we replace X with AB
( ( A B ) Y ) a , b = c ( A B ) a , c Y c , b
( ( A B ) Y ) a , b = c ( k A a , k B k , c ) Y c , b
After some basic manipulations we get
( A B Y ) a , b = c k A a , k B k , c Y c , b
Finally replace Y with C
( A B C ) a , b = c k A a , k B k , c C c , b
So we had derivted our triple matrix formula. (And like this we can generalize for n matrices)
ubumanzi18

ubumanzi18

Beginner2022-09-15Added 2 answers

It would be similar to the 2 matrices case but it involves 2 nested sums. I am not sure if this is very efficient in practice:
d i j = u v a i u b u v c v j

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?