Here the eight probes of The DFT (13.2) sit in a grid, one per row, beside the column . Make a guess before you play it: what does row 0, whose arrows never turn, do to the column?
The DFT as one matrix
F has entry W₈^{kn} = e^{−j2πkn/8} in row k, column n, drawn as a small arrow. x = 1, 2, 3, 4, 3, 2, 1, 0.
Row k of the grid is 13.2's probe k: arrows that turn k/8 of a turn per column. Row 0 never turns; row 4 flips every column.
Describe this picture
Three panels for and . The first is the grid , an array of unit arrows with rows to 7 and columns to 7; the arrow in row , column is and points at angle . Arrows are drawn rather than colours, so an angle reads by its shape. The second panel is the column as eight numbers, and the third is the column , empty at first. The readouts are the row and the bin . The clip plays once and holds on its last frame.
It opens with both readouts at “none yet”: row is 13.2’s probe , arrows that turn of a turn per column, so row 0 never turns and row 4 flips every column. Then a rectangular outline picks out row 0 and its result entry: . Row 1 gives 13.2’s chain for bin 1, ; row 2 gives ; row 3 gives . Rows 4 to 7 then fill their results together, with the caption blank. The last frame reads “Eight rows, eight bins: X = Fx, one matrix times one column”, with the readouts “all 8” and “see the column”.
After the clip ends, a slider named “Row k” picks a row: tap it, or use the arrow keys. Rows 4 to 7 read in the same form, for example “Row 5 times x: X[5] = 0.83 + 0.83j.”
The DFT as one matrix
The DFT (13.2) gave you bins, and each bin was a probe: eight arrows that turn a fixed amount per sample, multiplied into the signal and added up. That is sums of products. In Discrete convolution (5.2) you met a grid of numbers multiplied into a column, and this is the same shape of calculation. This page writes the DFT that way, and then asks what the grid is good for.
Stack the samples into one column, . Stack the bins into another, . Then
where is the DFT matrix, an grid whose entry in row and column is
Here , the arrow from 13.2 that turns of a turn clockwise. Row of the grid is probe . A row times a column means: multiply entry by entry, then add. This is the dot product, and it is exactly the sum that defined .
In the picture at the top, row 0 is all ones, so its dot product is the plain sum of the samples, 16. Row 1 times is the chain of arrows you drew in 13.2, now as one row of the grid, and it gives . After the clip ends, tap a row, or use the arrow keys, to read its bin.
Notice the two extremes. Row 0 never turns, so it adds the samples as they are. Row 4 turns half a turn per column, so its arrows alternate and every other column is flipped. Every other row is somewhere between.
A small case by hand
Take . Then , and the four rows of are
For , the dot product of row 1 with is . Doing the other rows the same way gives
which is what np.fft.fft returns for the same input.
Rows that cancel
If is a grid, can I undo it? To find out, I need to know what happens when I multiply two of its rows against each other. First, three words.
The conjugate transpose of , written , swaps rows and columns and conjugates every entry. Because is symmetric, , this only conjugates: . Now take row and row . Multiply row by the conjugate of row , entry by entry, and add. Two rows are orthogonal when this sum is 0. The identity matrix has 1 on its diagonal and 0 elsewhere, so .
Before you play the clip, make a guess. Row 1 turns of a turn per column. Row 2 turns twice as fast. When I multiply row 1 by the conjugate of row 2, how fast do the products turn? Then watch the chain of products: it closes for every row but one.
Rows that cancel
Multiply row 1 by the conjugate of row q, entry by entry, and add: a chain of eight arrows.
Row 1 against row 0: each product turns 45° further than the last, and the eight close an octagon. Sum 0.
Describe this picture
One plane with real and imaginary axes, and no control. Row 1 is multiplied by the conjugate of row , entry by entry, and the eight products are unit arrows laid nose to tail; a filled square at the tip marks their sum. A key names the arrows “products” and the square “sum”. The readouts are the row and the sum.
At each product turns 45° further than the last, and the eight close an octagon: sum 0. At , row 1 against itself, every product is 1, the arrows line up, and the sum is . At the products turn the other way and close again: sum 0. Rows 3 to 7 pass in turn, and each chain closes with sum 0. The last frame reads “Different rows cancel, and a row against itself gives N: Fᴴ F = N I. So the inverse is Fᴴ/N, and F/√N keeps every vector’s length”, with the readouts “0 to 7” and “8 only for q = 1”.
A chain that closes adds to 0, which is the fact from The DTFT (12.2) and from Complex numbers for signals (3.3): equal steps round a circle add to 0. Row 1 against itself is the exception. Each product is , so the chain is a straight line of length 8. Only gives a straight chain.
What the cancelling gives
Every row against every row is one entry of the product (the rows of are the conjugated columns, and these match the conjugated rows because is symmetric). The clip showed that those entries are on the diagonal and 0 off it:
Divide by and you have the inverse, , so
This is the inverse DFT of 13.2, with and the in front. In the case, comes out as , and gives back .
There is a way to keep every length. A matrix is unitary when its conjugate transpose is its inverse. The matrix is not, because and not . But is, because the two factors of multiply to the missing . On this site the unitary DFT always shows its scale, and its output is never called , because is the DFT with no scale.
Length squared is energy, from How big is a signal (1.3). The unitary DFT keeps it:
That is Parseval’s relation from 13.2, , in matrix form. Check it for : the energy is , and the squared sizes of are , , and , which sum to . Divide by and you are back at 30.
Arrows in, the same arrows out
Now the second use of the grid. In Circular vs linear convolution (13.4) you saw that a circular convolution can be written as a matrix. This is the circulant matrix of : each row is the row above it, rotated right by one place, and
For the two-point average on a ring of samples, the first row of has 0.5 in column 0 and in column 7, and the second row has 0.5 in columns 0 and 1. Each output is , the average of a sample and its neighbour round the ring.
One more word. An eigenvector of a matrix is a column that comes out of it only scaled, and the scale is its eigenvalue. Where have you met this? In Properties of LTI systems (5.4), a complex exponential went through a system and came out as the same exponential times a number. A circulant is the circular version of that statement.
Before you play the clip, make a guess. Feed the arrow for , which is column of . What do you expect to come out?
Arrows in, the same arrows out
C is the 8×8 circulant of h = 0.5, 0.5: a 2-point average on the ring. In: the arrow e^{j2πkn/8}, n = 0 to 7.
Arrow k = 0 is all ones. Averaging neighbours leaves it alone: out = 1 × in.
Describe this picture
Three panels for the circulant of , a 2-point average on the ring, fed the arrow for to 7. The first draws as a grid of cells, with 0.5 as a filled square and 0 as an empty one. The second is the row marked “in”: eight dials, each a unit circle with a triangle-headed arrow. The third is the row marked “out”: eight dials showing on the same scale, with square-headed arrows. Each time a new arrow comes in, the output dials first copy it and then turn to their scaled place, with the caption blank until they settle. The readouts are the arrow and , as a size and an angle, and one large dial repeats .
At the arrow is all ones, and averaging neighbours leaves it alone: reads 1.00∠0.0°. At every output dial is its input dial times the same number, 0.92∠−22.5°: the same arrow, shorter and turned. At all eight dials are scaled by 0.71∠−45.0°. The last frame, , alternates, and averaging neighbours cancels it: . Its caption ends “Every arrow is an eigenvector of C, and its eigenvalue H[k] is the DFT of h.”
After the clip ends, a slider named “Arrow k” chooses any arrow from 0 to 7: drag across the input dials, or use the arrow keys. At , for example, the caption reads “k = 3: every dial scaled by H[3] = 0.38∠−67.5°.”
Notice that all eight output dials shrink and turn by the same amount. After the clip ends, drag across the input dials to try any arrow from 0 to 7.
Why every sample is scaled by the same number
Put the arrow through . For the two-point average,
The bracket does not contain . It is the same number for every sample, and it is the DFT of at bin :
For and this has size and angle , which matches the clip at . For it is : the arrow alternates , and the average of a sample and its neighbour is 0. The wrap-around matters here. Because the ring closes, the identity holds at every including , where the neighbour is .
Convolution becomes multiplication
Stack the eight eigenvectors as the columns of . Feeding all of them in at once gives
where is the matrix with those numbers on its diagonal and 0 elsewhere. Multiply by on the right, and use :
Read it from right to left. First takes the DFT. Then the diagonal matrix multiplies each bin by its own , with no bin touching another. Then inverts. This is the rule of Properties of the DFT (13.3), , proved a second time with matrices.
Check it with and . Then . For , the matrix product gives , and taking the inverse DFT of gives the same four numbers. The first output is the average of and its neighbour .
The maths behind it · unitary matrices
The matrix is a unitary matrix, the complex version of a rotation: it changes the basis to the arrows without changing any length. Every circulant matrix shares this one set of eigenvectors, so any two circulants of the same size commute: filtering by and then by gives the same answer as the other order.
The maths behind it · principal components
The covariance matrix of a stationary signal that wraps round is circulant, so its principal components are the DFT’s arrows and the variances along them are its power spectrum. PCA of such data is a DFT. Power spectral density (24.4) follows this up.
Worked example
Here is one by hand, to check that the pieces fit. Take , and .
- The DFT matrix gives .
- The eigenvalues are the DFT of : .
- Multiply bin by bin. Bin 1 gives and bin 3 gives , so .
- Invert with . The first output is . The full result is , which is the circular convolution computed directly.
Each product in step 3 uses and its conjugate partner .
Where you’ll meet this
The matrix has a lot of structure, and the next page, The FFT (14.1), uses it: can be factored into a few sparse matrices, so the products of this page shrink to about . The two-dimensional version, a DFT along rows and then along columns, is The 2-D DFT (28.3).
Reference card
| Quantity | Formula | Notes |
|---|---|---|
| DFT matrix | , | row is probe |
| Orthogonal rows | rows cancel unless equal | |
| Inverse | the inverse DFT | |
| Unitary DFT | , keeps | Parseval; never called |
| Circulant | ; each row the one above, rotated | 13.4 |
| Eigenvectors | eigenvalue , the DFT of | |
| Diagonalisation | convolution becomes multiplication |