Symmetric matrices are the "nicest" matrices in linear algebra — they have real eigenvalues, orthogonal eigenvectors, and can be perfectly diagonalized. Understanding symmetric matrices is the key to mastering principal component analysis, optimization theory, vibration analysis in physics, and many other fields.
Introduction: The Power of Symmetry
In mathematics and physics, symmetry often heralds beautiful properties. Think of the six-fold symmetry of snowflakes, the mirror symmetry of butterfly wings — these symmetries bring not only visual beauty but also profound physical laws. Linear algebra is no exception: symmetric matrices possess the most elegant properties.
Imagine you're analyzing the energy of a physical system, or optimizing an objective function in machine learning. You'll find that these problems ultimately reduce to analyzing symmetric matrices. Why? Because:
- Energy is always expressed as a quadratic form:
- Covariance matrices are always symmetric:
- Hessian matrices (second derivatives) are always
symmetric:
Life Analogy: A symmetric matrix is like a mirror — what you see from the left is the same as what you see from the right. This "symmetry" brings tremendous mathematical convenience: simpler computations, more elegant properties, and broader applications.
对称矩阵与二次型/fig1.png)
Basic Properties of Symmetric Matrices
Definition and Intuition
A matrix
Geometric Meaning: The linear transformation corresponding to a symmetric matrix is "uniform" in some sense — it stretches or compresses along principal axis directions without twisting the space. It's like uniformly stretching a piece of clay with both hands rather than twisting it.
Life Example: Spring System
Imagine two masses connected by three springs. If you push the first mass, it affects the second mass through the springs; conversely, the second mass affects the first in the same way. This "symmetry of mutual interaction" is the essence of symmetric matrices.
对称矩阵与二次型/fig2.png)
Example: Covariance Matrix
Special Properties of Symmetric Matrices
Theorem 1: The eigenvalues of a symmetric matrix are all real numbers.
This is a very important property. Eigenvalues of general matrices can be complex (like rotation matrices), but symmetric matrices guarantee all eigenvalues are real.
Proof:
Let
Theorem 2: Eigenvectors corresponding to different eigenvalues of a symmetric matrix are mutually orthogonal.
Proof:
Let
对称矩阵与二次型/fig3.png)
Life Analogy: Imagine a football field where you can run along the length (eigenvector 1) or along the width (eigenvector 2). These two directions are perpendicular and don't interfere with each other — this is the orthogonality of eigenvectors.
Spectral Theorem
This is the most important theorem about symmetric matrices:
Spectral Theorem: Any real symmetric matrix
Significance: 1. In the basis of eigenvectors, a symmetric matrix appears as a simple diagonal matrix 2. Any symmetric matrix can be viewed as stretching/compressing along orthogonal directions 3. This is the theoretical foundation for Principal Component Analysis (PCA), spectral clustering, and other algorithms
Life Analogy: Imagine you need to move a furniture of unusual shape through a doorframe. The spectral theorem tells you: just find the furniture's "principal axis" directions, and the problem becomes simple — along these directions, the furniture's dimensions are the simplest.
对称矩阵与二次型/fig4.png)
Corollary (Spectral Decomposition): A symmetric
matrix can be written as a sum of outer products of eigenvalues and
eigenvectors:
Why "spectral"? In physics, a spectrum decomposes white light into different colors (frequencies). Similarly, spectral decomposition decomposes a matrix into different "frequencies" (eigenvalues). Each eigenvalue corresponds to a "pure" direction (eigenvector), just as each color corresponds to a pure light wave.
Quadratic Forms
Definition of Quadratic Forms
A quadratic form is a homogeneous polynomial of
degree 2 in variables
Life Example: Energy
In physics, elastic potential energy is a typical quadratic
form:
Example 1: Binary quadratic form
Verification:
Geometric Meaning of Quadratic Forms
The geometric meaning of quadratic form
Case 1:
Life Analogy: This is like the shape of a bowl — no matter which direction you go from the center, you go upward. A ball placed at the bottom of the bowl will stably stay there.
对称矩阵与二次型/fig5.png)
Case 2:
Life Analogy: This is like an upside-down bowl — a ball would roll off from the top.
Case 3:
Life Analogy: This is like a horse saddle — curved upward along the horse's back and curved downward along its belly. When riding, you sit at the saddle point, which is neither the highest nor lowest point.
Case 4:
Standardization of Quadratic Forms
Goal: Through coordinate transformation, convert the quadratic form to standard form (containing only squared terms).
Principal Axis Theorem: For quadratic form
Steps: 1. Find eigenvalues
Detailed Example:
Consider quadratic form
Step 2: Find eigenvalues
For
Classification of Quadratic Forms
Based on the signs of eigenvalues of matrix
| Eigenvalue Signs | Quadratic Form Name | Standard Form | Geometric Shape |
|---|---|---|---|
| All positive | Positive definite | Ellipsoid | |
| All negative | Negative definite | Downward ellipsoid | |
| Mixed positive and negative | Indefinite | Saddle surface | |
| Non-negative, at least one 0 | Positive semidefinite | Some |
Degenerate ellipsoid |
Positive Definite Matrices
Definition and Criteria
A symmetric matrix
Geometric Meaning: The quadratic form
Related Concepts: - Positive
semidefinite:
Life Analogy: - Positive definite: Bowl bottom — energy increases in any direction away from origin - Negative definite: Hilltop — energy decreases in any direction away from origin - Indefinite: Saddle — increases in some directions, decreases in others - Positive semidefinite: Flat valley bottom in one direction
Methods for Determining Positive Definiteness
There are several equivalent criteria:
Method 1: Eigenvalue Test
From spectral theorem
Example:
Intuition: Sylvester's criterion progressively checks — first the 1D case, then 2D... each step requires "positive energy."
Method 3: Cholesky Decomposition Test
Method 4: Energy Test
In physics and engineering, positive definite matrices correspond to
positive energy systems. If
Life Example: Structural Stability of Buildings
Imagine a bridge. Engineers need to ensure the bridge's stiffness matrix is positive definite — this means under any external force, the bridge produces positive elastic potential energy rather than "collapsing." If the stiffness matrix is not positive definite, the bridge might become unstable in some direction.
Properties of Positive Definite Matrices
Invertible: Positive definite matrices are always invertible (all eigenvalues
, determinant )Positive diagonal entries:
(take , get )Positive determinant:
Inverse is also positive definite: If
is positive definite, then is also positive definiteSum preserves positive definiteness: If
are positive definite, then is positive definiteProduct not necessarily positive definite:
may not be positive definite (unless ), but is positive definiteSquare root exists: Positive definite matrices have a unique positive definite square root
Principal Axis Theorem and Applications
Principal Axis Theorem
Theorem: For quadratic form
Geometric Interpretation: - Original coordinates:
Quadric surface may be a tilted ellipsoid - Principal axis coordinates:
Ellipsoid axes align with coordinate axes - Principal axis lengths
determined by
Application 1: Determining Quadric Curve/Surface Type
Problem: What curve is
Solution:
Matrix:$A =
(A - I) = (3-)^2 - 1 = 0 _1 = 4, _2 = 2$(both positive)Conclusion: Positive definite, represents an ellipse
Standard form: In principal axis coordinates:
That is: This is the standard ellipse equation with semi-major axis , semi-minor axis .
Application 2: Rayleigh Quotient and Optimization
Problem: Find extrema of
Solution: Using Lagrange multipliers:
Conclusion: - Maximum is the largest eigenvalue
This is the result of Rayleigh quotient:
Life Analogy: Imagine an ellipsoid-shaped mountain. You're standing on it and want to know the steepest direction from the peak. The answer is along the ellipsoid's shortest axis — this is the eigenvector direction corresponding to the largest eigenvalue.
Application 3: Covariance Matrix and PCA
In statistics, covariance matrix
- Eigenvalues: Variance of principal components (spread of data in that direction)
- Eigenvectors: Principal component directions (directions of maximum data variation)
Principal Component Analysis (PCA) is just spectral decomposition of the covariance matrix!
Life Example: Face Recognition
Suppose you have a set of face images, each being a
Cholesky Decomposition
Definition
For a positive definite matrix
Uniqueness: If
Difference from Spectral Decomposition: - Spectral
decomposition:
Cholesky decomposition is faster (
Intuition: Cholesky decomposition is like "taking
the square root" of a positive definite matrix — just as
Computation Method
For a
General Formula (computed row by row):
Detailed Example:
Compute Cholesky decomposition of
Verification:
Applications
1. Solving Linear Systems
Solving
Step 1: Cholesky decomposition
2. Testing Positive Definiteness
If Cholesky decomposition succeeds (no negative numbers under square
root), then
3. Generating Normal Random Vectors
Generating
Geometry of Ellipses and Hyperbolas
Two-Dimensional Case
The geometric shape of quadratic equation
| Discriminant | Matrix Property | Geometric Shape |
|---|---|---|
| Positive or negative definite | Ellipse | |
| Indefinite | Hyperbola | |
| Semidefinite | Parabola/parallel lines |
Intuition: This is like determining whether a bowl is right-side up (ellipse), saddle-shaped (hyperbola), or trough-shaped (parabola).
Geometric Properties of Ellipses
Ellipse equation
- Semi-major axis:
(along direction) - Semi-minor axis:
(along direction) - Foci:
, where - Eccentricity:
( )
Relationship with matrices:
For
Life Example: Planetary Orbits
Planets orbit the sun in ellipses. The sun sits at one focus of the
ellipse. Earth's orbit has eccentricity about
Geometric Properties of Hyperbolas
Hyperbola equation
- Real axis:
(along direction) - Imaginary axis:
(along direction) - Foci:
, where - Asymptotes:
Life Example: Supersonic Aircraft
When an aircraft flies supersonically, the shockwave front forms a cone. The intersection of this cone with the ground is one branch of a hyperbola.
Three-Dimensional Case
Three-dimensional quadric surfaces are richer:
| Eigenvalue Signs | Surface Type | Equation (Standard Form) |
|---|---|---|
| Ellipsoid | ||
| Hyperboloid of one sheet | ||
| Hyperboloid of two sheets | ||
| Elliptic cylinder | ||
| Hyperbolic cylinder |
Matrix Square Roots
Definition
For a positive definite symmetric matrix
Existence: The square root of a positive definite symmetric matrix exists and is unique (if we require the square root to also be symmetric positive definite).
Computation Methods
Method 1: Spectral Decomposition
Method 2: Cholesky Decomposition
If
Symmetric square root:
Application: Whitening Transform
In machine learning, whitening transforms correlated data into uncorrelated data with unit variance.
Given covariance matrix
Why whitening? Many machine learning algorithms assume features are independent with equal variance. Whitening preprocessing satisfies this assumption, improving algorithm performance.
Life Analogy: Imagine analyzing student grade data where math and physics scores are highly correlated. Whitening finds a new coordinate system where the new "scores" are mutually independent — making it easier to analyze each "ability's" independent contribution.
Practical Application Cases
Application 1: Small Vibrations in Physics
In classical mechanics, vibrations of multi-degree-of-freedom systems near equilibrium can be described by quadratic forms.
Kinetic energy:
Potential energy:
Vibration frequencies: Determined by generalized
eigenvalue problem
Guitar string vibration can be decomposed into multiple "resonant modes," each corresponding to a characteristic frequency. The fundamental frequency determines pitch, harmonics determine timbre. These frequencies and modes are the eigenvalues and eigenvectors of the stiffness matrix!
Application 2: Ellipse Fitting in Image Processing
Given a set of data points, fitting the best ellipse is a common task in computer vision.
Method: Minimize sum of squared residuals to get
quadratic curve equation
Application 3: Regularization in Machine Learning
In Ridge Regression, the objective function is:
Intuition: The original
Application 4: Portfolio Optimization in Finance
In Markowitz portfolio theory, risk minimization:
Where
Intuition:
Exercises
Basic Problems
1. Determine whether the following matrices are symmetric and positive definite:
(a)
3. Compute the Cholesky decomposition of
4. Find eigenvalues and eigenvectors of
5. Determine the type of quadric curve
Advanced Problems
6. Prove: If
7. Prove: If
8. For quadratic form
10. Prove: The trace of a symmetric matrix equals the sum of eigenvalues, and the determinant equals the product of eigenvalues.
11. Let
Programming Problems
12. Implement Cholesky decomposition algorithm (without using numpy built-in function):
1 | def cholesky(A): |
13. Verify spectral theorem in Python: For a
randomly generated symmetric matrix, compute its spectral decomposition
and verify
14. Implement quadratic form visualization: Given a 2D symmetric matrix, plot its level curves and mark eigenvector (principal axis) directions.
15. Implement PCA dimensionality reduction: - Generate 2D correlated data - Compute covariance matrix - Perform spectral decomposition - Visualize principal component directions - Project onto first principal component
16. Implement whitening transform and verify that whitened data has covariance matrix close to identity.
Application Problems
17.
Vibration Analysis: Two masses (each mass
18.
Portfolio: Two assets with covariance matrix
- Verify
is positive definite - Find minimum variance portfolio (constraint: weights sum to 1)
- Find several points on the efficient frontier
19.
Ellipse Fitting: Given data points, fit an ellipse equation using least squares.
| x | 1 | 2 | 3 | 2 | 1 | 0 | -1 | 0 |
|---|---|---|---|---|---|---|---|---|
| y | 2 | 2 | 0 | -2 | -2 | -1 | 0 | 1 |
Thinking Questions
20. Why is the regularization term in machine
learning usually
21. Why is a covariance matrix always positive semidefinite? When is it positive definite?
22. If matrix
23. Does Cholesky decomposition exist for positive semidefinite matrices? If it exists, is it unique?
24. Why is it said that "symmetric matrices are the best matrices"? Analyze from three perspectives: computational complexity, numerical stability, and theoretical elegance.
Exercise Solutions
Basic Problems (1-5)
1. Symmetric and positive definite判定:
(a)
(b)
(c)
2.
3. Cholesky:
4. Eigenvalues:
5.
Advanced Problems (6-11)
6. Proof: For
7. Proof:
8. Eigenvalues:
9. Sylvester's criterion proof: By induction on
10. Spectral theorem:
11.
Application Problems (17-19)
17. Vibration: (a)
18. Portfolio: (a)
19. Ellipse Fitting: Use least squares to fit
Thinking Questions (20-24)
20.
21.
22. General matrices need Jordan normal
form. Diagonalizable iff geometric multiplicities equal
algebraic multiplicities. Normal matrices (
23. Semidefinite matrices have modified
Cholesky
24. (i) Computation: Store
Chapter Summary
Key Takeaways
- Special properties of symmetric matrices:
- Eigenvalues are all real
- Eigenvectors are mutually orthogonal
- Can be orthogonally diagonalized
- Spectral Theorem:
- One of the most important decomposition theorems- Reveals the essential structure of symmetric matrices
- Positive Definite Matrices:
- Definition:
- Tests: All eigenvalues positive / All leading minors positive / Cholesky decomposition exists - Meaning: Positive energy, stable system, invertibility
- Definition:
- Quadratic Forms:
- Standard form:
- Classification: Positive definite, negative definite, indefinite, semidefinite - Geometry: Ellipsoids, saddle surfaces, and other quadric surfaces
- Standard form:
- Principal Axis Theorem:
- Finds principal axis directions of quadric surfaces
- Applications in optimization, physics, data analysis
- Cholesky Decomposition:
- Fast decomposition for positive definite matrices- Numerically stable, computationally efficient
Next Chapter Preview
"Singular Value Decomposition (SVD)"
- "Spectral decomposition" for arbitrary matrices (not just symmetric)
- SVD generalizes the spectral theorem for symmetric matrices
- Pseudoinverse, best low-rank approximation
- Applications: Image compression, recommender systems, natural language processing
SVD is called the "crown jewel of linear algebra"— we'll see why!
References
- Strang, G. (2019). Introduction to Linear
Algebra. 5th ed. Chapter 6.
- Classic treatment of symmetric matrices and positive definiteness
- Horn, R. A., & Johnson, C. R. (2012).
Matrix Analysis. 2nd ed. Cambridge University Press.
- In-depth matrix theory including various positive definiteness criteria
- Boyd, S., & Vandenberghe, L. (2004). Convex
Optimization. Cambridge University Press.
- Applications of positive definite matrices in optimization
- Golub, G. H., & Van Loan, C. F. (2013).
Matrix Computations. 4th ed. Johns Hopkins University Press.
- Authoritative reference for Cholesky decomposition and other numerical algorithms
- 3Blue1Brown. Essence of Linear Algebra
series. YouTube.
- Excellent visualizations of eigenvalues and quadratic forms
Next Chapter: Singular Value Decomposition →
Previous Chapter: ← Orthogonality and Projections
This is Chapter 8 of the 18-part "Essence of Linear Algebra" series.
- Post title:Essence of Linear Algebra (8): Symmetric Matrices and Quadratic Forms
- Post author:Chen Kai
- Create time:2019-02-12 10:00:00
- Post link:https://www.chenk.top/chapter-08-symmetric-matrices-and-quadratic-forms/
- Copyright Notice:All articles in this blog are licensed under BY-NC-SA unless stating additionally.