Back to the on-screen lesson ·

Symmetric matrices and the spectral theorem

Why a symmetric matrix has real eigenvalues and perpendicular eigenvectors, how $A = QDQ^{T}$ replaces an inverse by a transpose, and what the eigenvalues say about a quadratic form.

Paper packet. Every task here also exists on screen, where it is checked automatically; answers written on paper are not assessed by Nydus. When you are back at a device, enter your answers there.

1. What you will learn

By the end of this lesson you will be able to recognise a symmetric matrix and say what the spectral theorem promises about it, prove in one line that eigenvectors for different eigenvalues of a symmetric matrix are orthogonal, build the orthogonal $Q$ and diagonal $D$ with $A = QDQ^{T}$ and use the transpose in place of an inverse, turn a quadratic expression into the unique symmetric matrix behind it by halving the cross term, and classify that form as positive definite, semi-definite or indefinite from the signs of the eigenvalues or from the leading principal minors.

2. The two things that could go wrong, and are about to stop

Diagonalisation can fail in exactly two ways. The characteristic polynomial may have no real roots, as a rotation's does; or it may have a repeated root whose eigenspace is too small, as a shear's does. Both have appeared in this unit and both had to be checked for every matrix. This lesson names one hypothesis that rules out both at once, and then never has to check again.

3. The words of this lesson

$A$ is symmetric when $A^{T} = A$, so the entry in row $i$, column $j$ equals the entry in row $j$, column $i$. $Q$ is orthogonal when its columns are orthonormal, which is the same as $Q^{T}Q = I$ and hence $Q^{-1} = Q^{T}$. $A$ is orthogonally diagonalisable when $A = QDQ^{T}$ with $Q$ orthogonal and $D$ diagonal. A quadratic form is $q(v) = v^{T}Av$ with $A$ symmetric. It is positive definite when $q(v) > 0$ for every $v \ne 0$, positive semi-definite when $q(v) \ge 0$, and indefinite when it takes both signs.

4. One hypothesis, three conclusions

The spectral theorem. If $A$ is a real symmetric matrix then every eigenvalue of $A$ is real, eigenvectors belonging to different eigenvalues are automatically orthogonal, and there is an orthonormal basis of $\mathbb{R}^n$ made of eigenvectors of $A$. Equivalently, $A = QDQ^{T}$ with $Q$ orthogonal and $D$ real diagonal.

Each of the three conclusions is worth a sentence on its own.

Real eigenvalues. No symmetric matrix has a complex eigenvalue, ever. The rotation matrices, which have no real eigenvalue at all, are exactly the matrices this rules out.

Automatic orthogonality. For a general diagonalisable matrix the eigenvectors are independent and usually at some awkward angle. For a symmetric one, eigenvectors for different eigenvalues are perpendicular whether you arrange it or not. Inside a single repeated eigenvalue's eigenspace you may have to run Gram-Schmidt, but across different eigenvalues there is nothing to do.

No defective symmetric matrix exists. A repeated eigenvalue of a symmetric matrix always has an eigenspace of the full algebraic multiplicity. The shear $\begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix}$ is not symmetric, and that is not a coincidence.

The inverse $Q^{-1}$ has become a transpose, which is the practical payoff: $A^k = QD^kQ^{T}$ needs no inversion at all, and neither does anything else built from the decomposition.

Another way: picture

A symmetric matrix acts on the plane by stretching along two perpendicular axes — never by rotating, never by shearing. Draw the unit circle and its image: an ellipse whose axes are at right angles to each other and lined up with the eigenvectors, stretched by the eigenvalues. A negative eigenvalue flips that axis. $Q^{T}$ turns the eigenvector axes into the coordinate axes, $D$ stretches along them, and $Q$ turns them back; the whole matrix is that sandwich and nothing more.

Another way: steps

  1. Check $A^{T} = A$. Nothing below is promised without it.
  2. Find the eigenvalues from $\det(A - \lambda I) = 0$; they will be real.
  3. For each eigenvalue, find a basis of its eigenspace, and run Gram-Schmidt inside any eigenspace of dimension above one.
  4. Normalise every eigenvector to unit length and put them in the columns of $Q$; the matching eigenvalues go on the diagonal of $D$ in the same order.
  5. Check by computing $QDQ^{T}$, or at least check $Q^{T}Q = I$.

5. Both proofs, in a line each

Orthogonality. Let $Av = \lambda v$ and $Aw = \mu w$ with $\lambda \ne \mu$. Then

$$\lambda (v \cdot w) = (Av) \cdot w = v^{T}A^{T}w = v^{T}Aw = v \cdot (Aw) = \mu (v \cdot w).$$

The symmetry is used once, in the middle, to move $A$ from one side of the dot product to the other. So $(\lambda - \mu)(v \cdot w) = 0$, and since $\lambda \ne \mu$ it must be that $v \cdot w = 0$. That is the entire argument, and it explains why the result feels like an accident when you first meet it: there is only one step in it.

Realness. For a $2 \times 2$ the characteristic polynomial of $\begin{pmatrix} a & b \\ b & c \end{pmatrix}$ is $\lambda^2 - (a + c)\lambda + (ac - b^2)$, with discriminant

$$(a + c)^2 - 4(ac - b^2) = (a - c)^2 + 4b^2 \ge 0.$$

A sum of two squares cannot be negative, so the roots are real. The general proof runs the same way with complex conjugates: if $Av = \lambda v$ then $\overline{v}^{T}Av$ equals both $\lambda (\overline{v}^{T}v)$ and $\overline{\lambda}(\overline{v}^{T}v)$, and $\overline{v}^{T}v > 0$, so $\lambda = \overline{\lambda}$.

6. Quadratic forms, and what the eigenvalues decide

A quadratic form is an expression like $q(x, y) = 3x^2 + 4xy + 5y^2$, and every one of them is $v^{T}Av$ for exactly one symmetric $A$: the coefficients of the squares go on the diagonal, and the cross-term coefficient is split in half between the two off-diagonal places. Splitting it is what makes the matrix unique.

Now write $A = QDQ^{T}$ and change coordinates by $w = Q^{T}v$. Then

$$q(v) = v^{T}QDQ^{T}v = w^{T}Dw = \lambda_1w_1^2 + \dots + \lambda_nw_n^2,$$

and every cross term has vanished. In the eigenvector coordinates a quadratic form is nothing but a weighted sum of squares, with the eigenvalues as the weights. So the sign of the form is decided entirely by the signs of the eigenvalues:

EigenvaluesThe formThe level set $q = 1$
all $> 0$positive definitean ellipse
all $\ge 0$, one $= 0$positive semi-definitea pair of parallel lines
mixed signsindefinitea hyperbola
all $< 0$negative definiteempty

For a $2 \times 2$ there is a shortcut that avoids finding the eigenvalues: the form is positive definite exactly when the top-left entry and the determinant are both positive. That is the smallest case of the leading-principal-minor test, and it is the one worth memorising.

7. Four traps, three of them about words

Symmetric is not orthogonal. A symmetric matrix satisfies $A^{T} = A$; an orthogonal one satisfies $Q^{T}Q = I$. The spectral theorem uses both words in one sentence and they mean quite different things. The identity is the rare matrix that is both.

Diagonalisable is not orthogonally diagonalisable. $\begin{pmatrix} 1 & 1 \\ 0 & 2 \end{pmatrix}$ is diagonalisable; its eigenvectors are $(1, 0)$ and $(1, 1)$, which are not perpendicular, and no choice of eigenvectors makes them so. A matrix is orthogonally diagonalisable only if it is symmetric — the converse of the theorem is true too, since $QDQ^{T}$ is visibly its own transpose.

Positive entries do not make a form positive definite. $\begin{pmatrix} 1 & 3 \\ 3 & 1 \end{pmatrix}$ has nothing but positive entries and eigenvalues $4$ and $-2$; at $v = (1, -1)$ the form returns $-4$. It is the eigenvalues that decide, and no amount of looking at the entries substitutes for them.

The theorem is about real symmetric matrices. Over the complex numbers the right hypothesis is $A^{*} = A$, not $A^{T} = A$, and $\begin{pmatrix} 1 & i \\ i & 1 \end{pmatrix}$ is symmetric in the transpose sense and has no basis of eigenvectors at all.

8. Diagonalising a symmetric matrix orthogonally

  1. $A = \begin{pmatrix} 5 & 2 \\ 2 & 5 \end{pmatrix}$. It is symmetric, so everything below is promised before any work is done.

    Check the hypothesis first.

  2. $A(1, 1) = (7, 7)$ and $A(1, -1) = (3, -3)$, so the eigenvalues are $7$ and $3$ with eigenvectors $(1, 1)$ and $(1, -1)$ — perpendicular, as promised, with no effort spent arranging it.

    Distinct eigenvalues, automatic orthogonality.

  3. Normalise: $Q = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}$, $D = \begin{pmatrix} 7 & 0 \\ 0 & 3 \end{pmatrix}$, and $A = QDQ^{T}$ with no inverse computed anywhere.

    The transpose is the inverse.

9. Classifying a quadratic form

  1. $q(x, y) = 2x^2 - 4xy + 5y^2$. The matrix is $\begin{pmatrix} 2 & -2 \\ -2 & 5 \end{pmatrix}$: the cross-term coefficient $-4$ is split into $-2$ and $-2$.

    Halve the cross term.

  2. Top-left entry $2 > 0$; determinant $10 - 4 = 6 > 0$. Both minors positive, so the form is positive definite.

    The two-by-two shortcut.

  3. Confirming with eigenvalues: $\lambda^2 - 7\lambda + 6 = (\lambda - 6)(\lambda - 1)$, so $6$ and $1$, both positive. In eigenvector coordinates $q = 6w_1^2 + w_2^2$, and the level set $q = 1$ is an ellipse.

    The two routes agree.

10. Your turn: is $\begin{pmatrix} 1 & 3 \\ 3 & 4 \end{pmatrix}$ positive definite?

  1. It is symmetric, so the eigenvalues are real and the question is only about their signs.

    The hypothesis holds.

  2. Top-left entry is $1 > 0$; determinant is $4 - 9 = -5$.

    Both minors must be positive.

  3. Your turn: work this step out. Its working is at the end of the packet.

    The determinant is negative, so it is the product of the eigenvalues that is negative: one is positive and one is negative. The form is indefinite, and its level set $q = 1$ is a hyperbola.

11. Guided practice

Let $A = \begin{pmatrix} 6 & 4 \\ 4 & 6 \end{pmatrix}$. Write the diagonal matrix $D$ in $A = QDQ^{T}$, taking the eigenvector $(1, 1)$ first.

This task has no paper form; do it on a device.

12. Guided practice

Match each matrix to what is true of its eigenvalues and eigenvectors over the real numbers.

Real eigenvalues and an orthonormal basis of eigenvectorsNo real eigenvalue at allReal eigenvalues, but no basis of eigenvectors
$\begin{pmatrix} 7 & 1 \\ 1 & 2 \end{pmatrix}$
$\begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}$
$\begin{pmatrix} 7 & 1 \\ 0 & 7 \end{pmatrix}$

13. Practice

Let $A = \begin{pmatrix} 4 & 5 \\ 4 & 4 \end{pmatrix}$, which is not symmetric. Write $A + A^{T}$.

This task has no paper form; do it on a device.

14. Practice

The characteristic polynomial of $\begin{pmatrix} 4 & 5 \\ 5 & 6 \end{pmatrix}$ is $\lambda^2 - 10\lambda - 1$. What is its discriminant?

Answer:

15. Practice

For which values of $t$ is $\begin{pmatrix} 5 & 10 \\ 10 & t \end{pmatrix}$ positive definite?

This task has no paper form; do it on a device.

16. Somewhere new

Two coupled springs store energy $E(x, y) = 5x^2 + 10xy + 3y^2$ when displaced by $x$ and $y$. Every such expression is $v^{T}Sv$ for exactly one symmetric $S$. Fill in $S$.

First columnSecond column
First row
Second row

17. Lesson test

Lesson test: one question per skill, one attempt each, no hints. Your answers are checked when you submit.

18. Test question

Let $A = \begin{pmatrix} 9 & 5 \\ 5 & 9 \end{pmatrix}$. Write the diagonal matrix $D$ in $A = QDQ^{T}$, taking the eigenvector $(1, 1)$ first.

This task has no paper form; do it on a device.

19. What you can do now

You can state the spectral theorem with its one hypothesis, orthogonally diagonalise a symmetric matrix, and classify a quadratic form. Say in your own words why symmetry is enough to rule out both of the ways diagonalisation can fail. Next: the decomposition that keeps working when the matrix is not symmetric, and not even square.

Working for the steps left to you

10. Your turn: is $\begin{pmatrix} 1 & 3 \\ 3 & 4 \end{pmatrix}$ positive definite?, step 3

Name what it is, not only what it is not.