The direct DFT
Our signal is a pulse of N = 8 samples. Each output X[k] multiplies all 8 samples by a twiddle factor W^(nk) and adds them up. Eight outputs × eight products = 64 multiplications.
Divide and conquer
Sort the samples: the even ones x[0], x[2], x[4], x[6] go left, the odd ones go right. Each half has its own 4-point DFT, E[k] and O[k]. Then X[k] = E[k] + W^k·O[k].
Split each half the same way, and again, until each group holds one sample. A 1-point DFT is just the sample. The order 0, 4, 2, 6, 1, 5, 3, 7 is bit-reversed: 1 = 001 becomes 100 = 4.
Butterflies, stage by stage
The building block is the butterfly. It takes two numbers a and b, multiplies b by one twiddle factor W, and outputs a + W·b and a − W·b: one multiplication, two additions. Here a = 1, b = 0, W = 1.
Stage 1 runs four butterflies on neighbouring pairs, all with W = 1. Each pair of samples becomes its own 2-point DFT. Every cell of the next row now holds 1.
Stage 2 pairs cells two apart and joins the 2-point DFTs into 4-point DFTs. Now W changes: 1 for the first pair, W² = −j (a quarter turn) for the second. Complex numbers appear: 1 − j.
Stage 3 pairs cells four apart, with W⁰, W¹, W², W³. This is X[k] = E[k] ± W^k·O[k] from the split. W¹ = 0.71−0.71j, so X[1] = 1−2.41j.
The payoff
The bottom row holds X[k] in natural order, k = 0 to 7, exactly what the 64-multiplication sum gives. Its sizes |X[k]| are samples of the pulse's smooth DTFT, taken at ω = 2πk/8.
3 stages × 4 butterflies = 12 multiplications instead of 64. In general (N/2)·log2 N instead of N². For N = 1024 that is 5,120 instead of 1,048,576: about 205 times fewer.
In Python, np.fft.fft(x) runs a fast algorithm like this one and returns the same eight X[k]. Its documentation says it is most efficient when N is a power of 2.
The working
# step 1/10 · direct X[k] = Σ x[n]·W^(nk), n = 0 .. 7 W = e^(−j2π/8) (a turn of 1/8 circle) x = [1, 1, 1, 1, 0, 0, 0, 0] one X[k]: 8 multiplications 8 outputs: 8 × 8 = 64 N samples cost N² multiplications. N = 1024 -> 1,048,576
Counts are complex multiplications, the usual measure (Oppenheim and Schafer, ch. 9). They include the trivial ones by 1 and −j; real programs skip those, so they do even less work. The direct DFT also needs N(N−1) additions; the FFT needs N·log2 N. Every value in the figure is computed from the model: the pulse x = [1, 1, 1, 1, 0, 0, 0, 0], the butterflies, and the direct sum, which agree to rounding.