1. Home
  2. Explore
  3. Computer Science
  4. Fast Fourier Transform

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Fast Fourier Transform

The Fast Fourier Transform (FFT): History, Mathematics, and Impact

The FFT is the most important numerical algorithm of our lifetime. — Gilbert Strang

The Fast Fourier Transform (FFT) is a foundational algorithm in signal processing, computing, and scientific analysis. Its origins are deeply tied to Cold War efforts to detect covert nuclear weapons tests, and its modern applications range from image compression to WiFi and 5G.


Historical Background: The Nuclear Test Ban Problem

The Baruch Plan and the Arms Race

Following the atomic bombings of Hiroshima and Nagasaki, it was clear that nuclear weapons represented an unprecedented leap in destructive power—a thousand times more energy than the largest conventional explosive.

The United States initially recognized that it would not hold a nuclear monopoly for long. The Baruch Plan proposed that the US would decommission its entire nuclear arsenal if all other nations pledged never to develop nuclear weapons. The plan called for an international body to control all radioactive materials, from mining to refining, limiting their use to peaceful purposes like power generation.

The Soviet Union rejected the Baruch Plan, viewing it as an American tactic to maintain nuclear dominance. This rejection launched the global nuclear arms race.

The Challenge of Verification

As nuclear testing accelerated, most tests occurred in remote locations (the Arctic, South Pacific islands, and the Nevada desert). The US developed thermonuclear weapons (hydrogen bombs), which combined fission and fusion to release energy a thousand times greater than the first atomic bombs.

In 1954, the Castle Bravo test at Bikini Atoll demonstrated the dangers of unverified testing. The device (code-named "Shrimp") used lithium deuteride as fuel and was expected to yield 6 megatons. Due to unanticipated reactions with lithium-7, it released 15 megatons—2.5 times the expected yield. Radioactive material rained over a much larger area than planned:

  • Residents of neighboring atolls were evacuated three days later, already suffering from radiation sickness

  • The 23 crew members of the Japanese fishing boat Lucky Dragon were caught in radioactive white ash and developed acute radiation syndrome; one died six months later

These events triggered global public outcry. The modern peace sign was designed in the 1950s by combining the semaphore letters for N and D (nuclear disarmament). World leaders called for a comprehensive test ban.

The 1963 Partial Test Ban Treaty

Nuclear powers entered negotiations in Geneva in 1958. To demonstrate seriousness, all testing stopped during negotiations—making 1959 the only year in decades with no nuclear detonations.

The central obstacle to a comprehensive test ban was verification: how could nations ensure compliance?

  • Atmospheric tests: Easy to detect — radioactive isotopes disperse globally

  • Underwater tests: Detectable by hydrophones — distinctive sounds travel efficiently below the ocean surface

  • Underground tests: Extremely difficult to detect from afar — radiation is mostly contained

The Soviet Union refused to allow onsite inspections, regarding them as espionage. Consequently, the 1963 treaty was only a partial test ban—prohibiting tests in the atmosphere, underwater, and space—but not underground, precisely because compliance was nearly impossible to verify.


The Mathematical Solution: The Fourier Transform

Decomposing Signals into Sine Waves

A Fourier transform decomposes any signal into pure sine waves, each with its own amplitude and frequency. The sum of sine waves can look arbitrarily complex, yet the transform reveals the underlying components.

Frequency detection via correlation: If a signal is multiplied by a sine wave of a specific frequency and the area under the resulting curve is summed:

  • If the test frequency does not match any component in the signal → the product oscillates evenly above and below the x-axis → the net area is zero

  • If the test frequency exactly matches a signal component → the waves are correlated → the product is always positive → the net area is non-zero

The size of this non-zero area reveals the amplitude of that frequency component in the original signal. This process must be repeated for all possible frequencies to obtain the full frequency spectrum.

Correlation with Sine, Cosine, and Phase

A full Fourier transform requires analyzing both sine and cosine components because:

  • If the signal is a pure cosine wave and it is multiplied by a sine wave of the same frequency, the area under the curve is zero

  • For each frequency, the signal must be multiplied by both a sine wave and a cosine wave

  • The ratio of the cosine amplitude to the sine amplitude indicates the phase (how much the signal is shifted left or right)

Euler's Formula Representation

Using Euler's formula, the sine and cosine components can be handled in a single operation:

eiθ=cos⁡θ+isin⁡θe^{i\theta} = \cos\theta + i\sin\thetaeiθ=cosθ+isinθ

The real part of the resulting complex sum gives the cosine amplitude, and the imaginary part gives the sine amplitude. This compact representation is standard in modern Fourier analysis.


From Theory to Practice: The Discrete Fourier Transform

Finite, Discrete Signals

Real-world signals differ from idealized infinite waves:

  • They are finite (limited duration)

  • They consist of individual samples (data points)

  • There is fundamental "graininess" to the data

A seismometer signal, for example, may look smooth but does not record ground motion with infinite precision. Because the signal is discrete and finite, the idealized continuous Fourier transform cannot be used. Instead, the Discrete Fourier Transform (DFT) must be performed.

Frequency Bins and Resolution

The DFT produces a frequency spectrum that is also discrete and finite. Frequencies fall into a finite number of bins:

  • The number and size of bins depend on the number of samples and how closely spaced they are

  • Wider sample spacing → lower maximum measurable frequency (cannot capture high-frequency oscillations)

  • Shorter signal duration → wider frequency bins (harder to distinguish similar frequencies) → lower frequency resolution

  • The lowest non-zero frequency that can be measured has a period equal to the total duration of the signal

  • Higher frequency bins are integer multiples of this fundamental frequency

  • The total number of frequency bins equals the number of samples (NNN)

The Computational Bottleneck (N2N^2N2)

To complete one DFT:

  • Each of NNN data points must be multiplied by NNN different frequency waves

  • This requires N2N^2N2 complex multiplications

For N=8N = 8N=8 samples, this is 64 multiplications—manageable. But for N=1,000,000N = 1,000,000N=1,000,000 samples:

  • N2=1012N^2 = 10^{12}N2=1012 calculations

  • On 1960s computers, this would take over three years for a single transform

Analyzing tens of seismic events per day from hundreds of seismometers was completely impractical with standard DFT, giving scientists strong motivation to find a faster method.


The Breakthrough: The Fast Fourier Transform (FFT)

The 1963 PSAC Meeting

At a meeting of the President's Science Advisory Committee in 1963, President John F. Kennedy was present alongside physicist Richard Garwin and mathematician John Tukey. While discussing the Apollo program and nuclear fallout shelters, Tukey appeared to be doodling—but was actually working on discrete Fourier transforms.

At the end of the meeting, Garwin asked Tukey what he had worked out. Tukey revealed he knew a way to compute discrete Fourier transforms with drastically fewer calculations:

  • A DFT requiring over three years could be completed in just 35 minutes

  • This became known as the Fast Fourier Transform (FFT)

Exploiting Symmetry to Eliminate Redundancy

The key insight of the FFT is that sinusoidal functions are periodic, causing significant overlap in the values of different frequency waves at the sample points.

Example with 8 samples: The DFT requires each data point to be multiplied by 8 different frequency waves (64 multiplications). However:

  • At the middle data point, all four odd frequencies have the same value, and all four even frequencies have the same value

  • Instead of 8 multiplications at this point, only 2 are needed

  • Similar duplication occurs at other data points, reducing 64 calculations to 24

The Power of Nlog⁡NN \log NNlogN

The improvement scales dramatically with data size:

Samples (NNN)

DFT Operations (N2N^2N2)

FFT Operations (Nlog⁡2NN \log_2 NNlog2​N)

Savings Factor

8

64

24

~2.7x

1,000

1,000,000

~10,000

100x

1,000,000

101210^{12}1012

~2×1072 \times 10^72×107

50,000x

How the FFT works step-by-step:

  1. Split the NNN samples into even-indexed and odd-indexed points

  2. Compare the first half of the frequencies to the second half

  3. Exploit the symmetry: values of sine waves for the even points are the same across frequency halves; values for the odd points are negatives (related by a complex number)

  4. Once the odd and even sums are calculated for the lower half of frequencies, these values can be reused for the upper half

  5. Repeat recursively: split samples again into even and odd points until only single data points remain

  6. At each split, symmetry cuts the number of calculations in half

This reduces the complexity from N2N^2N2 to Nlog⁡2NN \log_2 NNlog2​N.

Implementation and Timing

Garwin approached IBM researcher James Cooley to program the FFT algorithm. To maintain secrecy, he did not reveal the true purpose (detecting underground Soviet nuclear tests), instead claiming it was for calculating spins in a crystal of helium-3.

Cooley and Tukey published the algorithm in a seminal 1965 paper. Its use immediately exploded—but it was too late to secure a comprehensive nuclear test ban.

By the time the FFT was available, the UK, France, and China had joined the US and USSR as nuclear powers. The Partial Test Ban Treaty of 1963, far from de-escalating the arms race, simply drove it underground. The reasoning became: if only underground testing is allowed, extensive testing is necessary to avoid falling behind.

From 1963 onward, 1,500 nuclear weapons were detonated — roughly one per week for 30 years. At the peak in the mid-1980s, 70,000 nuclear warheads existed. Total expenditure on nuclear weapons in the 20th century is estimated at $10 trillion each for the US and Soviet Union (adjusted for inflation).

The Gauss Antecedent

Remarkably, the FFT was discovered 150 years earlier but forgotten. In 1805, mathematician Carl Friedrich Gauss was studying the newly discovered asteroids Pallas, Ceres, and Juno. While determining the orbit of Juno, Gauss developed a novel approach to harmonic analysis — the same Cooley-Tukey FFT algorithm.

Gauss never published this insight. He jotted it down in his notes and used a different method for the actual orbit calculation. His breakthrough appeared only after his death in Volume 3 of his collected works, written in:

  • Non-standard notation

  • 19th-century Latin

It went unnoticed. Had Gauss recognized the significance of his discovery and published it accessibly, the FFT might have transformed the world decades earlier.


Modern Applications of the FFT

Image Compression

The FFT is the basis for most modern compression algorithms, including those enabling video and audio streaming.

Process for 2D image compression:

  1. Take the pixel brightness values for each row of an image and perform an FFT

  2. This reveals the frequencies present in the brightness variations of the rows (brightness = magnitude; color = phase)

  3. Perform another FFT on the columns of pixels, yielding a 2D FFT of the entire image

  4. For real-world images, a large percentage of values in the transform are close to zero (especially high frequencies toward the edges of the transformed image)

  5. These near-zero values represent negligible information and can be discarded — as much as 99% of the data

  6. When the inverse transform is applied, the resulting image is a fairly good representation of the original

On modern computers, images are often stored as compressed 2D FFTs. When the user opens the image, the computer simply inverts the transform.

Additional Applications

  • Radar and sonar: Analyzing reflected signals to detect objects

  • WiFi and 5G: Encoding and decoding wireless signals

  • Solving differential equations: Converting complex calculus problems into simpler algebra

  • Studying crystal structures: Analyzing diffraction patterns

  • General signal processing: Filtering, compression, and feature extraction


Key Takeaways

  • The Discrete Fourier Transform (DFT) decomposes discrete signals into their frequency components but requires N2N^2N2 computations — prohibitively slow for large datasets

  • The Fast Fourier Transform (FFT) exploits the periodic symmetries of sinusoids to reduce computation to Nlog⁡2NN \log_2 NNlog2​N, creating savings that grow dramatically with data size

  • The FFT was discovered multiple times: by Gauss in 1805 (unpublished, in Latin), and independently by Cooley and Tukey in 1965

  • The primary motivation for the FFT was detecting underground nuclear tests during Cold War arms control negotiations

  • The algorithm arrived too late for a comprehensive test ban in 1963, contributing to 30 more years of underground nuclear testing and the accumulation of 70,000 warheads

  • Today, the FFT is embedded in virtually all digital signal processing: streaming video, wireless communication, radar, sonar, medical imaging, and scientific computing

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent