Scientia sine finibus

Linear Algebra / Unit 7, Symmetric Matrices / Topic 7.1

Units and Topics

Unit 7. Symmetric Matrices

7.1 Symmetric Matrices and the Spectral Theorem

A symmetric matrix is equal to its transpose. This topic shows three facts about a symmetric matrix with real entries. Its eigenvalues are real numbers, its eigenvectors can be chosen perpendicular to each other, and it can be diagonalized by an orthogonal matrix. Together, the three facts are called the spectral theorem.

You need Topics 3.3, 5.1, 5.3, 6.1, and 6.3 for this topic.

1. Three Facts about Symmetric Matrices

From Topic 3.3, a matrix A is symmetric when AT = A. The entry in row i and column j is equal to the entry in row j and column i. In this unit, all matrices have real entries.

Topic 5.2 showed that a real matrix can have complex eigenvalues, and Topic 5.3 showed that some matrices cannot be diagonalized. A symmetric matrix has neither difficulty.

  • All eigenvalues of a symmetric matrix are real numbers.
  • Eigenvectors that belong to different eigenvalues are perpendicular.
  • An n by n symmetric matrix has n independent eigenvectors, and they can be chosen as an orthonormal basis.

An example

A = 2112

Topic 5.1 found the eigenvalues 3 and 1 of this matrix, with the eigenvectors (1, 1) and (1, −1). Both eigenvalues are real. The dot product of the two eigenvectors is 1 − 1 = 0, so they are perpendicular.

2. Why the Three Facts Are True

Perpendicular eigenvectors

The rule of Topic 3.3 moves a matrix across a dot product as its transpose. For a symmetric matrix the transpose is the matrix itself.

(Ax) · y = x · (Ay)

Let x and y be eigenvectors with the different eigenvalues λ₁ and λ₂. Put Ax = λ₁x on the left side and Ay = λ₂y on the right side.

λ₁(x · y) = λ₂(x · y) so (λ₁ − λ₂)(x · y) = 0

The two eigenvalues are different, so λ₁ − λ₂ is not zero. The dot product x · y must be zero.

Real eigenvalues

For a 2 by 2 matrix, Topic 5.2 found the eigenvalues from the trace T and the determinant D. The eigenvalues are real when T² − 4D is not negative. For the symmetric matrix with the rows a, b and b, d,

T² − 4D = (a + d)² − 4(ad − b²)the trace is a + d, and the determinant is ad − b²T² − 4D = (a − d)² + 4b²multiply out and collect the terms

A sum of two squares is never negative, so the eigenvalues are real. The proof for larger matrices uses complex numbers, and Topic 8.3 gives it.

Enough eigenvectors

A symmetric matrix always has a full set of n independent eigenvectors, even when an eigenvalue is repeated. Part 4 looks at repeated eigenvalues. Topic 8.5 returns to the proof.

3. The Spectral Theorem

Divide each eigenvector by its length, and put the unit eigenvectors q₁, …, qₙ in the columns of a matrix Q. The columns are orthonormal, so Q is an orthogonal matrix. Put the eigenvalues, in the same order, on the diagonal of a matrix Λ.

The spectral theorem. Each symmetric matrix A with real entries can be written as A = QΛQT, where Q is an orthogonal matrix whose columns are eigenvectors of A, and Λ is a diagonal matrix that holds the eigenvalues.

Compare this with the diagonalization A = XΛX⁻¹ of Topic 5.3. For a symmetric matrix the eigenvector matrix can be chosen orthogonal, and then its inverse is its transpose. No inverse has to be calculated.

The example again

The eigenvectors (1, 1) and (1, −1) both have the length √2.

Q = 1/√2 111−1 Λ = 3001 QΛQT = 1/2 111−1 3001 111−1the two factors 1/√2 give 1/2QΛQT = 1/2 313−1 111−1multiply the first two matricesQΛQT = 2112multiply by the third matrix

The statement also works in the other direction. A product QΛQT with an orthogonal Q and a diagonal Λ is always symmetric, because its transpose is (QT)TΛTQT = QΛQT. The symmetric matrices are exactly the real matrices that have an orthonormal basis of eigenvectors with real eigenvalues.

The set of eigenvalues of a matrix is called its spectrum, which is where the name of the theorem comes from.

4. Repeated Eigenvalues

When an eigenvalue is repeated, its eigenvectors fill a plane or a larger subspace, which Topic 5.1 called the eigenspace. A symmetric matrix always has an eigenspace as large as the number of repeats. Any orthonormal basis of the eigenspace can be used for the columns of Q, so Q is not unique.

A = 200020005

The eigenvalue 2 is repeated twice, and its eigenspace is the xy-plane. The vectors (1, 0, 0) and (0, 1, 0) are one choice of two perpendicular unit eigenvectors. The vectors (1, 1, 0)/√2 and (1, −1, 0)/√2 are another choice. The eigenspace of the eigenvalue 5 is the z-axis, which is perpendicular to the plane.

If the eigenvectors that you find in a repeated eigenspace are not perpendicular, use the Gram-Schmidt process of Topic 6.2 inside that eigenspace.

5. A Sum of Projections

From Topic 6.1, the matrix qqT projects each vector onto the line of the unit vector q. Multiplying out QΛQT column by column gives a sum with one term for each eigenvector.

A = λ₁q₁q₁T + λ₂q₂q₂T + … + λₙqₙqₙT

The matrix A projects a vector onto each eigenvector line, multiplies each projection by the eigenvalue of that line, and adds the results.

For the example, q₁ = (1, 1)/√2 and q₂ = (1, −1)/√2.

3q₁q₁T + 1q₂q₂T = 3/2 1111 + 1/2 1−1−11each term is an eigenvalue times a projection3q₁q₁T + 1q₂q₂T = 2112add the matching entries

Quantum mechanics writes each measurable quantity in this form, as a sum of eigenvalues times projections. Topic 9.2 develops this.

6. What a Symmetric Map Does

The eigenvectors of a symmetric matrix give a set of perpendicular axes. Along each axis, the map multiplies lengths by the eigenvalue of that axis. A symmetric map is a stretch along perpendicular directions, with no rotation of those directions. The unit circle goes to an ellipse whose axes lie along the eigenvectors, and the half-lengths of the axes are the sizes of the eigenvalues.

Try it: the eigenvector lines of a matrix

The sliders set the entries of the matrix with the rows a, b and c, d. The gray circle is the unit circle, and the green curve is its image under the matrix. The blue line and the red line are the eigenvector lines, and each arrow shows where the matrix sends the unit eigenvector of that line. Clear the check box to set c separately from b, and compare a matrix that is not symmetric.

7. Symmetric Matrices in Physics

  • The moment of inertia of a rigid body in three dimensions is a symmetric 3 by 3 matrix. Its eigenvectors are the principal axes of the body. A body that spins about a principal axis has an angular momentum that is parallel to its angular velocity.
  • For masses that are joined by springs, the forces are given by a symmetric matrix of spring constants. Its eigenvectors are the normal modes, which are the patterns in which all of the masses oscillate with one frequency.
  • The stress inside a solid is described by a symmetric matrix. Its eigenvectors are the directions in which the material is only pulled or pushed, with no shear.

In each case, the eigenvectors give perpendicular axes in which the problem separates into independent parts.

Common Mistakes

  • Writing A = QΛQT with eigenvectors that were not divided by their lengths. The columns of Q must be unit vectors.
  • Putting the eigenvalues in Λ in a different order from the eigenvectors in Q.
  • Expecting perpendicular eigenvectors from a matrix that is not symmetric.
  • Assuming that two eigenvectors of a repeated eigenvalue are perpendicular. They can be chosen perpendicular, but two that you find by elimination may not be.
  • Thinking that a symmetric matrix must have positive eigenvalues. The matrix with the rows 1, 2 and 2, 1 has the eigenvalues 3 and −1.

Summary

FactStatement
Symmetric matrixAT = A
EigenvaluesAll real
EigenvectorsPerpendicular for different eigenvalues, and a full orthonormal set always exists
Spectral theoremA = QΛQT with an orthogonal matrix Q
Sum of projectionsA = λ₁q₁q₁T + … + λₙqₙqₙT
The mapA stretch along perpendicular axes

Practice

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

1. Find the eigenvalues and unit eigenvectors of 1221.

λ² − 2λ − 3 = 0the trace is 2 and the determinant is −3(λ − 3)(λ + 1) = 0factor

The eigenvalues are 3 and −1. For 3, the eigenvector is (1, 1), and the unit eigenvector is (1, 1)/√2. For −1, the unit eigenvector is (1, −1)/√2.

2. Write A = 5222 as QΛQT.

The trace is 7 and the determinant is 6, so the eigenvalues are 6 and 1.

For 6, the equations give x = 2y, so the eigenvector is (2, 1). For 1, the equations give y = −2x, so the eigenvector is (1, −2). Both have the length √5.

Q = (1/√5) 211−2 and Λ = 6001.

3. The matrix 2103 is not symmetric. Are its eigenvectors perpendicular?

The matrix is triangular, so the eigenvalues are 2 and 3. The eigenvectors are (1, 0) and (1, 1).

Their dot product is 1, so they are not perpendicular.

4. A symmetric matrix has the eigenvalue 4 with the eigenvector (1, 1) and the eigenvalue 2 with the eigenvector (1, −1). Find the matrix.

Use the sum of projections with q₁ = (1, 1)/√2 and q₂ = (1, −1)/√2.

A = 4/2 1111 + 2/2 1−1−11each eigenvalue times its projectionA = 3113add the matching entries

5. Show that BTB is symmetric for any matrix B.

The transpose of a product reverses the order.

(BTB)T = BT(BT)Tthe transposes in the reverse order(BTB)T = BTBthe transpose of a transpose is the original matrix

The matrix is equal to its transpose, so it is symmetric. Topics 7.2 and 7.3 use this matrix.

6. The matrix 111111111 has the eigenvalues 3, 0, and 0. Describe its eigenvectors.

For 3, the eigenvector is (1, 1, 1). For 0, the eigenvectors are the solutions of x + y + z = 0, which is a plane.

The plane is perpendicular to (1, 1, 1). Two perpendicular vectors in the plane are (1, −1, 0) and (1, 1, −2).

Python Practice

Step 1. Eigenvalues and eigenvectors of a symmetric matrix

Topic 5.1 used the instruction np.linalg.eig. For a symmetric matrix, the instruction np.linalg.eigh is the better choice. It gives the eigenvalues in order from the smallest to the largest, and it gives eigenvectors that are already orthonormal. As before, the eigenvectors are the columns of the second result.

Python

The eigenvalues are 1 and 3. The columns of Q are the unit eigenvectors, with the entries 0.707 or −0.707, which is 1/√2. Python can give an eigenvector with the opposite sign. Both signs are correct.

Now find the eigenvalues of the matrix of Practice Problem 2, with the rows 5, 2 and 2, 2.

Python

Step 2. Check that Q is orthogonal

From Topic 6.3, a matrix Q is orthogonal when QTQ is the identity matrix. The instruction np.round rounds the result, so that very small rounding errors show as 0.

Python

The result is the identity matrix, so the eigenvectors are orthonormal.

Step 3. Rebuild the matrix from Q and Λ

The instruction np.diag(w) makes a diagonal matrix from the list of eigenvalues. The product QΛQT should give the matrix A back.

Python

The result is the matrix A. No inverse was needed.

The spectral theorem also builds a matrix from chosen eigenvalues. In the next box, the same Q is used with the eigenvalues 10 and 5 in place of 1 and 6. Change the code so that the eigenvalues are 2 and 7.

Python

Each eigenvalue went up by 1, and the result is A + I. Adding the identity matrix does not change the eigenvectors.

Step 4. A sum of projections

As in Unit 5, Q[:, 0] is the first column of Q and Q[:, 1] is the second column. The instruction np.outer(q, q) calculates the matrix qqT, which projects onto the line of q. The code below adds the two projections, each multiplied by its eigenvalue.

Python

The two projection matrices have the entries 0.5 and −0.5, as in Part 5. The last result is the matrix A.

Step 5. A matrix that is not symmetric

The matrix of Practice Problem 3 is not symmetric, so the code below uses np.linalg.eig. The last line prints the dot product of the two eigenvectors.

Python

The dot product is 0.707, not 0, so the eigenvectors are not perpendicular. Now change one entry of A so that the matrix is symmetric, and run the code again.

Python

For the symmetric matrix, the eigenvectors are perpendicular.

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. Which of these matrices is symmetric?

2. Find the eigenvalues of the symmetric matrix 4114.

3. A is a symmetric matrix with real entries. Two of its eigenvectors belong to different eigenvalues. What is true about the two eigenvectors?

4. A symmetric matrix has the eigenvalue 5 with the eigenvector (1, 2). Its other eigenvalue is 0, with the eigenvector (2, c). Find c.

5. A = QΛQT. The columns of Q are (0.6, 0.8) and (−0.8, 0.6), and the diagonal entries of Λ are 10 and 5. Find the two entries in the first row of A.

Next: Topic 7.2, Quadratic Forms and Positive Definite Matrices