Purpose: Multiply two large numbers (or polynomials) in by splitting each operand into parts. Karatsuba is the case ; Toom-3 () gives .
The Idea: evaluate, multiply, interpolate
Treat each operand as a polynomial in the split radix :
The product corresponds to , a polynomial of degree , hence determined by values. So:
- Evaluate and at small points, typically (where means βtake the leading coefficientβ).
- Multiply pointwise β recursive multiplications of size .
- Interpolate to recover the coefficients of , by solving a small Vandermonde system with a fixed, precomputed sequence of additions, subtractions and small-constant divisions.
- Recompose: , propagating carries.
Complexity
| Name | Exponent | |
|---|---|---|
| 2 | Karatsuba (Toom-2) | |
| 3 | Toom-3 | |
| 4 | Toom-4 | |
| β | , but the linear overhead explodes |
The catch: the interpolation stepβs constant grows rapidly with . Toom-4 needs many more additions and divisions than Toom-3, so the crossover keeps moving. Real libraries stop around Toom-4 or Toom-8 and switch to FFT.
The multiplication ladder (GMP-style thresholds)
| Operand size | Method |
|---|---|
| < ~30 limbs | schoolbook |
| ~30 β 300 | Karatsuba |
| ~300 β 1000 | Toom-3 |
| ~1000 β 3000 | Toom-4 / Toom-6.5 / Toom-8.5 |
| > ~3000 | SchΓΆnhage-Strassen / FFT |
Toom-3 worked out
Split into 3 parts, evaluate at :
Five recursive products , then a fixed sequence of ~10 additions and two exact divisions (by 2 and 3) recovers . Every division is exact, so no precision is lost.
The connection to FFT
Toom-Cook is evaluate-multiply-interpolate at a handful of small integer points. The FFT is the same three steps at roots of unity, where evaluation and interpolation themselves become instead of -with-a-huge-constant. Seeing them as one family is the useful insight.
Variants / Use Cases
- Karatsuba β the case, the one worth implementing by hand
- Big Integer Multiplication β the topic page
- SchΓΆnhage-Strassen β where the ladder ends
- Unbalanced Toom variants β for multiplying operands of very different sizes