Post · 11 min read· pp. 867–872

CS359G Lecture 2: Linear Algebra Review

In which we review linear algebra and introduce spectral graph theory.

1. Eigenvalues and Eigenvectors

Spectral graph theory studies how the eigenvalues of the adjacency matrix of a graph, which are purely algebraic quantities, relate to combinatorial properties of the graph.

We begin with a brief review of linear algebra.

If x=a+ib{x=a+ib} is a complex number, then we let x∗=a−ib{x^* = a- ib} denote its conjugate.

If M∈Cn×n{M\in {\mathbb C}^{n \times n}} is a square matrix, λ∈C{\lambda \in {\mathbb C}} is a scalar, v∈Cn−{0}{{\bf v} \in {\mathbb C}^n - \{ {\bf {0}} \}} is a non-zero vector and we have

Mv=λv     (1)\displaystyle M {\bf v} = \lambda {\bf v} \ \ \ \ \ (1)

then we say that λ{\lambda} is an eigenvalue of M{M} and that v{{\bf v}} is eigenvector of M{M} corresponding to the eigenvalue λ{\lambda}.

When (1) is satisfied, then we equivalently have

(M−λI)⋅v=0\displaystyle (M-\lambda I) \cdot {\bf v} = {\bf {0}}

for a non-zero vector v{{\bf v}}, which is equivalent to

det⁡(M−λI)=0     (2)\displaystyle \det (M-\lambda I) = 0 \ \ \ \ \ (2)

For a fixed matrix M{M}, the function λ→det⁡(M−λI){\lambda \rightarrow \det(M-\lambda I)} is a univariate polynomial of degree n{n} in λ{\lambda} and so, over the complex numbers, the equation (2) has exactly n{n} solutions, counting multiplicities.

If G=(V,E){G=(V,E)} is a graph, then we will be interested in the adjacency matrix A{A} of G{G}, that is the matrix such that Aij=1{A_{ij} = 1} if (i,j)∈E{(i,j) \in E} and Aij=0{A_{ij} =0} otherwise. If G{G} is a multigraph or a weighted graph, then Aij{A_{ij}} is equal to the number of edges between (i,j){(i,j)}, or the weight of the edge (i,j){(i,j)}, respectively.

The adjacency matrix of an undirected graph is symmetric, and this implies that its eigenvalues are all real.

Definition 1 A matrix M∈Cn×n{M\in {\mathbb C}^{n \times n}} is Hermitian if Mij=Mji∗{M_{ij} = M_{ji}^*} for every i,j{i,j}.

Note that a real symmetric matrix is always Hermitian.

Lemma 2 If M{M} is Hermitian, then all the eigenvalues of M{M} are real.

Proof: Let M{M} be an Hermitian matrix and let λ{\lambda} be a scalar and x{{\bf x}} be a non-zero vector such that Mx=λx{M {\bf x} = \lambda {\bf x}}. We will show that λ=λ∗{\lambda = \lambda^*}, which implies that λ{\lambda} is a real number. We define the following inner product operation over vectors in Cn{{\mathbb C}^n}:

⟨v,w⟩:=∑ivi∗⋅wi\displaystyle \langle {\bf v},{\bf w} \rangle := \sum_i v_i^*\cdot w_i

Notice that, by definition, we have ⟨v,w⟩=(⟨w,v⟩)∗{\langle {\bf v}, {\bf w} \rangle = (\langle {\bf w}, {\bf v} \rangle)^*} and ⟨v,v⟩=∣∣v∣∣2{\langle {\bf v}, {\bf v} \rangle = || {\bf v} ||^2}. The lemma follows by observing that

⟨Mx,x⟩\displaystyle \langle M {\bf x} , {\bf x} \rangle

=∑i∑jMij∗xj∗xi\displaystyle = \sum_i \sum_j M^*_{ij} x_j^* x_i

=∑i∑jMjixixj∗\displaystyle = \sum_i \sum_j M_{ji} x_i x_j^*

=⟨x,Mx⟩\displaystyle = \langle {\bf x} , M {\bf x} \rangle

where we use the fact that M{M} is Hermitian, and that

⟨Mx,x⟩=⟨λx,x⟩=λ∗∣∣x∣∣2\displaystyle \langle M{\bf x}, {\bf x} \rangle = \langle \lambda {\bf x}, {\bf x} \rangle = \lambda^* ||x||^2

and

⟨x,Mx⟩=⟨x,λx⟩=λ∣∣x∣∣2\displaystyle \langle {\bf x}, M {\bf x} \rangle = \langle {\bf x}, \lambda {\bf x} \rangle = \lambda ||x||^2

so that λ=λ∗{\lambda = \lambda^*}. □\Box

From the discussion so far, we have that if A{A} is the adjacency matrix of an undirected graph then it has n{n} real eigenvalues, counting multiplicities of the number of solutions to det⁡(A−λI)=0{\det (A - \lambda I ) = 0}.

If G{G} is a d{d}-regular graph, then instead of working with the adjacency matrix of G{G} it is somewhat more convenient to work with the normalized matrix M:=1d⋅A{M:= \frac 1d \cdot A}.

In the rest of this section we shall prove the following relations between the eigenvalues of M{M} and certain purely combinatorial properties of G{G}.

Theorem 3 Let G{G} be a d{d}-regular undirected graph, and M=1d⋅A{M = \frac 1d \cdot A} be its normalized adjacency matrix. Let λ1≥λ2≥⋯≥λn{\lambda_1 \geq \lambda_2 \geq \cdots \geq \lambda_n} be the real eigenvalues of M{M} with multiplicities. Then

1. λ1=1{\lambda_1 = 1} and λn≥−1{\lambda_n \geq -1}. 2. λ2=1{\lambda_2=1} if and only if G{G} is disconnected. 3. λn=−1{\lambda_n=-1} if and only if at least one of the connected components of G{G} is bipartite.

In the next lecture we will begin to explore an “approximate” version of the second claim, and to show that λ2{\lambda_2} is close to 1 if and only if G{G} has a sparse cut.

1.1. More on Eigenvalues and Eigenvectors

In order to relate the eigenvalues of the adjacency matrix of a graph to combinatorial properties of the graph, we need to first express the eigenvalues and eigenvectors as solutions to optimization problems, rather than solutions to algebraic equations.

First, we observe that if M{M} is a real symmetric matrix and λ{\lambda } is a real eigenvalue of M{M}, then λ{\lambda} admits a real eigenvector. This is because if Mx=λx{M {\bf x} = \lambda {\bf x}} for some x∈Cn{{\bf x} \in {\mathbb C}^n}, then we also have Mx′=λx′{M {\bf x}' = \lambda {\bf x}'}, where x′∈Rn{{\bf x}'\in {\mathbb R}^n} is the vector whose i{i}-th coordinate is the real part of the i{i}-th coordinate of x{{\bf x}}. Now, if λ{\lambda} is a (real) eigenvalue of a symmetric real matrix M{M}, then the set {x∈Rn:Mx=λx}{\{ {\bf x} \in {\mathbb R}^n : M {\bf x} = \lambda {\bf x} \}} is a vector subspace of Rn{{\mathbb R}^n}, called the eigenspace of λ{\lambda}.

If λ≠λ′{\lambda \neq \lambda'} are two distinct eigenvalues of a symmetric real matrix M{M}, then the eigenspaces of λ{\lambda} and λ′{\lambda'} are orthogonal.

Proof: Let x{{\bf x}} be an eigenvector of λ{\lambda} and y{{\bf y}} be an eigenvector of λ′{\lambda'}. From the symmetry of M{M} and the fact that M{M}, x{{\bf x}} and y{{\bf y}} all have real entries we get

⟨Mx,y⟩=⟨x,My⟩\displaystyle \langle M {\bf x} , {\bf y} \rangle = \langle {\bf x} , M {\bf y} \rangle

but

⟨Mx,y⟩=λ⋅⟨x,y⟩\displaystyle \langle M{\bf x}, {\bf y} \rangle = \lambda \cdot \langle {\bf x},{\bf y} \rangle

and

⟨x,My⟩=λ′⋅⟨x,y⟩\displaystyle \langle {\bf x},M{\bf y} \rangle = \lambda' \cdot \langle {\bf x} , {\bf y} \rangle

so that

(λ−λ′)⋅⟨x,y⟩=0\displaystyle (\lambda-\lambda') \cdot \langle {\bf x},{\bf y} \rangle = 0

which implies that ⟨x,y⟩=0{\langle {\bf x},{\bf y} \rangle = 0}, that is, that x{{\bf x}} and y{{\bf y}} are orthogonal. □\Box

Definition 4 The algebraic multiplicity of an eigenvalue λ{\lambda} of a matrix M{M} is the multiplicity of λ{\lambda} as a root of the polynomial det⁡(M−λI){\det(M-\lambda I)}. The geometric multiplicity of λ{\lambda} is the dimension of its eigenspace.

The following is the only result of this section that we state without proof.

If M{M} is a symmetric real matrix and λ{\lambda} is an eigenvalue of M{M}, then the geometric multiplicity and the algebraic multiplicity of λ{\lambda} are the same.

This gives us the following “normal form” for the eigenvectors of a symmetric real matrix.

If M∈Rn×n{M \in {\mathbb R}^{n \times n}} is a symmetric real matrix, and λ1,…,λn{\lambda_1, \ldots, \lambda_n} are its eigenvalues with multiplicities, and v1{{\bf v}_1} is a length-1 eigenvector of λ1{\lambda_1}, then there are vectors v2,…,vn{{\bf v}_2,\ldots,{\bf v}_n} such that vi{{\bf v}_i} is an eigenvector of λi{\lambda_i} and v1,…,vn{{\bf v}_1,\ldots,{\bf v}_n} are orthonormal.

Proof: For each eigenvalue, choose an orthonormal basis for its eigenspace. For λ1{\lambda_1}, choose the basis so that it includes v1{{\bf v}_1}. □\Box

Finally, we get to our goal of seeing eigenvalue and eigenvectors as solutions to continuous optimization problems.

Lemma 5 If M{M} is a symmetric matrix and λ1{\lambda_1} is its largest eigenvalue, then

λ1=sup⁡x∈Rn:∣∣x∣∣=1xTMx\displaystyle \lambda_1 = \sup_{{\bf x} \in {\mathbb R}^n: ||{\bf x}||=1} {\bf x}^T M {\bf x}

Furthermore, the sup⁡{\sup} is achieved, and the vectors achieving it are precisely the eigenvectors of λ1{\lambda_1}.

Proof: That the sup⁡{\sup} is achieved follows from the fact that the set {x∈Rn:∣∣x∣∣=1}{\{ {\bf x} \in {\mathbb R}^n : || {\bf x}|| =1 \}} is compact and that x→xTMx{{\bf x} \rightarrow {\bf x}^T M {\bf x}} is a continuous function.

If v1{{\bf v}_1} is a length-1 eigenvector of λ1{\lambda_1}, then

sup⁡x∈Rn:∣∣x∣∣=1xTMx≥v1TMv1=λ1\displaystyle \sup_{{\bf x} \in {\mathbb R}^n: ||{\bf x}||=1} {\bf x}^T M {\bf x} \geq {\bf v}_1^T M {\bf v}_1 = \lambda_1

If y{{\bf y}} is a length-1 vector that achieves the sup⁡{\sup}, then let v1,…,vn{{\bf v}_1,\ldots,{\bf v}_n} be as in Fact 1 and write

y=α1v1+…αnvn\displaystyle {\bf y} = \alpha_1 {\bf v}_1 + \ldots \alpha_n {\bf v}_n

Then

sup⁡x∈Rn:∣∣x∣∣=1xTMx=yTMy=∑iαi2λi\displaystyle \sup_{{\bf x} \in {\mathbb R}^n: ||{\bf x}||=1} {\bf x}^T M {\bf x} = {\bf y}^T M {\bf y} = \sum_i \alpha_i^2 \lambda_i

Since ∑iαi2=∣∣y∣∣2=1{\sum_i \alpha_i^2 = ||{\bf y}||^2 = 1}, we have

sup⁡x∈Rn:∣∣x∣∣=1xTMx=∑iαi2λi≤λ1⋅∑iαi2=λ1\displaystyle \sup_{{\bf x} \in {\mathbb R}^n: ||{\bf x}||=1} {\bf x}^T M {\bf x} = \sum_i \alpha_i^2 \lambda_i \leq \lambda_1 \cdot \sum_i \alpha_i^2 = \lambda_1

Finally, we see that we have yTMy=λ1{{\bf y}^T M {\bf y} = \lambda_1} precisely when, for every i{i} such that αi≠0{\alpha_i \neq 0} we have λi=λ1{\lambda_i = \lambda_1}, that is, precisely when y{{\bf y}} is in the eigenspace of λ1{\lambda_1}. □\Box

Similarly we can prove

Lemma 6 If M{M} is a symmetric matrix, λ1{\lambda_1} is its largest eigenvalue, and v1{{\bf v}_1} is an eigenvector of λ1{\lambda_1}, then

λ2=sup⁡x∈Rn:∣∣x∣∣=1,x⊥v1xTMx\displaystyle \lambda_2 = \sup_{{\bf x} \in {\mathbb R}^n: ||{\bf x}||=1, {\bf x} \perp {\bf v}_1} {\bf x}^T M {\bf x}

Furthermore, the sup⁡{\sup} is achieved, and the vectors achieving it are precisely the eigenvectors of λ2{\lambda_2}. (If λ1=λ2{\lambda_1=\lambda_2}, then the vectors achieving the sup⁡{\sup} are the eigenvalues of λ1=λ2{\lambda_1=\lambda_2} which are orthogonal to v1{{\bf v}_1}.)

And

Lemma 7 If M{M} is a symmetric matrix and λn{\lambda_n} is its largest eigenvalue, then

λn=inf⁡x∈Rn:∣∣x∣∣=1xTMx\displaystyle \lambda_n = \inf_{{\bf x} \in {\mathbb R}^n: ||{\bf x}||=1} {\bf x}^T M {\bf x}

Furthermore, the inf⁡{\inf} is achieved, and the vectors achieving it are precisely the eigenvectors of λn{\lambda_n}.

1.2. Proof of the Theorem

We will make repeated use of the following identity, whose proof is immediate: if M{M} is the normalized adjacency matrix of a regular graph, and x{{\bf x}} is any vector, then

∑i,jMi,j(xi−xj)2=2xTx−2xTMx     (3)\displaystyle \sum_{i,j} M_{i,j} (x_i - x_j)^2 = 2{\bf x}^T{\bf x} - 2 {\bf x}^T M {\bf x} \ \ \ \ \ (3)

That is,

xTMx=xTx−12∑i,jMi,j(xi−xj)2≤xTx\displaystyle {\bf x}^T M {\bf x} = {\bf x}^T {\bf x} - \frac 12 \sum_{i,j} M_{i,j} (x_i - x_j)^2 \leq {\bf x}^T {\bf x}

And so

λ1=max⁡x∈Rn:∣∣x∣∣=1xTMx≤1\displaystyle \lambda_1 = \max_{{\bf x} \in {\mathbb R}^n : ||{\bf x} ||=1} {\bf x}^T M {\bf x} \leq 1

If we take 1=(1,…,1){{\bf 1} = (1,\ldots,1)} to be the all-one vector, we see that 1TM1=1{{\bf 1}^T M {\bf 1} = 1}, and so 1{1} is the largest eigenvalue of M{M}, with 1{{\bf 1}} being one of the vectors in the eigenspace of 1.

So we have the following formula for λ2{\lambda_2}:

λ2=sup⁡x∈Rn:∣∣x∣∣=1,∑ixi=0xTMx\displaystyle \lambda_2= \sup_{{\bf x}\in {\mathbb R}^n : ||{\bf x}||=1, \sum_i x_i = 0} {\bf x}^T M {\bf x}

where we equivalently expressed the condition x⊥1{{\bf x} \perp {\bf 1}} as ∑ixi=0{\sum_i x_i = 0}.

Using (3), we have

λ2=1−inf⁡x∈Rn:∣∣x∣∣=1,∑ixi=012∑ijMij(xi−xj)2\displaystyle \lambda_2 = 1 - \inf_{{\bf x}\in {\mathbb R}^n : ||{\bf x}||=1, \sum_i x_i = 0} \frac 12 \sum_{ij} M_{ij} (x_i - x_j)^2

So, if λ2=1{\lambda_2=1}, there must exist a non-zero v∈Rn{{\bf v}\in {\mathbb R}^n} such that ∑ivi=0{\sum_i v_i = 0} and ∑ijMij(vi−vj)2=0{\sum_{ij} M_{ij} (v_i - v_j)^2 =0}, but this means that, for every edge (i,j)∈E{(i,j)\in E} of positive weight we have vi=vj{v_i=v_j}, and so vi=vj{v_i=v_j} for every i,j{i,j} which are in the same connected component. The conditions ∑ivi=0{\sum_i v_i =0} and v≠0{{\bf v} \neq {\bf {0}}} imply that v{{\bf v}} has both positive and negative coordinates, and so the sets A:={i:vi>0}{A:= \{ i: v_i >0 \}} and B:={i:vi<0}{B:= \{ i: v_i < 0 \}} are non-empty and disconnected, and so G{G} is not connected.

Conversely, if G{G} is disconnected, and S{S} and V−S{V-S} are non-empty sets such that E(S,V−S)=0{E(S,V-S)= 0}, then we can define v{{\bf v}} so that vi=∣S∣/(∣V−S∣){v_i = |S|/(|V-S|)} if i∉S{i\not\in S}, and vi=−∣V−S∣/∣S∣{v_i = -|V-S|/|S|} if ∈S{\in S}, so that ∑ivi=0{\sum_i v_i = 0}. This gives us a non-zero vector such that ∑ijMij(vi−vj)2=0{\sum_{ij} M_{ij} (v_i - v_j)^2 =0} and, after dividing every coordinate by ∣∣v∣∣{||{\bf v}||}, a length-1 vector proving that λ2≥1{\lambda_2 \geq 1}.

Finally, to study λn{\lambda_n} we observe that for every vector x∈Rn{{\bf x}\in {\mathbb R}^n} we have

∑i,jMi,j(xi+xj)2=2xTx+2xTMx\displaystyle \sum_{i,j} M_{i,j} (x_i + x_j)^2 = 2 {\bf x}^T {\bf x} + 2 {\bf x}^T M {\bf x}

and so

λn=min⁡x∈Rn:∣∣x∣∣=1xTMx\displaystyle \lambda_n = \min_{{\bf x}\in {\mathbb R}^n: ||{\bf x}||=1} {\bf x}^T M {\bf x}

=min⁡x∈Rn:∣∣x∣∣=1−xTx+12∑i,jMi,j(xi+xj)2\displaystyle = \min_{{\bf x}\in {\mathbb R}^n: ||{\bf x}||=1} -{\bf x}^T {\bf x} + \frac 12 \sum_{i,j} M_{i,j} (x_i + x_j)^2

=−1+min⁡x∈Rn:∣∣x∣∣=112∑i,jMi,j(xi+xj)2\displaystyle = -1 + \min_{{\bf x}\in {\mathbb R}^n: ||{\bf x}||=1} \frac 12 \sum_{i,j} M_{i,j} (x_i + x_j)^2

From which we see that it is always λn≥−1{\lambda_n \geq -1}, and that if λn=−1{\lambda_n = -1} then there must be a non-zero vector x{{\bf x}} such that xi=−xj{x_i = -x_j} for every edge (i,j)∈E{(i,j)\in E}. Let i{i} be a vertex such that xi=a≠0{x_i = a \neq 0}, and define the sets A:={j:xj=a}{A:= \{ j: x_j = a \}}, B:={j:xj=−a}{B:= \{ j: x_j = -a \}} and R={j:xj≠±a}{R= \{ j: x_j \neq \pm a \}}. The set A∪B{A\cup B} is disconnected from the rest of the graph, because otherwise an edge with an endpoint in A∪B{A\cup B} and an endpoint in R{R} would give a positive contribution to ∑i,jMi,j(xi+xj)2{\sum_{i,j} M_{i,j} (x_i + x_j)^2}; furthermore, every edge incident on a vertex on A{A} must have the other endpoint in B{B}, and vice versa. Thus, A∪B{A\cup B} is a connected component, or a collection of connected components, of G{G} which is bipartite, with the bipartition A,B{A,B}.