StatGardenREF. DESK
Calculators/Maths/Matrix multiplication cost
Maths

Matrix multiplication cost calculator

Compares the scalar multiplications needed by the schoolbook method, Strassen recursion and the AlphaEvolve 4x4 algorithm for an n by n product.

Published 1 October 2026

What this calculator does

Multiplying two n by n matrices the obvious way costs n³ scalar multiplications: every entry of the answer is a dot product of a row and a column. That was assumed to be optimal until 1969, when Volker Strassen showed you can multiply two 2 by 2 matrices with seven multiplications instead of eight, and that recursing on that trick brings the whole product down to about n^2.807.

The exponent is the whole game. A constant factor saving is worth a little; a smaller exponent is worth more the bigger your matrices get. In May 2025 Google DeepMind reported that its AlphaEvolve system had found a way to multiply two 4 by 4 complex-valued matrices with 48 multiplications rather than the 49 that Strassen recursion gives, which is the first improvement on that case in 56 years and takes the exponent to about 2.793.

The formula

Formulaschoolbook = n³; Strassen = 7^ceil(log₂ n); AlphaEvolve = 48^ceil(log₄ n). The 48-multiplication base case is for complex-valued entries

All three methods work by recursion. Strassen splits each matrix into 2 by 2 blocks and uses seven block multiplications, so a matrix padded to size 2^k costs 7^k. AlphaEvolve splits into 4 by 4 blocks and uses 48, so a matrix padded to 4^k costs 48^k. The growth exponents are log₂7 = 2.807 and log₄48 = 2.793 against the schoolbook 3. Sizes that are not an exact power get padded up, which is why a small matrix can look worse under the 4 by 4 method than under Strassen.

TermMeaning
Scalar multiplicationOne multiplication of two numbers. The thing being counted, because on large matrices it dominates the additions.
Growth exponentThe ω in n^ω. Lower is better, and the advantage compounds with size.
PaddingRounding the matrix up to the next power of 2 or 4 so the recursion divides evenly. Wasted work, and the reason small cases look odd.
Complex-valuedThe 48-multiplication result is for matrices whose entries are complex numbers. For real entries, 49 is still the best known at 4 by 4.

The inputs explained

FieldWhat to enter
Matrix size nThe side length of the square matrices. The methods are compared at their own padded sizes, which the table shows.
Multiplications per secondHow many scalar multiplications your hardware does per second, used only for the time estimates. A billion is a reasonable single-core figure.

When to use it

Seeing why the exponent matters

Run the calculation at 4, then 64, then 4096. At size 4 the saving is a quarter. By 4096 the schoolbook method is doing nearly five times the multiplications. The gap is not constant, it widens with every doubling, which is what a smaller exponent means in practice.

Understanding the padding penalty

Try a size of 2. Strassen needs seven multiplications, but the 4 by 4 method has to pad to size 4 and spend 48. Fast algorithms are asymptotic claims, and below their first block size they lose.

Estimating whether it is worth implementing

The time estimates assume multiplications are the only cost. In reality Strassen adds a lot of additions and has worse numerical stability, which is why libraries often use it only above a crossover size of a few hundred.

Worked examples

Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.

How much does a lower exponent save?

Each row quadruples the size, so the padding is exact for both recursions.

Scalar multiplications by matrix size
Matrix sizeSchoolbook multiplicationsStrassen multiplicationsAlphaEvolve multiplications
4×4644948
16×164,0962,4012,304
64×64262,144117,649110,592
256×25616,777,2165,764,8015,308,416
1024×10241,073,741,824282,475,249254,803,968
4096×409668,719,476,74013,841,287,20012,230,590,460
At 4 by 4 the three methods need 64, 49 and 48, which is the case the 2025 result is about. By 4096 by 4096 the schoolbook method needs about 68.7 billion multiplications against 12.2 billion for AlphaEvolve, a saving of just over four fifths. The ratio between the two fast methods stays small throughout, because 2.807 and 2.793 are close together.

Where does the padding penalty bite?

Sizes that are not powers of four get rounded up, and the cost is charged at the padded size.

Small matrices, where the recursions have not got going
Matrix sizeSchoolbook multiplicationsStrassen multiplicationsAlphaEvolve multiplications
2×28748
3×3274948
4×4644948
5×51253432,304
8×85123432,304
16×164,0962,4012,304
At size 2 the 4 by 4 method pads to 4 and spends 48 multiplications where Strassen spends 7 and the schoolbook method spends 8, so it is six times worse than doing nothing clever. Size 5 is worse still: Strassen pads to 8 and spends 343 while the 4 by 4 method pads to 16 and spends 2,304, against a schoolbook cost of 125. The methods only pull ahead once the matrix is large enough to amortise the padding, which is the practical reason nobody uses a fast algorithm on small blocks.

Questions

Does this mean matrix multiplication is now much faster in practice?

Not yet. The 48-multiplication result is a reduction in a recursive base case, and turning that into faster library code means dealing with the extra additions, memory traffic and numerical stability that fast algorithms bring. The significance is theoretical: it moved a bound that had not moved since 1969.

Why does the 4 by 4 case matter so much?

Because Strassen recursion already handles 4 by 4 by doing 2 by 2 twice, at 7 × 7 = 49 multiplications. Beating 49 at that size means beating Strassen on his own ground, which had resisted since 1969.

Is 2.793 the best exponent known?

No. Purely theoretical methods based on the Coppersmith-Winograd family get the exponent below 2.372, but the constants are so large that those algorithms are never used on real matrices. The interest in the AlphaEvolve result is that it is a small, explicit, practical base case.

Does it work for ordinary real matrices?

The 48-multiplication algorithm is for complex-valued entries. For real entries the best known at 4 by 4 remains 49, so the AlphaEvolve column here is an answer to a slightly different question than the Strassen column.

What is the lower bound?

Nobody knows. The exponent cannot be below 2, since you have to read n² inputs, and closing the gap between 2 and the best known algorithm is one of the long-standing open problems in the subject.

For the matrix operations themselves there is 2×2 matrix operations, the determinant and matrix rank. The story behind the 48-multiplication result is in the piece on AlphaEvolve and Strassen.