Decompose rectangular maps into orthogonal directions, measure their sensitivity, and find minimum-norm solutions.
90 minYou need Modules 7, 8 and 10
In this module you will
Construct singular directions from the spectral theorem
Interpret singular values as stretch factors
Use a pseudoinverse for a minimum-norm least-squares solution
1
A rectangular map has two coordinate systems
A rectangular matrix sends inputs and outputs between different spaces. To find input directions that stretch independently, look at ATA. It is symmetric and positive semidefinite because xTATAx=∥Ax∥2. Its orthonormal eigenvectors vi have nonnegative eigenvalues σi2. Arrange the square roots σi from largest to smallest. They are the singular values.
For each σi>0, take ui=Avi/σi. These output directions have unit length and are mutually orthogonal, since
(Avi)⋅(Avj)=σj2vi⋅vj. Input directions with zero eigenvalue satisfy Avi=0. Complete the output basis orthonormally to obtain the singular value decompositionA=UΣVT, with a rectangular diagonal matrix Σ. Keeping only the r positive directions gives the compact form A=∑i=1rσiuiviT.
Example 11.1Stretch and collapse✓ Checked
Take A=(300200). It stretches the first two coordinate directions by 3 and 2 and collapses the third. Its rank is 2. The rectangular SVD lists two singular values, 3,2. The input Gram matrix has a third eigenvalue, 0, for the collapsed direction.
2
The effect of small singular values
For a full-column-rank matrix, σmax is the greatest output norm for a unit input and σmin the smallest. In spectral coordinates the squared output norm is a weighted sum ∑iσi2zi2 with ∑izi2=1. The condition number in Euclidean norm is σmax/σmin. The Gram matrix has condition number equal to its square. This explains why forming the normal equations can make a numerical solve more sensitive to rounding.
3
Solve in singular coordinates
The pseudoinverse A+=∑σi>0σi−1viuiT first reads the part of b along the reachable output directions, then undoes each nonzero stretch. This produces a least-squares fit. Other coefficient vectors producing that fit add a vector in the kernel. Since the pseudoinverse gives a coefficient vector orthogonal to the kernel, adding a nonzero kernel vector increases its length. Thus A+b is the unique least-squares solution of minimum norm.
In a numerical fit a very small singular value amplifies noise. Truncating that direction changes the problem by discarding an unstable component. Choose a threshold according to scale and noise, and report it when interpreting the fit.
Compute itCompare exact and minimum-norm fits
Python
from sympy import Matrix
A = Matrix([[3, 0, 0], [0, 2, 0]])
b = Matrix([6, 8])
print(list(A.pinv() * b))
print((A * A.pinv() * b).tolist())
Output
[2, 4, 0]
[[6], [8]]
4
Exercises
Exercise 11.1★Singular values are nonnegative
Find the singular values of diag(2,−5).
Show solution✓ Checked
The Gram matrix is diag(4,25), so the singular values are 5 and 2.
Exercise 11.2★★Least squares with a zero row
Find the minimum-norm least-squares solution of diag(2,0)x=(6,4)T.
Show solution✓ Checked
Only the first row can affect the prediction. Fit it with x1=3. Every x2 gives the same fit, and x2=0 gives the smallest norm. The fitted vector is (6,0)T.
Exercise 11.3★★★Compare condition numbers
Find κ2(A) and κ2(ATA) for A=diag(4,1/2).
Show solution✓ Checked
The two stretch factors are 4 and 1/2, so their ratio is 8. The Gram factors are 16 and 1/4, so their ratio is 64.
5
Check yourself
1
Which matrix gives the right singular directions?
Right singular directions lie in the input space, and their squared stretches are eigenvalues of ATA.
2
Which parts of the SVD are inverted by the pseudoinverse?
Null-space directions stay zero, so the computed coefficients have minimum norm.
3
What can a very small positive singular value do in a solve?
The solve multiplies that coordinate by the reciprocal of the singular value.