Symmetric Matrices & Quadratic Forms

Study Sheet

Symmetric Matrices & Quadratic Forms

The spectral theorem and definiteness

The Nicest Matrices in Mathematics

Tip
The spectral theorem
42
S sends the unit circle (dashed) to an ellipse with half-axes 4 along (1, 1) and 2 along (1, −1).

A symmetric matrix (A=ATA = A^{\mathsf T}) is as good as it gets: all eigenvalues real, eigenvectors of distinct eigenvalues automatically orthogonal, and a full orthonormal eigenbasis always exists — A=QΛQTA = Q\Lambda Q^{\mathsf T} with QQ a rotation.

Geometrically: every symmetric matrix is a pure stretch along some perpendicular set of axes, no shearing, no rotation mixed in. This is the spectral theorem, and it is why symmetric matrices rule applied mathematics: covariance matrices, Hessians, stiffness matrices, and graph Laplacians are all symmetric by construction. For example S=(3113)S = \begin{pmatrix}3&1\\1&3\end{pmatrix} has eigenvalues 44 and 22 with perpendicular eigenvectors (1,1)(1, 1) and (1,−1)(1, -1). It sends the unit circle to an ellipse whose axes point along those two directions, with half-lengths 44 and 22.

Tip
Quadratic forms and definiteness
q > 0q < 0
Level curves q = ±1, ±4 of x² + 4xy + y²: hyperbolas around the principal axes y = x and y = −x (dashed).

A quadratic form q(x)=xTAxq(\mathbf x) = \mathbf x^{\mathsf T}A\mathbf x (write ax2+bxy+cy2ax^2 + bxy + cy^2 with the symmetric matrix (ab/2b/2c)\begin{pmatrix}a & b/2\\ b/2 & c\end{pmatrix} — Halve the cross term) is classified by eigenvalue signs: all positive — positive definite, a bowl with a genuine minimum; all negative — a dome; mixed — a saddle. On the unit circle, qq ranges exactly over [λmin⁡,λmax⁡][\lambda_{\min}, \lambda_{\max}], attained along the eigenvectors (the principal axes). The quick test without eigenvalues: positive definite iff a>0a > 0 and det⁡A>0\det A > 0. Recognize this as the honest form of the second-derivative DD-test from multivariable calculus — the Hessian is a symmetric matrix, and D>0,fxx>0D > 0, f_{xx} > 0 is exactly the 2×22\times2 definiteness test.

Why eigenvalue signs decide: rotate coordinates to the orthonormal eigenbasis, x=uq1+vq2\mathbf x = u\mathbf q_1 + v\mathbf q_2. Because the qi\mathbf q_i are perpendicular unit vectors, the cross term disappears and q=λ1u2+λ2v2q = \lambda_1u^2 + \lambda_2v^2. Two positive coefficients make a bowl, two negative a dome, and opposite signs a saddle whose level curves are hyperbolas. For q=x2+4xy+y2q = x^2 + 4xy + y^2, matrix (1221)\begin{pmatrix}1&2\\2&1\end{pmatrix}, the eigenvalues are 33 (along (1,1)(1, 1)) and −1-1 (along (1,−1)(1, -1)), so q=3u2−v2q = 3u^2 - v^2: indefinite.

Side note
Ellipses are eigen-pictures

The level curve q(x)=1q(\mathbf x) = 1 of a positive-definite form is an ellipse whose axes point along the eigenvectors with half-lengths 1/λi1/\sqrt{\lambda_i}. Rotate to the eigenbasis and the cross term vanishes: λ1u2+λ2v2=1\lambda_1u^2 + \lambda_2v^2 = 1. Every tilted ellipse you have ever completed the square on was a symmetric matrix asking to be diagonalized.

Try it
Try it: extremes on the unit circle

Find the largest and smallest values of q=5x2+4xy+5y2q = 5x^2 + 4xy + 5y^2 on the unit circle x2+y2=1x^2 + y^2 = 1, and where they occur.

Show the answer

The matrix is (5225)\begin{pmatrix}5&2\\2&5\end{pmatrix} (half the cross term off the diagonal). Trace 1010, determinant 25−4=2125 - 4 = 21, so λ2−10λ+21=(λ−3)(λ−7)=0\lambda^2 - 10\lambda + 21 = (\lambda - 3)(\lambda - 7) = 0. On the unit circle qq ranges over [λmin⁡,λmax⁡][\lambda_{\min}, \lambda_{\max}], attained along the eigenvectors. For 77: A−7I=(−222−2)A - 7I = \begin{pmatrix}-2&2\\2&-2\end{pmatrix} gives (1,1)(1, 1); for 33: (1,−1)(1, -1). So the maximum is 77 at ±12(1,1)\pm\tfrac{1}{\sqrt2}(1, 1) and the minimum is 33 at ±12(1,−1)\pm\tfrac{1}{\sqrt2}(1, -1). Check: q(12,12)=52+2+52=7q\left(\tfrac1{\sqrt2}, \tfrac1{\sqrt2}\right) = \tfrac52 + 2 + \tfrac52 = 7 ✓. This is exactly what Lagrange multipliers give: ∇q=λ∇(x2+y2)\nabla q = \lambda\nabla(x^2 + y^2) reads Ax=λxA\mathbf x = \lambda\mathbf x.

Classifying Quadratic Forms

Tip
Three tests that agree

For a symmetric SS and q(x)=xTSxq(\mathbf x) = \mathbf x^{\mathsf T}S\mathbf x:

  • positive definite (q>0q > 0 for all x≠0\mathbf x \ne \mathbf 0)   ⟺  \iff all eigenvalues >0> 0   ⟺  \iff all leading principal minors >0> 0;
  • positive semidefinite (q≥0q \ge 0)   ⟺  \iff all eigenvalues ≥0\ge 0;
  • indefinite (qq takes both signs)   ⟺  \iff eigenvalues of both signs.

For 2×22\times2: det⁡S<0\det S < 0 means indefinite, and det⁡S>0\det S > 0 means definite, with the sign of S11S_{11}.

The eigenvalue test is the principal-axes formula q=∑λiui2q = \sum\lambda_iu_i^2. The 2×22\times2 determinant test follows because det⁡S=λ1λ2\det S = \lambda_1\lambda_2: a negative product means opposite signs, a positive one means equal signs, and then S11=q(e1)S_{11} = q(\mathbf e_1) reveals which. The leading-minor test is the same fact seen through elimination: the pivots of SS are ratios of consecutive leading minors, and qq is a weighted sum of squares with the pivots as weights.

Example
Worked: an indefinite form

Classify q=2x2+6xy+2y2q = 2x^2 + 6xy + 2y^2. Halve the cross term: S=(2332)S = \begin{pmatrix}2&3\\3&2\end{pmatrix}, with det⁡S=4−9=−5<0\det S = 4 - 9 = -5 < 0. So the eigenvalues have opposite signs and qq is indefinite.

The eigenvalues are 55 (along (1,1)(1, 1)) and −1-1 (along (1,−1)(1, -1)): trace 44 ✓, product −5-5 ✓. Concrete witnesses: q(1,1)=2+6+2=10>0q(1, 1) = 2 + 6 + 2 = 10 > 0 and q(1,−1)=2−6+2=−2<0q(1, -1) = 2 - 6 + 2 = -2 < 0. As a surface z=q(x,y)z = q(x, y) is a saddle, rising along y=xy = x and falling along y=−xy = -x; the critical point at the origin is neither a maximum nor a minimum.

Example
Worked: a semidefinite form
q = 0
Level sets of (x + y)²: the lines x + y = ±1 (q = 1) and ±2 (q = 4), and q = 0 on the whole dashed line y = −x.

Classify q=x2+2xy+y2q = x^2 + 2xy + y^2. S=(1111)S = \begin{pmatrix}1&1\\1&1\end{pmatrix} has det⁡S=0\det S = 0, so one eigenvalue is 00; the trace 22 gives the other.

The eigenvalues are 22 (along (1,1)(1, 1)) and 00 (along (1,−1)(1, -1)), both ≥0\ge 0: positive semidefinite, not definite. Indeed q=(x+y)2q = (x + y)^2 is never negative but vanishes on the whole line y=−xy = -x, not just at the origin. Its level curves q=cq = c are pairs of parallel lines x+y=±cx + y = \pm\sqrt c — a trough, not a bowl.

Example
Worked: three variables by leading minors

Is q=2x2+2y2+2z2+2xy+2yzq = 2x^2 + 2y^2 + 2z^2 + 2xy + 2yz positive definite? Halving the cross terms, S=(210121012)S = \begin{pmatrix}2&1&0\\1&2&1\\0&1&2\end{pmatrix}. The leading minors are 22, then det⁡(2112)=3\det\begin{pmatrix}2&1\\1&2\end{pmatrix} = 3.

The third minor is det⁡S=2(4−1)−1(2−0)+0=4\det S = 2(4 - 1) - 1(2 - 0) + 0 = 4. All three leading minors are positive, so qq is positive definite — no cubic equation for eigenvalues needed. (The eigenvalues are 22 and 2±22 \pm \sqrt2, all positive, with product 2⋅(4−2)=42\cdot(4 - 2) = 4 ✓.)

Side note
Where it goes wrong: not halving the cross term

For q=x2+3xy+3y2q = x^2 + 3xy + 3y^2 the correct matrix is (132323)\begin{pmatrix}1&\tfrac32\\\tfrac32&3\end{pmatrix}, with determinant 3−94=34>03 - \tfrac94 = \tfrac34 > 0: positive definite. Putting the whole 33 off the diagonal, (1333)\begin{pmatrix}1&3\\3&3\end{pmatrix}, gives determinant 3−9=−63 - 9 = -6 and the false verdict "indefinite." The check is xTSx\mathbf x^{\mathsf T}S\mathbf x at (1,1)(1, 1): q(1,1)=7q(1, 1) = 7, while the wrong matrix gives 1+6+3=101 + 6 + 3 = 10 — the cross term counted twice.

Try it
Try it: classify and find extremes

Classify q=3x2−2xy+3y2q = 3x^2 - 2xy + 3y^2 and find its largest and smallest values on the unit circle.

Show the answer

S=(3−1−13)S = \begin{pmatrix}3&-1\\-1&3\end{pmatrix} has trace 66 and determinant 9−1=8>09 - 1 = 8 > 0 with S11=3>0S_{11} = 3 > 0, so qq is positive definite. The eigenvalues solve λ2−6λ+8=(λ−2)(λ−4)=0\lambda^2 - 6\lambda + 8 = (\lambda - 2)(\lambda - 4) = 0. For 44: S−4I=(−1−1−1−1)S - 4I = \begin{pmatrix}-1&-1\\-1&-1\end{pmatrix} gives (1,−1)(1, -1); for 22: (1,1)(1, 1). So on the unit circle the maximum is 44 at ±12(1,−1)\pm\tfrac1{\sqrt2}(1, -1) and the minimum is 22 at ±12(1,1)\pm\tfrac1{\sqrt2}(1, 1). Check: q(12,−12)=32+1+32=4q\left(\tfrac1{\sqrt2}, -\tfrac1{\sqrt2}\right) = \tfrac32 + 1 + \tfrac32 = 4 ✓.

Principal Axes and Constrained Extremes

Tip
Reading an ellipse off its matrix

If SS is positive definite with eigenvalues λ1,λ2\lambda_1, \lambda_2 and unit eigenvectors q1,q2\mathbf q_1, \mathbf q_2, the level curve xTSx=c\mathbf x^{\mathsf T}S\mathbf x = c is an ellipse with half-axes

c/λ1 along q1,c/λ2 along q2.\sqrt{c/\lambda_1}\ \text{along}\ \mathbf q_1, \qquad \sqrt{c/\lambda_2}\ \text{along}\ \mathbf q_2.

On the circle ∣x∣=r|\mathbf x| = r, qq ranges from λmin⁡r2\lambda_{\min}r^2 to λmax⁡r2\lambda_{\max}r^2. The larger eigenvalue gives the shorter axis.

In principal coordinates the curve is λ1u2+λ2v2=c\lambda_1u^2 + \lambda_2v^2 = c; setting v=0v = 0 gives u=±c/λ1u = \pm\sqrt{c/\lambda_1}. A large eigenvalue means qq climbs fast in that direction, so the level cc is reached sooner — the ellipse is narrow there. Scaling x\mathbf x by rr scales qq by r2r^2, which moves the unit-circle extremes to any circle.

Example
Worked: the axes of a tilted ellipse
√22
Level curves q = 2, 8, 18 of 3x² + 2xy + 3y²; the middle one, q = 8, has half-axes √2 along (1, 1) and 2 along (1, −1).

Describe the curve 3x2+2xy+3y2=83x^2 + 2xy + 3y^2 = 8. S=(3113)S = \begin{pmatrix}3&1\\1&3\end{pmatrix} has eigenvalues 44 (along (1,1)(1, 1)) and 22 (along (1,−1)(1, -1)), both positive, so the curve is an ellipse: 4u2+2v2=84u^2 + 2v^2 = 8, that is, u22+v24=1\dfrac{u^2}{2} + \dfrac{v^2}{4} = 1.

Half-axes: 8/4=2\sqrt{8/4} = \sqrt2 along (1,1)(1, 1) and 8/2=2\sqrt{8/2} = 2 along (1,−1)(1, -1). Check an endpoint: 2⋅12(1,1)=(1,1)\sqrt2\cdot\tfrac{1}{\sqrt2}(1, 1) = (1, 1), and q(1,1)=3+2+3=8q(1, 1) = 3 + 2 + 3 = 8 ✓; the other is 2(1,−1)\sqrt2(1, -1), where q=6−4+6=8q = 6 - 4 + 6 = 8 ✓. So the points of the ellipse closest to the origin are ±(1,1)\pm(1, 1), at distance 2\sqrt2, and the farthest are ±2(1,−1)\pm\sqrt2(1, -1), at distance 22 — no calculus needed.

Example
Worked: extremes on a larger circle

Find the maximum and minimum of q=3x2+2xy+3y2q = 3x^2 + 2xy + 3y^2 on the circle x2+y2=9x^2 + y^2 = 9. On the unit circle qq runs from 22 to 44; on the circle of radius 33, every value is multiplied by 32=93^2 = 9.

So the maximum is 4⋅9=364\cdot9 = 36, at ±32(1,1)\pm\tfrac{3}{\sqrt2}(1, 1), and the minimum is 2⋅9=182\cdot9 = 18, at ±32(1,−1)\pm\tfrac{3}{\sqrt2}(1, -1). Check the maximum: at x=y=32x = y = \tfrac{3}{\sqrt2}, x2=y2=xy=92x^2 = y^2 = xy = \tfrac92, so q=272+9+272=36q = \tfrac{27}{2} + 9 + \tfrac{27}{2} = 36 ✓. Lagrange multipliers would produce the same two directions after a page of algebra; the eigenvectors give them at once.

Side note
Where it goes wrong: taking the eigenvalue as the half-axis

For 3x2+2xy+3y2=83x^2 + 2xy + 3y^2 = 8 it is tempting to read "half-axes 44 and 22" straight from the eigenvalues. Test the claimed endpoint 4⋅12(1,1)=(22,22)4\cdot\tfrac{1}{\sqrt2}(1, 1) = (2\sqrt2, 2\sqrt2): there q=4⋅16=64q = 4\cdot16 = 64, not 88. The half-axis is c/λ\sqrt{c/\lambda} — it depends on the level cc, shrinks as λ\lambda grows, and involves a square root.

Try it
Try it: principal axes

Find the half-axes and their directions for the ellipse 5x2+8xy+5y2=95x^2 + 8xy + 5y^2 = 9.

Show the answer

S=(5445)S = \begin{pmatrix}5&4\\4&5\end{pmatrix}: trace 1010, determinant 25−16=925 - 16 = 9, so λ2−10λ+9=(λ−1)(λ−9)=0\lambda^2 - 10\lambda + 9 = (\lambda - 1)(\lambda - 9) = 0. For 99: S−9I=(−444−4)S - 9I = \begin{pmatrix}-4&4\\4&-4\end{pmatrix} gives (1,1)(1, 1); for 11: (1,−1)(1, -1). In principal coordinates 9u2+v2=99u^2 + v^2 = 9, so the half-axes are 9/9=1\sqrt{9/9} = 1 along (1,1)(1, 1) and 9/1=3\sqrt{9/1} = 3 along (1,−1)(1, -1). Check: the endpoint 32(1,−1)\tfrac{3}{\sqrt2}(1, -1) has x2=y2=92x^2 = y^2 = \tfrac92 and xy=−92xy = -\tfrac92, so q=452−36+452=9q = \tfrac{45}{2} - 36 + \tfrac{45}{2} = 9 ✓.

Proofs & Why It Matters

Tip
Proof: eigenvectors of a symmetric matrix are orthogonal

Let Au=λuA\mathbf u = \lambda\mathbf u and Av=μvA\mathbf v = \mu\mathbf v with λ≠μ\lambda \ne \mu. Compute λ(u⋅v)=(Au)⋅v=uTATv=uTAv=μ(u⋅v)\lambda(\mathbf u\cdot\mathbf v) = (A\mathbf u)\cdot\mathbf v = \mathbf u^{\mathsf T}A^{\mathsf T}\mathbf v = \mathbf u^{\mathsf T}A\mathbf v = \mu(\mathbf u\cdot\mathbf v), using symmetry in the middle.

So (λ−μ)(u⋅v)=0(\lambda - \mu)(\mathbf u\cdot\mathbf v) = 0, and since λ≠μ\lambda \ne \mu: u⋅v=0\mathbf u\cdot\mathbf v = 0. ■\blacksquare Significance: orthogonal eigenvectors mean the world decomposes into independent, non-interacting directions — normal modes of vibration, principal components of data, energy levels in quantum mechanics. The proof is three lines; the consequences fill physics departments.

Tip
Proof: the range of q on the unit circle

Expand x\mathbf x in the orthonormal eigenbasis: x=∑ciqi\mathbf x = \sum c_i\mathbf q_i with ∑ci2=1\sum c_i^2 = 1 on the unit circle. Then q(x)=∑λici2q(\mathbf x) = \sum\lambda_ic_i^2 — a weighted average of the eigenvalues with weights ci2c_i^2.

An average lies between the extremes, hitting λmin⁡\lambda_{\min} and λmax⁡\lambda_{\max} when all weight sits on one eigenvector. ■\blacksquare This one-line argument (the Rayleigh quotient) is how Google-scale eigenvalue problems are actually solved: maximize the quotient numerically.

Going Deeper: Worked Problems

Example
Worked: rotating away a cross term
32
The ellipse 5x² − 4xy + 8y² = 36: half-axes 3 along (2, 1) and 2 along (−1, 2).

Identify the conic 5x2−4xy+8y2=365x^2 - 4xy + 8y^2 = 36 by diagonalizing its quadratic form.

Step 1 — the symmetric matrix is (5−2−28)\begin{pmatrix}5&-2\\-2&8\end{pmatrix} (half the cross term).

Step 2 — eigenvalues: trace 1313, det 3636: λ2−13λ+36=(λ−4)(λ−9)=0\lambda^2 - 13\lambda + 36 = (\lambda-4)(\lambda-9) = 0.

Step 3 — in the eigenbasis the equation becomes 4u2+9v2=364u^2 + 9v^2 = 36, i.e. u29+v24=1\dfrac{u^2}{9} + \dfrac{v^2}{4} = 1: an ellipse with semi-axes 33 and 22.

Step 4 — the axes' directions are the eigenvectors: for λ=4\lambda = 4, (A−4I)v=0(A - 4I)\mathbf v = 0 gives (2,1)(2, 1) — the long axis points along (2,1)(2,1). Both eigenvalues positive confirmed the ellipse before any drawing; a negative one would have meant a hyperbola.

Example
Worked: the Hessian test as a definiteness check

Classify the critical point of f(x,y)=x2+xy+y2−3xf(x,y) = x^2 + xy + y^2 - 3x at (2,−1)(2, -1).

Step 1 — confirm it is critical: fx=2x+y−3=0f_x = 2x + y - 3 = 0 and fy=x+2y=0f_y = x + 2y = 0 at (2,−1)(2,-1) ✓.

Step 2 — the Hessian is the constant symmetric matrix (2112)\begin{pmatrix}2&1\\1&2\end{pmatrix}.

Step 3 — leading minors: 2>02 > 0 and det⁡=3>0\det = 3 > 0: positive definite, so the quadratic form near the point is a bowl and (2,−1)(2,-1) is a local (in fact global) minimum, with f=4−2+1−6=−3f = 4 - 2 + 1 - 6 = -3.

Step 4 — connect: the calculus "D=fxxfyy−fxy2=3>0D = f_{xx}f_{yy} - f_{xy}^2 = 3 > 0, fxx>0f_{xx} > 0" test is literally the leading-minor test for positive definiteness. Two courses, one criterion.