Let be two univariate polynomials in with degrees and respectively. Let be their ring of coefficients. Define
(39) |
(40) |
COMPUTING THE PRODUCT by the straightforward method requires
Thus the complexity of the computation of the product of two univariate polynomials of degree at most is (in term of operations in ).
COMPUTING THE SUM is (in term of operations in ) if and have of degree at most .
ADDING IS OFTEN CHEAPER THAN MULTIPLYING. So adding polynomials is cheaper than multiplying them. For many rings addition is also cheaper than multiplication. So when computing let's try to save on the number of multiplications in .
THE KARATSUBA'S TRICK. Assume and have degree (strictly) less than (where is an integer). The Karatsuba's trick computes the product as follows.
(41) |
ITS COMPLEXITY. Let us count how many operations in we perform with the Karatsuba's trick.
(42) |
(43) |
(44) |
(45) |