Skip to main content

Multiplying Polynomials

Multiplying polynomials

The algorithm that allows us to multiply polynomials in O(nlogn)O(n \log n) is called the Cooley-Tukey fast Fourier transform, or FFT for short. It was discovered by Gauss 160 years earlier, but then separately rediscovered and publicized by Cooley-Tukey.

The heart of Cooley-Tukey FFT is actually about converting between coefficient and evaluation representations, rather than the multiplication itself. Given polynomials pp and qq in dense coefficient representation, it works like this.

  1. Convert pp and qq from coefficient to evaluation form in O(nlogn)O(n\log n) using Cooley-Tukey FFT
  2. Compute r=pqr = p*q in evaluation form by multiplying their points pairwise in O(n)O(n)
  3. Convert rr back to coefficient form in O(nlogn)O(n\log n) using the inverse Cooley-Tukey FFT

The key observation is that we can choose any nn distinct evaluation points to represent any degree n1n - 1 polynomial. The Cooley-Tukey FFT works by selecting points that yield an efficient FFT algorithm. These points are fixed and work for any polynomials of a given degree.

The next section describes the Cooley-Tukey FFT in detail.