Multiprecision Arithmetic
Schoolbook and Karatsuba Multiplication
Quadratic schoolbook multiplication, the Karatsuba three-multiplication identity, and where the crossover between them sits.
Engineering / MathematicsMultiprecision Arithmetic3 min readKV-MATH-0507
Multiplication is the operation whose cost dominates almost every algorithm in this collection. The naive method is quadratic; Karatsuba's identity reduces the exponent, and the crossover between them is a tuning parameter every serious library exposes.
Schoolbook multiplication
The direct method computes every partial product and accumulates. For operands of k and l limbs it performs k times l limb multiplications, each producing a double-width result that must be accumulated with carry.
Squaring is cheaper
Squaring admits a genuine saving because off-diagonal partial products appear twice. Computing them once and doubling reduces the limb multiplications by roughly half.
The Karatsuba identity
Split each operand into high and low halves. The naive product needs four half-size multiplications; Karatsuba needs three.
Karatsuba multiplication
- SplitDivide both operands at limb m, roughly half the length.
- Three productsCompute the high product, the low product, and the product of the two sums.
- CombineSubtract the high and low products from the middle one, then assemble with shifts and additions.
- RecurseApply the same method to each half-size product until the crossover threshold is reached.
Complexity and crossover
| Operand size | Preferred method | Reason |
|---|---|---|
| Below ~20-40 limbs | Schoolbook | Karatsuba's additions and recursion overhead dominate |
| Middle range | Karatsuba | Exponent advantage takes over |
| Very large | Toom-Cook or FFT-based | Further exponent reductions, larger overheads still |
Frequently Asked Questions
Why does Karatsuba use three multiplications rather than four?
Is Karatsuba worth implementing if a library is available?
Source. Henri Cohen, A Course in Computational Algebraic Number Theory, Springer GTM 138 — 1.2.3. Structural reference unverified: the source file was not available during authoring; chapter and section numbers are taken from the published edition and have not been checked against a physical copy.
