 # 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 2022-09-13 Answered
Is there a formula for the product of 3 matrices? That is, if $A\in {\mathbb{R}}^{m×n},B\in {\mathbb{R}}^{n×n},$, and $C\in {\mathbb{R}}^{n×p}$, and I want the (i,j) entry of the product D=ABC, how can I write ${D}_{i,j}$? I know $\left(AB{\right)}_{i,j}=\sum _{k=1}^{n}{a}_{ik}{b}_{kj}$, but I'm not sure if this can be generalized to more than 2 matrices.
You can still ask an expert for help

• Live experts 24/7
• Questions are typically answered in as fast as 30 minutes
• Personalized clear answers

Solve your problem for the price of one coffee

• Math expert for every subject
• Pay only if we can solve it Annie Wells
You can done it for a arbritary number of matrices, the case of tree matrices goes
$\left(AB{\right)}_{i,j}=\sum _{k}{A}_{i,k}{B}_{k,j}$
With some renaming we reach
$\left(XY{\right)}_{a,b}=\sum _{c}{X}_{a,c}{Y}_{c,b}$
So we replace X with AB
$\left(\left(AB\right)Y{\right)}_{a,b}=\sum _{c}\left(AB{\right)}_{a,c}{Y}_{c,b}$
$\left(\left(AB\right)Y{\right)}_{a,b}=\sum _{c}\left(\sum _{k}{A}_{a,k}{B}_{k,c}\right){Y}_{c,b}$
After some basic manipulations we get
$\left(ABY{\right)}_{a,b}=\sum _{c}\sum _{k}{A}_{a,k}{B}_{k,c}{Y}_{c,b}$
Finally replace Y with C
$\left(ABC{\right)}_{a,b}=\sum _{c}\sum _{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)

We have step-by-step solutions for your answer! ubumanzi18
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}_{ij}=\sum _{u}\sum _{v}{a}_{iu}{b}_{uv}{c}_{vj}$

We have step-by-step solutions for your answer!