Given N samples x[0], x[1], …, x[N−1], the DFT produces N complex coefficients:
X[k] = Σₙ₌₀ᴺ⁻¹ x[n] · e^(−2πikn/N) k = 0 … N−1
In plain English: e^(−2πikn/N) is a point spinning at frequency k (it completes k full turns as n runs through the window). At every sample you multiply the signal by the spinning point and add the result. If the signal contains that frequency, the products line up and reinforce; if it does not, they cancel. This is a correlation, the same dot product similarity you met in Lesson 01 — now with complex arrows from Lesson 19.
Each coefficient carries exactly the three dials from chapter 01:
- X[0], the DC component: the phasor is the fixed point 1, so X[0] = Σx[n] — the sum of the samples, N times their mean. It is the constant offset of the signal.
- X[k] for 1 ≤ k ≤ N/2: amplitude |X[k]| and phase ∠X[k] of the sine that completes k cycles per window. Larger k means faster oscillation.
- X[N/2], the Nyquist bin: the fastest alternation N samples can represent: +, −, +, −.
- X[k] for k > N/2: negative frequencies. For a real-valued signal they are mirrors: X[N−k] = conj(X[k]). Only the first N/2 + 1 coefficients carry new information.
The squared magnitude P[k] = |X[k]|² is the power spectrum: how much energy sits at frequency k. The angle ∠X[k] is the phase spectrum: where that frequency’s sine starts. Most analysis tasks keep the power and throw the phase away — for [1, 2, 3, 4], P = [100, 8, 4, 8], and the Parseval check below shows those four numbers add up to the signal energy.
Exact example, N = 4. Take x = [1, 0, 0, 0]. Every phasor equals 1 at n = 0 and the other three samples are zero, so X[k] = 1 for all k: DFT([1, 0, 0, 0]) = [1, 1, 1, 1]. A spike contains every frequency in equal measure. Flip it around: x = [1, 1, 1, 1] gives X[0] = 4, and at k = 1 the four phasor values 1, −i, −1, i sum to zero (likewise for k = 2, 3), so DFT([1, 1, 1, 1]) = [4, 0, 0, 0] — a constant has energy only at DC. One more: x = [0, 1, 0, 0] makes X[k] = e^(−2πik/4), so DFT([0, 1, 0, 0]) = [1, −i, −1, i]; moving the spike by one sample rotated every coefficient by a quarter turn, and X[3] is the conjugate mirror of X[1].