The Fourier Transform and the FFT
Any signal can be looked at in two completely equivalent ways. The time domain asks "what is the value at each instant?" The frequency domain asks "which oscillations, and how strong, add up to make this signal?" The Fourier transform is the exact dictionary that translates between the two, and the Fast Fourier Transform (FFT) is the algorithm that does the translation quickly enough to run on real data millions of times a second.
The one idea. Every signal is a sum of pure sine waves. The Fourier transform finds the recipe — the amplitude and phase of each sine wave needed to rebuild the signal. Reading that recipe is the frequency domain; the original wiggle is the time domain.
This note states the transform mathematically, then walks through the five textbook signals — impulse, step, ramp, cosine, sine — plotting each one in both domains so the pairing becomes visual, not just symbolic.
Two domains, one signal
Feeding a block of samples into the FFT returns, for each frequency bin, a complex number carrying two facts: a magnitude (how much of that frequency is present) and a phase (where in its cycle that wave sits). The pipeline is short:
The FFT is lossless and invertible: the inverse FFT turns the bins back into the exact original samples. Nothing is thrown away — the two domains are the same information wearing different clothes.
The mathematics
Continuous Fourier transform
For a continuous signal $x(t)$, the Fourier transform and its inverse are
The kernel $e^{-i2\pi f t} = \cos(2\pi f t) - i\sin(2\pi f t)$ is a pure oscillation at frequency $f$. The integral correlates the signal against that oscillation: if $x$ contains a component at $f$, the product stays in step and the integral is large; if it does not, the product averages to zero. Doing this for every $f$ sweeps out the whole spectrum.
The Discrete Fourier Transform (DFT)
Real data is a finite list of $N$ samples $x[0], x[1], \ldots, x[N-1]$, so the integral becomes a sum — the DFT:
Each output $X[k]$ measures how strongly the signal oscillates at bin $k$, which corresponds to a physical frequency
where $f_s$ is the sampling rate. Bin $k$ is simply "$k$ complete cycles across the window." Because our signals are real, the spectrum is conjugate-symmetric, $X[N-k] = \overline{X[k]}$, so the magnitude is mirror-symmetric and we only need to plot the lower half $k = 0, \ldots, N/2$ (the top being the Nyquist frequency).
What makes the FFT fast
Computed directly, Equation 2.2 costs $N$ multiply-adds for each of $N$ outputs — $O(N^2)$ work. The FFT (Cooley–Tukey) computes the identical numbers in $O(N\log N)$ by splitting the sum into even- and odd-indexed samples and reusing the shared pieces:
where $E$ and $O$ are half-length DFTs, each again split the same way. The factor $e^{-i2\pi k/N}$ is the twiddle factor, and the add/subtract pairing is the butterfly. For $N = 1024$ this is roughly a 100× speed-up; the FFT is what made frequency analysis practical. It changes the cost, not the result — every spectrum below is exactly what the DFT of Equation 2.2 produces.
Reading a magnitude spectrum
In the plots that follow, the left panel is the signal $x[n]$ in time, and the right panel is the magnitude spectrum $|X[k]|$. Writing $X[k] = |X[k]|\,e^{i\angle X[k]}$ splits each bin into magnitude (how much of that frequency) and phase (where in its cycle). Magnitude is what the eye reads first — a spike means a strong pure tone, a flat line means all frequencies are present equally, and a decaying curve means the energy is concentrated at low frequencies with a tail.
Examples in both domains
All examples use $N = 64$ samples. Watch a recurring theme: the more localized a signal is in one domain, the more spread out it is in the other.
Impulse
The unit impulse $\delta[n]$ is $1$ at a single instant and $0$ everywhere else — the most localized signal possible.
Time domain — $\delta[n]$
Frequency domain — $|X[k]|$ (flat)
A perfectly sharp event in time is maximally spread in frequency: to build an infinitely thin spike you need all frequencies, added in phase. This is the Fourier face of the uncertainty principle — you cannot be sharp in both domains at once.
Step
The step switches from $0$ to $1$ and stays there. Its single sharp edge is what matters.
Time domain — $u[n]$
Frequency domain — $|X[k]|$ ($1/f$ tail)
The tall bar at $k=0$ is the DC term — the signal's average. The slowly decaying tail says a step still needs plenty of high frequencies to render its edge sharply; cut them off and the edge overshoots and rings.
Ramp
A ramp rises linearly across the window — like one tooth of a sawtooth.
Time domain — $r[n]$
Frequency domain — $|X[k]|$
Compared with the step, the ramp has no instantaneous jump, so its high-frequency tail is weaker: smoother in time ⇒ less high-frequency content. Sharpness costs high frequencies.
Cosine
Now a pure tone — a cosine at exactly $f_0 = 6$ cycles per window.
Time domain — $\cos(2\pi\cdot 6\,n/N)$
Frequency domain — spike at $k=6$
A never-ending pure oscillation is the exact opposite of the impulse: perfectly spread in time, perfectly localized in frequency. All of its energy lives in one bin.
Sine
The same frequency as the cosine, but a sine — shifted by a quarter cycle.
Time domain — $\sin(2\pi\cdot 6\,n/N)$
Frequency domain — spike at $k=6$
This is the crucial subtlety of the magnitude spectrum: sine and cosine look different in time yet have the same magnitude spectrum. Their entire difference — the $90^\circ$ shift — lives in the phase, $\angle X[k]$, which the magnitude plot throws away. Magnitude tells you which frequencies; phase tells you how they line up.
Putting it together: superposition
The Fourier transform is linear: the transform of a sum is the sum of the transforms. So a signal built from several tones shows one spike per tone — and the FFT pulls them apart cleanly. Below, $x[n] = \sin(2\pi\cdot 6\, n/N) + \tfrac{1}{2}\sin(2\pi\cdot 15\, n/N)$.
Time domain — sum of two sines
Frequency domain — two spikes
The tangled time-domain wiggle looks complicated, but the spectrum is obvious: two lines, at the two frequencies present, with heights in the ratio $2:1$ matching their amplitudes. Turning a hard time-domain problem into an easy frequency-domain one is the whole point of the FFT.
Summary of transform pairs
| Signal (time) | Spectrum (frequency) | Fingerprint |
|---|---|---|
| Impulse $\delta[n]$ | $X[k] = 1$ | Flat — all frequencies equally |
| Constant / step edge | DC spike $+\ 1/f$ tail | Low frequencies dominate; slow tail |
| Ramp $n$ | DC $+\ 1/f^2$-ish decay | Low frequencies; faster roll-off |
| Cosine $\cos(2\pi f_0 t)$ | $\tfrac12[\delta(f{-}f_0)+\delta(f{+}f_0)]$ | Single spike at $f_0$ |
| Sine $\sin(2\pi f_0 t)$ | $\tfrac{1}{2i}[\delta(f{-}f_0)-\delta(f{+}f_0)]$ | Single spike at $f_0$ (differs in phase) |
| Sum of tones | $\sum$ of spikes | One line per tone (linearity) |
Two threads run through every example. First, duality: sharp in time ⇔ broad in frequency, and vice versa (impulse vs. cosine are the extremes). Second, linearity: complicated signals are just sums of simple tones, and the FFT reads off that recipe in $O(N\log N)$ time — which is why it is one of the most widely used algorithms ever written.