Skip to the lesson
FixTheRobot Explore Robotics / Linear Algebra / M6 Eigenvalues, Eigenvectors and SVD / M6-T3

Linear Algebra · Theory · M6

M6-T3 — Symmetric Matrices

Symmetric matrices are the friendly corner of linear algebra: real eigenvalues, perpendicular eigenvectors, and a clean factorisation A = QΛQᵀ.

  • Lesson 3 of 8
  • Module 6: Eigenvalues, Eigenvectors and SVD
  • Eigen and SVD
  • About 7 minutes to read

Covariance matrices, information matrices, Hessians of cost functions and the normal-equation matrix AᵀA are all symmetric. That single property gives them real eigenvalues and a perpendicular set of eigenvectors, and it turns the eigen-decomposition from a delicate computation into the most reliable tool in the course.

Learning objectives

After this lesson, you should be able to:

  • State the spectral theorem and write a symmetric matrix as A = QΛQᵀ.
  • Prove that a symmetric matrix has real eigenvalues and that eigenvectors of different eigenvalues are orthogonal.
  • Use the decomposition to compute powers, inverses and the axes of an ellipse.
  • Recognise symmetric matrices in robotics (covariance, Hessian, AᵀA) and explain why numerical routines for them are more reliable.

Introduction and motivation

Almost every matrix that describes an uncertainty, an energy or a curvature in robotics is symmetric: the covariance of a pose estimate, the information matrix in a pose graph, the Hessian approximation JᵀJ in Gauss-Newton, the inertia matrix of an arm. The spectral theorem says all of them can be understood as independent stretches along perpendicular axes, which is exactly how we draw uncertainty ellipses and reason about well-conditioned and poorly-conditioned directions.

The intuition

A general matrix can shear space, and its eigenvectors may be skewed or even missing. A symmetric matrix cannot shear: it only stretches (or flips) along perpendicular axes. Find those axes (the eigenvectors) and the stretch factors (the eigenvalues) and you know everything about the matrix.

Spectral decompositionA symmetric matrix factors as Q, then a diagonal matrix of eigenvalues, then Q transposed: rotate into the eigenvector axes, stretch each axis by its eigenvalue, rotate back.Qᵀrotate into theeigenvector axes → Λstretch axis iby λᵢ → Qrotate backto the original axes A = Q Λ Qᵀ (read right to left) Orthogonal Q: no shearing. Only pure stretching along perpendicular axes.
Symmetric matrices factor into rotate, stretch along axes, rotate back: A = QΛQᵀ.

Interactive figure. Level curves of the quadratic form for a symmetric matrix. When both eigenvalues are positive they are ellipses whose perpendicular axes are the eigenvectors; the readout lists the matrix, its eigenvalues and whether it is positive definite. This figure needs JavaScript to be interactive.

Edit the symmetric matrix entries a, b, c. The ellipses are the level curves of xᵀAx; their axes are the eigenvectors of A, always perpendicular, and a short axis marks a large eigenvalue.

Geometric and physical interpretation

Geometric view. The unit circle is mapped by a symmetric matrix to an ellipse whose principal axes lie along the eigenvectors, with half-lengths |λ|. Because the axes are perpendicular, the ellipse is never skewed. Physical view. A covariance ellipse has its long axis along the direction of greatest uncertainty (largest eigenvalue). An inertia matrix has principal axes about which a rigid body spins without wobble.

The mathematics

A
a real symmetric matrix, Aᵀ = A.
Q
an orthogonal matrix whose columns are orthonormal eigenvectors of A (Q⁻¹ = Qᵀ).
Λ
the diagonal matrix of the eigenvalues, Λ = diag(λ₁, …, λₙ).
λᵢ, qᵢ
the i-th eigenvalue and its unit eigenvector.

The spectral theorem

A = Q Λ Qᵀ = λ₁ q₁q₁ᵀ + λ₂ q₂q₂ᵀ + ... + λₙ qₙqₙᵀ

What it means. Every real symmetric matrix has real eigenvalues and an orthonormal set of n eigenvectors. The second form writes A as a sum of rank-one pieces: each piece stretches by λᵢ along the direction qᵢ.

Functions of a symmetric matrix

Aᵏ = Q Λᵏ Qᵀ        A⁻¹ = Q Λ⁻¹ Qᵀ        A^(1/2) = Q Λ^(1/2) Qᵀ

What it means. Because Qᵀ Q = I, the Q factors cancel in the middle and only the diagonal entries are raised to powers. The inverse needs every λᵢ ≠ 0; the square root needs every λᵢ ≥ 0.

For symmetric A: real eigenvalues, orthonormal eigenvectors, and A = QΛQᵀ. Powers, inverses and square roots act on the eigenvalues alone.

Step-by-step derivation: real eigenvalues and orthogonal eigenvectors

Eigenvectors for different eigenvalues are orthogonal. Let A v₁ = λ₁ v₁ and A v₂ = λ₂ v₂ with λ₁ ≠ λ₂ and Aᵀ = A.

  1. Compute v₂ᵀ A v₁ two ways. Using A v₁ = λ₁ v₁: v₂ᵀ A v₁ = λ₁ v₂ᵀ v₁.
  2. Using symmetry, v₂ᵀ A = (Aᵀ v₂)ᵀ = (A v₂)ᵀ = λ₂ v₂ᵀ, so v₂ᵀ A v₁ = λ₂ v₂ᵀ v₁.
  3. Subtract: (λ₁ − λ₂) v₂ᵀ v₁ = 0. Since λ₁ ≠ λ₂, we must have v₂ᵀ v₁ = 0.

Eigenvalues are real. Allow a complex eigenpair A v = λ v and take the conjugate transpose: v* A v = λ v* v. The left side equals its own conjugate because A is real symmetric ((v* A v)* = v* Aᵀ v = v* A v), so it is real; v* v = ‖v‖² > 0 is real as well, hence λ is real. For 2 × 2 matrices this agrees with the discriminant (a − c)² + 4b² ≥ 0 from the previous lesson.

The factorisation. For distinct eigenvalues, put the orthonormal eigenvectors into the columns of Q. Then A Q = Q Λ (column i is A qᵢ = λᵢ qᵢ), and since Q⁻¹ = Qᵀ, A = Q Λ Qᵀ. When an eigenvalue is repeated, the eigenspace has dimension equal to its multiplicity and we can pick an orthonormal basis inside it (for example with Gram-Schmidt), so the result still holds. This is the content of the spectral theorem.

Powers. A² = QΛQᵀ QΛQᵀ = QΛ²Qᵀ, and likewise for every integer power and for the inverse.

A worked example: decomposing a 2 × 2 symmetric matrix

Take A = [[2, 1], [1, 2]].

  • Eigenvalues. Trace 4, determinant 3, so λ² − 4λ + 3 = 0, giving λ₁ = 3 and λ₂ = 1.
  • Eigenvectors. (1, 1) for 3 and (1, −1) for 1; normalised, q₁ = (1, 1)/√2 and q₂ = (1, −1)/√2. Their dot product is (1 − 1)/2 = 0 ✓.
  • Factorisation. Q = (1/√2)[[1, 1], [1, −1]], Λ = diag(3, 1), and Q Λ Qᵀ = [[2, 1], [1, 2]] ✓.
  • Rank-one form. 3 q₁q₁ᵀ + 1 q₂q₂ᵀ = 3·½[[1, 1], [1, 1]] + ½[[1, −1], [−1, 1]] = [[2, 1], [1, 2]] ✓.
  • Inverse. A⁻¹ = Q diag(1/3, 1) Qᵀ = (1/3)[[2, −1], [−1, 2]]; check A A⁻¹ = I.
  • Square root. A^(1/2) = Q diag(√3, 1) Qᵀ, and squaring it returns A. This construction reappears for whitening in Module 9.

Robotics application

Uncertainty ellipses. A 2D position covariance Σ is decomposed as QΛQᵀ; the ellipse axes point along the columns of Q with half-lengths k√λᵢ (k = 2.45 for the 95% contour in 2D). The same procedure draws the ellipses in SLAM and UAV state-estimation displays; see the SLAM lesson on uncertainty.

Gauss-Newton curvature. The matrix JᵀJ is symmetric, so its eigenvectors give orthogonal directions in parameter space and its eigenvalues give the information in each. A near-zero eigenvalue is a direction the data cannot constrain, such as sliding along a featureless corridor (see rank and condition number).

Rigid-body inertia. The inertia tensor of a UAV or manipulator link is symmetric; its eigenvectors are the principal axes and the eigenvalues the principal moments of inertia, which decide how the body responds to torques.

Mobile robots and LiDAR. The 2 × 2 scatter matrix of a scan patch is symmetric; its eigenvalue ratio separates line-like patches (one eigenvalue near zero) from corner-like patches, a standard feature test.

Engineering implications and limitations

Practical rules

  • Use a symmetric eigen-solver. numpy.linalg.eigh exploits symmetry: it is faster, returns real sorted eigenvalues and exactly orthonormal eigenvectors. Using eig on a symmetric matrix can return tiny imaginary parts and non-orthogonal vectors for repeated eigenvalues.
  • Symmetrise before decomposing. Floating point updates (such as a Kalman covariance update) leave a matrix very slightly asymmetric. Use (P + Pᵀ)/2 before calling eigh or Cholesky.
  • Eigenvector sign and ordering are arbitrary. q and −q are both valid. Never compare eigenvectors across runs without fixing a sign convention; sort by eigenvalue.
  • Repeated eigenvalues mean a free choice of axes. A circular covariance has no preferred direction: any orthonormal pair works.
  • Symmetry is only exact for the model. The Hessian estimated by finite differences may be only approximately symmetric; check it and symmetrise.

Limits

The theorem requires a real symmetric (or complex Hermitian) matrix. A non-symmetric matrix such as a Jacobian, a rotation or a dynamics matrix does not have orthogonal eigenvectors in general; use the SVD (next lessons) for those.

Common misconceptions

“Every matrix with real entries has real eigenvalues.”

Only symmetric ones are guaranteed. A rotation matrix has complex eigenvalues.

“All eigenvectors of a symmetric matrix are orthogonal.”

Eigenvectors for different eigenvalues are. Within a repeated eigenvalue they need not be, but an orthogonal set can always be chosen.

“A symmetric matrix is a diagonal matrix.”

It is diagonal in the eigenvector basis, not in the original coordinates. Off-diagonal entries (correlations) are what make the axes tilt.

“QΛQᵀ and QΛQ⁻¹ are different things.”

They are the same here: Q is orthogonal, so Qᵀ = Q⁻¹. For non-symmetric matrices the factor Q⁻¹ is a genuine inverse and Q is not orthogonal.

Engineering takeaways

  1. A real symmetric matrix has real eigenvalues and orthogonal eigenvectors, so A = QΛQᵀ.
  2. The matrix is a pure stretch along perpendicular axes; the unit circle becomes an ellipse with those axes.
  3. Powers, inverses and square roots are applied to the eigenvalues only: A⁻¹ = QΛ⁻¹Qᵀ.
  4. Covariances, Hessians, AᵀA and inertia tensors are symmetric, so this decomposition appears throughout robotics.
  5. Use eigh, symmetrise first, and do not rely on eigenvector signs.

References and further reading

Primary papers and authoritative documentation.

Knowledge check

Three conceptual questions. Write an answer, then reveal the explanation. Your answers stay in your browser.

Question 1

Find the eigenvalues, orthonormal eigenvectors and a factorisation A = QΛQᵀ for A = [[5, 2], [2, 2]].

Explanation

trace 7, determinant 6, so λ² − 7λ + 6 = 0, giving λ = 6 and 1. For 6: (A − 6I) = [[−1, 2], [2, −4]], null vector (2, 1)/√5. For 1: [[4, 2], [2, 1]], null vector (1, −2)/√5. These are perpendicular. A = Q diag(6, 1) Qᵀ with Q = (1/√5)[[2, 1], [1, −2]].

Question 2

A position covariance has eigenvalues 9 and 1 with the long axis along (1, 1)/√2. What are the half-axis lengths of its 1-sigma ellipse and what is the covariance matrix?

Explanation

The 1-sigma half-axes are √9 = 3 and √1 = 1. Σ = 9 q₁q₁ᵀ + 1 q₂q₂ᵀ = 9·½[[1, 1], [1, 1]] + ½[[1, −1], [−1, 1]] = [[5, 4], [4, 5]]. The positive off-diagonal entry means the two coordinates are positively correlated.

Question 3

Why is eigh preferred over eig for a covariance matrix, and why symmetrise first?

Explanation

eigh uses the symmetry guarantee (real eigenvalues, orthonormal eigenvectors) with a stable, faster algorithm and returns sorted real output. Rounding in the filter update makes P slightly asymmetric, so averaging P and Pᵀ restores exact symmetry and prevents tiny complex parts or non-orthogonal vectors.

What’s next

Among symmetric matrices, the ones whose eigenvalues are all positive are the most important: they are the valid covariances and the cost functions with a unique minimum. The next lesson shows how to test for positive definiteness.

Next lesson

M6-T4 — Positive Definite Matrices

Test whether a symmetric matrix is positive definite and explain why covariance matrices must be.

Nothing below is required to finish this lesson.