Scientia sine finibus

Linear Algebra / Unit 8, Complex Vector Spaces / Topic 8.5

Units and Topics

Unit 8. Complex Vector Spaces

8.5 The Spectral Theorem for Hermitian Matrices

Topic 7.1 diagonalized a real symmetric matrix with an orthogonal matrix. This topic gives the complex version: a Hermitian matrix is diagonalized by a unitary matrix, A = UΛU†. The topic writes a Hermitian matrix as a sum of eigenvalues times projections, uses that sum to calculate functions of a matrix, and names the larger family of matrices that have an orthonormal basis of eigenvectors.

You need Topics 6.1, 7.1, 8.3, and 8.4 for this topic.

1. The Spectral Theorem

The spectral theorem for Hermitian matrices. Each n by n Hermitian matrix A has an orthonormal basis of Cⁿ that consists of eigenvectors of A. With these eigenvectors in the columns of a unitary matrix U, and the real eigenvalues on the diagonal of Λ, A = UΛU†.

The theorem holds for each Hermitian matrix, including a matrix with repeated eigenvalues. A Hermitian matrix always has enough eigenvectors. The proof is by induction on the size of the matrix. One eigenvector always exists, because the characteristic polynomial has a root. The matrix sends each vector that is orthogonal to that eigenvector to another vector that is orthogonal to it, so the same argument can be repeated in a space of one dimension less.

An example

Topic 8.3 found the eigenvalues 4 and 1 of the matrix H below, with the eigenvectors (1 − i, 2) and (−1 + i, 1). Their lengths are √6 and √3.

H = 21 − i1 + i3 u₁ = 1/√6 1 − i2 u₂ = 1/√3 −1 + i1 Λ = 4001

The matrix U has the columns u₁ and u₂. No inverse has to be calculated, because U⁻¹ = U†.

2. A Sum of Projections

For a unit vector u, the matrix P = uu† projects each vector onto the line of u. It is the complex version of the projection matrix of Topic 6.1. Multiplying out UΛU† gives the spectral decomposition.

A = λ₁P₁ + λ₂P₂ + … + λₙPₙ with Pi = uiui†

The projections have four properties.

  • Pi² = Pi. Projecting twice is the same as projecting once.
  • Pi† = Pi. Each projection is Hermitian.
  • PiPj = 0 for two different indexes, because the eigenvectors are orthogonal.
  • P₁ + P₂ + … + Pₙ = I. The projections add up to the identity matrix.

The last property is called the completeness relation. It says that each vector is the sum of its projections onto the eigenvectors. Topic 9.2 develops it.

The Pauli matrix σx

The unit eigenvectors of σx are (1, 1)/√2 for the eigenvalue 1 and (1, −1)/√2 for the eigenvalue −1.

P₊ = 1/2 1111 P₋ = 1/2 1−1−11 (1)P₊ + (−1)P₋ = 0110 = σx and P₊ + P₋ = I

The Pauli matrix σy

The unit eigenvector for the eigenvalue 1 is u = (1, i)/√2. The row u† holds the conjugates, (1, −i)/√2.

P₊ = uu†the projection onto the eigenvectorP₊ = 1/2 1i 1−ia column times its conjugate transposeP₊ = 1/2 1−ii1P₋ = 1/2 1i−i1the same calculation for the other eigenvector

The difference P₊ − P₋ is the matrix with the rows 0, −i and i, 0, which is σy.

3. Repeated Eigenvalues

When an eigenvalue is repeated, its eigenvectors fill a subspace of more than one dimension. Physics calls such an eigenvalue degenerate. Any orthonormal basis of that subspace can be used, so the eigenvectors are not unique. The sum of their projections does not depend on the choice. It is the projection onto the whole eigenspace.

The spectral decomposition is therefore best written with one term for each different eigenvalue, where each P is the projection onto the eigenspace of that eigenvalue. In this form the decomposition of a Hermitian matrix is unique.

4. Functions of a Hermitian Matrix

The properties of the projections make powers easy. All of the mixed products are zero, and each Pi² is Pi.

A² = λ₁²P₁ + … + λₙ²Pₙ and Ak = λ₁kP₁ + … + λₙkPₙ

The same rule defines any function of the matrix: apply the function to each eigenvalue, and keep the projections.

f(A) = f(λ₁)P₁ + … + f(λₙ)Pₙ = U f(Λ) U†
FunctionResultCondition
InverseA⁻¹ = (1/λ₁)P₁ + … + (1/λₙ)PₙNo eigenvalue is zero
Square root√λ₁ P₁ + … + √λₙ PₙNo eigenvalue is negative
ExponentialeA = eλ₁P₁ + … + eλₙPₙNone
Unitary exponentialeiA = eiλ₁P₁ + … + eiλₙPₙNone

A square root

The matrix with the rows 2, 1 and 1, 2 has the eigenvalues 3 and 1, with the same eigenvectors as σx. So it is 3P₊ + P₋, and its square root is

√3 P₊ + P₋ = 1/2 √3 + 1√3 − 1√3 − 1√3 + 1

Multiplying this matrix by itself gives the matrix with the rows 2, 1 and 1, 2.

A unitary exponential

eiθσx = eiθP₊ + e−iθP₋apply the function to each eigenvalueeiθσx = cos θi sin θi sin θcos θadd the two matrices, with the formula of Euler

The entries come from the formulas of Topic 8.1 for cos θ and sin θ. The result is a unitary matrix, as Topic 8.4 stated.

5. An Average of Eigenvalues

Let x be a vector of length 1, and write it in the eigenvector basis: x = c₁u₁ + … + cₙuₙ with ci = ⟨ui, x⟩. Then

⟨x, Ax⟩ = λ₁|c₁|² + λ₂|c₂|² + … + λₙ|cₙ|²

The numbers |ci|² are not negative, and they add up to 1. The real number ⟨x, Ax⟩ of Topic 8.3 is a weighted average of the eigenvalues. It lies between the smallest and the largest eigenvalue, as in Topic 7.2.

This is the measurement rule of quantum mechanics in the language of linear algebra. A measurement of the quantity A on the state x gives the eigenvalue λi with the probability |ci|², and the average of many measurements is ⟨x, Ax⟩. Topic 9.3 develops this.

Try it: the weights of the two eigenvalues

The state is the unit vector x = (cos(α/2), eiφ sin(α/2)). The sliders set α and φ, and the menu chooses a Pauli matrix. The blue bar and the red bar show the weights |c|² of the eigenvalues 1 and −1. The green mark on the line below shows the average ⟨x, Ax⟩.

6. Normal Matrices

Hermitian matrices are not the only matrices with an orthonormal basis of eigenvectors. A square matrix A is called normal when it gives the same product with its conjugate transpose in both orders.

A†A = AA†

A matrix has an orthonormal basis of eigenvectors exactly when it is normal. Then A = UΛU† with a unitary U, and the eigenvalues on the diagonal of Λ can be complex.

Kind of normal matrixConditionEigenvalues
HermitianA† = AReal
Skew-HermitianA† = −AImaginary
UnitaryA† = A⁻¹Absolute value 1

The shear with the rows 1, 1 and 0, 1 is not normal. Topic 5.3 showed that it cannot be diagonalized at all. The matrix with the rows 2, 1 and 0, 3 is not normal either. It can be diagonalized, but its eigenvectors (1, 0) and (1, 1) are not orthogonal.

Common Mistakes

  • Writing A = UΛUT for a complex matrix. The last factor is the conjugate transpose U†.
  • Building U from eigenvectors that do not have the length 1.
  • Calculating a projection as uuT for a complex vector. The row must hold the conjugates: P = uu†.
  • Calculating a function of a matrix by applying the function to each entry. The function is applied to the eigenvalues.
  • Expecting orthogonal eigenvectors from any matrix that can be diagonalized. Only normal matrices have them.
  • Treating the eigenvectors of a repeated eigenvalue as unique.

Summary

FactStatement
Spectral theoremA Hermitian matrix is A = UΛU†, with a unitary U and a real diagonal Λ
Spectral decompositionA = λ₁P₁ + … + λₙPₙ with Pi = uiui†
ProjectionsP² = P, P† = P, PiPj = 0, and P₁ + … + Pₙ = I
Function of a matrixf(A) = f(λ₁)P₁ + … + f(λₙ)Pₙ
Average⟨x, Ax⟩ = λ₁|c₁|² + … + λₙ|cₙ|² for a unit vector x
Normal matrixA†A = AA†, which is the condition for an orthonormal basis of eigenvectors

Practice

Work each problem on paper first. Then open the answer to check your work.

1. Find the spectral decomposition of A = 2i−i2.

The trace is 4 and the determinant is 4 − 1 = 3, so the eigenvalues are 3 and 1.

For 3, the first row gives −x + iy = 0, so the unit eigenvector is (i, 1)/√2. For 1, the unit eigenvector is (−i, 1)/√2.

P₃ = (1/2) 1i−i1 and P₁ = (1/2) 1−ii1, and A = 3P₃ + P₁.

2. Check that the matrix P₃ of Problem 1 satisfies P₃² = P₃.

1/4 1i−i1 1i−i1 = 1/4 1 + 1i + i−i − i1 + 1multiply= 1/2 1i−i1the same matrix again

3. Find σx¹⁰⁰ and σx¹⁰¹.

σx = P₊ − P₋the spectral decompositionσxk = (1)kP₊ + (−1)kP₋raise each eigenvalue to the power kσx¹⁰⁰ = P₊ + P₋ = Ik = 100σx¹⁰¹ = P₊ − P₋ = σxk = 101

4. Find the inverse of the matrix A of Problem 1 from its spectral decomposition.

A⁻¹ = 1/3P₃ + P₁1 divided by each eigenvalueA⁻¹ = 1/6 1i−i1 + 1/2 1−ii1A⁻¹ = 1/3 2−ii2

5. For the matrix A of Problem 1 and the state x = (1, 0), find the weights of the two eigenvalues and the average ⟨x, Ax⟩.

c₃ = ⟨(i, 1)/√2, x⟩ = −i/√2|c₃|² = 1/2the weight of the eigenvalue 3|c₁|² = 1/2the weight of the eigenvalue 1average = 3(1/2) + 1(1/2) = 2

The average is the entry of A in row 1, column 1.

6. Is the rotation 0−110 normal? What does that say about its eigenvectors?

The matrix is real and orthogonal, so it is unitary, and each unitary matrix is normal.

Its eigenvectors (1, −i) and (1, i), for the eigenvalues i and −i, are orthogonal in the complex inner product.

Python Practice

Step 1. Diagonalize a Hermitian matrix

The instruction np.linalg.eigh gives the real eigenvalues w and a unitary matrix U whose columns are orthonormal eigenvectors. The product UΛU† should give the matrix back.

Python

The eigenvalues are 1 and 4, and the last result is the matrix H.

Step 2. The projections

For a unit vector u, the expression np.outer(u, u.conj()) calculates the projection matrix uu†. The second vector receives the conjugates, as the row u† does. The code below builds the two projections of H and checks two of their properties.

Python

The two projections add up to the identity matrix, and their product is the zero matrix.

Now add a line that builds the matrix B = λ₁P₁ + λ₂P₂ from the eigenvalues w[0] and w[1]. The result should be H.

Python

Step 3. A function of a matrix

From Part 4, a function of a Hermitian matrix is found by applying the function to the eigenvalues. The code below calculates the square root of the matrix with the rows 2, 1 and 1, 2, and then multiplies the result by itself.

Python

The entries of R are 1.366 and 0.366, which are (√3 + 1)/2 and (√3 − 1)/2, as in Part 4. The last result is the matrix A.

Now change the code so that R is the inverse of A. The function is 1/λ, which is typed as 1 / w.

Python

Step 4. An average of eigenvalues

The code below finds the components of a unit vector x in the eigenvector basis. The product U.conj().T @ x calculates all of the inner products ⟨u, x⟩ at once. The weights are the squared absolute values of the components.

Python

The weights are 0.6667 for the eigenvalue 1 and 0.3333 for the eigenvalue 4. The weighted average is 2, and the last line gives the same number as ⟨x, Hx⟩.

Step 5. Test whether a matrix is normal

From Part 6, a matrix is normal when A†A is equal to AA†. The code below tests the shear, which is not normal.

Python

The two products are different, so the result is False. Now test the rotation of Practice Problem 6, with the rows 0, −1 and 1, 0.

Python

The result is True. The rotation is normal, so it has an orthonormal basis of complex eigenvectors.

Quiz

This quiz has 5 questions on this topic. A question asks you either to choose one answer or to type numbers. The page grades your answers and explains each one. A number can be typed as a whole number, a decimal, a fraction such as 1/3, or a calculation such as sqrt(18)/2 or arccos(1/2). The page shows the value of a calculation next to the box. Angles in a calculation are in degrees. The Calculator button under each question opens a calculator. Your answers are saved in your browser, so they are still on the page when you come back to it.

Choose how your answers are checked

1. A Hermitian matrix is written as A = UΛU†. Which statement is true?

2. A Hermitian matrix A has the eigenvalues 2 and 5. For a unit vector x, the weight of the eigenvalue 2 is 0.25, and the weight of the eigenvalue 5 is 0.75. Find ⟨x, Ax⟩.

3. u is a unit vector, and P = uu†. Which equation is true?

4. The Pauli matrix σx = 0110 has the eigenvalues 1 and −1. Find the two entries in the first row of σx¹⁰.

5. Which kind of matrix does not always have an orthonormal basis of eigenvectors?

Next: Topic 8.6, Commutators and Shared Eigenvectors