Cleve Moler is the author of the first MATLAB, one of the founders of MathWorks, and is currently Chief Mathematician at the company. He is the author of two books about MATLAB that are available online. He writes here about MATLAB, scientific computing and interesting mathematics.
This is the third in a series of posts on the finite Fourier transform. The Fourier matrix produces an interesting graphic and has a surprising eigenvalue distribution.
The Fourier matrix of order $n$ is the $n$ -by- $n$ complex Vandermonde matrix $F$ whose elements $f_{k,j}$ are powers of the $n$ th root of unity
$$ \omega = e^{-2 \pi i/n} $$
$$ f_{k,j} = \omega^{k j} $$
The matrix can be generated with the MATLAB statements
k = (0:n-1)';
j = (0:n-1);
F = exp(-2*pi*i*k*j/n);
Or, by taking the FFT of the identity matrix
F = fft(eye(n))
The statement
plot(F)
connects points in the complex plane whose coordinates are the real and imaginary parts of the elements of the columns of F, thereby generating a subgraph of the graph on n points. If n is prime, connecting the elements of all columns generates the complete graph on n points. If n is not prime, the sparsity of the graph of all columns is related to the computational complexity, and hence the speed, of the fast FFT algorithm. The graphs for n = 8, 9, 10, and 11 are generating and plotted by the following code.
for n = 8:11
subplot(2,2,n-7)
F = fft(eye(n));
plot(F)
axis square
axis off
title(['n = ' int2str(n)])
end
Because n = 11 is prime, the corresponding graph shows all possible connections. But the other three values of $n$ are not prime. Some of the links in their graphs are missing, indicating that the FFT of a vector with that many points can be computed more quickly.
n = 12
The remainder of this post examines F12 in more detail. Here is its graph.
clf
n = 12;
F = fft(eye(n));
plot(F)
axis square
axis off
title(['n = ' int2str(n)])
fftmatrix
The program fftmatrix, available here, or included with the NCM App, allows you to investigate these graphs. fftmatrix(n) plots all the columns of the Fourier matrix of order n. fftmatrix(n,j) plots just one column.
Let's plot the individual columns of F12. The first column of F12 is all ones, so its plot is just a single point.
for j = 1:12
p = mod(j-1,4)+1;
subplot(2,2,p);
fftmatrix_mod(12,j-1)
title(['j = ' int2str(j)])
if p == 4, snapnow, endend
To see typical behavior, look at the third subplot, the red graph labeled j = 3, generated by the third column
These are the powers of $\omega^2$. Because 2 divides 12 evenly these powers hit all the even-numbered points around the circle twice and miss all the odd-numbered points. Now look at the cyan graph labeled j = 11. These are the powers of $\omega^{10}$, which are the complex conjugates of the powers of $\omega^2$. So the two graphs lie on top of each other.
Six of the twelve columns in the graph of F12 connect only a subset of the nodes and ten of the columns lie on top of their complex conjugate columns. As a result, when all of the columns are combined to form the full graph, it is sparse. This sparsity, in turn, makes it possible to construct a fast finite Fourier transform algorithm for n = 12.
Eigenvalues
I've always been curious about the eigenvalues and vectors of the Fourier matrices. In 1979, three friends of mine at the University of New Mexico, Gus Efroymson, Art Steger, and Stan Steinberg, posed the question in the SIAM Review problem section. They didn't know that Jim McClellan and Tom Parks had actually solved their problem seven years earlier, when Jim was a grad student working under Tom at Rice. I didn't learn about the McClellan-Parks paper until fairly recently.
The Wikipedia page on the discrete Fourier transform says the facts about the eigenvalues are well known, but that the eigenvectors are the subject of ongoing research.
Let's rescale $F$ so that its columns have unit length.
Now $F$ is unitary, the complex generalization of orthogonal. This implies that all of its eigenvalues lie on the unit circle in the complex plane.
Furthermore, it turns out that $F^4 = I$.
This implies that any eigenvalue $\lambda$ must satisfy $\lambda^4$ = 1. Consequently the only possible eigenvalues are 1, -1, i, and -i. You might guess that guess that if $n$ is divisible by 4, the eigenvalues would be equally distributed among these four values. But, surprisingly, to me at least, that doesn't happen.
It's hard to pick through this unsorted output, but there are four +1's, three -1's, three -i's, and only two +i's.
Here is a tricky piece of code that uses angle and the counting feature of sparse indexing to count the number of each of the four possible eigenvalues.
type eigfftmat
function c = eigfftmat(n)
% EIGFFTMAT Count eigenvalues of the Fourier matrix.
% c = eigfftmat(n) is a 4-vector with counts for +1, -1, -i, +i.
% Compute the eigenvalues.
e = eig(fft(eye(n)));
% Sparse repeated indexing acts as a counter.
c = full(sparse(mod(round(angle(e')/(pi/2)),4)+1,1,1))';
c([3 2]) = c([2 3]);
end
When we run this code for a sequence of values of n, we see the pattern predicted by the McClellan-Parks analysis. The number of each of the four possible eigenvalues depends upon floor(n/4) and mod(n,4).
disp(' n +1 -1 -i +i')
for n = 4:20
disp([n eigfftmat(n)])
end
Comments
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.