Karatsuba Multiplication
Consider integers x and y where n is the number of digits in the larger one. Let’s also choose a number, m which is less than n. Then:
x = x1 x 10m + x0 where x0 < 10m
y = y1 y 10m + y0 where y0 < 10m
So
x y = (x1 x 10m + x0) (y1 x 10m + y0)
= x1y1 x 102m + x1y0 x 10m + x0y1 x 10m + x0y0
= x1y1 x 102m + (x1y0 + x0y1) x 10m + x0y0
This requires four multiplications where each multiplication is of numbers having fewer digits than the original n.
Now
x1y0 + x0y1 = (x1 + x0) (y1 + y0) – x1y1 – x0y0
which turns these two multiplications into three but two of them are the same as calculated above; namely x1y1 and x0y0. Hence, we end up calculating the original x times y with three other multiplications plus a few additions. But note that each of these multiplications takes place between numbers having fewer digits than the original.
An example may help solidify this in your mind.
x = 345,678
y = 3,875
here n is 6, the number of digits in the largest number. Let’s pick m = 3, about one half of n. Then
x = 345 x 1000 + 678 where x1 = 345 and x0 = 678
y = 3 x 1000 + 875 where y1 = 3 and y0 = 875
So
x1y1 = 1,035
x0y0 = 593,250
and x1y0 + x0y1 = (x1 + x0) (y1 + y0) – x1y1 – x0y0 = x1y1 x 102m + (x1y0 + x0y1) x 10m + x0y0
= (1,023)(878) – 1,035 – 593,250 = 303,909
So xy = 1,035 x 1,000,000 + 303,900 x 1,000 + 593,250 = 1,229,502,250
Using a power of 10 means that instead of multiplying, we are simply shifting left and inserting zeros.
Additional information about the Karatsuba algorithm can be found here on Wikipedia.