Skip to main content
© 2026 ePowerAI. All rights reserved.
CoursesContact
eAI
CoursesContact
Week 12: Symmetric and Positive Definite Matrices
Linear Algebra
01Week 1: Vectors and Linear Combinations
02Week 2: Linear Transformations and Matrices
03Week 3: Elimination and LU Factorization
04Week 4: Determinants
05Week 5: Vector Spaces, Independence, and Basis
06Week 6: The Four Fundamental Subspaces
07Week 7: Orthogonality and Projections
08Week 8: Least Squares and QR
09Week 9: Eigenvalues and Eigenvectors
10Week 10: Diagonalization and Markov Matrices
11Week 11: Differential Equations
12Week 12: Symmetric and Positive Definite Matrices
13Week 13: The SVD and Complex Matrices
14Week 14: The Fourier Matrix, FFT, and PCA
Week 12· Linear Algebra20 min read

Week 12: Symmetric and Positive Definite Matrices

✦Learning Outcomes
  • State the spectral theorem for symmetric matrices
  • Explain why the eigenvectors of a symmetric matrix can be chosen orthogonal
  • Test a matrix for positive definiteness using eigenvalues, pivots, or leading determinants
  • Interpret a quadratic form geometrically as an ellipse or ellipsoid
◆Prerequisites

Background knowledge assumed:

  • Eigenvalues and eigenvectors
  • Orthogonality

Recommended: Review Week 9: Eigenvalues and Eigenvectors and Week 7: Orthogonality and Projections before starting.

The Spectral Theorem#

A real matrix AAA is symmetric when A=ATA = A^TA=AT — every entry equals its transpose partner, so aij=ajia_{ij} = a_{ji}aij​=aji​. Symmetric matrices appear everywhere: covariance matrices, Hessian matrices of smooth functions, graph Laplacians, and Gram matrices of the form BTBB^TBBTB. This week is about what symmetry buys you algebraically and geometrically.

The spectral theorem is the central fact:

Every real symmetric n×nn \times nn×n matrix AAA has nnn real eigenvalues λ1,…,λn\lambda_1,\ldots,\lambda_nλ1​,…,λn​ (counting multiplicity) and an orthonormal basis of eigenvectors q1,…,qnq_1,\ldots,q_nq1​,…,qn​. In matrix form

A=QΛQT,A = Q\Lambda Q^T,A=QΛQT,

where Λ=diag⁡(λ1,…,λn)\Lambda = \operatorname{diag}(\lambda_1,\ldots,\lambda_n)Λ=diag(λ1​,…,λn​) and QQQ is an orthogonal matrix (QTQ=IQ^TQ = IQTQ=I, so Q−1=QTQ^{-1} = Q^TQ−1=QT) whose columns are the eigenvectors.

Compare with ordinary diagonalization A=SΛS−1A = S\Lambda S^{-1}A=SΛS−1 from Week 10. Symmetry upgrades two things at once:

  1. All eigenvalues are real — no complex conjugate pairs, no hidden oscillation from imaginary parts.
  2. The eigenvector matrix can be chosen orthogonal — S−1S^{-1}S−1 is simply STS^TST, and the change of coordinates is a pure rotation/reflection (an isometry of Rn\mathbb{R}^nRn).

Why eigenvectors for distinct eigenvalues are orthogonal. Suppose Aq1=λ1q1Aq_1 = \lambda_1 q_1Aq1​=λ1​q1​, Aq2=λ2q2Aq_2 = \lambda_2 q_2Aq2​=λ2​q2​, with λ1≠λ2\lambda_1 \neq \lambda_2λ1​=λ2​ and A=ATA = A^TA=AT. Take the inner product:

λ1q2Tq1=q2T(Aq1)=(Aq2)Tq1=λ2q2Tq1.\lambda_1 q_2^T q_1 = q_2^T (A q_1) = (A q_2)^T q_1 = \lambda_2 q_2^T q_1.λ1​q2T​q1​=q2T​(Aq1​)=(Aq2​)Tq1​=λ2​q2T​q1​.

So (λ1−λ2) q2Tq1=0(\lambda_1 - \lambda_2)\, q_2^T q_1 = 0(λ1​−λ2​)q2T​q1​=0. Because λ1≠λ2\lambda_1 \neq \lambda_2λ1​=λ2​, we must have q2Tq1=0q_2^T q_1 = 0q2T​q1​=0: the eigenvectors are orthogonal. When eigenvalues repeat, you can still orthonormalize within each eigenspace (Gram–Schmidt from Week 7) and keep different eigenspaces orthogonal. The result is always an orthonormal basis of Rn\mathbb{R}^nRn.

Worked check. Let

A=(2−1−12).A = \begin{pmatrix} 2 & -1 \\ -1 & 2 \end{pmatrix}.A=(2−1​−12​).

Trace 444, determinant 333, so eigenvalues solve λ2−4λ+3=0\lambda^2 - 4\lambda + 3 = 0λ2−4λ+3=0: λ1=3\lambda_1 = 3λ1​=3, λ2=1\lambda_2 = 1λ2​=1. For λ=3\lambda = 3λ=3:

A−3I=(−1−1−1−1)⇒q1=12(1−1).A - 3I = \begin{pmatrix} -1 & -1 \\ -1 & -1 \end{pmatrix} \quad\Rightarrow\quad q_1 = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ -1 \end{pmatrix}.A−3I=(−1−1​−1−1​)⇒q1​=2​1​(1−1​).

For λ=1\lambda = 1λ=1:

A−I=(1−1−11)⇒q2=12(11).A - I = \begin{pmatrix} 1 & -1 \\ -1 & 1 \end{pmatrix} \quad\Rightarrow\quad q_2 = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ 1 \end{pmatrix}.A−I=(1−1​−11​)⇒q2​=2​1​(11​).

Indeed q1Tq2=0q_1^T q_2 = 0q1T​q2​=0, and

A=Q(3001)QT,Q=12(11−11).A = Q\begin{pmatrix} 3 & 0 \\ 0 & 1 \end{pmatrix}Q^T, \qquad Q = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ -1 & 1 \end{pmatrix}.A=Q(30​01​)QT,Q=2​1​(1−1​11​).

(You can verify QTQ=IQ^TQ = IQTQ=I and QΛQT=AQ\Lambda Q^T = AQΛQT=A by direct multiplication.)


Quadratic Forms#

A quadratic form is a scalar function of a vector built from a symmetric matrix:

f(x)=xTAx=∑i=1n∑j=1naij xixj.f(x) = x^T A x = \sum_{i=1}^{n}\sum_{j=1}^{n} a_{ij}\, x_i x_j.f(x)=xTAx=i=1∑n​j=1∑n​aij​xi​xj​.

In components for n=2n = 2n=2 with A=(abbc)A = \begin{pmatrix} a & b \\ b & c \end{pmatrix}A=(ab​bc​) this is

xTAx=a x12+2b x1x2+c x22.x^TAx = a\,x_1^2 + 2b\,x_1 x_2 + c\,x_2^2.xTAx=ax12​+2bx1​x2​+cx22​.

(The off-diagonal bbb contributes twice because a12a_{12}a12​ and a21a_{21}a21​ both equal bbb.) Quadratic forms measure energy, squared length after a linear map (∥Bx∥2=xT(BTB)x\|Bx\|^2 = x^T(B^TB)x∥Bx∥2=xT(BTB)x), and second-order Taylor terms of a smooth function near a critical point.

Diagonalization simplifies the form. Write A=QΛQTA = Q\Lambda Q^TA=QΛQT and change variables to the eigen-coordinates y=QTxy = Q^T xy=QTx (so x=Qyx = Qyx=Qy). Then

xTAx=(Qy)TA(Qy)=yT(QTAQ)y=yTΛy=∑i=1nλi yi2.x^T A x = (Qy)^T A (Qy) = y^T (Q^T A Q) y = y^T \Lambda y = \sum_{i=1}^{n} \lambda_i\, y_i^2.xTAx=(Qy)TA(Qy)=yT(QTAQ)y=yTΛy=i=1∑n​λi​yi2​.

The cross terms vanish. In the eigenvector basis, the quadratic form is a pure weighted sum of squares: λ1y12+⋯+λnyn2\lambda_1 y_1^2 + \cdots + \lambda_n y_n^2λ1​y12​+⋯+λn​yn2​. That is why the spectral theorem is the engine of everything that follows — positive definiteness, ellipses, and (next week) the SVD all reduce to the signs and sizes of the λi\lambda_iλi​.

Example. For the matrix above with λ=3,1\lambda = 3,1λ=3,1,

xTAx=3y12+y22x^TAx = 3 y_1^2 + y_2^2xTAx=3y12​+y22​

in the QQQ-coordinates. Along the first eigen-direction the form grows thrice as fast as along the second.


Positive Definite Matrices#

A symmetric matrix AAA is positive definite (often written A≻0A \succ 0A≻0) when

xTAx>0for every nonzero vector x.x^T A x > 0 \quad\text{for every nonzero vector } x.xTAx>0for every nonzero vector x.

If the inequality is ≥0\ge 0≥0 instead of >0> 0>0, AAA is positive semidefinite. Negative definite means xTAx<0x^TAx < 0xTAx<0 for all x≠0x \neq 0x=0 (equivalently, −A-A−A is positive definite).

Positive definite matrices are the multivariable analogue of a positive number: they define genuine energies, strict convexity of xTAx/2x^TAx/2xTAx/2, and unique minima of associated least-squares problems. Three classical tests decide positive definiteness — all equivalent for real symmetric AAA.

Test 1 — Eigenvalues#

From the spectral form xTAx=∑λiyi2x^TAx = \sum \lambda_i y_i^2xTAx=∑λi​yi2​ with y=QTxy = Q^Txy=QTx and ∥y∥=∥x∥\|y\| = \|x\|∥y∥=∥x∥ (because QQQ is orthogonal), we get:

  • AAA is positive definite ⟺\Longleftrightarrow⟺ every eigenvalue λi>0\lambda_i > 0λi​>0.
  • AAA is positive semidefinite ⟺\Longleftrightarrow⟺ every λi≥0\lambda_i \ge 0λi​≥0.
  • AAA is indefinite if some λi>0\lambda_i > 0λi​>0 and some λj<0\lambda_j < 0λj​<0 (the form takes both positive and negative values).

This is usually the conceptual test: stretch factors in every eigen-direction must be positive.

Test 2 — Pivots#

Eliminate AAA by Gaussian elimination without row exchanges (or more carefully: with pivots that stay on the diagonal when possible). The successive pivots d1,d2,…,dnd_1, d_2, \ldots, d_nd1​,d2​,…,dn​ that appear on the diagonal of the upper-triangular factor are all positive if and only if AAA is positive definite. Equivalently, the LDLT^TT factorization A=LDLTA = LDL^TA=LDLT has a positive diagonal DDD.

Test 3 — Leading principal minors (determinants)#

Let AkA_kAk​ be the upper-left k×kk \times kk×k principal submatrix of AAA (the first kkk rows and columns). The leading principal minors are det⁡(A1),…,det⁡(An)\det(A_1),\ldots,\det(A_n)det(A1​),…,det(An​). Sylvester's criterion:

A≻0⟺det⁡(Ak)>0 for every k=1,…,n.A \succ 0 \quad\Longleftrightarrow\quad \det(A_k) > 0 \text{ for every } k = 1,\ldots,n.A≻0⟺det(Ak​)>0 for every k=1,…,n.

For a 2×22 \times 22×2 matrix (abbc)\begin{pmatrix} a & b \\ b & c \end{pmatrix}(ab​bc​) this is simply a>0a > 0a>0 and ac−b2>0ac - b^2 > 0ac−b2>0.

Worked example. Take again

A=(2−1−12).A = \begin{pmatrix} 2 & -1 \\ -1 & 2 \end{pmatrix}.A=(2−1​−12​).
  • Eigenvalues: λ=3\lambda = 3λ=3 and λ=1\lambda = 1λ=1, both positive ⇒\Rightarrow⇒ positive definite.
  • Pivots: first pivot 2>02 > 02>0; after eliminating, the Schur complement is 2−(−1)2/2=3/2>02 - (-1)^2/2 = 3/2 > 02−(−1)2/2=3/2>0. Both pivots positive.
  • Leading determinants: det⁡(A1)=2>0\det(A_1) = 2 > 0det(A1​)=2>0 and det⁡(A)=4−1=3>0\det(A) = 4 - 1 = 3 > 0det(A)=4−1=3>0.

All three tests agree. Contrast with B=(1221)B = \begin{pmatrix} 1 & 2 \\ 2 & 1 \end{pmatrix}B=(12​21​): eigenvalues 333 and −1-1−1, so BBB is indefinite — det⁡(B)=−3<0\det(B) = -3 < 0det(B)=−3<0 already fails the leading-determinant test.

Why three tests? Eigenvalues are conceptual. Pivots are computational during elimination. Leading determinants are a quick hand check for small nnn. Use whichever is handy; they always give the same yes/no answer for symmetric AAA.


Geometric Picture#

Fix a positive definite AAA and a positive constant ccc. The level set

{x:xTAx=c}\{ x : x^T A x = c \}{x:xTAx=c}

is a closed bounded surface around the origin. In the eigen-coordinates y=QTxy = Q^T xy=QTx the equation becomes

λ1y12+λ2y22+⋯+λnyn2=c,\lambda_1 y_1^2 + \lambda_2 y_2^2 + \cdots + \lambda_n y_n^2 = c,λ1​y12​+λ2​y22​+⋯+λn​yn2​=c,

or equivalently

y12c/λ1+y22c/λ2+⋯+yn2c/λn=1.\frac{y_1^2}{c/\lambda_1} + \frac{y_2^2}{c/\lambda_2} + \cdots + \frac{y_n^2}{c/\lambda_n} = 1.c/λ1​y12​​+c/λ2​y22​​+⋯+c/λn​yn2​​=1.

That is the standard equation of an ellipse when n=2n = 2n=2, and an ellipsoid when n≥3n \ge 3n≥3. The geometry is completely determined by the spectral data:

| Feature | Determined by | |---|---| | Orientation of the axes | Eigenvectors (columns of QQQ) | | Axis half-lengths for level ccc | c/λi\sqrt{c / \lambda_i}c/λi​​ along eigenvector qiq_iqi​ | | “Fatness” vs “thinness” | Ratio of eigenvalues (condition number of AAA) |

Large λi\lambda_iλi​ means a short axis: the quadratic form grows quickly in that direction, so the level set xTAx=cx^TAx = cxTAx=c is reached sooner. Small λi\lambda_iλi​ means a long axis. When one eigenvalue is much larger than another, the ellipse is elongated along the small-eigenvalue direction.

If AAA is not positive definite. Zero eigenvalues open the level set into a cylinder (unbounded in the null direction). Opposite-sign eigenvalues produce hyperbolas — the form is indefinite and the “energy” xTAxx^TAxxTAx can be positive, zero, or negative depending on direction.

Preview of Week 13. For any matrix BBB (not necessarily square), the Gram matrix A=BTBA = B^TBA=BTB is always symmetric and positive semidefinite. Its eigenvalues are the squared singular values of BBB, and its eigenvectors are the right singular vectors. The spectral theorem for AAA is the algebraic core of the SVD — the next lesson's main tool.


Knowledge check#

Exercise · Fill in the blank

Test A = [[2,-1],[-1,2]] for positive definiteness using leading determinants. The first leading determinant is 2. What is the second leading determinant (the full det(A))?


Browser lab#

Check positive definiteness via eigenvalues and plot the quadratic form's level set.

python · runs in browser
import numpy as np
import matplotlib.pyplot as plt

A = np.array([[2., -1.],
              [-1., 2.]])

eigvals = np.linalg.eigvalsh(A)
print("eigenvalues =", eigvals)
print("positive definite:", np.all(eigvals > 0))

theta = np.linspace(0, 2 * np.pi, 200)
circle = np.array([np.cos(theta), np.sin(theta)])

vals, vecs = np.linalg.eigh(A)
ellipse = vecs @ np.diag(1 / np.sqrt(vals)) @ circle

fig, ax = plt.subplots(figsize=(5, 5))
ax.plot(ellipse[0], ellipse[1])
ax.set_aspect("equal")
ax.set_title(r"Level set $x^TAx = 1$")
plt.show()

np.linalg.eigvalsh / eigh are the symmetric (Hermitian) variants of the eigensolvers — they return real eigenvalues sorted ascending and an orthogonal eigenvector matrix. The construction Q diag⁡(1/λi) (cos⁡θ,sin⁡θ)Q\,\operatorname{diag}(1/\sqrt{\lambda_i})\,(\cos\theta, \sin\theta)Qdiag(1/λi​​)(cosθ,sinθ) maps the unit circle to the ellipse xTAx=1x^TAx = 1xTAx=1: half-axis lengths are 1/λi1/\sqrt{\lambda_i}1/λi​​ along the eigenvectors, matching the geometric picture above.


Quiz#

Question 1 of 3

The spectral theorem guarantees that a real symmetric matrix has:

Real eigenvalues and orthogonal eigenvectors
Complex eigenvalues
No eigenvectors
Negative eigenvalues
← Previous
Week 11: Differential Equations
Next →
Week 13: The SVD and Complex Matrices
On this page
  • The Spectral Theorem
  • Quadratic Forms
  • Positive Definite Matrices
  • Test 1 — Eigenvalues
  • Test 2 — Pivots
  • Test 3 — Leading principal minors (determinants)
  • Geometric Picture
  • Knowledge check
  • Browser lab
  • Quiz