One product, used twice: the trick behind the FFT. Watch the dashed arrow give one output added and a second one flipped.
One product, two outputs
x = 1, 2, 0, −1, 0, 1, 2, 1. Even and odd samples, then two 4-point DFTs.
Eight samples. A direct DFT would take 8 × 8 = 64 multiplies.
Describe this picture
Two panels for : its even and odd samples, then two 4-point DFTs. The samples panel shows from −2 to 3 against the sample from 0 to 7. Even samples, , , , , are stems ending in dots, and odd samples, , , , , are stems ending in squares. The plane panel shows the real part from −4 to 7 against the imaginary part from −4 to 4, on the same scale. A solid arrow from the origin is . A dashed accent arrow from its tip is , and its end is marked with a ring labelled . The dashed arrow flipped, drawn dotted, ends at a square labelled . Finished outputs stay as faint rings and squares labelled to . The readouts are , which shows “not started” until the arrows begin, and the multiplies.
The clip has no control and lasts 16.5 seconds. It opens on eight samples, which then part into two rows of four; the multiplies readout shows 32 from the moment the split is complete. Then for , 1, 2 and 3 the two arrows draw, and the readout counts 33, 34, 35, 36, one for each product that has landed. The caption for each appears when the square lands and stays for only 0.7 seconds, and is blank while the arrows draw. The last caption reads “Four products gave eight outputs: 32 + 4 = 36 multiplies instead of 64. Split each half again and the saving repeats.” At the end the arrows for are still drawn. Reduced-motion steps stop at 0, 4, 6.8, 9.5, 11.8 and 16.5 seconds.
The cost of the DFT
The DFT (13.2) defines each of bins as a correlation with a probe, and each bin takes products:
The count is bins times products, which is multiplies. For 8 samples that is . For 1024 samples it is , over a million, for one spectrum.
The fast Fourier transform (FFT) is not a different transform. It gives the same as the DFT, by a way of ordering the work so that most products are never computed. This page shows the one trick behind it, and then counts what it saves.
One product, two outputs
Split the sum into even samples and odd samples , with . Since , the two sums are themselves DFTs of length . Two steps of an -step circle are one step of an -step circle, as in Complex numbers for signals (3.3, section 7). I write them and :
The factor that multiplies is a power of . It is called a twiddle factor. Both half-size DFTs repeat every in , and , because half a turn of the circle is . So the same two numbers also give the second half of the outputs:
The product is computed once, added once and subtracted once. Think of weighing two parcels together and apart: two weighings give both answers.
The picture at the top of the page uses the signal of this lesson, for . The solid arrow is , and the dashed arrow, , is added to it nose to tail, as in 3.3 (section 3). The dashed arrow flipped gives . Split into even and odd samples, needs two 4-point DFTs of 16 multiplies each, 32 in all.
For , is , and the same product subtracted gives . For there is one product, . Added, it gives ; subtracted, . For the product is , so and . Four products gave eight outputs: multiplies instead of 64.
Notice that the dashed arrow flips: the ring and the square sit at opposite ends of it, mirrored about the tip of the solid arrow.
The count of 36 includes the 32 multiplies of the two 4-point DFTs, and the four products by a twiddle factor. It counts every multiply the same, including the one by and the one by . More FFT algorithms (14.2) shows how real codes skip those.
A small check by hand
Take the 4-point case . The even samples are 1 and 3, and the odd samples are 2 and 4. Their 2-point DFTs are and . The twiddle factors are and . Then
This agrees with a direct 4-point DFT of 1, 2, 3, 4.
Three stages of butterflies
The saving does not stop at one split. The two half-size DFTs have the same shape as the original, so I split each of them again, into two 2-point DFTs, and each of those into single samples. A DFT of one sample is the sample. For there are three splits in all.
One split step, “two in, a sum and a difference out, one multiply on the lower wire”, is called a butterfly, because its wires cross like wings. It computes . A column of butterflies is a stage. The number of stages is , which is how many times halves before it reaches 1. For that is 3.
Splitting by even and odd three times reorders the inputs. The sample that goes in row is at the index you get by reading the three bits of backwards. That is called bit-reversed order. Row 1 is 001, which read backwards is 100, which is 4, so row 1 holds . The rows hold , and the outputs come out in order.
Before you start the instrument, think of a knockout tournament: 8 players, 3 rounds. Each round halves the field, and every player is connected to the final through exactly three matches.
Three stages of butterflies
The 8-point FFT of x = 1, 2, 0, −1, 0, 1, 2, 1.
The inputs go in bit-reversed order: x[4] (binary 100) sits in row 1 (001).
Describe this picture
One graph of the 8-point FFT of : four columns of eight nodes, the inputs in bit-reversed order, then stages 1, 2 and 3. The inputs are labelled , , , , , , , from the first row to the last, and the outputs to . Each node has its value beside it, to one decimal, such as “3.1+2.7j”. Each butterfly has two straight wires and two crossing wires. A twiddle factor is written on a lower input wire where it is not 1: in stage 2, and , , in stage 3. The butterflies being drawn are thick and the finished ones thin. The readouts are the stage, from “inputs” to “3 of 3”, and the multiplies.
The clip lasts 15.5 seconds, with a caption after each stage and none while a stage is drawn. First the eight samples fly from natural order into their bit-reversed rows, with the multiplies at 0. Then the stages fill in one at a time, and the readouts go to “1 of 3” and 4, “2 of 3” and 8, and “3 of 3” and 12. Reduced-motion steps stop at 0, 2.5, 4.5, 7.5, 10.5 and 15.5 seconds. Once the clip has finished, tapping an output node, or the Up and Down arrow keys, chooses through a control named “Output to trace”, whose value reads like “X[3]”. The wires that feed that output turn thick in the accent colour, the rest fade, and the caption reads, for example, “X[3] uses all eight inputs, through one butterfly in each of the three stages.”
The inputs go in bit-reversed order: (binary 100) sits in row 1 (001). Stage 1 is four 2-point DFTs, and each butterfly makes a sum and a difference. After stage 2, rows 0 to 3 hold , and rows 4 to 7 hold .
Stage 3 is the step from the previous instrument: its rows 0 to 3 are , its rows 4 to 7 are , and its twiddle factors are . Three stages of four butterflies make 12 multiplies, against 64 for the direct sum, and the outputs come out in order, to .
When the clip ends, tap an output node, or use the arrow keys, to trace which wires feed it. Notice that every output is reached from every input, through exactly three butterflies: 2 wires feed it in stage 3, 4 in stage 2, and 8 in stage 1.
How the saving grows
Each stage has butterflies and each butterfly has one multiply. With stages, the whole FFT costs
multiplies, against for the direct sum. Doubling quadruples the direct cost. It only a little more than doubles the FFT’s cost, so the gap keeps widening. For there are 10 stages with 512 butterflies each, which is 5120 multiplies against . The ratio is , which is times fewer.
The idea is old. Gauss used it in 1805 and did not publish it. Cooley and Tukey’s 1965 paper made spectra of long records practical overnight.
The last picture doubles from 8 to 65 536 and counts both ways. Watch the gap between the two curves.
How the saving grows
Complex multiplies for one N-point DFT, direct and by FFT.
N = 8: 64 direct multiplies, 12 by FFT, 5.3 times fewer.
Describe this picture
One log–log plot of complex multiplies for one -point DFT, direct and by FFT: the DFT length from 8 to 65 536, against the multiplies from 10 to , with a tick at each power of 10. Two traces are built up point by point: the direct count as joined squares on a dashed line, and the FFT count as joined dots on a solid line. A ring marks the current on each. The readouts are , how many times fewer, and the two counts.
The clip lasts 12.5 seconds. It starts at , reading 5.3×, 64 and 12, and doubles every 0.8 seconds, up to 65 536 at 10.4 seconds. Between holds the caption follows the form “N = 256: 64.0 times fewer multiplies.” At the readouts are 204.8×, “1.05 million” and 5 120, and at the end 8192.0×, “4.29 billion” and 524 288. Reduced-motion steps stop at , 64, 1024 and 65 536. Once the clip has finished, dragging along the plot, the Left and Right arrow keys (one doubling), or Home and End choose , through a control named “DFT length N”.
At the FFT takes 12 multiplies against 64, 5.3 times fewer. At it is about a million directly against 5120, 204.8 times fewer. At it is 4.29 billion against 524 288, 8192 times fewer: each doubling of roughly doubles the saving.
When the clip ends, drag along the plot, or use the arrow keys, to choose . Notice that “times fewer” grows from 5.3 at to 8192 at , and that the two traces drift further apart on the log scale at every doubling.
The count includes multiplies by 1 and by , which need no real multiplication. Real codes skip them, and 14.2 gives the exact table. The count is also not a timing. On a laptop a 4096-point FFT takes tens of microseconds, and you can time the library in the browser console. Its count is multiplies, against directly, which is times fewer.
The maths behind it · sparse matrix factorisation
The DFT matrix of The DFT as a matrix (13.5) is dense, with entries. The FFT writes it as a product of sparse matrices, each with two non-zero entries per row, after a permutation (bit reversal). Factoring a matrix into sparse pieces is how many fast algorithms work.
The maths behind it · divide and conquer
A merge sort splits a list in halves until single items remain, and merges back in rounds. It has the same shape.
Where you’ll meet this
Every spectrum analyser, audio plug-in and radio receiver computes its DFTs this way. Lengths that are not a power of two come next, in More FFT algorithms (14.2). Filtering by multiplying spectra is in Fast convolution (14.3). Computing only a few bins is in Goertzel and the chirp z-transform (14.4). Padding a record with zeros to reach a power of two is in Zero-padding and resolution (15.3).
Reference card
| Quantity | Formula | Notes |
|---|---|---|
| Even/odd split | ||
| Second half | because | |
| Butterfly | one multiply | |
| Stages | butterflies each | |
| Cost | direct ; FFT | speed-up |
| Input order | bit-reversed | outputs in order |