###### What’s the Fourier Transform?

Given a signal, the Fourier Transform returns the frequencies that make up the signal. The signal can either be continuous or sampled; the equation for the Fourier Transform differs slightly between the two. In this article, the Discrete Fourier Transform will be discussed, but the same ideas can be applied to the continuous version as well.

###### How does the algorithm do it, and what do the results mean?

The Discrete Fourier Transform for a series of complex numbers for is defined as

Each represents a different frequency (the relation between and its frequency will be discussed soon). From Euler’s formula, we know that , where is the imaginary unit.

- As goes from to , completes almost full cycles around the complex unit circle defined by Euler’s formula, each cycle being radians, or 360 degrees
- The summation is attempting to calculate how well the signal correlates with a sinusoidal signal, the frequency of which is the one associated with

The Fourier Transform is a **complex** operation. Looking back at Euler’s formula, the imaginary part comes from instead of , but the difference between the two is a phase shift. If a signal correlates completely with cosine, the result will be real. For sine, it will be completely imaginary. If it’s complex, the phase shift of the signal with respect to cosine is something else. The phase shift in all cases can be calculated by looking back once again at Euler’s formula.

The diagram makes it clear that a signal that correlates exactly with cosine will have a phase shift of 0 or , depending on the sign of the signal. For sine, it’s . The phase shift in general can be calculated by

###### How does relate to the time-domain frequency?

Because of the Nyquist sampling theorem, the frequency components of a signal sampled at a frequency of can be determined only for frequencies between 0 and , not including the frequency . Frequencies higher than this range will be aliased and associated with a frequency inside that range.

Here is an example where a sinusoidal signal is being sampled at twice its frequency, but at two different offsets. Sample 1 uniquely determines the frequency of the signal. But sample 2 cannot, and this shows that a signal with a frequency cannot be distinguished from a zero-frequency signal under this special circumstance.

The -length array that the Fourier Transform returns represents evenly-spaced frequency buckets from 0 to , excluding . Thus

where is the frequency of the th bucket, is the sampling rate, and is the length of the sample, and goes from 0 to .

If there was a bucket that represented the Nyquist frequency, , that means and you would see that

which is another way of looking at this aliasing condition.

#### Fast Fourier Transform

The Fast Fourier Transform (FFT) is any algorithm that has a better algorithmic complexity than the naive DFT algorithm, which is . The most used FFT algorithm is the Cooley-Tukey algorithm, which makes use of symmetry between a FFT of points, and the result of splitting those points into an ‘even’ and ‘odd’ group and running FFTs on those, preventing recalculations.

The first summation contains the signal at even indices, and the second summation contains the signal at odd indices, thus ‘even’ and ‘odd’ groups.

These two summations are just FFTs on the even-indexed and odd-indexed elements of , here denoted as and respectively.

where represents the th element of the FFT of . The length of the FFT equals the length of the input matrix, but may be greater than the length of or , but there is a relation here that solves this issue.

For example, for a 1024-point FFT, first the FFT of the 0th, 2nd, 4th, … 1023rd points are calculated, as well as the FFT of the 1st, 3rd, 5th, …, 1022nd points. Let these be and respectively. The 11th element (at index 10) in the 1024-point FFT will be

It can be seen that a FFT can be broken down into two FFTs, each half the size, and the results added and multiplied with factors of (called twiddle factors). But these FFTs can be continuously broken down until they’re each size one, at which point the result is just the input. To rebuild the size FFT, each ‘odd’ element is multiplied by the twiddle factor and added to its ‘even’ counterpart, taking . There are steps here, so the total runtime is .

The efficiency comes from reuse of calculations that affect multiple elements in .