Circulant Matrices
Circulant Matrices
September 7, 2017
1 Circulant Matrices
In this lecture, I want to introduce you to a new type of matrix: circulant matrices. Like Hermitian
matrices, they have orthonormal eigenvectors, but unlike Hermitian matrices we know exactly what their
eigenvectors are! Moreover, their eigenvectors are closely related to the famous Fourier transform and Fourier
series. Even more importantly, it turns out that circulant matrices and the eigenvectors lend themselves to
incredibly efficient algorithms called FFTs, that play a central role in much of computational science and
engineering.
Consider a system of n identical masses m connected by springs k, sliding around a circle without friction.
2
Similar to lecture 26, the vector ~s of displacements satifies m ddt2~s = −kA~s, where A is the n × n matrix:
2 −1 −1
−1 2 −1
−1 2 −1
A=
.. .. ..
. . .
−1 2 −1
−1 2 −1
−1 −1 2
(This matrix is real-symmetric and, less obviously, positive semidefinite. So, it should have orthogonal
eigenvectors and real eigenvalues λ ≥ 0.)
For example, if n = 7:
In [2]: A = [ 2 -1 0 0 0 0 -1
-1 2 -1 0 0 0 0
0 -1 2 -1 0 0 0
0 0 -1 2 -1 0 0
0 0 0 -1 2 -1 0
0 0 0 0 -1 2 -1
-1 0 0 0 0 -1 2]
https://github.com/stevengj/1806-spring17/raw/master/lectures/cyc
1
Out[2]: 7×7 Array{Int64,2}:
2 -1 0 0 0 0 -1
-1 2 -1 0 0 0 0
0 -1 2 -1 0 0 0
0 0 -1 2 -1 0 0
0 0 0 -1 2 -1 0
0 0 0 0 -1 2 -1
-1 0 0 0 0 -1 2
This matrix has a very special pattern: every row is the same as the previous row, just shifted to the
right by 1 (wrapping around “cyclically” at the edges). That is, each row is a circular shift of the first row.
This is called a circulant matrix. A 4 × 4 circulant matrix looks like:
c0 c1 c2 c3
c3 c0 c1 c2
C= c2 c3 c0 c1
c1 c2 c3 c0
The general form of an n × n circulant matrix C is:
c0 c1 c2 ··· cn−1
cn−1
c 0 c1 c2 ···
C=
cn−2 cn−1 c1 ···
.. .. .. .. ..
. . . . .
c1 c2 ··· cn−1 c0
When working with circulant matrix, it is convenient to number entries from 0 to n − 1 rather than from
1 to n!
Can you see the pattern? This is one of those cases that is actually clearer if we write out the summation:
n
X
yk = cj−k xj
j=0
There is a slight problem with this formula: the subscript j −k can be < 0! No problem: we just interpret
the subscript periodically, i.e. we let c−1 = cn−1 , c−2 = cn−2 , and so on. Equivalently, we define cj±n = cj .
(We could say that the subscripts are modulo n.)
Multiplying by a circulant matrix is equivalent to a very famous operation called a circular convolution.
Convolution operations, and hence circulant matrices, show up in lots of applications: digital signal pro-
cessing, image compression, physics/engineering simulations, number theory and cryptography,
and so on.
2
2 Eigenvectors of circulant matrices
One amazing property of circulant matrices is that the eigenvectors are always the same. The eigen-
values are different for each C, but since we know the eigenvectors they are easy to diagonalize.
We can actually see one eigenvector right away. Let’s call it x(0) :
1
1
x(0) = 1
..
.
1
This is an eigenvector because multiplying Cx(0) simply sums each row of C. But since each row of
C contains the same entries (just in a different order), the sum is the same:
Thus, one of the eigenvalues λ0 of C is simply the sum of the row entries.
How can we find the other eigenvectors?
The quantity ωn has the very special property that ωnn = e2πi = 1 = ωn0 , but no smaller power equals 1.
Therefore, ωnj+n = ωnj ωnn = ωnj : the exponents of ω[U+2099] are periodic. (Just like the cj !)
For example, let’s plot the powers of ω7 :
In [3]: ω 7 = exp(2π*im / 7)
Interact.Slider{Int64}(Signal{Int64}(7, nactions=1),"",7,1:20,"horizontal",true,"d",true)
3
Out[4]:
They are called “roots of unity” because ωnj for j = 0, . . . , n − 1 (or 1, . . . , n) are all the solutions z to
z n = 1.
ωn0k
ωn 1k
2k
x = ωn
(k)
..
.
(n−1)k
ωn
Therefore, the matrix F whose columns are the eigenvectors is:
F = x(0) x(1) ··· x(n−1)
with entries
(k) 2πi
Fjk = xj = ωnjk = e n jk .
4
Multiplying a vector by F is called a discrete Fourier transform (DFT). This is one of the most important
matrices in the world! (It is sort of a finite, computer-friendly analogue to a Fourier series if you’ve seen
those before.)
Before we show this, let’s try it:
In [6]: round.(F(4))
Let’s check that it diagonalizes our 7 × 7 mass-and-spring matrix A from earlier. We should have
F −1 AF = Λ:
In [8]: eigvals(A)
5
Out[9]: 7-element Array{Complex{Float64},1}:
0.0-1.2326e-32im
0.75302-5.32581e-17im
2.44504+2.87857e-16im
3.80194+1.90437e-16im
3.80194+2.12572e-16im
2.44504-1.93109e-16im
0.75302+4.73147e-17im
Yup!
Since A is real-symmetric, you may wonder why the eigenvectors are not real. But they could be chosen
real. For a real-symmetric circulant matrix, the real and imaginary parts of the eigenvectors are themselves
eigenvectors. This is why most of the eigenvalues come in pairs! (The only eigenvalues that don’t come in
pairs correspond to eigenvectors x(k) that are purely real, e.g. x(0) = (1, 1, . . . , 1).) These real and imaginary
eigenvectors turn out to correspond to a discrete cosine transform (DCT) and a discrete sine transform
(DST).
But the remaining sum is now independent of `: because both cj and ωnj are periodic in j, all j → j − `
does is to re-arrange the numbers being summed (a circular shift), so you get the same sum. And ωn`k = x(k) ,
so we have:
Cx(k) = λk x(k)
where
n−1
X
λk = cj ωnjk
j=0
ĉ = F c
That is, the eigenvalues are the DFT of c (where c = first row of C).
Let’s check it:
In [11]: eigvals(A)
6
Out[11]: 7-element Array{Float64,1}:
-9.41142e-16
0.75302
0.75302
2.44504
2.44504
3.80194
3.80194
3 Unitarity
The DFT matrix F is special in many ways. It is symmetric, but not Hermitian, so its eigenvalues are not
real. However, it has orthogonal columns:
(It is a straightforward exercise to show this, e.g. using the geometric-series summation
√ formula.)
The columns are orthogonal but not orthonormal because they have length n. But this means that if
we divide by their length, then:
1
√ F
n
is a unitary matrix. Equivalently:
1 H 1
F −1 = F = F̄ ,
n n
where we have used the fact that F T = F . This is the inverse discrete Fourier transform (IDFT).
Note that this means that every circulant matrix C has orthogonal eigenvectors (the columns of
F). (Even if the matrix C is not Hermitian or one of the similar cases we have seen so far!)
7
Figure 2: FFTW logo
In [13]: fft(A[:,1]) # computes the same thing as F(7) * A[:,1], but much faster
But now that we know that F diagonalizes any circulant matrix, it leads to an amazing fact: you can
multiply Cx for any circulant matrix in ˜ n log n operations and ˜ n work.
Specifically, C = F ΛF −1 = F Λ
n F̄ , so to multiply Cx we just need to:
This means that circulant matrices are perfectly suited to iterative solver algorithms (e.g. the
power method or steepest-descent), just like sparse matrices!