Strassen Formulas

DOWNLOAD Mathematica Notebook

The usual number of scalar operations (i.e., the total number of additions and multiplications) required to perform n×n matrix multiplication is

 M(n)=2n^3-n^2
(1)

(i.e., n^3 multiplications and n^3-n^2 additions). However, Strassen (1969) discovered how to multiply two matrices in

 S(n)=7·7^(lgn)-6·4^(lgn)
(2)

scalar operations, where lg is the logarithm to base 2, which is less than M(n) for n>654. For n a power of two (n=2^k), the two parts of (2) can be written

7·7^(lgn)=7·7^(lg2^k)
(3)
=7·7^k
(4)
=7·2^(klg7)
(5)
=7(2^k)^(lg7)
(6)
=7n^(lg7)
(7)
6·4^(lgn)=6·4^(lg2^k)
(8)
=6·4^(klg2)
(9)
=6·4^k
(10)
=6(2^k)^2
(11)
=6n^2,
(12)

so (◇) becomes

 S(2^k)=7n^(lg7)-6n^2.
(13)

Two 2×2 matrices can therefore be multiplied

 C=AB
(14)
 [c_(11) c_(12); c_(21) c_(22)]=[a_(11) a_(12); a_(21) a_(22)][b_(11) b_(12); b_(21) b_(22)]
(15)

with only

 S(2)=7·2^(lg7)-6·2^2=49-24=25
(16)

scalar operations (as it turns out, seven of them are multiplications and 18 are additions). Define the seven products (involving a total of 10 additions) as

Q_1=(a_(11)+a_(22))(b_(11)+b_(22))
(17)
Q_2=(a_(21)+a_(22))b_(11)
(18)
Q_3=a_(11)(b_(12)-b_(22))
(19)
Q_4=a_(22)(-b_(11)+b_(21))
(20)
Q_5=(a_(11)+a_(12))b_(22)
(21)
Q_6=(-a_(11)+a_(21))(b_(11)+b_(12))
(22)
Q_7=(a_(12)-a_(22))(b_(21)+b_(22)).
(23)

Then the matrix product is given using the remaining eight additions as

c_(11)=Q_1+Q_4-Q_5+Q_7
(24)
c_(21)=Q_2+Q_4
(25)
c_(12)=Q_3+Q_5
(26)
c_(22)=Q_1+Q_3-Q_2+Q_6
(27)

(Strassen 1969, Press et al. 1989).

Matrix inversion of a 2×2 matrix A to yield C=A^(-1) can also be done in fewer operations than expected using the formulas

R_1=a_(11)^(-1)
(28)
R_2=a_(21)R_1
(29)
R_3=R_1a_(12)
(30)
R_4=a_(21)R_3
(31)
R_5=R_4-a_(22)
(32)
R_6=R_5^(-1)
(33)
c_(12)=R_3R_6
(34)
c_(21)=R_6R_2
(35)
R_7=R_3c_(21)
(36)
c_(11)=R_1-R_7
(37)
c_(22)=-R_6
(38)

(Strassen 1969, Press et al. 1989). The leading exponent for Strassen's algorithm for a power of 2 is lg7 approx 2.808. The best leading exponent currently known is 2.376 (Coppersmith and Winograd 1990). It has been shown that the exponent must be at least 2.

Unfortunately, Strassen's algorithm is not numerically well-behaved. It is only weakly stable, i.e., the computed result C=AB satisfies the inequality

 ||C-AB||<=nu||A||||B||+O(u^2),
(39)

where u is the unit roundoff error, while the corresponding strong stability inequality (obtained by replacing matrix norms with absolute values of the matrix elements) does not hold.

Wolfram Web Resources

Mathematica »

The #1 tool for creating Demonstrations and anything technical.

Wolfram|Alpha »

Explore anything with the first computational knowledge engine.

Wolfram Demonstrations Project »

Explore thousands of free applications across science, mathematics, engineering, technology, business, art, finance, social sciences, and more.

Computerbasedmath.org »

Join the initiative for modernizing math education.

Online Integral Calculator »

Solve integrals with Wolfram|Alpha.

Step-by-step Solutions »

Walk through homework problems step-by-step from beginning to end. Hints help you try the next step on your own.

Wolfram Problem Generator »

Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet.

Wolfram Education Portal »

Collection of teaching and learning tools built by Wolfram education experts: dynamic textbook, lesson plans, widgets, interactive Demonstrations, and more.

Wolfram Language »

Knowledge-based programming for everyone.