For a length $N$ finite sequence $\{x[n]\}^{n-1}_{0}$, the Discrete Fourier Transform of the signal is a length N finite sequence $\{X[k]\}^{n-1}_{0}$ where

$X[k] = \sum_{n=0}^{N-1}{x[n]e^{-j\frac{2\pi}{N}kn}}$

One way to interpret the DFT is in terms of the Fourier series for a disrete periodic signal $\tilde{x}[n]=x[((n))_N]$ where the $((n))_N = n \mod N$. Recall that the coefficient of the kth term of the Fourier Series is

$a_k = \frac{1}{N}\sum_{n=0}^{N-1}{x[n]e^{-j\frac{2\pi}{N}kn}}$

Notice that the $a_k$ of the Fourier Series are the DFT values except scaled by a factor of $N$. In other words, if we extend a finite signal periodically, then the DFT and the DTFS are the same up to a constant scale factor. This gives an intuitive inverse DFT.

For a length N finite sequence $\{X[k]\}^{N-1}_{0}$ representing the DFT of a finite perioidc signal $\{x[n]\}^{N-1}_{0}$, the inverse DFT is given by

$x[n] = \frac{1}{N}\sum_{k=0}^{N-1}{X[k]e^{j\frac{2\pi}{N}kn}}$

Notice that the DFT and the IDFT are very similar in form. It turns out that the IDFT can be expressed as a DFT of $X^*[k]$. Namely

$IDFT\{X[k]\} = \frac{1}{N}DFT\{X^\star[k]\}^\star$

Further intuition for the DFT comes by relating it to the DTFT. Suppose we have a finite signal $x[n]$ which is $0$ for $n < 0$ and $n > N-1$. The DTFT of this signal is

$X(\omega) = \sum_{n=-\infty}^{\infty}{x[n]e^{-j\omega n}} = \sum_{n=0}^{N-1}{x[n]e^{-j\omega n}}$

Suppose we sample the DTFT at intervals of $\frac{2\pi}{N}k$, then the kth sample is given by

$X[k] = X\left(\frac{2\pi}{N}k\right) = \sum_{n=0}^{N-1}{x[n]e^{-j\frac{2\pi}{N}k n}}$

Thus we can think of the DFT as a $N$ evenly spaced samples of the DTFT. One important point to notice is that while the DTFT is often centered around 0 (meaning it is plotted over a range from $-\pi$ to $\pi$), because we are summing from 0 to N-1 in the DFT, the DFT coefficients are centered around $\pi$, and thus they are plotted on a range fo $[0, 2\pi - \frac{2\pi}{N}]$

$x[n]\circledast y[n] \leftrightarrow X[k]Y[k]$

$x[n]\circledast y[n] = \sum_{m=0}^{N-1}x[m]y[((n-m))_N]$

Because multiplying DFT coefficients performs a specific case of convolution, we can compute a linear convolution using the circular convolution. Suppose we have two finite signals $\{x[n]\}_0^{L-1}$ and $\{h[n]\}_0^{P-1}$ The linear convolution of these two signals will be length $L+P-1$, so in order to take an IDFT and get $L+P-1$ samples, we need to take at least $N\le L+P-1$ points.

Pad each vector to length $L+P-1$

If $N$ is smaller than $L-P+1$, the result is akin to aliasing in the time domain. To see why, consider that the DFT coefficients are essentially the DTFS coefficients of the periodic extension of $x[n]$ (denote $\tilde{x}[n]$).

$\tilde{x}[n]=\sum_{r=-\infty}^{\infty}x[n-rN]$

$Y(e^{j\omega})=X(e^{j\omega})H(e^{j\omega})$

$\tilde{y}[n] = \sum_{r=-\infty}^{\infty}y[n-rN].$

Notice that if $N$ is not large enough, then these copies will be overlapping (a.k.a aliasing). Since the DFT is just sampling the DTFT, the circular convolution will represent the true convolution so long as the copies don’t overlap.

In a discrete time system, the input signal might have a very long length, making it impractical to be stored in a computer’s memory or to compute the DFT of it all at once (especially if we have a real-time system). Thus to compute the output of a digital filter (with impulse response of length $P$), we need to compute the DFT in blocks shorter than the signal.

Decompose $x[n]$ into nonoverlapping segments of length $L$

$x[n] = \sum_{r}x_r[n] \qquad x_r[n] = \begin{cases} x[n] & rL \le n \le (r+1)L\\ 0 & \text{else}. \end{cases}$

$y[n] = x[n]*h[n]=\sum_r{x_r[n]*h[n]}.$

Zero pad $x_r[n]$ and $h[n]$ to length $N\ge L+P-1$ to prevent time-domain aliasing

The neighboring outputs overlap in the last $P-1$ points, so add the overlapping sections together to get the final output

Divide $x[n]$ into sections of length $L$ such that each section overlaps the previous by $P-1$ points

$x_r[n]=x[n+r(L-P+1)-P+1] \qquad 0 \le n \le L-1$

Zero pad $x_r[n]$ and $h[n]$ to length $N\ge L+P-1$ to prevent time domain aliasing.

The first $P-1$ samples of the output will be incorrect, so we can discard them.

$y[n]=\sum_{r=0}^{\infty}y_r[n-r(L-P+1)+P-1] \qquad y_r[n]= \begin{cases} x_r[n]*h[n] & P-1\le n \le L-1\\ 0 & \text{ else} \end{cases}$

The DFT gives us an easy way to do convolutions. Unfortunately naiively, computing it is an $O(N^2)$ operation because we must sum together $N$ elements to compute $N$ different coefficients. Thankfully, there is a fast algorithm which can compute the DFT in $O(N\log N)$ time so we can compute convolutions quickly.

The fast fourier transform is an algorithm which computes the DFT efficiently in $O(N\log N)$time.

The Nth roots of unity are the complex roots of $W_N^N=1$.

$W_N^k=e^{-j\frac{2\pi k}{N}}$

$W_N^{N-kn} = W_N^{-kn} = (W_N^{kn})^\star$

$W_{kn} = W_N^{k(n+N)} = W_N^{(k+N)n}$

When squared, the Nth roots of unity become the $\frac{N}{2}$th roots of unity.

Using Theorem 1, Theorem 2, Theorem 3, we can take two approaches to the FFT: decimation in time, which splits $x[n]$ into smaller subsequences, and decimation in frequency which splits $X[n]$ into smaller subsequences.

The idea here is too break $x[n]$ into smaller subsequences. We assume that $N$ is a power of 2 for simplicity.

$X[k]=\sum_{n=0}^{N-1}x[n]W_N^{kn} = \sum_{\text{n even}}x[n]W_N^{kn}+\sum_{\text{n odd}}x[n]W_N^{kn}$

We let $n=2r$ and $n=2r+1$.

$\begin{aligned} X[k] &= \sum_{r=0}^{\frac{N}{2}-1}x[2r]W_N^{2rk}+\sum_{r=0}^{\frac{N}{2}-1}x[2r+1]W_N^{k(2r+1)}\\ &= \sum_{r=0}^{\frac{N}{2}-1}x[2r]W_{\frac{N}{2}}^{rk}+W_N^k\sum_{r=0}^{\frac{N}{2}-1}x[2r+1]W_{\frac{N}{2}}^{kr}\\\end{aligned}$

$\begin{aligned} \therefore X[k] = G[k] + W_N^kH[k]\end{aligned}$

Both $G$ and $H$ are $\frac{N}{2}$ periodic, and notice that

$W_N^{k+\frac{N}{2}}=e^{-j\frac{2\pi}{N}(k+\frac{N}{2})}= -W_N^k.$

This means once we compute $G[k]$ and $H[k]$ we can compute $X[k]$ easily because

$X[k] = G[k]+W_N^kH[k]\qquad X\left[k+\frac{N}{2}\right]=G[k]-W_N^kH[k] \qquad \text{for }k\in\left[0, \frac{N}{2}\right)$

We can continue this relationship recursively downwards. Once we get too $N=2$, we can represet this as a simple **butterfly operation**:

$X[0] = x[0]+x[1] \qquad X[1] = x[0]-x[1].$

$\begin{aligned} X[2r] &= \sum_{n=0}^{\frac{N}{2}-1}x[n]W_N^{2rn}+\sum_{n=0}^{\frac{N}{2}-1}x\left[n+\frac{N}{2}\right]W_N^{2r\left(n+\frac{N}{2}\right)}=W_{\frac{N}{2}}^{rn}\sum_{n=0}^{\frac{N}{2}-1}\left(x[n]+x\left[n+\frac{N}{2}\right]\right)\\ X[2r+1] &= W_{\frac{N}{2}}^{rn}\sum_{n=0}^{\frac{N}{2}-1}\left(x[n]-x\left[n+\frac{N}{2}\right]\right)\end{aligned}$