Fast Multiplication
Grade-school multiplication is , yet divide and conquer beats it. Karatsuba multiplies -bit integers with three half-size products instead of four, giving , and Strassen multiplies matrices with seven block products instead of eight, giving .
╌╌╌╌
Adding two -bit numbers is easy: the grade-school ripple-carry method is , and you cannot beat linear because you must at least read the input. Multiplication is the interesting one. The grade-school algorithm forms shifted partial products and sums them, costing . For a long time that was assumed to be the best possible — until divide and conquer showed otherwise. The same idea then breaks the cubic bound for matrix multiplication. Both stories share a single idea: spend a few cheap additions to buy back one expensive multiplication.1
Multiplying integers: the schoolbook baseline
Write each -bit integer as a high half and a low half. With , split into its least-significant bits and its top bits , and likewise split into and :
Multiplying out and gives
The powers of two are just bit-shifts (free, up to the additions), so the cost is dominated by the four half-size products , , , . That yields a recurrence
Unrolling it shows this naïve split buys nothing:
At the leaf term is , which dominates everything: . The master theorem says the same instantly: with , , , the branching exponent exceeds the work exponent , so the recurrence is leaf-heavy and . Four subproblems of half size land us right back in the quadratic regime.
Karatsuba: three products instead of four
The fix, due to Karatsuba (1960), is to compute the middle coefficient without a third and fourth multiplication.2 Notice the algebraic identity
We were going to compute and anyway. So once we have those two products, the middle term needs only one more multiplication, , plus a few additions. Three half-size products now suffice where four were needed.
The low and high coefficients are just and ; the middle coefficient is recovered from the single extra product plus the two reused products, as .
- 1if then
- 2returnbase case: one-bit (or word) product
- 3
- 4split andlow and high halves
- 5recursive product 1
- 6recursive product 2
- 7recursive product 3 — the trick
- 8recovers
- 9returnshift and add
A worked example in base 10
The identity is base-agnostic, so it is easiest to watch on ordinary decimal digits. Multiply by . Split each at the middle two digits, using as the base (so counts digits here, not bits):
Karatsuba needs three products of the two-digit halves:
The middle coefficient falls out of the identity with no further multiplication:
Reassemble by shifting each coefficient to its place value and adding:
A cross-check confirms it: . The schoolbook method would have formed four two-digit products (, , , ); Karatsuba used three and recovered the fourth's contribution from a subtraction.
Cost
There are now recursive calls, each on half-size inputs, with work to split, shift, and add (the subtractions , may produce one extra bit, which does not change the asymptotics):
The recursion tree makes the cost legible. Level has nodes, each doing work, for a row total of . The rows grow geometrically downward, so the leaves dominate:
Summing the geometric row totals,
using (the identity ). The master theorem confirms it in one line: with , , , the branching exponent beats the work exponent , so this is leaf-heavy and . Trading one multiplication for a handful of additions drops integer multiplication below quadratic.
Strassen: seven products instead of eight
The same spend additions to save a multiplication
idea breaks the cubic
bound for matrix multiplication. The schoolbook method costs :
each of the entries of is a length- dot product. Divide and
conquer splits each matrix into four blocks,
and the product is read off block by block exactly as for scalars:
Taken at face value, the four output blocks need eight block multiplications, giving . The master theorem returns : more subproblems exactly cancel their smaller size, so blocking alone buys nothing — the integer-multiplication story again, one dimension up.
Strassen's 1969 insight is that seven products suffice.3 Form seven recursive -size multiplications,
and recover the output blocks by addition only:
The eighth multiplication is gone, traded for a handful of extra block additions that cost only . The recurrence becomes
and now the leaves win. With , , , the branching exponent exceeds the work exponent , so by the master theorem
The constant is large, so the crossover with the cubic method only pays off for sizable ; in practice Strassen is switched in above a threshold and the base case falls back to the cache-friendly schoolbook multiply. Theoretically, though, it was the first sub-cubic algorithm, and a long line of refinements has pushed the exponent down toward .
Crossover: when divide and conquer actually wins
Both algorithms carry a fat constant: Karatsuba does extra additions and subtractions, Strassen does block additions per level versus the naive products' simpler bookkeeping. Below some threshold the schoolbook method's smaller constant wins outright, so every real implementation switches back to schoolbook at the base case rather than recursing down to .
This is the recurring theme of asymptotically fast algorithms — a better exponent is worthless until is large enough to overcome the constant, so the clever method is layered on top of a simple base case, not used in place of it.
Toom–Cook: splitting into more pieces
Karatsuba splits each operand into two halves and uses three products. The same idea generalizes. View an -digit integer written in base as a degree- polynomial whose coefficients are the chunks: is the polynomial evaluated at . Multiplying the integers is multiplying the polynomials and then substituting (a shift-and-add that resolves carries).
The product has degree , so it is determined by its values at points. Toom–Cook (specifically Toom-) runs three phases:
- evaluate and at small points (e.g. ),
- multiply the paired values pointwise — recursive products of -size numbers,
- interpolate the products back into the coefficients of , then evaluate at .
Karatsuba is Toom-: two chunks, products. Toom- uses three chunks and products of third-size operands, giving — a better exponent than Karatsuba's , at the price of a messier interpolation step with larger additive constants. In general Toom- achieves , and as grows the exponent creeps toward — but the evaluate/interpolate overhead grows too, so no fixed reaches near-linear.
FFT multiplication: near-linear
The Fast Fourier Transform takes the polynomial view to its conclusion. Instead of a fixed handful of evaluation points, evaluate at the complex -th roots of unity. The FFT performs that evaluation for all roots at once in (a divide-and-conquer that splits a polynomial into its even- and odd-indexed coefficients), the pointwise multiply is , and the inverse FFT interpolates back in another . Substituting and resolving carries finishes the integer product. The total is
for the polynomial multiply, and for integer multiplication once one accounts for the growing precision of the roots (Schönhage–Strassen). A 2019 result of Harvey and van der Hoeven removed the last factor, reaching — conjectured to be optimal.
The through-line is one substitution: multiplying two integers is multiplying two polynomials in the base variable, then carrying. Every method here — the schoolbook grid, Karatsuba, Toom–Cook, FFT — is a different way to multiply those polynomials, trading more evaluation-and-interpolation bookkeeping for fewer recursive products. Fast multiplication therefore leads directly to fast polynomial arithmetic, and shows up wherever big integers or high-degree polynomials do: cryptography, computer algebra, and signal processing among them.4
Frontiers of multiplication
The two stories in this lesson — integer and matrix multiplication — both remain open at their frontiers, and both illustrate a gap between what is asymptotically fastest and what any machine will ever run.
Integer multiplication: the conjectured floor was reached. For decades the best known bound was Schönhage–Strassen's (1971), the FFT method of the previous section. It was long conjectured that is the true complexity, with no room below. In 2019 Harvey and van der Hoeven proved exactly that bound: an algorithm multiplying -bit integers in . It is a landmark — it likely closes the problem — but it is a galactic algorithm: the constant hidden in the is so enormous (the method lifts the numbers into a high-dimensional FFT over a cleverly chosen ring) that the crossover where it beats Schönhage–Strassen exceeds any input that will ever be multiplied. It settles the theory while changing nothing in practice, where the tower of schoolbook, Karatsuba, Toom–Cook, and Schönhage–Strassen from earlier still governs which method a library picks by operand size.
Matrix multiplication: a moving target. Strassen's opened a race that is still running. Let be the matrix-multiplication exponent — the smallest number such that matrices can be multiplied in for every . Strassen put ; the Coppersmith–Winograd algorithm (1990) and its laser-method descendants (Williams 2012, and Alman & Williams 2021) have pushed the record to . Every one of these is galactic — the constants make them useless below astronomically large — so practical libraries still use Strassen above a tuned threshold and schoolbook below it. The lower bound is only the trivial (you must at least read the inputs), and whether is one of the central open questions of algorithm theory.
When the algebra is discovered by search. Strassen found his seven products by
hand; the modern twist is to let a machine search for such identities.
AlphaTensor (Fawzi et al., 2022) cast the discovery of low-rank matrix
multiplication schemes as a single-player game and, with reinforcement learning,
rediscovered Strassen-like decompositions and found new ones for specific small
sizes (for instance a scheme over using fewer
multiplications than the previously known best). It is the same idea this lesson
turns on — trade multiplications for additions — but with the search for which
additions automated rather than reasoned out. The frontier of spend cheap operations to save expensive ones
is now partly a search problem.
Takeaways
- Schoolbook integer multiplication is ; the naive divide split into four half-size products, , stays .
- Karatsuba uses the identity to compute the middle coefficient from one extra product, cutting four subproblems to three: .
- Schoolbook matrix multiplication is ; naive block divide, , stays .
- Strassen recovers the four output blocks from seven products instead of eight: — the first sub-cubic matrix multiply.
- The master theorem reads off every one of these by comparing the branching exponent to the work exponent ; both fast methods are leaf-heavy.
- Toom–Cook generalizes Karatsuba by splitting into chunks and treating the digits as polynomial coefficients: Toom- uses products for ; Karatsuba is Toom-.
- The FFT evaluates at roots of unity to multiply the underlying polynomials in , giving near-linear integer multiplication (down to since 2019).
- Both win only asymptotically: a fat constant means the clever method is layered above a schoolbook base case, switched in only past a crossover size .
- At the frontier both problems are open or galactic: Harvey–van der Hoeven (2019) reached the conjectured for integers, and the matrix-multiplication exponent has fallen to (Alman–Williams) with the trivial the only known floor — all useless at real sizes, and now partly discovered by machine search (AlphaTensor).
Footnotes
- CLRS, Ch. 4 — Divide-and-Conquer: integer and matrix multiplication as divide-and-conquer case studies, trading multiplications for additions. ↩
- Erickson, Algorithms, Ch. 1 — Recursion: Karatsuba's -bit integer multiplication via the identity reducing four half-size products to three, with the recurrence. ↩
- CLRS, Ch. 4 (§4.2) — Strassen's algorithm for matrix multiplication and its recurrence; the original result is V. Strassen (1969),
Gaussian elimination is not optimal,
Numerische Mathematik 13, 354–356. ↩ - Skiena, The Algorithm Design Manual, §13 — Numerical Problems: high-precision arithmetic, the link from integer to polynomial multiplication, and FFT-based methods for large operands. ↩
╌╌ END ╌╌