Week 5 · Symmetric matrices: the well-behaved ones
Read the words of the video
- Last week, some math shapes had crooked special directions. This week, we meet the well-behaved ones! Imagine a matrix that's a mirror image across its middle line. It's like stretching a grid, such as a window pane, perfectly straight in two directions, with no strange twisting. Everything stays neat and tidy.
- For these special symmetric matrices, everything is tidy! Their special numbers, called eigenvalues, are always real. Even better, their special directions, or eigenvectors, are always perfectly perpendicular to each other. This neat behaviour is why these matrices are super important in machine learning, making data analysis much simpler.
- Let's try one! A symmetric matrix like 'two, one; one, two' has two special numbers: three and one. And its special directions? They are indeed perfectly perpendicular. We can rewrite the matrix using these perpendicular directions and the special numbers, making it much easier to understand and work with. It's a neat trick!
- For your exams, remember that symmetric matrices always have real eigenvalues and perpendicular eigenvectors. Also, positive definite matrices have all positive eigenvalues, like a bowl shape! This tidy family is super important for understanding data in machine learning, helping us solve complex problems with confidence and clarity. You've got this!
The one-minute story
Last week you met matrices whose special directions can be crooked: two eigenvectors could lean towards each other at any odd angle, and some matrices had no real special directions at all.
This week is about the well-behaved family. Imagine a matrix that is a mirror image of itself across its diagonal: the number in row 1, column 2 equals the number in row 2, column 1. That is a symmetric matrix. It is like stretching a sheet along two perpendicular axes, like the grid of a window, with no weird shearing.
Everything is tidy for symmetric matrices: all the eigenvalues are real numbers, the special directions are perpendicular, and the matrix can always be rewritten using a clean rotation. Because data analysis keeps producing symmetric matrices (covariance, similarity, curvature), this tidy family is the one that matters most in machine learning.
By the end of this week you can:
- state and use the spectral theorem for symmetric matrices;
- recognise orthogonal matrices and why they are special;
- decide whether a quadratic form or symmetric matrix is positive definite, semi-definite, negative definite or indefinite;
- handle the complex cousins: Hermitian and unitary matrices.
Words you need
- Symmetric matrix - .
- Orthogonal matrix - square, with perpendicular unit-length columns: . It rotates or reflects without stretching.
- Orthonormal - perpendicular and length 1.
- Quadratic form - the expression , a "squared" function of the entries of .
- Positive definite (PD) - for every non-zero .
- Conjugate - of a complex number is .
- Hermitian matrix - , where means "transpose and conjugate". The complex version of symmetric.
- Unitary matrix - . The complex version of orthogonal.
Idea 1: Symmetric matrices and the spectral theorem
Spectral theorem. If is a real symmetric matrix, then
- all its eigenvalues are real;
- eigenvectors for different eigenvalues are perpendicular;
- is always diagonalisable, and with orthonormal eigenvectors:
Here has the unit-length eigenvectors as columns and holds the eigenvalues. Compare with week 4: . For symmetric matrices the awkward turns into the easy .
Why are the eigenvectors perpendicular? Take and with . Since is symmetric, . The left side is , the right side is . So . Because , we must have .
Orthogonal matrices
A matrix with has these properties:
- columns are perpendicular unit vectors, so (inverting is free);
- and : lengths and angles are preserved;
- , and every eigenvalue has .
Rotations and reflections are the orthogonal matrices.
Question. Write as .
Solution.
- Trace , determinant : , so and (both real, as promised).
- : gives . : gives .
- They are perpendicular: . Normalise by dividing each by .
- , , and .
Check one entry: the top-left of is . ✓
Idea 2: Quadratic forms and definiteness
For a symmetric , the quadratic form is a function that curves like a bowl, a dome, or a saddle. For it is .
Put a marble on a surface. If the surface curves up in every direction, the marble settles at the bottom: positive definite (a bowl). If it curves down in every direction, the marble rolls off the top: negative definite (a dome). If it curves up one way and down another, you have a saddle (a horse's saddle, or a Pringle): indefinite.
| Name | Condition | All eigenvalues | Shape |
|---|---|---|---|
| Positive definite (PD) | for all | all | bowl |
| Positive semi-definite (PSD) | all | bowl with a flat valley | |
| Negative definite | all | dome | |
| Negative semi-definite | all | dome with a flat ridge | |
| Indefinite | takes both signs | mixed signs | saddle |
Why do eigenvalues decide it? Write and let . Then . A sum of squares weighted by the . If every it is positive whatever is; if some are negative you can choose to make it negative.
Quick tests that avoid finding eigenvalues
- : PD and . Indefinite if .
- Leading minors (Sylvester): PD all leading principal minors (the determinants of the top-left , , , ... blocks) are .
- PSD is subtler: all principal minors must be , not just the leading ones.
- A PD matrix has a positive diagonal, and every PD matrix is invertible.
Question. Decide the definiteness of , and .
Solution.
- : and , so PD. (Its eigenvalues are 3 and 1.)
- : , so indefinite. (Eigenvalues and .)
- : and trace , so eigenvalues and : positive semi-definite, not definite, because gives .
Question. Is positive definite?
Solution. Leading minors: ; ; . All positive, so yes, PD. (Its eigenvalues are , all positive.)
Where you will see this again.
- The Hessian of a function is PD at a minimum (week 7).
- A function is convex exactly when its Hessian is PSD everywhere (week 8).
- A covariance matrix is always PSD (it measures variances, which cannot be negative), which is why PCA works (week 6).
- A function is a valid kernel exactly when its Gram matrix is PSD (MLT week 2).
Idea 3: The complex family
Some papers use complex numbers. All you need: is a number with ; a complex number is ; its conjugate is ; and , a real non-negative number.
For a complex matrix, the conjugate transpose flips the matrix over its diagonal and conjugates every entry. The real-world matrices you know are the special case where conjugating changes nothing.
| Real | Complex | Definition | Key properties |
|---|---|---|---|
| symmetric | Hermitian | diagonal entries real; eigenvalues real; eigenvectors for different eigenvalues orthogonal; unitarily diagonalisable | |
| orthogonal | unitary | ; every eigenvalue has ; columns orthonormal |
Schur's theorem (appears in Quiz 2): every square matrix can be written with unitary and upper triangular, and the eigenvalues of sit on the diagonal of . Hermitian and unitary matrices are special cases where turns out to be diagonal.
Question. Classify and .
Solution.
- : transpose gives , then conjugate gives . So is Hermitian. Its eigenvalues: trace 5, determinant , so , giving 1 and 4: real, as promised.
- . Then . So is unitary. But , so it is not Hermitian: a "unitary but not Hermitian" matrix, a favourite exam object.
Your turn
Which are guaranteed for a real symmetric matrix? (a) real eigenvalues (b) orthogonal eigenvectors for different eigenvalues (c) at least one eigenvalue is positive (d) diagonalisable.
Need a hint?
Think about the three clauses of the spectral theorem.
Show the full solution
(a), (b), (d) are guaranteed. (c) is not: is symmetric with only negative eigenvalues.
Is positive definite? And ?
Need a hint?
Check and .
Show the full solution
First: , : PD. Second: : indefinite.
is orthogonal and . What is ? If , what kind of transformation could be?
Need a hint?
Orthogonal matrices preserve length.
Show the full solution
. A determinant of means a reflection (it flips orientation). A rotation has determinant .
For which values of is positive definite?
Need a hint?
The test: and .
Show the full solution
. So PD exactly when . At it is PSD (determinant 0).
Is Hermitian?
Need a hint?
Compute : transpose, then conjugate.
Show the full solution
Transpose gives the same matrix (it is symmetric as a table), conjugating turns into : . Not Hermitian, even though it is symmetric as a table of numbers. Being symmetric is not enough in the complex world.
Exam radar
MLF Quiz 2 summaries (30 of the 53 papers have one) mention quadratic forms in 19 papers, positive definite matrices in 12 + 10, Hermitian matrices in 10, unitary matrices in 9, Schur's theorem in 6. Real symmetric properties and PD properties appear as MSQs in nearly every cycle of the End Term, as does the "unitary but not Hermitian" question.
Typical MSQ: "Which of the following is true for a real symmetric matrix / positive definite matrix / Hermitian matrix?" Memorise the table in Idea 3 and the spectral theorem's three clauses.
- "Symmetric" is a real-matrix word. For complex matrices the test is .
- PSD allows zero eigenvalues; PD does not. A PD matrix is invertible, a merely PSD one need not be.
- Leading minors prove PD. They do not prove PSD.
- Orthogonal projection. projections squash lengths; orthogonal matrices preserve them.
- "Orthogonal matrix" means perpendicular unit columns, not just perpendicular columns.
Quick quiz
A real symmetric matrix has eigenvalues 2, 5 and 7. Which word describes it?
- positive definite
- negative definite
- indefinite
- orthogonal
Which is always TRUE for a real symmetric matrix?
- It has a zero eigenvalue.
- Eigenvectors for different eigenvalues are perpendicular.
- It has complex eigenvalues.
- It is not invertible.
The matrix [[4, 2], [2, 1]] is...
- positive definite
- positive semi-definite but not positive definite
- indefinite
- negative definite
Select all TRUE statements about an orthogonal matrix Q. (select all that apply)
- Q transpose times Q equals the identity.
- It preserves lengths of vectors.
- Its determinant must be exactly 1.
- It can have eigenvalue 3.
Recap
- Symmetric: real eigenvalues, perpendicular eigenvectors, .
- Orthogonal: , , preserves lengths, , .
- Definiteness is decided by eigenvalue signs. : PD and . Leading minors all positive PD.
- Hermitian complex symmetric (, real eigenvalues). Unitary complex orthogonal (, ).
- Spectral theorem: , ,
- Quadratic form
- PD all all leading minors ; PSD all
- Orthogonal: , ,
- Hermitian: ; unitary: ; Schur:
- MLT week 1 - PCA: finding the best view of your data: Covariance matrices are symmetric, so the spectral theorem promises real eigenvalues and perpendicular principal components.
- MLT week 2 - Kernel PCA: curved views of data: A function is a valid kernel exactly when its matrix is positive semi-definite.
Practise with real exam questions
These come straight from past papers (with the real figures and the official answer key). Open 50 real questions on this week All Quiz 2 papers