Fourier Transform
What Is the Fourier Transform?
Joseph Fourier discovered in 1807 that any periodic signal can be decomposed into a sum of sine and cosine waves of different frequencies, amplitudes, and phases. The Fourier transform is the tool that performs this decomposition. It takes a signal in the time domain (amplitude vs. time) and converts it to the frequency domain (amplitude vs. frequency), revealing which frequencies are present and how strong each one is.
Select a preset waveform or draw your own signal on the top canvas. The middle canvas shows the frequency spectrum (which sine waves compose it), and the bottom canvas shows the individual components and their sum. Use the slider to control how many terms are used in the reconstruction.
How It Works
The Discrete Fourier Transform (DFT) takes N samples of a signal and produces N complex coefficients. Each coefficient X[k] represents a specific frequency component:
$$X[k] = \sum_{n=0}^{N-1} x[n] \cdot e^{-i2\pi kn/N}$$
The magnitude |X[k]| tells you how much of frequency k is present in the signal. The phase angle tells you the offset. The inverse transform reconstructs the signal by summing up sinusoids at each frequency, weighted by these coefficients:
$$x[n] = \frac{1}{N} \sum_{k=0}^{N-1} X[k] \cdot e^{i2\pi kn/N}$$
With all N terms, the reconstruction is perfect (the original signal, exactly). With fewer terms, you get an approximation that captures the dominant frequencies first. This is the basis of lossy compression: JPEG images and MP3 audio both work by computing a Fourier-like transform, discarding the small coefficients, and keeping only the ones that matter most.
What to Try
- Square wave: Select it and watch the reconstruction with 1, 3, 5, 10, 50 terms. The overshoots at the discontinuities never fully disappear—this is the Gibbs phenomenon.
- Sawtooth: Contains all harmonics (integer multiples of the fundamental frequency). More terms = closer approximation.
- Triangle: Contains only odd harmonics, and they decay as 1/n², so convergence is fast. Even a few terms give a good approximation.
- Two Frequencies: The spectrum shows two clean spikes. The signal is a sum of exactly two sine waves and the transform recovers them perfectly.
- Draw your own: Sketch any shape. The transform will find the best sinusoidal approximation. Sharp features require many high-frequency terms; smooth curves need very few.
Why It Matters
The Fourier transform is one of the most important mathematical tools ever invented. It is fundamental to:
- Audio: MP3, AAC, and all modern audio codecs use the Modified Discrete Cosine Transform (a variant of the DFT) to compress sound.
- Images: JPEG uses the Discrete Cosine Transform on 8×8 pixel blocks.
- Telecommunications: Wi-Fi, LTE, and 5G all use OFDM (Orthogonal Frequency Division Multiplexing), which is literally an inverse FFT at the transmitter and a forward FFT at the receiver.
- Physics: Quantum mechanics is formulated in terms of Fourier duals (position/momentum, time/energy). Heisenberg’s uncertainty principle is a direct consequence of Fourier analysis.
- Medical imaging: MRI machines measure frequency-domain data and use the inverse Fourier transform to reconstruct images of the body.