Session 25 · Unit 3

Symmetric Matrices and Positive Definiteness


Symmetric matrices are the most important class of matrices, and this lecture states their two main facts up front. The eigenvalues are real, and the eigenvectors can be chosen perpendicular — which turns the diagonalization into the spectral theorem A = Q Lambda Q-transpose. Strang proves the eigenvalues are real, shows that the signs of the pivots match the signs of the eigenvalues, and closes by introducing positive definite matrices, the subclass where every eigenvalue, every pivot, and every sub-determinant is positive.

The two main facts, stated right away

This is the lecture on symmetric matrices — “the most important class of matrices.” The question we now ask of any matrix is: what are its eigenvalues, what are its eigenvectors? And when a matrix has special structure, that structure should show up there. Markov matrices have an eigenvalue equal to 11. What do symmetric matrices — real matrices with A=ATA = A^T — have?

Strang tells you the two main facts immediately:

  1. The eigenvalues are real. The rotation matrices that produced complex eigenvalues — that can’t happen here.
  2. The eigenvectors are perpendicular — or more carefully, can be chosen perpendicular.

Why the careful wording? Take the identity matrix: certainly symmetric, all eigenvalues equal to 11. But every vector is an eigenvector, so how can they all be perpendicular? The point is that in the typical case — all eigenvalues different — each eigenvalue owns one line of eigenvectors, and those lines really are perpendicular. When an eigenvalue repeats, there’s a whole plane of eigenvectors, and in that plane we have the freedom to choose perpendicular ones. Either way, a symmetric matrix has a full set of perpendicular eigenvectors.

The spectral theorem

For a usual matrix with a complete set of eigenvectors, diagonalization reads A=SΛS1A = S \Lambda S^{-1}. What changes when AA is symmetric? The Λ\Lambda is still diagonal, with real λ\lambda‘s. But the eigenvector matrix is now special: its columns are perpendicular, and we can scale each to length one — no problem. So the columns are orthonormal, and the right letter is no longer SS but QQ:

A=QΛQ1=QΛQTA = Q \Lambda Q^{-1} = Q \Lambda Q^T

The last step is the payoff: for a square matrix with orthonormal columns, the inverse is the transpose, Q1=QTQ^{-1} = Q^T.

The name comes from the spectrum — the set of eigenvalues — by analogy with the spectrum of light as a combination of pure things: the matrix is broken into pure eigenvalues and eigenvectors. In mechanics it’s the principal axis theorem: look at a material along the right axes and it becomes diagonal — the directions don’t couple.

And the symmetry is visible in the formula itself. Transpose QΛQTQ \Lambda Q^T: the outer factors swap, ΛT=Λ\Lambda^T = \Lambda, and you get the same product back. Anything of that form is automatically symmetric, and the theorem says every symmetric matrix arises this way.

Why the eigenvalues are real

Start from the only thing we know: Ax=λxA\mathbf{x} = \lambda \mathbf{x}, where for all we know at this moment λ\lambda and x\mathbf{x} could be complex. Two moves, then a comparison.

Move 1 — conjugate everything. Conjugation respects products, so Aˉxˉ=λˉxˉ\bar{A}\bar{\mathbf{x}} = \bar{\lambda}\bar{\mathbf{x}}. Since AA is real, Aˉ=A\bar{A} = A:

Axˉ=λˉxˉA\bar{\mathbf{x}} = \bar{\lambda}\bar{\mathbf{x}}

Notice symmetry hasn’t been used yet — this already says something on its own: for any real matrix, complex eigenvalues come in conjugate pairs λ,λˉ\lambda, \bar{\lambda}, with eigenvectors x,xˉ\mathbf{x}, \bar{\mathbf{x}}.

Move 2 — transpose. Transposing the conjugated equation gives xˉTAT=xˉTλˉ\bar{\mathbf{x}}^T A^T = \bar{\mathbf{x}}^T \bar{\lambda}. Now symmetry enters: AT=AA^T = A. “At that moment I used the assumption.”

Compare. Multiply the original equation on the left by xˉT\bar{\mathbf{x}}^T, and multiply the transposed equation on the right by x\mathbf{x}:

xˉTAx=λxˉTxandxˉTAx=λˉxˉTx\bar{\mathbf{x}}^T A \mathbf{x} = \lambda\, \bar{\mathbf{x}}^T \mathbf{x} \qquad \text{and} \qquad \bar{\mathbf{x}}^T A \mathbf{x} = \bar{\lambda}\, \bar{\mathbf{x}}^T \mathbf{x}

Same left side, so the right sides agree: λxˉTx=λˉxˉTx\lambda\, \bar{\mathbf{x}}^T\mathbf{x} = \bar{\lambda}\, \bar{\mathbf{x}}^T\mathbf{x}. If the factor xˉTx\bar{\mathbf{x}}^T\mathbf{x} is not zero, cancel it and conclude λ=λˉ\lambda = \bar{\lambda} — a number equal to its own conjugate has no imaginary part. λ\lambda is real.

So everything hangs on that one quantity, and it’s worth a second of its own. For a real vector, xTx=x12+x22+\mathbf{x}^T\mathbf{x} = x_1^2 + x_2^2 + \cdots is the length squared — Pythagoras. For a complex vector the honest analogue conjugates one factor: each term is xˉkxk\bar{x}_k x_k, and when you multiply a+iba + ib by aiba - ib, the result is a2+b2a^2 + b^2 — the iabiab and iab-iab cancel, and i(i)i \cdot (-i) makes the b2b^2 come in with a plus. Every term is positive, so xˉTx\bar{\mathbf{x}}^T\mathbf{x} is positive except for the zero vector. “If you want a decent answer, multiply numbers by their conjugates.” That’s the length squared of a complex vector, and it’s the safe cancellation that finishes the proof — and a preview of the next lecture, where complex vectors and matrices get their full treatment.

Every symmetric matrix is a combination of projections

Break the factorization down. Write out QΛQTQ \Lambda Q^T with columns q1,q2,\mathbf{q}_1, \mathbf{q}_2, \ldots and multiply columns times rows:

A=QΛQT=λ1q1q1T+λ2q2q2T++λnqnqnTA = Q\Lambda Q^T = \lambda_1 \mathbf{q}_1 \mathbf{q}_1^T + \lambda_2 \mathbf{q}_2 \mathbf{q}_2^T + \cdots + \lambda_n \mathbf{q}_n \mathbf{q}_n^T

What kind of matrix is qqT\mathbf{q}\mathbf{q}^T, a unit column times its own transpose? We met it in chapter four: it’s aaT\mathbf{a}\mathbf{a}^T with no need to divide by aTa\mathbf{a}^T\mathbf{a}, since that’s 11. It’s a projection matrix — symmetric, and squaring it brings back a qTq=1\mathbf{q}^T\mathbf{q} = 1 in the middle, so it equals its own square.

So every symmetric matrix is a combination of mutually perpendicular projection matrices, weighted by real eigenvalues. That’s another way people like to state the spectral theorem.

Pivots know the signs of the eigenvalues

Once the eigenvalues are real, the next question is: are they positive or negative? That’s the question that decides between stability and instability in differential equations. And you’d hate to have to compute the eigenvalues to answer it. For a symmetric matrix of order 50, finding the 50 eigenvalues by pencil and paper is a lifetime’s job — and even numerically, forming the degree-50 polynomial det(AλI)\det(A - \lambda I) and finding its roots is a very bad, unstable way to do it. (Strang apologizes: that’s the method he taught, but he meant it for two-by-twos and three-by-threes.) Real eigenvalue computation belongs to numerical linear algebra.

But Matlab will quite happily find the 50 pivots, safely and quickly. And here’s the remarkable fact:

Nobody is confusing pivots with eigenvalues — they’re different numbers. The one connection you already know is that the product of the pivots equals the product of the eigenvalues, because both equal the determinant (pivots when there are no row exchanges). But the product says nothing about the 50 individual signs, which this theorem does.

It even gives a start on computing eigenvalues: shift the matrix to A7IA - 7I, and all eigenvalues shift down by 77. Count the positive pivots of the shifted matrix and you know how many eigenvalues of AA lie above 77 and how many below.

Positive definite matrices: the excellent subclass

The last minutes start the next section of the book. If symmetric matrices are good, positive definite matrices are “a subclass that are excellent — just the greatest.”

What about determinants as a test? Positive eigenvalues certainly make the determinant positive — but that alone is not enough. The matrix

[1003]\begin{bmatrix} -1 & 0 \\ 0 & -3 \end{bmatrix}

has determinant +3+3, yet its pivots (and eigenvalues) are 1-1 and 3-3: not positive definite at all. The fix is to test all the sub-determinants coming down from the upper left — nn tests, not one. For the good example: 5>05 > 0 and 11>011 > 0, passes. For the bad one: the 1×11 \times 1 determinant is 1-1, fails immediately.

Problems

Work these before revealing the solutions — the pivot tests make most of them fast.

Problem 25.1 Spectral factorization by hand

Find the eigenvalues and orthonormal eigenvectors of

A=[3113]A = \begin{bmatrix} 3 & 1 \\ 1 & 3 \end{bmatrix}

and write out the factorization A=QΛQTA = Q\Lambda Q^T. Check that the eigenvectors are perpendicular.

Show solution

det(AλI)=λ26λ+8=(λ4)(λ2)\det(A - \lambda I) = \lambda^2 - 6\lambda + 8 = (\lambda - 4)(\lambda - 2), so λ1=4\lambda_1 = 4, λ2=2\lambda_2 = 2 — real, as symmetry guarantees.

For λ=4\lambda = 4: (A4I)x=0(A - 4I)\mathbf{x} = \mathbf{0} gives x1=(1,1)\mathbf{x}_1 = (1, 1). For λ=2\lambda = 2: x2=(1,1)\mathbf{x}_2 = (1, -1). Their dot product is 11=01 - 1 = 0: perpendicular. Normalize to unit length (divide by 2\sqrt{2}):

Q=12[1111],Λ=[4002],A=QΛQT.Q = \frac{1}{\sqrt{2}}\begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix}, \qquad \Lambda = \begin{bmatrix} 4 & 0 \\ 0 & 2 \end{bmatrix}, \qquad A = Q \Lambda Q^T.

Multiplying it out: QΛQT=12[4+242424+2]=[3113]Q\Lambda Q^T = \frac{1}{2}\begin{bmatrix} 4 + 2 & 4 - 2 \\ 4 - 2 & 4 + 2 \end{bmatrix} = \begin{bmatrix} 3 & 1 \\ 1 & 3 \end{bmatrix}. ✓

Problem 25.2 Projection-matrix form

For the matrix AA of Problem 25.1, write AA as a combination λ1q1q1T+λ2q2q2T\lambda_1 \mathbf{q}_1\mathbf{q}_1^T + \lambda_2 \mathbf{q}_2\mathbf{q}_2^T of projection matrices, and verify that each qqT\mathbf{q}\mathbf{q}^T equals its own square.

Show solution

With q1=12(1,1)\mathbf{q}_1 = \frac{1}{\sqrt{2}}(1,1) and q2=12(1,1)\mathbf{q}_2 = \frac{1}{\sqrt{2}}(1,-1):

q1q1T=12[1111],q2q2T=12[1111]\mathbf{q}_1\mathbf{q}_1^T = \frac{1}{2}\begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix}, \qquad \mathbf{q}_2\mathbf{q}_2^T = \frac{1}{2}\begin{bmatrix} 1 & -1 \\ -1 & 1 \end{bmatrix}

Then

412[1111]+212[1111]=[2222]+[1111]=[3113]=A.4 \cdot \frac{1}{2}\begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix} + 2 \cdot \frac{1}{2}\begin{bmatrix} 1 & -1 \\ -1 & 1 \end{bmatrix} = \begin{bmatrix} 2 & 2 \\ 2 & 2 \end{bmatrix} + \begin{bmatrix} 1 & -1 \\ -1 & 1 \end{bmatrix} = \begin{bmatrix} 3 & 1 \\ 1 & 3 \end{bmatrix} = A. ✓

Each piece is a projection: squaring qqT\mathbf{q}\mathbf{q}^T gives q(qTq)qT=qqT\mathbf{q}(\mathbf{q}^T\mathbf{q})\mathbf{q}^T = \mathbf{q}\mathbf{q}^T because qTq=1\mathbf{q}^T\mathbf{q} = 1. (Check on the first one: 12[1111]\frac{1}{2}\begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix} squared is 14[2222]\frac{1}{4}\begin{bmatrix} 2 & 2 \\ 2 & 2 \end{bmatrix} — the same matrix.)

Problem 25.3 Counting eigenvalue signs by pivots

Without computing any eigenvalues, determine how many eigenvalues of

A=[1331]A = \begin{bmatrix} 1 & 3 \\ 3 & 1 \end{bmatrix}

are positive and how many are negative. Then confirm by finding the eigenvalues.

Show solution

Eliminate: the first pivot is 11. Subtract 33 times row one from row two: the second pivot is 19=81 - 9 = -8. One positive pivot, one negative pivot — so by the sign theorem for symmetric matrices, one positive and one negative eigenvalue.

Confirm: λ22λ+(19)=λ22λ8=(λ4)(λ+2)\lambda^2 - 2\lambda + (1 - 9) = \lambda^2 - 2\lambda - 8 = (\lambda - 4)(\lambda + 2), so λ=4\lambda = 4 and λ=2\lambda = -2. One positive, one negative, matching the pivots. (Consistency check: product of pivots =1(8)=8=detA== 1 \cdot (-8) = -8 = \det A = product of eigenvalues =4(2)= 4 \cdot (-2).)

Problem 25.4 Testing positive definiteness

For which numbers bb is

A=[4bb9]A = \begin{bmatrix} 4 & b \\ b & 9 \end{bmatrix}

positive definite? Answer with the sub-determinant test, and check that the pivot test gives the same condition.

Show solution

Sub-determinants: the 1×11\times 1 determinant is 4>04 > 0 ✓; the 2×22\times 2 determinant is 36b236 - b^2, which is positive exactly when 6<b<6-6 < b < 6.

Pivots: the first pivot is 4>04 > 0. The second pivot is the determinant divided by the first pivot, 36b24\frac{36 - b^2}{4}, positive under exactly the same condition.

So AA is positive definite precisely for 6<b<6-6 < b < 6. At b=±6b = \pm 6 the determinant is zero — the matrix is singular, with an eigenvalue 00, so it just fails.

Problem 25.5 Determinant alone is not enough

Give a symmetric 2×22\times 2 matrix whose determinant is positive but which is not positive definite, and explain which test it fails. Then state what its two pivots tell you about its two eigenvalues.

Show solution

The lecture’s own example works:

A=[1003],detA=3>0.A = \begin{bmatrix} -1 & 0 \\ 0 & -3 \end{bmatrix}, \qquad \det A = 3 > 0.

It fails the sub-determinant test at the first step: the 1×11\times 1 upper-left determinant is 1-1, which is negative. (Two negatives multiply to a positive determinant — that’s exactly why the whole determinant alone can’t detect the problem.)

The pivots are 1-1 and 3-3, both negative — so by the sign theorem both eigenvalues are negative (here they are simply 1-1 and 3-3). This matrix is in fact negative definite: the mirror image of excellent.