You learn orthogonal matrices (Pᵀ = P⁻¹), the special properties of symmetric matrices (real eigenvalues, orthogonal eigenspaces, always diagonalizable), how to diagonalize a symmetric matrix with an orthogonal P so that PᵀAP = D, and how to use Gram-Schmidt for a repeated eigenvalue.
The last topic of the semester shows how “well-behaved” symmetric matrices are. A general matrix may not be diagonalizable, may have no real eigenvalues, and its eigenvectors may sit at skew angles to each other. None of this happens with a symmetric matrix: the eigenvalues are real, eigenvectors of distinct eigenvalues are perpendicular, and the matrix is always diagonalizable. Moreover, P can be chosen so that its columns are mutually perpendicular unit vectors; then you don’t even need to compute P−1, because P−1=PT. This result is called the spectral theorem and is used everywhere from statistics (PCA) to physics.
Golden rules:
An orthogonal matrix: the columns have unit length and are pairwise perpendicular. Its inverse is its transpose.
In a symmetric matrix, eigenvectors of distinct eigenvalues are automatically perpendicular.
Apply Gram-Schmidt in the eigenspace of a repeated eigenvalue.
At the end normalize every vector. This is the step that gets forgotten.
Orthogonal vectors and orthogonal matrices
From week 6: if u⋅v=0, then u and v are orthogonal. A set made of pairwise perpendicular vectors is an orthogonal set, and if all have unit length it is an orthonormal set. An orthogonal set containing no zero vector is always linearly independent.
A square matrix Q is an orthogonal matrix if it satisfies QTQ=I. Since the (i,j) entry of QTQ is the dot product of column i with column j:
QTQ=I⟺the columns are orthonormal⟺Q−1=QT.
Example
Orthogonal?
[cosθsinθ−sinθcosθ] (rotation)
yes, det=1
[100−1] (reflection)
yes, det=−1
[3/54/5−4/53/5]
yes (Q5)
[111−1]
no: the columns are perpendicular but have length 2
The last row is a classic trap: perpendicular columns are not enough, they must also be unit length. 21[111−1] is orthogonal.
Orthogonal matrices preserve length and angle: ∥Qx∥=∥x∥, because ∥Qx∥2=xTQTQx=xTx. Geometrically, only rotations and reflections.
Three properties of symmetric matrices
If A is real and symmetric (AT=A):
All its eigenvalues are real.
Eigenvectors belonging to distinct eigenvalues are perpendicular. Proof: Au=λu, Av=μv, λ=μ. λ(u⋅v)=(Au)Tv=uTATv=uTAv=μ(u⋅v). (λ−μ)(u⋅v)=0, so u⋅v=0. (AT=A is used exactly here.)
For every eigenvalue, geometric multiplicity = algebraic multiplicity. Consequence: it is always diagonalizable.
Spectral theorem. Let A be an n×n real matrix. The following two statements are equivalent:
A is symmetric.
There exist an orthogonal P and a diagonal D with PTAP=D (orthogonal diagonalization).
So the answer to “is it orthogonally diagonalizable?” is at a glance: is the matrix symmetric?
The recipe for orthogonal diagonalization
Solve the characteristic equation.
Find a basis of the eigenspace for each eigenvalue.
If an eigenspace has dimension 2 or more, apply Gram-Schmidt to its basis to make it orthogonal. (Single-dimensional eigenspaces, and orthogonality between different eigenspaces, come for free.)
Normalize every vector: v/∥v∥.
The columns of P are these orthonormal vectors, with the eigenvalues in D in the same order. A=PDPT.
Gram-Schmidt (two vectors). If {v1,v2} is independent,
u1=v1,u2=v2−u1⋅u1v2⋅u1u1.
u2 removes from v2 the component along u1; what remains is the perpendicular part. With three vectors, both the u1 and u2 components are removed from u3.
Example 1 (2×2).A=[3113]. Trace 6, det 8: λ2−6λ+8=(λ−4)(λ−2).
λ=4:(1,1),λ=2:(1,−1),P=21[111−1],D=[4002].
The eigenvectors came out perpendicular by themselves; the only job was to normalize.
Example 2 (3×3, repeated eigenvalue).A=211121112.
The characteristic polynomial is λ3−6λ2+9λ−4=(λ−1)2(λ−4). Check: trace 6=1+1+4.
λ=4: the rows of A−4I are (−2,1,1),(1,−2,1),(1,1,−2); the solution is x=y=z: (1,1,1).
λ=1: all rows of A−I are (1,1,1): a single equation x+y+z=0. A basis is v1=(−1,1,0), v2=(−1,0,1). These are not perpendicular (v1⋅v2=1).
PITFALL · skipping Gram-Schmidt for a repeated eigenvalue. Two eigenvectors from the same eigenspace need not be perpendicular. In Example 2, (−1,1,0) and (−1,0,1) are both correct eigenvectors, but the angle between them is 60∘. If you normalize them directly and put them in P, you get PTP=I.
TIP · check. To check PTP=I, look at the dot product of each pair of columns (it must be 0) and the length of each column (it must be 1). Much shorter than multiplying out PTAP completely.
Application: quadratic forms
The expression Q(x,y)=ax2+bxy+cy2 is a quadratic form and is written with a symmetric matrix:
Q(x)=xTAx,A=[ab/2b/2c].
If A=PDPT, then with the change of variable x=Py, Q=λ1y12+λ2y22: no cross term. The columns of P are the principal axes. In Q11, 3x2+4xy+3y2=5x′2+y′2; the directions (1,1) and (−1,1) are the axes of the ellipse. The signs of the eigenvalues tell whether the form is always positive (positive definite).
Semester summary: the diagonalization hierarchy
Type of matrix
Diagonalizable?
P
General square matrix
sometimes (if there are n independent eigenvectors)
invertible
n distinct eigenvalues
always
invertible
Symmetric
always
orthogonal (P−1=PT)
Common mistakes
Wrong
Right
Counting a matrix with perpendicular columns as orthogonal
The columns must also be unit length
Forgetting to normalize
Divide each column by its own length
Using the eigenvectors of a repeated eigenvalue as they are
Gram-Schmidt first
Doing Gram-Schmidt between different eigenspaces
Not needed, they are already perpendicular
Writing A=PDP−1 and computing P−1
P−1=PT
Writing the xy coefficient of a quadratic form as is in the off-diagonal
Half of it: b/2
Trying to orthogonally diagonalize a non-symmetric matrix
Only symmetric ones
detQ is always 1
±1
Test yourself
Exam-style questions. Solve them on paper first, then reveal the answer.
Question 1easy
Which of the matrices A=[1221] and Q=21[1−111] is orthogonal?
Show answer
Only Q
Orthogonal: QTQ=I, that is, the columns have unit length and are perpendicular to each other.Q: the columns are 21(1,−1) and 21(1,1), dot product 21(1−1)=0, lengths 1.A: ATA=[5445]=I. Being symmetric is not being orthogonal.
Question 2easy
Find the eigenvalues of the symmetric matrix A=[5222].
Show answer
6 and 1
Trace 7, det 10−4=6: λ2−7λ+6=(λ−6)(λ−1). Since it is symmetric, it was known in advance that they would be real.
Question 3medium
Orthogonally diagonalize A=[5222]: find an orthogonal P and diagonal D with PTAP=D.
Show answer
P=51[211−2],D=[6001]
λ=6: A−6I=[−122−4], x=2y: (2,1).λ=1: A−I=[4221], 2x+y=0: (1,−2). The two are perpendicular: 2−2=0. Both have length 5; normalize and use them as columns.
Question 4easy
Find k such that (1,k,2) and (3,1,−1) are orthogonal.
Show answer
k=−1
Perpendicular ⟺ dot product 0: 3+k−2=0, k=−1.
Question 5medium
Find the inverse of Q=[3/54/5−4/53/5].
Show answer
[3/5−4/54/53/5]
The columns are (3/5,4/5) and (−4/5,3/5): lengths 259+16=1, dot product −2512+2512=0. Q is orthogonal. The inverse of an orthogonal matrix is its transpose: Q−1=QT. No calculation.
Question 6medium
True or false: Every real symmetric matrix is diagonalizable.
Show answer
True
Spectral theorem: the eigenvalues of a real symmetric matrix are real, and for every eigenvalue the geometric multiplicity equals the algebraic multiplicity. In fact it is diagonalizable with an orthogonal P. The non-symmetric [2012] was not diagonalizable; with a symmetric matrix this can't happen.
Question 7hard
A is a 3×3 symmetric matrix. (1,2,−1) is an eigenvector for λ=3 and (2,a,4) is an eigenvector for λ=−1. Find a.
Show answer
a=1
In a symmetric matrix, eigenvectors of distinct eigenvalues are perpendicular.(1,2,−1)⋅(2,a,4)=2+2a−4=0⇒a=1.
Question 8hard
Orthogonally diagonalize A=102030201.
Show answer
P=1/201/20101/20−1/2,D=diag(3,3,−1)
The eigenvalues are 3,3,−1 ((λ−3)2(λ+1)).λ=3: A−3I=−20200020−2, x=z, y free: (1,0,1) and (0,1,0). These are already perpendicular, no Gram-Schmidt needed.λ=−1: A+I=202040202, y=0, x=−z: (1,0,−1). Normalize: (1,0,1)/2, (0,1,0), (1,0,−1)/2.
Question 9medium
What are the possible values of detQ for an orthogonal matrix Q?
Show answer
1 or −1
QTQ=I⇒detQTdetQ=1⇒(detQ)2=1. Rotations give +1 (the matrix in Q5), reflections −1 (diag(1,−1)).
Question 10hard
Apply the Gram-Schmidt process to {(1,1,0),(1,0,1)} to get an orthogonal basis of their span.
Show answer
{(1,1,0),(1,−1,2)}
u1=(1,1,0). u2=(1,0,1)−u1⋅u1(1,0,1)⋅u1u1=(1,0,1)−21(1,1,0)=(21,−21,1). Multiply by 2 (orthogonality is not affected): (1,−1,2). Check: 1−1+0=0.
Question 11hard
Write the quadratic form Q(x,y)=3x2+4xy+3y2 as xTAx with A symmetric, and find the eigenvalues of A.
Show answer
A=[3223]; eigenvalues 5 and 1
Diagonal: the coefficients of x2 and y2. The coefficient of xy is 4, split half and half between the two off-diagonal entries: 2 and 2. Eigenvalues: trace 6, det 5, λ2−6λ+5: 5 (direction (1,1)) and 1 (direction (−1,1)). In the new axes Q=5x′2+y′2: the cross term disappears.
Verification: The eigenvalues and eigenspaces were found in node with BigInt fractions from the roots of the characteristic polynomial and the exact null space; to avoid normalizations containing square roots, orthogonality SᵀS = diag(‖vᵢ‖²) and diagonalization SᵀAS = diag(‖vᵢ‖²λᵢ) were checked exactly with the unscaled column matrix S; the Gram-Schmidt steps and dot products were computed with exact fractions (verify/MAT1041/14.mjs).
Review card
Symmetric: A^T = A.
ORTHOGONAL MATRIX: Q^T Q = I ⇔ Q⁻¹ = Q^T ⇔ the columns are ORTHONORMAL (unit + perpendicular).
det Q = ±1. Preserves length and angle: ||Qx|| = ||x||.
SYMMETRIC MATRIX (spectral theorem):
(1) eigenvalues are REAL (2) eigenvectors of distinct eigenvalues are PERPENDICULAR
(3) it is ALWAYS diagonalizable, and with an ORTHOGONAL P: P^T A P = D.
The converse is also true: an orthogonally diagonalizable matrix is symmetric.
RECIPE: eigenvalues → a basis of each E_λ → (for repeated λ) Gram-Schmidt → NORMALIZE → the columns of P.
Gram-Schmidt: u1 = v1; u2 = v2 - (v2·u1)/(u1·u1) u1. Scaling is allowed.
Vectors in different eigenspaces are already perpendicular; GS only WITHIN the same eigenspace.
Normalize: v/||v||. DON'T FORGET: a P that is not normalized is not orthogonal.
A = PDP^T (P^T instead of P⁻¹).
Quadratic form ax² + bxy + cy² → A = [a b/2; b/2 c]; eigenvectors = principal axes.