



























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




























In this lecture we will discuss two main related topics
Raphaël Clifford
I (^) A degree n − 1 polynomial in x can be seen as a function:
A(x) =
n∑− 1
i= 0
ai · xi^.
I (^) Any integer greater than the degree of a polynomial is a degree-bound of that polynomial. I (^) The polynomial A in x is:
a 0 · x^0 + a 1 · x^1 + a 2 · x^2 + · · · + an− 1 xn−^1.
I (^) The values ai are the coefficients, the degree is n − 1 and n, for example, is a degree-bound I (^) We can express any integer as a kind of polynomial by setting x to some base, say for decimal numbers:
∑^ n−^1
i= 0
ai · 10 i^.
Raphaël Clifford
Consider A(x) = 2 + 3 x + 1 .x^2 We can evaluate this as
A(x) = 2 + x( 3 + 1 .x)
Raphaël Clifford
I (^) Once we have our polynomial representations, we might want to do some arithmetic with them. I (^) For a coefficient representation, the addition C = A + B constructs C as the vector:
(a 0 + b 0 , a 1 + b 1 , a 2 + b 2 ,... , an− 1 + bn− 1 ).
I (^) Strictly speaking, A and B should have the same length but in practice we can just pad with zero coefficients to make this so.
Raphaël Clifford
I (^) For a point-value representation, the addition C = A + B constructs C as:
{(x 0 , y 0 + z 0 ), (x 1 , y 1 + z 1 ), (x 2 , y 2 + z 2 ),... , (xn− 1 , yn− 1 + zn− 1 )}
where xi is a point, yi = A(xi ) and zi = B(xi ). I (^) Note that the two point-value representations must use the same evaluation points. I (^) Both these operations are O(n) in terms of the time they take.
Raphaël Clifford
I (^) Computing a polynomial multiplication, sometimes called convolution, is a little bit harder than addition. I (^) For a coefficient representation, the product C = A × B can be calculated with school-book long multiplication:
C(x) =
(^2) ∑n− 2
i= 0
ci xi
where
ci =
∑^ i
j= 0
aj · bi−j
I (^) To do now: multiply 7x^2 − 10 x + 9 and 2x^2 + 4 x − 5 I (^) For a point-value representation, C = A × B is a bit easier:
{(x 0 , y 0 · z 0 ), (x 1 , y 1 · z 1 ), (x 2 , y 2 · z 2 ),... , (xn− 1 , yn− 1 · zn− 1 )}
where xi is a point, yi = A(xi ) and zi = B(xi ). I (^) The first method is O(n^2 ), the second method is O(n)!
Raphaël Clifford
I (^) Actually, recall that we can do a bit better than the O(n^2 ) case using the divide and conquer method due to Karatsuba. I (^) We find this gives an algorithm with time complexity:
O(nlog^2 3 ) = O(n^1.^59 )
which is better than our previous method which took O(n^2 ) operations.
Raphaël Clifford
I (^) The problem is that even this is too slow ... we know that using a point-value representation is O(n)! I (^) So a better technique would be to traverse around this diagram:
Coefficient Representation Coefficient Representation
Point-Value Representation
Point-Value- Representation
Evaluate Interpolate
Point-Value Multiply
Coefficient Multiply
I (^) Note that the opposite of evaluation is called interpolation. I (^) So we evaluate to a point-value representation, multiply and then interpolate back again. I (^) The question is, are we quicker than the normal multiply?
Raphaël Clifford
The main steps for fast multiplication of two polynomials A and B each of degree n are:
Raphaël Clifford
I (^) First let’s address evaluation: I (^) We need to evaluate a polynomial of degree n at n different points (ignore the degree-bound doubling for the moment). I (^) Appears complexity of our method will be O(n^2 ). I (^) Is there a faster way of doing this than just using Horner’s Rule? I (^) Yes there is, we select the points we evaluate at to be special. I (^) These special points are chosen to be the N-th Complex Roots of Unity: I (^) That is, the values ωN = e^2 πij/N^ for j = 0 , 1 ,... , N − 1. I (^) Say we are evaluating at N points so we take the N-th complex roots of unity ωN. I (^) That is, we evaluate the polynomial at the points:
ω^0 N , ω^1 N , ω^2 N ,... , ω NN −^1.
Raphaël Clifford
We want to evaluate a polynomial A at the n roots of unity. I (^) Therefore we evaluate
A(x) =
n∑− 1
j= 0
aj ωnkj
for every k = 0 , 1 ,... , n − 1. I (^) Let’s define the vector of results of these evaluations as
yk = A(ωkn )
I (^) This vector y = (y 0 ,... , yn− 1 ) is the Discrete Fourier Transform (DFT) of the coefficient vector a = (a 0 , a 1 ,... , an− 1 ).
The discrete Fourier transform of 0 + 0 x + x^2 − x^3 is 0, − 1 + i, 2 , − 1 − i
Raphaël Clifford
The Cancellation Lemma: ωdkdN = ωkN.
The Halving Lemma: If N > 0 is even then the squares of the N complex N-th roots of unity are the N/ 2 complex N/ 2 -th roots of unity.
By the cancellation lemma, we have (ωnk )^2 = ωkn/ 2 , for any nonnegative integer k.
Raphaël Clifford
I (^) The basic idea of the Fast Fourier Transform (FFT), a fast version of the DFT, is define two new polynomials:
A^0 = a 0 + a 2 x + · · · + aN− 2 xN/^2 −^1 A^1 = a 1 + a 3 x + · · · + aN− 1 xN/^2 −^1
and use these to divide and conquer the problem. I (^) From the above, we have:
A(x) = A^0 + xA^1 .
I (^) So the problem of evaluating A at ω N^0 , ω N^1 ,... , ωN N −^1 is reduced to evaluating A[^0 ]^ and A[^1 ]^ at the points:
(ω^0 N )^2 , (ω^1 N )^2 , (ω^2 N )^2 ,... , (ωN N −^1 )^2
then combining the results. I (^) The Halving Lemma tells us there are only N/2 complex N/2-th roots of unity, each one must occur twice!
Raphaël Clifford
Consider A[x] = 0 + 0 x + 1 .x^2 − x^3 again.
A[^0 ][x] = a 0 + a 2 x = 0 + 1 .x A[^1 ][x] = a 1 + a 3 x = 0 − 1 .x We can check by seeing that
A[x] = A[^0 ][x^2 ] + x.A[^1 ][x^2 ] = 0 + 1 .x^2 + x( 0 − 1 .x^2 ) = x^2 − x^3
as required.
Raphaël Clifford