To multiply two n-digit numbers using the ordinary long-multiplication method requires
a computational complexity of
Ο(n2)
.
In contrast, the Karatsuba method reduces the complexity to
Ο(n log23)
.
Note: For multiplications involving numbers with several thousand digits or more,
algorithms based on the FFT or the Chinese Remainder Theorem are generally more suitable.
The method is named after its discoverer, Anatolii Alexeevitch Karatsuba (Russian: Kpp
qp, @~p|yz @|u{uury).
In other words, when the number of digits doubles, the multiplication cost increases by only a factor of three.
X = 123456
Y = 789012
Let R = 103 = 1000.
Split X into its upper and lower three digits:
a = 123
b = 456
Split Y similarly:
c = 789
d = 12
Compute each term in equation (3):
a c = 97047
b d = 5472
(a - b)(c - d) = -258741
Written as a single expression:
X Y
= 97047 R2 + (97047 - (-258741) + 5472 ) R + 5472
= 97408265472
Displayed in a long-multiplication?like form:
97 047 ← R2
+ 97 047 ← R
- -258 741 ← R
+ 5 472 ← R
+ 5 472
------------------
= 97 408 265 472
This example demonstrates how the multiplication of two large numbers can be decomposed into three smaller multiplications and six additions.



© 2000 Takayuki HOSODA.