Consider the problem of multiplying two polynomials…

. The coefficients can be found as: .

  • For , we have .
  • We need to compute coefficients.
  • Each requires time to compute using the above expression. Assuming the coefficients are small, each multiplication is .
  • Naive polynomial multiplication is .

A fast algorithm for polynomial multiplication gives us a fast algorithm for scalar multiplication.

Improvements

A polynomial can be characterized in 2-ways.

  1. With coefficients
  2. Its value at distinct points (basically plug in a value to x and get the value for the value representation)

For two polynomials of degree d. We want to do three main things.

  1. Evaluation: Compute the value representations of A and B
  2. Multiplication: Compute the value representation of C
  3. Interpolation: Recover the coefficients of C from its value representation

Like I said earlier, the value representation is just arbitrarily choosing values of x and subbing them in and evaluating the polynomial. For interpolation, we just our value representations to make a matrix with an unknown coefficient vector and then solve for that vector by inverting .

The missing steps here are how we choose our ’s and how we actually do the evaluation and interpolation. This is what FFT is for.

Actual FFT

Given a complex number Then, consider the following selection for these ’s.

  • for each .

These points are called the roots of unity and are the complex solutions to .

To help us with evaluation, we want to split the polynomial into its odd and even powers so that we end up with something like where each split can be written as a power of . Since we have a split polynomial, we can use a Divide and Conquer approach to evaluation.

Here, we evaluate the two split polynomials at . But if is a power of 2, then , so each is an root of unit.

The algorithm is then as follows:

function FFT(A, w)
Input: Coefficients a_0,...,a_d of polynomial A(x) where d <= n-1 and n is a power of two
Output: Value representation A(w^0),...,A(w^n-1)

if w=1:
	return A(1)
express A(x) in the form A_e(x^2)+xA_o(x^2)
call FFT(A_e,w^2) to evaluate A_e at (n/2)th roots of unity
call FFT(A_o,w^2) to evaluate A_o at (n/2)th roots of unity
for j=0 to n-1:
	compute A(w^j)=A_e(w^2j)+w^jA_o(w^2j)
return A(w^0),...,A(w^n-1)

Examining the recurrence relation, .

For interpolation, we just need to invert using the inversion formula…
.

So we just call which gives us the coefficients using the inverted matrix.

Two polynomials of degree d can be multiplied in time using FFT for evaluation and interpolation. We can use polynomial multiplication to multiply two n-but binary numbers in time as well.