Since the input function is a finite sequence of real or complex numbers, the DFT is ideal for processing information stored in computers. In particular, the DFT is widely employed in signal processing and related fields to analyze the frequencies contained in a sampled signal, to solve partial differential equations, and to perform other operations such as convolutions. The DFT can be computed efficiently in practice using a fast Fourier transform (FFT) algorithm.
Since FFT algorithms are so commonly employed to compute the DFT, the two terms are often used interchangeably in colloquial settings, although there is a clear distinction: "DFT" refers to a mathematical transformation, regardless of how it is computed, while "FFT" refers to any one of several efficient algorithms for the DFT. This distinction is further blurred, however, by the synonym finite Fourier transform for the DFT, which apparently predates the term "fast Fourier transform" (Cooley et al., 1969) but has the same initialism.
The transform is sometimes denoted by the symbol , as in or or .
The inverse discrete Fourier transform (IDFT) is given by
A simple description of these equations is that the complex numbers represent the amplitude and phase of the different sinusoidal components of the input "signal" . The DFT computes the from the , while the IDFT shows how to compute the as a sum of sinusoidal components with frequency cycles per sample. By writing the equations in this form, we are making extensive use of Euler's formula to express sinusoids in terms of complex exponentials, which are much easier to manipulate. (In the same way, by writing in polar form, we immediately obtain the sinusoid amplitude from and the phase from the complex argument.) An important subtlety of this representation, aliasing, is discussed below.
Note that the normalization factor multiplying the DFT and IDFT (here 1 and 1/N) and the signs of the exponents are merely conventions, and differ in some treatments. The only requirements of these conventions are that the DFT and IDFT have opposite-sign exponents and that the product of their normalization factors be 1/N. A normalization of for both the DFT and IDFT makes the transforms unitary, which has some theoretical advantages, but it is often more practical in numerical computation to perform the scaling all at once as above (and a unit scaling can be convenient in other ways).
(The convention of a negative sign in the exponent is often convenient because it means that is the amplitude of a "positive frequency" . Equivalently, the DFT is often thought of as a matched filter: when looking for a frequency of +1, one correlates the incoming signal with a frequency of −1.)
In the following discussion the terms "sequence" and "vector" will be considered interchangeable.
with denoting the set of complex numbers. In other words, for any N > 0, an N-dimensional complex vector has a DFT and an IDFT which are in turn N-dimensional complex vectors.
where is the Kronecker delta. This orthogonality condition can be used to derive the formula for the IDFT from the definition of the DFT, and is equivalent to the unitarity property below.
where the star denotes complex conjugation. Parseval's theorem is a special case of the Plancherel theorem and states:
These theorems are also equivalent to the unitary condition below.
If the expression that defines the DFT is evaluated for all integers instead of just for , then the resulting infinite sequence is a periodic extension of the DFT, periodic with period N.
The periodicity can be shown directly from the definition:
where we have used the fact that . In the same way it can be shown that the IDFT formula leads to a periodic extension.
The convolution theorem for the continuous and discrete time Fourier transforms indicates that a convolution of two infinite sequences can be obtained as the inverse transform of the product of the individual transforms. With sequences and transforms of length N, a circularity arises:
&= frac{1}{N} sum_{k=0}^{N-1} left(sum_{l=0}^{N-1} x_l e^{-frac{2 pi i}{N} k l}right) cdot left(sum_{m=0}^{N-1} y_m e^{-frac{2 pi i}{N} k m}right) cdot e^{frac{2pi i}{N} k n}
&= sum_{l=0}^{N-1} x_l sum_{m=0}^{N-1} y_m left(frac{1}{N} sum_{k=0}^{N-1} e^{frac{2 pi i}{N} k (n-l-m)} right).
end{align}
The quantity in parentheses is 0 for all values of except those of the form , where is any integer. At those values, it is 1. It can therefore be replaced by an infinite sum of Kronecker delta functions, and we continue accordingly. Note that we can also extend the limits of to infinity, with the understanding that the and sequences are defined as 0 outside [0,N-1]:
&= sum_{l=0}^{N-1} x_l sum_{p=-infty}^{infty} left(sum_{m=-infty}^{infty} y_m cdot delta_{m(n-l-pN)}right)
&= sum_{l=0}^{N-1} x_l left(sum_{p=-infty}^{infty} y_{n-l-pN}right) stackrel{mathrm{def}}{=} (mathbf{x * y_N})_n ,
end{align}
which is the convolution of the sequence with a periodically extended sequence defined by:
Similarly, it can be shown that:
which is the cross-correlation of and
A direct evaluation of the convolution or correlation summation (above) requires operations for an output sequence of length N. An indirect method, using transforms, can take advantage of the efficiency of the fast Fourier transform (FFT) to achieve much better performance. Furthermore, convolutions can be used to efficiently compute DFTs via Rader's FFT algorithm and Bluestein's FFT algorithm.
Methods have also been developed to use circular convolution as part of an efficient process that achieves normal (non-circular) convolution with an or sequence potentially much longer than the practical transform size (N). Two such methods are called overlap-save and overlap-add.
For even , notice that the Nyquist component is handled specially.
This interpolation is not unique: aliasing implies that one could add N to any of the complex-sinusoid frequencies (e.g. changing to ) without changing the interpolation property, but giving different values in between the points. The choice above, however, is typical because it has two useful properties. First, it consists of sinusoids whose frequencies have the smallest possible magnitudes, and therefore minimizes the mean-square slope of the interpolating function. Second, if the are real numbers, then is real as well.
In contrast, the most obvious trigonometric interpolation polynomial is the one in which the frequencies range from 0 to (instead of roughly to as above), similar to the inverse DFT formula. This interpolation does not minimize the slope, and is not generally real-valued for real ; its use is a common mistake.
vdots & vdots & ddots & vdotsomega_N^{(N-1) cdot 0} & omega_N^{(N-1) cdot 1} & ldots & omega_N^{(N-1) cdot (N-1)} end{bmatrix}
where
is a primitive Nth root of unity. The inverse transform is then given by the inverse of the above matrix:
With unitary normalization constants , the DFT becomes a unitary transformation, defined by a unitary matrix:
where det() is the determinant function. The determinant is the product of the eigenvalues, which are always or as described below. In a real vector space, a unitary transformation can be thought of as simply a rigid rotation of the coordinate system, and all of the properties of a rigid rotation can be found in the unitary DFT.
The orthogonality of the DFT is now expressed as an orthonormality condition (which arises in many areas of mathematics as described in root of unity):
If is defined as the unitary DFT of the vector then
and the Plancherel theorem is expressed as:
If we view the DFT as just a coordinate transformation which simply specifies the components of a vector in a new coordinate system, then the above is just the statement that the dot product of two vectors is preserved under a unitary DFT transformation. For the special case , this implies that the length of a vector is preserved as well—this is just Parseval's theorem:
First, we can compute the inverse DFT by reversing the inputs:
(As usual, the subscripts are interpreted modulo ; thus, for , we have .)
Second, one can also conjugate the inputs and outputs:
Third, a variant of this conjugation trick, which is sometimes preferable because it requires no modification of the data values, involves swapping real and imaginary parts (which can be done on a computer simply by modifying pointers). Define swap() as with its real and imaginary parts swapped—that is, if then swap() is . Equivalently, swap() equals . Then
That is, the inverse transform is the same as the forward transform with the real and imaginary parts swapped for both input and output, up to a normalization (Duhamel et al., 1988).
The conjugation trick can also be used to define a new transform, closely related to the DFT, that is involutary—that is, which is its own inverse. In particular, is clearly its own inverse: . A closely related involutary transformation (by a factor of (1+i) /√2) is , since the factors in cancel the 2. For real inputs , the real part of is none other than the discrete Hartley transform, which is also involutary.
The eigenvalues of the DFT matrix are simple and well-known, whereas the eigenvectors are complicated, not unique, and are the subject of ongoing research.
Consider the unitary form defined above for the DFT of length , where . This matrix satisfies the equation:
Since there are only four distinct eigenvalues for this matrix, they have some multiplicity. The multiplicity gives the number of linearly independent eigenvectors corresponding to each eigenvalue. (Note that there are N independent eigenvectors; a unitary matrix is never defective.)
The problem of their multiplicity was solved by McClellan and Parks (1972), although it was later shown to have been equivalent to a problem solved by Gauss (Dickinson and Steiglitz, 1982). The multiplicity depends on the value of modulo 4, and is given by the following table:
| size N | λ = +1 | λ = −1 | λ = -i | λ = +i |
|---|---|---|---|---|
| 4m | m + 1 | m | m | m − 1 |
| 4m + 1 | m + 1 | m | m | m |
| 4m + 2 | m + 1 | m + 1 | m | m |
| 4m + 3 | m + 1 | m + 1 | m + 1 | m |
Unfortunately, no simple analytical formula for the eigenvectors is known. Moreover, the eigenvectors are not unique because any linear combination of eigenvectors for the same eigenvalue is also an eigenvector for that eigenvalue. Various researchers have proposed different choices of eigenvectors, selected to satisfy useful properties like orthogonality and to have "simple" forms (e.g., McClellan and Parks, 1972; Dickinson and Steiglitz, 1982; Grünbaum, 1982; Atakishiyev and Wolf, 1997; Candan et al., 2000; Hanna et al., 2004; Gurevich and Hadani, 2008).
The choice of eigenvectors of the DFT matrix has become important in recent years in order to define a discrete analogue of the fractional Fourier transform—the DFT matrix can be taken to fractional powers by exponentiating the eigenvalues (e.g., Rubio and Santhanam, 2005). For the continuous Fourier transform, the natural orthogonal eigenfunctions are the Hermite functions, so various discrete analogues of these have been employed as the eigenvectors of the DFT, such as the Kravchuk polynomials (Atakishiyev and Wolf, 1997). The "best" choice of eigenvectors to define a fractional discrete Fourier transform remains an open question, however.
where the star denotes complex conjugation and the subscripts are interpreted modulo N.
Therefore, the DFT output for real inputs is half redundant, and one obtains the complete information by only looking at roughly half of the outputs . In this case, the "DC" element is purely real, and for even N the "Nyquist" element is also real, so there are exactly N non-redundant real numbers in the first half + Nyquist element of the complex output X.
Using Euler's formula, the interpolating trigonometric polynomial can then be interpreted as a sum of sine and cosine functions.
Most often, shifts of (half a sample) are used. While the ordinary DFT corresponds to a periodic signal in both time and frequency domains, produces a signal that is anti-periodic in frequency domain () and vice-versa for . Thus, the specific case of is known as an odd-time odd-frequency discrete Fourier transform (or O2 DFT). Such shifted transforms are most often used for symmetric data, to represent different boundary symmetries, and for real-symmetric data they correspond to different forms of the discrete cosine and sine transforms.
Another interesting choice is , which is called the centered DFT (or CDFT). The centered DFT has the useful property that, when is a multiple of four, all four of its eigenvalues (see above) have equal multiplicities (Rubio and Santhanam, 2005).
The discrete Fourier transform can be viewed as a special case of the z-transform, evaluated on the unit circle in the complex plane; more general z-transforms correspond to complex shifts a and b above.
where as above and the output indices run from . This is more compactly expressed in vector notation, where we define and as -dimensional vectors of indices from 0 to , which we define as :
where the division is defined as to be performed element-wise, and the sum denotes the set of nested summations above.
The inverse of the multi-dimensional DFT is, analogous to the one-dimensional case, given by:
The multidimensional DFT has a simple interpretation. Just as the one-dimensional DFT expresses the input as a superposition of sinusoids, the multidimensional DFT expresses the input as a superposition of plane waves, or sinusoids oscillating along the direction in space and having amplitude . Such a decomposition is of great importance for everything from digital image processing (d = 2) to solving partial differential equations in three dimensions (d = 3) by breaking the solution up into plane waves.
Computationally, the multidimensional DFT is simply the composition of a sequence of one-dimensional DFTs along each dimension. For example, in the two-dimensional case one can first compute the independent DFTs of the rows (i.e., along ) to form a new array , and then compute the independent DFTs of along the columns (along ) to form the final result . Or, one can transform the columns and then the rows—the order is immaterial because the nested summations above commute.
Because of this, given a way to compute a one-dimensional DFT (e.g. an ordinary one-dimensional FFT algorithm), one immediately has a way to efficiently compute the multidimensional DFT. This is known as a row-column algorithm, although there are also intrinsically multidimensional FFT algorithms.
where the star denotes complex conjugation and the -th subscript is interpreted modulo (for ).
A final source of distortion (or perhaps illusion) is the DFT itself, because it is just a discrete sampling of the DTFT, which is a function of a continuous frequency domain. That can be mitigated by increasing the resolution of the DFT. That procedure is illustrated in the discrete-time Fourier transform article.
Suppose we wish to compute the polynomial product c(x) = a(x) · b(x). The ordinary product expression for the coefficients of c involves a linear (acyclic) convolution, where indices do not "wrap around." This can be rewritten as a cyclic convolution by taking the coefficient vectors for a(x) and b(x) with constant term first, then appending zeros so that the resultant coefficient vectors a and b have dimension d > deg(a(x)) + deg(b(x)). Then,
Where c is the vector of coefficients for c(x), and the convolution operator is defined so
But convolution becomes multiplication under the DFT:
Here the vector product is taken elementwise. Thus the coefficients of the product polynomial c(x) are just the terms 0, ..., deg(a(x)) + deg(b(x)) of the coefficient vector
With a Fast Fourier transform, the resulting algorithm takes O (N log N) arithmetic operations. Due to its simplicity and speed, the Cooley-Tukey FFT algorithm, which is limited to composite sizes, is often chosen for the transform operation. In this case, d should be chosen as the smallest integer greater than the sum of the input polynomial degrees that is factorizable into small prime factors (e.g. 2, 3, and 5, depending upon the FFT implementation).
The fastest known algorithms for the multiplication of very large integers use the polynomial multiplication method outlined above. Integers can be treated as the value of a polynomial evaluated specifically at the number base, with the coefficients of the polynomial corresponding to the digits in that base. After polynomial multiplication, a relatively low-complexity carry-propagation step completes the multiplication.
| Note | ||
|---|---|---|
| Shift theorem | ||
| Real DFT | ||
| from the geometric progression formula | ||
| from the binomial theorem | ||
| is a rectangular window function of points centered on , where is an odd integer, and is a sinc-like function |
Many of the properties of the DFT only depend on the fact that is a primitive root of unity, sometimes denoted or (so that ). Such properties include the completeness, orthogonality, Plancherel/Parseval, periodicity, shift, convolution, and unitarity properties above, as well as many FFT algorithms. For this reason, the discrete Fourier transform can be defined by using roots of unity in fields other than the complex numbers; for more information, see discrete Fourier transform (general).
The standard DFT acts on a sequence x0, x1, …, xN−1 of complex numbers, which can be viewed as a function {0, 1, …, N − 1} → C. The multidimensional DFT acts on multidimensional sequences, which can be viewed as functions