Fast Fourier Transform
Fast Fourier Transform and Polynomial Multiplication
Polynomial representations and basic operations
A polynomial with n coefficients can be written as
Its degree is at most n−1. The coefficients can also be viewed as a vector, (a0,a1,…,an−1). This viewpoint is useful because many kinds of one-dimensional data, such as sampled audio, are naturally represented as sequences of numbers.
For the algorithms in these notes, the arithmetic-operation model assumes that adding or multiplying two real or complex numbers takes constant time.
Evaluation
Given a polynomial A and a value x0, evaluation computes A(x0). Horner’s rule rewrites the polynomial as
Evaluating this nested expression takes O(n) additions and multiplications. Equivalently, the powers of x0 can be generated successively: once x0k is known, x0k+1 requires just one more multiplication.
Addition
For two polynomials
their sum is obtained by adding corresponding coefficients:
This takes O(n) time.
Multiplication
For a product C(x)=A(x)B(x), each coefficient collects all products whose powers add to the same exponent:
For example, the coefficient of x2 is a0b2+a1b1+a2b0. Computing each coefficient this way takes quadratic time overall: naive polynomial multiplication takes O(n2) arithmetic operations for two inputs of length n.
The key goal of the fast Fourier transform is to reduce this cost to O(nlogn).
Polynomial multiplication and convolution
A polynomial’s coefficient vector can be treated as a numerical signal. Multiplying two polynomials then produces the same coefficient-summing pattern as a convolution.
For two sequences a and b, their convolution has entries
where entries outside the sequences’ ranges are treated as zero. This is exactly the coefficient formula for polynomial multiplication.
Convolution is useful in signal and image processing:
In audio, a waveform can be convolved with a filter to smooth it or alter its frequency content.
In image processing, a small kernel can be applied at many positions. A Gaussian blur, for example, smooths an image and can create the appearance of an out-of-focus lens.
Similar operations occur in many other forms of digital signal processing.
Convolution can also be described as taking dot products between one vector and shifted versions of another. Depending on the indexing convention, this may require reversing one vector; boundary handling must also be specified. The essential operation is the same as polynomial multiplication.
Three ways to represent a polynomial
A polynomial can be represented in several forms. Each makes some operations easy and others less convenient.
Coefficient representation
The polynomial is stored as (a0,a1,…,an−1).
Evaluation: O(n) using Horner’s rule.
Addition: O(n) by adding corresponding coefficients.
Multiplication: O(n2) using the direct coefficient formula.
Root representation
Over the complex numbers, a degree-d polynomial can be represented by its leading coefficient and its d roots, counted with multiplicity:
This representation makes multiplication easy: the roots of the product are the combined root lists, and the leading coefficients are multiplied. Evaluation is also straightforward: multiply the factors (x−ρr) and the leading coefficient.
However, addition is difficult in this representation. The roots of a sum are generally not obtained by simply combining the roots of the original polynomials. Moreover, there is no general formula in radicals for solving arbitrary polynomials of degree five or higher, so converting general coefficient data into exact roots cannot be done by a universal formula using only arithmetic operations and radicals.
Sample representation
A polynomial of degree at most n−1 is uniquely determined by its values at n distinct points. In this representation, the data are pairs
Distinct input points are essential. Given n distinct points, there is exactly one polynomial of degree at most n−1 that passes through the corresponding samples.
Samples make addition and multiplication easy when two polynomials are represented at the same points. If A(xj)=yj and B(xj)=zj, then
The difficulty is changing representations. Evaluating a coefficient vector at n arbitrary points by separately evaluating the polynomial at each point costs O(n2). Recovering coefficients from samples is an interpolation problem; ordinary linear-algebra methods are also costly. The FFT achieves fast conversion for a carefully chosen set of sample points.
Evaluation as a matrix–vector product
Suppose A(x)=∑k=0n−1akxk is to be evaluated at points x0,…,xn−1. The output values yj=A(xj) satisfy
In matrix form,
where a is the coefficient vector, y is the sample vector, and V is the Vandermonde matrix:
With arbitrary points, this matrix has n2 entries, and forming the evaluations directly takes O(n2) time. The crucial freedom is that the points xj can be chosen. A special choice makes the transformation and its inverse much faster.
Complex roots of unity
The useful sample points are evenly spaced around the unit circle in the complex plane.
A complex number has the form u+iv, where i2=−1. It can be viewed as the point (u,v) in the complex plane. A point on the unit circle can be written as
using Euler’s formula. Its magnitude is 1, and its angle is θ.
Let τ=2π. The nth roots of unity are
Equivalently, set
These points are evenly spaced around the unit circle, and each satisfies (ωj)n=1.
A central geometric property is that squaring doubles a point’s angle:
Thus, squaring the nth roots of unity maps them onto the (n/2)th roots of unity when n is even. Each resulting point has two preimages among the original roots. Repeated squaring therefore reduces the number of distinct points by a factor of two at each stage.
Divide and conquer using even and odd coefficients
Splitting a polynomial’s coefficient vector into its even and odd positions gives the decomposition
where
Each of the two smaller polynomials has about half as many coefficients as A.
For any evaluation point x,
This identity gives the divide-and-conquer structure:
Divide: Separate the coefficients into even-indexed and odd-indexed subsequences.
Conquer: Recursively evaluate both smaller polynomials at the squared points x2.
Combine: For each original point x, compute Aeven(x2)+xAodd(x2).
When the original points are the nth roots of unity, their squares form the (n/2)th roots of unity. Both recursive subproblems therefore need only about half as many points as the original problem.
For n a power of two, the running time satisfies
The two recursive calls each handle about n/2 coefficients and points. Dividing the coefficients and combining the results each take linear time. The recurrence gives
This divide-and-conquer evaluation algorithm is the fast Fourier transform (FFT).
The discrete Fourier transform
The mathematical transformation computed by the FFT is the discrete Fourier transform (DFT). Given coefficients a0,…,an−1, it computes the polynomial’s values at the nth roots of unity:
In matrix form,
The DFT is the transformation; the FFT is a fast algorithm for computing it. A direct matrix–vector multiplication takes O(n2) time, while the FFT uses the even–odd recursion to take O(nlogn) time.
The distinction matters: the FFT does not make every arbitrary polynomial evaluation problem fast. It makes evaluation at this specially structured set of roots of unity fast.
Inverse DFT and inverse FFT
To multiply polynomials efficiently, the coefficients must eventually be recovered from the transformed samples. The inverse transformation follows from the orthogonality of the roots of unity.
The complex conjugate of u+iv is u−iv. For a unit-circle point,
Let V denote the matrix obtained by taking the complex conjugate of every entry of V. Since V is symmetric, its conjugate is also its conjugate transpose. The matrix product satisfies
where I is the identity matrix.
To see why, consider the entry in row j and column k:
If j=k, every term is 1, so the sum is n.
If j=k, the terms form a geometric series whose ratio is a nontrivial nth root of unity. The series sums to 0.
Therefore,
The inverse DFT recovers the coefficients from the transformed values:
It can be computed with the same FFT structure: use roots with the negative exponent, then divide every output by n. Applying the negative-exponent transform without this division produces n times the original vector.
Fast polynomial multiplication
To multiply two polynomials efficiently, both must be evaluated at the same roots of unity. Their values can then be multiplied point by point, and the inverse transform recovers the product’s coefficients.
A robust procedure is:
Pad the inputs with zeros. If each input has n coefficients, their product can have up to 2n−1 coefficients. Choose a transform length N≥2n−1, usually the next power of two, and append zeros as needed.
Transform each input. Compute the FFTs of the padded coefficient vectors.
Multiply the transformed values. For each index j, set
Yj=AjBj.Transform back. Apply the inverse FFT to the values Yj to obtain the product coefficients.
The padding is necessary because only N samples cannot, in general, uniquely determine a product with more than N coefficients. It also prevents the coefficients from wrapping around and being combined incorrectly in a cyclic convolution.
Each transform takes O(NlogN) time, pointwise multiplication takes O(N) time, and the result is therefore computed in
time when N is chosen proportional to n. This improves on the direct O(n2) coefficient-by-coefficient method.
Applications of Fourier transforms
A Fourier transform expresses a signal in terms of its frequency components rather than its values over time. For audio, the original vector contains measurements of the signal amplitude at successive time samples. After transformation, the vector describes the signal in frequency space.
A transformed entry is generally a complex number. Its magnitude indicates how much of the corresponding frequency is present; its angle, or phase, describes that component’s shift relative to the signal’s timing. A signal consisting of a single ideal frequency has energy concentrated at that frequency’s transformed entry, rather than spread across all entries.
This representation makes several operations convenient:
A high-pass filter removes low-frequency components by suppressing the corresponding transformed entries.
A low-pass filter removes high-frequency components.
After modifying the frequency components, the inverse transform converts the signal back to the time domain.
Fourier methods are also useful in image processing and other signal-processing tasks. Convolution with a kernel, such as a Gaussian blur, can be carried out efficiently using Fourier transforms, particularly for large data sets. FFT-based techniques are used in audio compression and processing, noise-cancelling systems, and many other applications.
The FFT’s practical importance comes from combining a fast algorithm with a useful representation: it converts data between time or coefficient space and frequency or sample space in O(nlogn) time.

Ask anything
We've read this whole study set, so questions about it get the best answers.