Why does evaluating polynomials with n points using the Fast Fourier Transform take O(n log n) time? I am specifically talking about implementing a divide and conquer algorithm that divides the polynomial A(x) into its even powers and odd powers and then uses recursion.
Why does evaluating polynomials with n points using the Fast Fourier Transform take O(n
Share
Let T(n) be time used by the FFT algorithm to evaluate a polynomial of degree n at n points.
The algorithm splits
A(x)=xB(x^2)+C(x^2),
i.e. into two polynomials: odd and even coefficients. For example: 3x^3 + 2x^2 + 9x + 7 is split into x(3x^2 + 9) + (2x^2 + 7).
Originally you wanted to compute 3x^3 + 2x^2 + 9x + 7 at points a,b,c,d.
Now you want to compute 3x+9 and 2x+7 at points a2, b2, c2, d2. Later you will combine that to get values of 3x^3 + 2x^2 + 2x + 7 at a,b,c,d.
The crucial idea: since you use roots of unity, half of the values in a2, b2, c2, d2 are the same. Suppose that a2=c2 and b2=d2.
So you need to compute 3x+2 and 2x+7 at points a2, b2.
This means you reduced an instance of size N into two instances of size N/2 and O(N) postprocessing.
FFT repeats this process recursively. This is the same recursion equation as for mergesort, which is O(N log N) complexity.