Mathematics · Signal Processing · Physics
📅 Квітень 2026 ⏱ ≈ 15 хв читання 🎯 Intermediate

The Fourier Transform — Decomposing Everything Into Waves

The Fourier transform is arguably the most important mathematical tool in applied science. It reveals that any signal — a sound, an image, an electromagnetic wave, a sequence of stock prices — can be expressed as a sum (or integral) of sinusoids. From this single idea flows digital audio, JPEG compression, MRI imaging, X-ray crystallography, and GPS synchronization.

1. Fourier Series — Periodic Signals

Joseph Fourier's 1822 insight was that any periodic function f(t) with period T can be written as a sum of harmonically related sinusoids:

f(t) = a₀/2 + Σₙ₌₁^∞ [ aₙ cos(2πnt/T) + bₙ sin(2πnt/T) ] Coefficients: aₙ = (2/T) ∫₀ᵀ f(t) cos(2πnt/T) dt bₙ = (2/T) ∫₀ᵀ f(t) sin(2πnt/T) dt

Using Euler's formula e^{iθ} = cos θ + i sin θ, the series takes a compact complex exponential form:

f(t) = Σₙ₌₋∞^∞ cₙ · e^{i 2πnt/T} cₙ = (1/T) ∫₀ᵀ f(t) · e^{-i 2πnt/T} dt The complex coefficient cₙ encodes both amplitude and phase of the n-th harmonic.

A square wave, a sawtooth, or a triangular wave — each has a distinct Fourier series. Near sharp discontinuities, the partial sum overshoots by ~9%; this is the Gibbs phenomenon, which never fully disappears no matter how many terms are included.

Convergence: The Fourier series converges pointwise for piecewise-smooth functions. At a jump discontinuity it converges to the average of the left and right limits. This is why real-world audio compression artefacts ("ringing") appear near sharp transients.

2. The Continuous Fourier Transform

Extending to non-periodic signals — taking T → ∞ — yields the continuous Fourier transform F(ω):

F(ω) = ∫₋∞^∞ f(t) · e^{-iωt} dt (forward transform) f(t) = (1/2π) ∫₋∞^∞ F(ω) · e^{iωt} dω (inverse transform) Alternative convention uses frequency f (Hz) instead of ω (rad/s): F(f) = ∫₋∞^∞ f(t) · e^{-i 2πft} dt f(t) = ∫₋∞^∞ F(f) · e^{i 2πft} df

|F(f)|² is the power spectral density: how much power the signal carries per unit frequency. The total energy is preserved by Parseval's theorem:

Parseval: ∫|f(t)|² dt = ∫|F(f)|² df "Energy is the same in time domain and frequency domain."

3. Key Properties

The Fourier transform has elegant algebraic properties that make it the cornerstone of signal processing:

4. The Discrete Fourier Transform (DFT)

Real-world signals are sampled at discrete time steps. Given N samples x[0]…x[N-1] spaced Δt apart, the DFT produces N complex frequency bins X[0]…X[N-1]:

X[k] = Σₙ₌₀^{N-1} x[n] · e^{-i 2πkn/N} k = 0, 1, …, N-1 x[n] = (1/N) Σₖ₌₀^{N-1} X[k] · e^{i 2πkn/N} (inverse DFT) Physical frequency of bin k: fₖ = k / (N · Δt) Hz Nyquist frequency: f_max = 1 / (2Δt) — highest representable frequency

The DFT wraps around: bins k and k±N represent the same frequency. Bins 0 to N/2 cover 0 Hz to the Nyquist limit; bins N/2+1 to N-1 represent negative frequencies.

Aliasing: if the signal contains frequencies above the Nyquist limit (1/2Δt), they fold back and appear as lower-frequency artefacts. This is why audio recorders apply an anti-aliasing low-pass filter before sampling.

5. The Fast Fourier Transform (FFT)

The naive DFT requires O(N²) operations — too slow for N = 10⁶ or larger. The Cooley-Tukey FFT (1965) exploits the recursive structure of the DFT to compute it in O(N log₂ N).

The key insight: split the N-point DFT into two N/2-point DFTs applied to even-indexed and odd-indexed samples:

X[k] = E[k] + W_N^k · O[k] k = 0…N/2-1 X[k + N/2] = E[k] − W_N^k · O[k] W_N^k = e^{-i 2πk/N} (twiddle factor) E[k] = DFT{ x[0], x[2], x[4], … } (even) O[k] = DFT{ x[1], x[3], x[5], … } (odd) Applied recursively to N = 2^m: log₂N stages of N/2 butterflies each. Operations: N log₂N vs N² — at N = 10⁶: 20M vs 10¹²
// Radix-2 Cooley-Tukey FFT — O(N log N)
function fft(re, im) {
  const N = re.length;
  // Bit-reversal permutation
  for (let i = 1, j = 0; i < N; i++) {
    let bit = N >> 1;
    for (; j & bit; bit >>= 1) j ^= bit;
    j ^= bit;
    if (i < j) { [re[i], re[j]] = [re[j], re[i]]; [im[i], im[j]] = [im[j], im[i]]; }
  }
  // Butterfly stages
  for (let len = 2; len <= N; len <<= 1) {
    const ang = -2 * Math.PI / len;
    const wRe = Math.cos(ang), wIm = Math.sin(ang);
    for (let i = 0; i < N; i += len) {
      let curRe = 1, curIm = 0;
      for (let k = 0; k < len / 2; k++) {
        const u = re[i+k], v = im[i+k];
        const tRe = curRe*re[i+k+len/2] - curIm*im[i+k+len/2];
        const tIm = curRe*im[i+k+len/2] + curIm*re[i+k+len/2];
        re[i+k] = u + tRe; im[i+k] = v + tIm;
        re[i+k+len/2] = u - tRe; im[i+k+len/2] = v - tIm;
        const nr = curRe*wRe - curIm*wIm; curIm = curRe*wIm + curIm*wRe; curRe = nr;
      }
    }
  }
}

6. 2-D Fourier Transforms

Images are 2-D signals. The 2-D DFT applies 1-D DFTs first along rows, then along columns (separability):

F[u,v] = Σₘ Σₙ f[m,n] · e^{-i 2π(um/M + vn/N)} Low frequencies near center (u=0,v=0): overall brightness High frequencies at edges: fine detail, sharp edges, noise Filtering in frequency domain (multiply by H[u,v], then IFFT) is equivalent to convolving with the corresponding kernel h[m,n].

The 2-D FFT is used in:

7. Applications Across Science

Audio (MP3 / AAC)

Psychoacoustic models quantise frequency bins according to the masking threshold — sounds near a loud tone are inaudible to human ears and can be severely compressed. The convolution theorem allows fast FIR filtering for equalization and reverb.

Telecommunications (OFDM)

Orthogonal Frequency-Division Multiplexing divides bandwidth into many subcarriers — each modulated separately. The IFFT converts frequency-domain data to a time-domain waveform at the transmitter; the receiver applies the FFT to recover the data. Used in WiFi (802.11), LTE, 5G, and digital TV (DVB-T).

Crystallography

X-ray diffraction from a crystal measures the magnitude (but not phase) of its 3-D Fourier transform. The "phase problem" — determining the missing phase information — occupied crystallographers for decades. Modern ab initio methods solve structures with ~10,000 atoms.

Partial Differential Equations

The heat equation ∂u/∂t = α ∇²u transforms to dU/dt = −α ω² U — a simple first-order ODE in frequency space with solution U(ω,t) = U(ω,0) e^{−αω²t}. Higher-frequency components decay faster — physical heat smoothing captured in one line of math.

Quantum Mechanics

Position and momentum wavefunctions are Fourier transform pairs. The uncertainty principle Δx·Δp ≥ ℏ/2 is an instance of the time-frequency uncertainty principle — a purely mathematical property of the Fourier transform.

Numerical convolution via FFT: to convolve two length-N sequences naively takes O(N²) multiplications. Via FFT: two forward transforms (N log N each) + pointwise multiplication (N) + inverse FFT (N log N) = O(N log N). For N = 10⁶ this is a factor of ~50,000 speedup.
〰️ Open Fourier Transform Simulation →