DFT and Roots of Unity
In questa pagina 4
Polynomials - Representations and ConvolutionA polynomial with degree bound n is represented by n coefficients or by n values at n distinct points (interpolation theorem, Vandermonde matrix). By coefficients the sum costs n and the product, the linear convolution, n^2 products and (n-1)^2 sums; by values the product costs only componentwise multiplication but needs at least 2n-1 points. General conversions cost too much: evaluation n times with Horner 2n(n-1), interpolation with Gauss-Jordan n^3 or Lagrange n^2. A special base is needed: the DFT.Polynomials - Representations and Convolution → showed that multiplying polynomials in requires a base of evaluation points where conversions are cheap. Here the base is chosen: the -th roots of unity. We define the DFT, prove the properties that make it fast, and the theorem linking it to linear convolution. The fast algorithm is in Fast Fourier TransformThe FFT computes the DFT_n (n a power of two) by divide and conquer: split the coefficients by index parity, p(x) = p0(x^2) + x p1(x^2), and by the halving lemma two DFTs of order n/2 suffice; y_i = y0_i + w^i y1_i and y_{i+n/2} = y0_i - w^i y1_i. The recurrence T(n) = 2T(n/2) + 2n with T(1) = 0 has exact solution 2 n log2 n. The inverse has matrix F^{-1}_{ij} = w^{-ij}/n and is obtained with the FFT on negative powers (then dividing by n outside the recursion) or with a reversed DFT_n(y). LIN_CONV multiplies two polynomials with n coefficients in 12 n log2(2n) + 4n operations.Fast Fourier Transform →.
The signal-processing view differs: there the DFT is the Fourier series of a periodic signal with a minus sign in the exponent. Here it is the evaluation of a polynomial at special points, with the plus sign: . The two conventions differ by an index permutation (below); numpy.fft.fft uses the minus sign.
Complex numbers in polar form
has modulus and argument : (Euler), so . -th roots: if then and ; the distinct roots are For : the roots of unity .
Definition. The principal -th root of unity is . The -th roots of unity are , forming . Since , for all .
Example (). ; the powers are the vertices of a regular octagon on the unit circle:
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | |
|---|---|---|---|---|---|---|---|---|
: , . : .
The DFT and the Fourier matrix
Definition (DFT). maps the coefficients of to its values at the -th roots of unity: is a representation by values (distinct points, interpolation theorem applies).
with the Fourier matrix , . First row and column are all ones; is symmetric and invertible (Vandermonde on distinct points), so the inverse DFT is the interpolation from .
Example (). . For : , , , . So .
Cost with general evaluation: Horner runs, .
Signal convention. With the "signal DFT" is ; as , the two vectors differ by the permutation (index fixed, the others reversed). It reappears in the inverse transform.
Properties of the roots of unity
Group. is a multiplicative group: closure ; identity ; inverse of is , i.e. for .
Cancellation lemma. For positive integers and : .
Proof. .
Corollary. For even , (half a turn); hence .
Halving lemma. For even and : . Squaring the roots of order yields the roots of order , each twice.
Proof. by cancellation; .
Example (): the squares are .
Summation lemma. For , :
Proof. If , and the sum is . Otherwise and the geometric sum is .
Example: : : ; : ; : .
All results hold with in place of (same roots, different order): needed for the inverse transform.
Example (). , so ; or by repeated cancellation : , .
The linear convolution theorem
Theorem. For and : with concatenation (zero padding) and the componentwise product.
Proof. Let , , . Padding leaves the polynomials unchanged but raises the bound to . The two DFTs of order are the values , ; their componentwise product is , the values of on . Since , points determine it, its coefficient vector with bound is , and the inverse DFT returns it by uniqueness of interpolation.
Order (not ) because the fast algorithm works on powers of two.
Example (). , , order : DFT, DFT, product , which are the values of at . So .
With general evaluations this costs ; with the FFT, . The same link explains why circulant matrices are diagonalized by (Supercirculant and Circulant MatricesSupercirculant matrices (alternating recursive quadrants) have only n distinct values: sum in n operations, product in 4n log2 n + n with the trick (A1+A2)(B1+B2) and (A1-A2)(B1-B2) instead of 4 calls (Theta(n^2)); their eigenvalues are the Hadamard transform of the first row (FHT, n log2 n). Circulant matrices are polynomials in the rotation matrix R, their product is the cyclic convolution of the first rows, and the Fourier matrix diagonalizes them: product in O(n log n) with the FFT.Supercirculant and Circulant Matrices →).
Versione ripasso
- Roots: ; roots (vertices of a regular -gon on the unit circle), . -th roots of : . , .
- DFT: , , (symmetric invertible Vandermonde, first row and column of ones). General evaluation costs .
- Example: , with rows , , , .
- Conventions: with the minus sign of signal courses (and
numpy) the result differs by the permutation . - Group: , identity , inverse .
- Cancellation: . Corollary: , so .
- Halving ( even): : the squares are the roots of order , each twice. Proof: cancellation and . : .
- Summation: if , else (ratio ; otherwise geometric sum ). Also with . , : .
- Example: (or ).
- Linear convolution: . Proof: the product of the values is the values of on ; determines it; interpolation is unique. Order (not ) for a power of two.
- Example: at order : , values of at ; result . With the FFT it costs ; the same link diagonalizes circulant matrices (Supercirculant and Circulant MatricesSupercirculant matrices (alternating recursive quadrants) have only n distinct values: sum in n operations, product in 4n log2 n + n with the trick (A1+A2)(B1+B2) and (A1-A2)(B1-B2) instead of 4 calls (Theta(n^2)); their eigenvalues are the Hadamard transform of the first row (FHT, n log2 n). Circulant matrices are polynomials in the rotation matrix R, their product is the cyclic convolution of the first rows, and the Fourier matrix diagonalizes them: product in O(n log n) with the FFT.Supercirculant and Circulant Matrices →).
- Quick checks: ( not a multiple of ); .
- Common mistakes: order instead of in the theorem; forgetting ; reducing the exponent modulo the wrong order (after a cancellation the order changes); using the summation lemma with as if it gave .