ContentsChapter 1 · Linear algebra7 of 7

1.7

Symmetric matrices and the SVD

In this chapter
  1. 1.1Vectors and linear combinations
  2. 1.2Span, basis and dimension
  3. 1.3Matrices as transformations
  4. 1.4Determinant, inverse and Ax = b
  5. 1.5Dot products, angles and projections
  6. 1.6Eigenvectors and eigenvalues
  7. 1.7Symmetric matrices and the SVD
Before you readCovariance matrices are symmetric. What might be special about the eigenvectors of a symmetric matrix?

A matrix is symmetric if A=ATA = A^T Symmetric matrices are the best-behaved kind, and they appear everywhere in ML (covariance matrices, XTXX^TX kernel matrices). The spectral theorem says:

So A=QΛQTA = Q \Lambda Q^T rotate into the eigenvector axes, stretch by the eigenvalues, rotate back. If every eigenvalue is ≥0\geq 0 the matrix is positive semi-definite (xTAx≥0x^TAx \geq 0 for all xx Covariance matrices always are.

The SVD

Non-symmetric and even non-square matrices have a similar decomposition, the singular value decomposition:

A=UΣVT.A = U \Sigma V^T.

VTV^T rotates, Σ\Sigma stretches along the axes by the singular values σ1≥σ2≥⋯≥0\sigma_1 \geq \sigma_2 \geq \dots \geq 0 and UU rotates again. Every matrix maps the unit circle to an ellipse; the singular values are the ellipse’s semi-axes.

A = [[2, 1], [0, 1]]σ₁ = 2.29, σ₂ = 0.87
A maps the unit circle (dashed) to an ellipse, or to a segment or point when det A = 0. The arrows σ₁u₁ and σ₂u₂ are its semi-axes.

The singular values are the square roots of the eigenvalues of ATAA^TA Keeping only the largest few gives the best low-rank approximation of AA which is how PCA compresses data (see Dimensionality reduction).

Recall
What does the spectral theorem say about a symmetric matrix?
Recall
When is a symmetric matrix positive semi-definite?
Recall
What do the three factors of A=UΣVTA = U\Sigma V^T do geometrically?
Exercise
What are the singular values of [300−2]\begin{bmatrix} 3 & 0 \\ 0 & -2 \end{bmatrix}