# Space complexity for multiplying $m$ matrices

Suppose you have $m$ $n$ by $n$ matrices $M_1,M_2,\dotsc,M_m$, and you want to calculate their product $\prod_{i=1}^{m} M_i$.

The naive method use $m \cdot poly(n)$ times but needs $poly(n)$ memory. I am wondering can there be any algorithm with $polylog(n,m)$ memory but still $m \cdot poly(n)$ or $poly(n,m)$ running time. It sounds like an old problem but I couldn't find any reference.

Note that using the divide and conquer technique (like in Savitch's theorem), we can achieve $polylog(n,m)$ memory and $m \cdot n^{O(\log m)}$ running time.

• SC. Feb 14, 2016 at 9:30
• Specifically, the question is equivalent to the open problem $\mathrm{DET}\subseteq\mathrm{SC}$. Feb 14, 2016 at 10:39
• @EmilJeřábek what are consequences of $DET\subseteq SC$? Is there a reference for this problem? Feb 14, 2016 at 21:27
• The original reference is Cook, A taxonomy of problems with fast parallel algorithms, Information and Control 64 (1985), 2–22. The reduction is actually not hard to sketch. First, you can reduce matrix inverse to determinant using Cramer’s rule. Second, let $M$ denote the $n(m+1)\times n(m+1)$ matrix, considered as $(m+1)\times(m+1)$ blocks of $n\times n$ matrices, in which the superdiagonal blocks are $M_1,\dots,M_m$, and the rest are $0$. Since $M$ is nilpotent ($M^{m+1}=0$), we have $(I-M)^{-1}=I+M+M^2+\dots+M^m$, and one can check that the block in the top-right corner of this inverse, ... Feb 15, 2016 at 17:22
• ... coming from the $M^m$ summand, equals the desired product $M_1\cdots M_m$. (BTW, note that the matrix being inverted here has determinant $1$, hence no division is needed in this application of Cramer’s rule.) Feb 15, 2016 at 17:23