Every difficulty in the previous lesson, missing eigenvectors, complex eigenvalues and ill-conditioned changes of basis, disappears for matrices equal to their own transpose.
A matrix is symmetric when , which for a two by two means the off-diagonal entries are equal: . The definition looks like a coincidence of notation. It is not, and this lesson proves what symmetry guarantees, shows what such matrices compute, and explains why they dominate applied work.
Two proofs
Eigenvectors of distinct eigenvalues are perpendicular. Suppose and with . Compute in two ways. Directly, it is . But writing the dot product as a matrix product, , using symmetry to replace by , and that is . So , and since the dot product must be zero.
Three lines, and the geometric content is large: the axes of a symmetric transformation meet at right angles.
The eigenvalues are real. For a general real matrix they need not be, as the rotation showed. Suppose with and possibly complex, and let be the entrywise complex conjugate. The quantity equals , and is the sum of , a positive real number. Conjugating and transposing the whole expression, and using that is real and symmetric, returns the same quantity with replaced by . So , which for a complex number means it is real.
Together with a slightly harder argument that covers repeated eigenvalues, these give the spectral theorem: every real symmetric matrix has a full set of real eigenvalues and an orthonormal basis of eigenvectors, so
with orthogonal and diagonal and real. The inverse of is its transpose, so the change of basis costs nothing and is perfectly conditioned. Symmetric matrices are never defective, never need complex numbers, and never produce a badly conditioned : all three failure modes of the previous lesson are excluded at once.
Example. Diagonalise and confirm that its eigenvectors are perpendicular.
The trace is and the determinant is , so and the eigenvalues are and , both real. For , the first row of is , so and the eigenvector is . For , the first row of is , so and the eigenvector is . Their dot product is . Normalising, and .
Now you. Diagonalise .
Answer
Trace , determinant , so and the eigenvalues are and . For the first row of is , giving the eigenvector ; for it is , giving . Their dot product is zero. Normalised, the two are and .
Quadratic forms
Symmetric matrices exist to compute quadratic expressions. Given a symmetric , the function
is a quadratic form: every term is of degree two. For a two by two , expanding gives . So corresponds to , and , which is the matrix diagonalised above. Note that the cross term is split evenly between the two off-diagonal entries, which is exactly why the matrix can be taken symmetric with no loss.
Now apply the spectral theorem. In the eigenvector basis the matrix is diagonal, so the form becomes a plain sum of squares with the eigenvalues as coefficients: if and are the coordinates along the two orthonormal eigenvectors, then
with no cross term at all. For the example, where is measured along and along . The cross term was an artefact of using coordinates misaligned with the natural axes of the form.
That makes the level curves readable. The set is , an ellipse with semi-axis in the direction and in the direction: the larger the eigenvalue, the shorter the axis, since a steeper form reaches the value sooner. Checking one point directly, along is , and , on the curve as predicted.
Example. Sketch the curve by finding its axes.
The matrix is , diagonalised above with eigenvalues and and eigenvectors and . So the curve is , an ellipse with semi-axis along and along . Check the first: the point gives .
Now you. What shape is the curve ?
Answer
The matrix is , whose eigenvalues are and with eigenvectors and . The form is , and with one positive and one negative coefficient the curve is a hyperbola, not an ellipse. Signs of the eigenvalues decide the shape.
Definiteness
A quadratic form is positive definite when for every non-zero , and since in the eigenvector basis, that happens exactly when every eigenvalue is positive. Negative definite means all negative, and indefinite means mixed signs, which is a saddle.
For a two by two there is a shortcut that avoids finding the eigenvalues: the form is positive definite exactly when and . The determinant is the product of the eigenvalues, so a positive determinant means they share a sign, and being positive settles which sign. For : and , so positive definite, and the eigenvalues confirm it, being and .
This is the multivariable second derivative test, and anyone who has taken calculus has met it in disguise. At a critical point of a function of several variables, the matrix of second partial derivatives, the Hessian, is symmetric because mixed partials are equal. If it is positive definite the point is a minimum, since the surface curves upward along every direction; negative definite gives a maximum; indefinite gives a saddle. The two by two condition with is precisely the rule usually quoted as and .
Example. Is the form positive definite?
The matrix is . Here and , so yes. The eigenvalues, from , are and , both positive, confirming it. The level curves are ellipses.
Now you. Classify .
Answer
The matrix is , with . A negative determinant means the eigenvalues have opposite signs, so the form is indefinite: it is positive along , where , and negative along , where . The level curves are hyperbolas and the origin is a saddle.
Where symmetric matrices come from
They are not rare. Three sources supply most of the symmetric matrices anyone meets.
Any matrix at all generates one: is symmetric, since , and it is positive semidefinite, since . That is the matrix at the heart of the normal equations four lessons ago, and its being positive definite whenever the columns of are independent is what made the least squares solution unique.
Physical laws that pair a cause with an effect are usually symmetric, because the underlying energy is a quadratic form: the stiffness matrix of a structure, the inertia tensor of a rigid body, the conductivity of a crystal. Diagonalising the inertia tensor gives the principal axes about which a body spins without wobbling, which is a physical fact recovered by an eigenvector computation.
And covariance matrices are symmetric by construction, since the covariance of with equals the covariance of with . Diagonalising one is principal component analysis, which finds the directions of greatest variation in data.
Principal components, on four points
Take the data , , and . The mean is , so the centred points are , , and . Dividing the sums of products by gives the variances and and the covariance . The covariance matrix has trace and determinant , so the eigenvalues satisfy , giving and .
The first eigenvalue accounts for per cent of the total variance, so the cloud is very nearly one-dimensional. Its direction solves , that is , so the principal direction is , or as a unit vector . Projecting the data onto that single direction loses under three per cent of the variation, which is data compression by eigenvector, and it is the same computation performed on matrices with thousands of rows.
Example. The four points above have covariance eigenvalues and . What fraction of the variance survives if the data is projected onto the second principal direction instead of the first?
The total variance is the trace, , and the second eigenvalue is , so the fraction is , under two and a half per cent. Keeping the wrong direction discards almost everything, which is why the eigenvalues are always sorted before any are thrown away.
Now you. A covariance matrix in three dimensions has eigenvalues , and . How much of the variance is captured by the first two principal directions?
Answer
The total is , and the first two account for , or per cent. Dropping the third direction turns three-dimensional data into two-dimensional data at a cost of five per cent of the variation, which is the trade principal component analysis exists to make.
Honest limits, and what comes after
The spectral theorem needs the matrix to be genuinely symmetric, and near-symmetry buys nothing in theory, though in practice a small asymmetry perturbs the eigenvalues only slightly, which is the sense in which symmetric problems are well conditioned. The theorem as stated is for real matrices; the complex analogue replaces the transpose by the conjugate transpose and symmetric by Hermitian, and the whole of quantum mechanics is built on that version, where the real eigenvalues are the possible measured values of an observable.
The obvious gap is that most matrices are neither symmetric nor square. The repair is the singular value decomposition: every by matrix, with no assumptions whatever, can be written with and orthogonal and diagonal with non-negative entries. Geometrically it says that every linear map is a rotation or reflection, followed by a scaling along perpendicular axes, followed by another rotation or reflection: no shear survives once the input and output are allowed their own bases. It follows from this lesson, since the axes are the eigenvectors of the symmetric matrices and , and the singular values are the square roots of their shared eigenvalues. It is what a numerical library actually computes when asked for a rank, a condition number, a least squares fit or a low-rank approximation, and it is the natural next subject after this one.
Look back at what a matrix has become. It began in the first lesson as a bookkeeping device for the coefficients of a system nobody wanted to write out twice. It is now a transformation of space, whose columns say where the basis goes, whose determinant says what it does to area, whose rank and null space say what it destroys, and whose eigenvectors are the directions it treats as its own. Reading those five things off a matrix is what it means to see one as a transformation, and it is what this course was for.