Skip to content

DFT, IDFT, and the FFT

The discrete Fourier transform (DFT) converts a finite-length discrete-time sequence into a finite set of equally spaced frequency samples. For an NN-point sequence x[n]x[n],

The DFT treats the listed samples as one period of a sequence that repeats with period NN. This periodic-extension assumption is what later makes multiplication of DFTs correspond to circular rather than ordinary linear convolution.

If the time samples were obtained at sampling frequency FsF_s, adjacent DFT bins are separated by

Equivalently, bin kk samples normalized angular frequency

Ωk=2πkN(mod⁡2π),fk=kFsN(mod⁡Fs).\Omega_k=\frac{2\pi k}{N}\quad(\operatorname{mod}2\pi), \qquad f_k=\frac{kF_s}{N}\quad(\operatorname{mod}F_s).

Discrete-time frequency is periodic with period FsF_s, so the upper DFT bins represent negative frequencies. In signed-frequency order,

Thus k=0k=0 is DC, the lower nonzero bins represent positive frequencies, and the upper bins wrap around to negative frequencies. For even NN, bin k=N/2k=N/2 is the Nyquist-frequency bin at Fs/2F_s/2, equivalently −Fs/2-F_s/2; those two endpoints denote the same discrete-time frequency.

A centred or fftshift display merely rearranges the bins so that negative frequencies appear before DC and positive frequencies; it changes neither their values nor their physical interpretation. Also distinguish the grid spacing Fs/NF_s/N from resolving power: the former is set by transform length, whereas separation of nearby tones is governed by the nonzero record duration and its window.

Define the NNth-root-of-unity, or twiddle, factor

The transform can then be written as the matrix product

The rows of the DFT matrix are sampled complex sinusoids. Each row correlates the input samples with one frequency bin.

Let FN=[WNkn]k,n=0N−1\mathbf{F}_N=[W_N^{kn}]_{k,n=0}^{N-1}. Distinct basis sinusoids are orthogonal because

Thus the rows and columns have norm N\sqrt{N} and are mutually orthogonal. The normalized matrix FN/N\mathbf{F}_N/\sqrt{N} is unitary. This identity both explains the IDFT and supplies the short proof of Parseval’s theorem in the section.

The inverse DFT (IDFT) reconstructs the time-domain samples from the DFT coefficients:

The forward and inverse equations form the transform pair

x[n] ⟷ X[k].x[n]\ \longleftrightarrow\ X[k].

They differ in the sign of the exponential and in the factor 1/N1/N assigned to the inverse transform.

Let (q)N(q)_N mean qq reduced modulo NN, and suppose x[n]⟷X[k]x[n]\longleftrightarrow X[k].

  1. Linearity: For constants aa and bb,
ax1[n]+bx2[n]⟷aX1[k]+bX2[k].ax_1[n]+bx_2[n] \longleftrightarrow aX_1[k]+bX_2[k].

The spectrum of a weighted sum is the same weighted sum of the individual spectra.

  1. Periodicity: The frequency-domain sequence obeys
X[k+N]=X[k].X[k+N]=X[k].

Both the finite time sequence and its DFT are treated as one period of periodic sequences.

  1. Circular time shift: A shift by n0n_0 samples changes only spectral phase:
x[(n−n0)N]⟷e−j2πkn0/NX[k].x[(n-n_0)_N] \longleftrightarrow e^{-\mathrm{j}2\pi kn_0/N}X[k].
  1. Frequency shift: Multiplication by a DFT-bin complex exponential shifts the spectrum circularly by k0k_0 bins:
x[n]ej2πk0n/N⟷X[(k−k0)N].x[n]e^{\mathrm{j}2\pi k_0n/N} \longleftrightarrow X[(k-k_0)_N].
  1. Circular convolution: For an NN-point circular convolution,
x[n]⊛Nh[n]⟷X[k]H[k].x[n]\circledast_N h[n] \longleftrightarrow X[k]H[k].

This identity is the basis of fast convolution using the DFT or FFT.

  1. Conjugate symmetry: If x[n]x[n] is real, then
X[(−k)N]=X∗[k].X[(-k)_N]=X^*[k].

Consequently, the negative-frequency half is the complex conjugate of the positive-frequency half.

For a real input, X[0]X[0] is real and, when NN is even, X[N/2]X[N/2] is also real. Hence only ⌊N/2⌋+1\lfloor N/2\rfloor+1 bins are independent. Magnitude is circularly even and phase is circularly odd wherever the spectrum is nonzero. A real circularly even sequence has a real DFT; a real circularly odd sequence has a purely imaginary DFT, with zero DC and zero Nyquist value when the latter bin exists.

DFT pair for a constant four-sample sequence. Equal time samples produce a single nonzero DC coefficient; all nonzero-frequency roots of unity cancel.

DFT pair for a constant four-sample sequence. Equal time samples produce a single nonzero DC coefficient; all nonzero-frequency roots of unity cancel.

The fast Fourier transform (FFT) is an efficient algorithm for computing a DFT. It is not a different transform: its output is the same X[k]X[k] defined by the DFT equation, obtained by exploiting root-of-unity symmetries and repeated smaller transforms.

MethodComplex multiplicationsComplexity
Direct DFTapproximately N2N^2O(N2)O(N^2)
Radix-2 FFTapproximately N2log⁡2N\dfrac{N}{2}\log_2NO(Nlog⁡2N)O(N\log_2N)

Direct DFT and radix-2 FFT computational costs.

For large NN, the reduction from quadratic to nearly linear-logarithmic growth is substantial.

When NN is a power of two, divide the input into its even- and odd-indexed samples,

xe[r]=x[2r],xo[r]=x[2r+1],0≤r<N/2.x_e[r]=x[2r], \qquad x_o[r]=x[2r+1], \qquad 0\leq r<N/2.

Let E[k]E[k] and O[k]O[k] be the N/2N/2-point DFTs of these two subsequences. Splitting the original DFT sum yields

X[k]=∑r=0N/2−1x[2r]WN2rk+∑r=0N/2−1x[2r+1]WN(2r+1)k=∑r=0N/2−1x[2r]WN/2rk+WNk∑r=0N/2−1x[2r+1]WN/2rk=E[k]+WNkO[k].\begin{aligned} X[k] & =\sum_{r=0}^{N/2-1}x[2r]W_N^{2rk} +\sum_{r=0}^{N/2-1}x[2r+1]W_N^{(2r+1)k} \\ & =\sum_{r=0}^{N/2-1}x[2r]W_{N/2}^{rk} +W_N^k\sum_{r=0}^{N/2-1}x[2r+1]W_{N/2}^{rk} \\ & =E[k]+W_N^kO[k]. \end{aligned}

Because E[k]E[k] and O[k]O[k] are periodic with period N/2N/2 and WNk+N/2=−WNkW_N^{k+N/2}=-W_N^k, the second half of the transform is available from the same pair of smaller DFTs:

These sum-and-difference equations form one radix-2 butterfly.

Two common radix-2 organizations are decimation in time (DIT), which recursively splits the input samples, and decimation in frequency (DIF), which recursively splits the output-frequency bins. Both compute the same DFT and use the same basic butterfly arithmetic.

Radix-2 butterfly. One twiddle multiplication and a shared sum–difference pair produce two DFT outputs.

Radix-2 butterfly. One twiddle multiplication and a shared sum–difference pair produce two DFT outputs.

Each butterfly performs one complex multiplication by a twiddle factor, one addition, and one subtraction. A radix-2 FFT has log⁡2N\log_2N stages and N/2N/2 butterflies per stage, giving approximately

This replaces the approximately N2N^2 operations needed by direct DFT evaluation.

In a common in-place DIT implementation, the inputs are arranged in bit-reversed order and the outputs emerge in natural order. Bit reversal is an implementation arrangement, not a requirement of every FFT program; other memory layouts and DIF implementations place the permutation elsewhere.

For the four-point flow graph, reversing the two binary index bits gives

Natural indexBinary indexReversed index
00000000
11010122
22101011
33111133

so natural order 0,1,2,30,1,2,3 becomes the input order 0,2,1,30,2,1,3. In general, an N=2MN=2^M radix-2 transform reverses MM binary index bits.

Two-stage four-point decimation-in-time FFT. Bit-reversed inputs x(0), x(2), x(1), x(3) pass through two butterflies per stage and produce X(0), …, X(3) in natural order.

Two-stage four-point decimation-in-time FFT. Bit-reversed inputs x(0),x(2),x(1),x(3)x(0),x(2),x(1),x(3) pass through two butterflies per stage and produce X(0),…,X(3)X(0),\ldots,X(3) in natural order.

The DFT sees only a finite observation. If a conceptually longer sequence x∞[n]x_\infty[n] is observed through a length-LL window w[n]w[n], the analysed record is

xr[n]=x∞[n]w[n].x_r[n]=x_\infty[n]w[n].

Time-domain multiplication convolves the original spectrum with the window spectrum. For the rectangular window w[n]=1w[n]=1, 0≤n<L0\leq n<L, its DTFT is

with limiting value LL at Ω=0\Omega=0. The main lobe and sidelobes of this Dirichlet kernel spread a sinusoid into neighbouring DFT bins whenever its frequency is not exactly on the DFT grid. This spreading is spectral leakage; it is not frequency aliasing.

  • Coherent record: A bin-centred sinusoid completes an integer number of cycles in the record. With a rectangular window, its ideal spectrum falls on the corresponding conjugate bin pair.

  • Tapered windows: Hann, Hamming, and Blackman windows suppress sidelobes and help expose a weak tone near a strong one.

  • Resolution trade-off: Sidelobe suppression widens the main lobe. A window cannot simultaneously give the narrowest main lobe and the lowest leakage; a longer nonzero record is needed for better physical resolution.

  • Amplitude and noise scaling: A window changes tone amplitude and equivalent noise bandwidth. Correct a coherent tone by Gc=L−1∑n=0L−1w[n]G_c=L^{-1}\sum_{n=0}^{L-1}w[n], while PSD normalization depends on ∑n∣w[n]∣2\sum_n|w[n]|^2.

Appending zeros to the LL measured samples and taking an NzN_z-point DFT, Nz>LN_z>L, samples the same windowed-record DTFT on the denser grid Fs/NzF_s/N_z. This produces a smoother spectrum, facilitates peak interpolation, permits an efficient FFT length, and supplies the length needed for linear convolution.

FFT computation is central to spectrum analysis, OFDM communication systems, fast convolution, and audio and image processing.