Math 2.0

Numerical analysis Definition

Strassen algorithm

Builds on MatrixMatrix multiplicationRingBig O notation

Definition

Let RR be a ring, let n=2mn = 2^m with m≥0m \ge 0, and let AA, BB be n×nn \times n matrices over RR. The Strassen algorithm computes C=ABC = AB as follows. If n=1n = 1, it returns the product of the two entries. Otherwise it splits AA, BB and CC into four blocks of size n/2n/2, as in A=(A11A12A21A22)A = \begin{pmatrix} A_{11} & A_{12} \\ A_{21} & A_{22} \end{pmatrix}. It computes seven products, each by a recursive call:

M1=(A11+A22)(B11+B22),M2=(A21+A22)B11,M3=A11(B12−B22),M4=A22(B21−B11),M5=(A11+A12)B22,M6=(A21−A11)(B11+B12),M7=(A12−A22)(B21+B22).\begin{aligned} M_1 &= (A_{11} + A_{22})(B_{11} + B_{22}), & M_2 &= (A_{21} + A_{22}) B_{11}, \\ M_3 &= A_{11}(B_{12} - B_{22}), & M_4 &= A_{22}(B_{21} - B_{11}), \\ M_5 &= (A_{11} + A_{12}) B_{22}, & M_6 &= (A_{21} - A_{11})(B_{11} + B_{12}), \\ M_7 &= (A_{12} - A_{22})(B_{21} + B_{22}). \end{aligned}

Then it returns C11=M1+M4−M5+M7,C12=M3+M5,C21=M2+M4,C22=M1−M2+M3+M6.C_{11} = M_1 + M_4 - M_5 + M_7, \quad C_{12} = M_3 + M_5, \quad C_{21} = M_2 + M_4, \quad C_{22} = M_1 - M_2 + M_3 + M_6.

Remarks

The formulas never use commutativity of RR, which is why they can be applied to blocks. With T(n)T(n) the number of ring operations, T(n)=7 T(n/2)+18(n/2)2T(n) = 7\,T(n/2) + 18 (n/2)^2, so T(n)=O(nlog⁡27)T(n) = O(n^{\log_2 7}) in big O notation. Matrices of other sizes are padded with zero rows and columns up to the next power of 22. Example: for A=(1234)A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} and B=(5678)B = \begin{pmatrix} 5 & 6 \\ 7 & 8 \end{pmatrix}, the products are M1=65M_1 = 65, M2=35M_2 = 35, M3=−2M_3 = -2, M4=8M_4 = 8, M5=24M_5 = 24, M6=22M_6 = 22, M7=−30M_7 = -30, and they give C=(19224350)C = \begin{pmatrix} 19 & 22 \\ 43 & 50 \end{pmatrix}, which equals ABAB. Non-example: the schoolbook recursion with the eight block products Ai1B1j+Ai2B2jA_{i1} B_{1j} + A_{i2} B_{2j} satisfies T(n)=8 T(n/2)+O(n2)T(n) = 8\,T(n/2) + O(n^2), which gives only O(n3)O(n^3). In practice one switches to the ordinary method below some block size, because the extra additions make the recursion slower for small matrices.

Reading path

To understand this page from the ground up, read these 5 pages in order. The foundations come first.

Show the path as a graph
Each page uses the pages above it. The colour of the bar on a box shows how strong the evidence is, and the box also gives it as text. The list has the same pages.
  • no evidence level
  1. Big O notation concept
  2. Matrix concept
  3. Matrix multiplication concept
  4. Ring concept
  5. Strassen algorithm definition

Further reading

  1. Web https://en.wikipedia.org/wiki/Strassen_algorithm
About this page
TagKF7HK5Z9XW
URIm2://KF7HK5Z9XW
Kinddefinition
WritingW0 stub
MSC65F30, 68Q25, 15A69
DefinesStrassen algorithm
UsesMatrix, Matrix multiplication, Ring, Big O notation
Changed2 November 2026

Markdown · JSON · Edit on GitHub

What this page needs for W1

  • a source with a locator (0 of 1)

The writing levels say how complete the text of a page is. They do not measure its truth.

What links here

No page links to this page yet.