Quadratic Forms and Spectral Theorems
Quadratic forms turn symmetric matrices into scalar-valued geometry. They describe conic sections, surfaces, energy functions, constrained extrema, and optimization tests. The spectral theorem is the key simplifier: a real symmetric matrix can be diagonalized by an orthogonal change of coordinates.
The reason symmetry matters is that symmetric matrices have especially clean eigenstructure. Their eigenvalues are real, eigenvectors from different eigenspaces are orthogonal, and an orthonormal eigenbasis exists. That lets quadratic forms be rotated into a coordinate system with no cross terms.
Definitions
A quadratic form in is an expression
where is symmetric. For two variables,
corresponds to
A matrix is orthogonal if
Orthogonal matrices preserve lengths and dot products. A matrix is orthogonally diagonalizable if
for some orthogonal and diagonal .
A quadratic form is positive definite if for every nonzero . It is negative definite if for every nonzero . It is indefinite if it takes both positive and negative values.
Key results
Spectral theorem for real symmetric matrices: if is real and symmetric, then is orthogonally diagonalizable. That is, there is an orthogonal matrix and a real diagonal matrix such that
The columns of are orthonormal eigenvectors of , and the diagonal entries of are the corresponding eigenvalues.
Principal axes theorem: if is symmetric and , then
Thus the quadratic form becomes
with no cross terms.
Eigenvalues classify definiteness:
| Eigenvalues of symmetric | Type of quadratic form |
|---|---|
| all positive | positive definite |
| all nonnegative and at least one zero | positive semidefinite |
| all negative | negative definite |
| all nonpositive and at least one zero | negative semidefinite |
| both positive and negative | indefinite |
For a differentiable function of two variables, the Hessian matrix at a critical point is symmetric under common smoothness assumptions. The definiteness of the Hessian gives the second-derivative test: positive definite means local minimum, negative definite means local maximum, and indefinite means saddle point.
The cross term in a quadratic form measures how the original coordinate axes fail to align with the natural axes of the form. For
the term mixes the variables. Orthogonal diagonalization chooses new perpendicular axes so that the same form is written without a mixed term:
The eigenvectors of the symmetric matrix point along these principal axes, and the eigenvalues measure curvature or scaling in those directions.
Positive definiteness has several equivalent tests. For symmetric matrices, the eigenvalue test is conceptually clean: all eigenvalues must be positive. For a symmetric matrix
positive definiteness is equivalent to
The second condition is the determinant being positive. These are the leading principal minor conditions in the case.
Quadratic forms also encode constrained extrema on spheres. If is symmetric and , then the Rayleigh quotient
takes values between the smallest and largest eigenvalues of . The maximum is the largest eigenvalue, achieved at a corresponding unit eigenvector; the minimum is the smallest eigenvalue. This result explains why eigenvalues appear in optimization, mechanics, statistics, and numerical methods.
In applications, a positive definite matrix often represents energy, variance, or squared distance. The positivity condition guarantees that the quantity is genuinely zero only at the zero vector and positive otherwise. Indefinite forms represent saddle geometry: there are directions of increase and directions of decrease through the same point.
Visual
ASCII picture of removing a cross term:
xy-coordinate axes principal axes
y y2
| tilted ellipse | ellipse aligned
| /-----/ | -----
------+---/-----/---- x ------+---------- y1
| /-----/ | -----
|
Worked example 1: Diagonalize a quadratic form
Problem: diagonalize
Step 1: write the symmetric matrix. Since the cross term is , we have , so :
Step 2: compute eigenvalues.
Expand:
Factor:
Step 3: find orthogonal eigenvectors. For ,
so and an eigenvector is .
For ,
so and an eigenvector is .
Step 4: normalize:
Then in principal coordinates,
Checked answer: both eigenvalues are positive, so the form is positive definite.
Worked example 2: Classify a critical point with a Hessian
Problem: classify the critical point of
Step 1: compute the gradient.
At both derivatives are zero, so it is a critical point.
Step 2: compute the Hessian.
Step 3: find eigenvalues.
Set this equal to zero:
Thus or .
Step 4: classify. The Hessian has one positive and one negative eigenvalue, so it is indefinite. Checked answer: is a saddle point.
Code
import numpy as np
A = np.array([[5, 2],
[2, 2]], dtype=float)
values, Q = np.linalg.eigh(A)
D = np.diag(values)
print(values)
print(Q.T @ A @ Q)
print(np.all(values > 0))
np.linalg.eigh is specialized for symmetric or Hermitian matrices. It returns real eigenvalues and orthonormal eigenvectors, matching the spectral theorem.
Common pitfalls
- Forgetting that the matrix of has off-diagonal entries , not .
- Applying the real spectral theorem to a nonsymmetric matrix.
- Assuming diagonalizable automatically means orthogonally diagonalizable. Orthogonal diagonalization is stronger and is guaranteed for real symmetric matrices.
- Classifying definiteness from diagonal entries of instead of eigenvalues or a valid criterion.
- Ignoring zero eigenvalues when distinguishing positive definite from positive semidefinite.
- Losing the coordinate change: , so the new variables are coordinates in the orthonormal eigenbasis.
A safe classification routine is to start with symmetry. The standard eigenvalue definiteness test applies to symmetric matrices. If the matrix is not symmetric, first rewrite the quadratic form using its symmetric part, because
The skew-symmetric part contributes nothing to the quadratic form. After the symmetric matrix is identified, use eigenvalues or a valid principal-minor test.
When diagonalizing a quadratic form, keep track of which variables are old and which are new. The equation means the columns of are the new orthonormal axes written in old coordinates. The vector contains coordinates along those axes. Losing this distinction can lead to correct eigenvalue arithmetic but wrong geometric interpretation.
The signs of eigenvalues describe the shape. In two variables, two positive eigenvalues give ellipses for level curves . One positive and one negative eigenvalue gives hyperbola-like level curves and saddle behavior. A zero eigenvalue creates a flat direction. These pictures are often more memorable than the terminology.
In optimization, positive definite Hessians mean the function curves upward in every direction near the critical point. Negative definite Hessians mean it curves downward in every direction. Indefinite Hessians mean there are both upward and downward directions, so the point is a saddle. This is the multivariable version of the one-variable second derivative test.
Orthogonal changes of coordinates are preferred because they do not distort lengths. If is orthogonal, then when . Thus diagonalizing a quadratic form by an orthogonal matrix rotates or reflects the coordinate system without stretching it. The shape changes its description, not its underlying geometry.
Positive semidefinite forms deserve separate attention. They never take negative values, but they can be zero for nonzero vectors. Geometrically, this means there are flat directions. In statistics, covariance matrices are positive semidefinite because variances cannot be negative, but zero variance can occur in directions with exact linear dependence.
The spectral theorem is also the reason symmetric matrices are central in applications. Energy matrices, covariance matrices, Hessians, and many graph matrices are symmetric. Their orthonormal eigenvectors provide stable axes for analysis, and their real eigenvalues can be ordered and interpreted as curvatures, variances, frequencies, or connectivity measures depending on the model.
A useful final check is to evaluate the quadratic form on eigenvectors. If and , then
So eigenvalues are the values of the quadratic form on its principal unit directions.
That sentence is often the simplest interpretation of the spectral theorem for quadratic forms.