14 - Singular Value Decomposition (SVD) (older version)

14 - Singular Value Decomposition (SVD) (older version)

Updated 14 Oct 2026

14. Singular Value Decomposition (SVD)

Main Theorem

Theorem: Any matrix A∈Rm×nA \in \mathbb{R}^{m \times n} can be factored as:

A=UΣVT\boxed{A = U\Sigma V^T}

where:

  • U∈Rm×mU \in \mathbb{R}^{m \times m} is orthogonal
  • V∈Rn×nV \in \mathbb{R}^{n \times n} is orthogonal
  • Σ∈Rm×n\Sigma \in \mathbb{R}^{m \times n} is diagonal with diagonal entries σ1,σ2,…,σp\sigma_1, \sigma_2, \ldots, \sigma_p
  • p=min⁡(m,n)p = \min(m, n)
  • σ1≥σ2≥…≥σp≥0\sigma_1 \geq \sigma_2 \geq \ldots \geq \sigma_p \geq 0

Examples of Σ\Sigma:

[200100],[100000],[400040],[400040003]\begin{bmatrix} 2 & 0 \\ 0 & 1 \\ 0 & 0 \end{bmatrix}, \quad \begin{bmatrix} 1 & 0 \\ 0 & 0 \\ 0 & 0 \end{bmatrix}, \quad \begin{bmatrix} 4 & 0 & 0 \\ 0 & 4 & 0 \end{bmatrix}, \quad \begin{bmatrix} 4 & 0 & 0 \\ 0 & 4 & 0 \\ 0 & 0 & 3 \end{bmatrix}

Note: VTV^T is always orthogonal.


Key Properties of SVD

  • This is called the singular value decomposition (SVD) of AA
  • The sequence σ1,…,σp\sigma_1, \ldots, \sigma_p are the singular values of AA and are uniquely determined by AA
  • Any matrix can be decomposed this way - no other factorization has this property

Analogy: Think of SVD as decomposing any transformation into three steps: rotate (by VTV^T), stretch/compress along axes (by Σ\Sigma), then rotate again (by UU). It's like finding the "principal directions" of how a matrix transforms space.


Applications of SVD

1. Matrix 2-Norm

SVD provides an elegant way to compute the matrix 2-norm.

Lemma 1: Let A∈Rm×nA \in \mathbb{R}^{m \times n} and Q∈Rm×mQ \in \mathbb{R}^{m \times m} be orthogonal. Then:

∥QA∥2=∥A∥2\boxed{\|QA\|_2 = \|A\|_2}

Proof:

  • Recall: ∥Qx∥2=∥x∥2\|Qx\|_2 = \|x\|_2 for orthogonal QQ
  • Therefore:

∥QA∥2=max⁡x≠0∥QAx∥2∥x∥2=max⁡x≠0∥Ax∥2∥x∥2=∥A∥2\|QA\|_2 = \max_{x \neq 0} \frac{\|QAx\|_2}{\|x\|_2} = \max_{x \neq 0} \frac{\|Ax\|_2}{\|x\|_2} = \|A\|_2


Lemma 2: Let A∈Rm×nA \in \mathbb{R}^{m \times n} and Q∈Rn×nQ \in \mathbb{R}^{n \times n} be orthogonal. Then:

∥AQ∥2=∥A∥2\boxed{\|AQ\|_2 = \|A\|_2}

Proof:

∥AQ∥2=max⁡x≠0∥AQx∥2∥x∥2\|AQ\|_2 = \max_{x \neq 0} \frac{\|AQx\|_2}{\|x\|_2}

  • Let y=Qxy = Qx, so ∥y∥2=∥Qx∥2=∥x∥2\|y\|_2 = \|Qx\|_2 = \|x\|_2
  • Therefore:

∥AQ∥2=max⁡y≠0∥Ay∥2∥y∥2=∥A∥2\|AQ\|_2 = \max_{y \neq 0} \frac{\|Ay\|_2}{\|y\|_2} = \|A\|_2


Lemma 3: Let D∈Rm×nD \in \mathbb{R}^{m \times n} be diagonal. Then:

∥D∥p=max⁡∣dii∣ for any p\boxed{\|D\|_p = \max |d_{ii}| \text{ for any } p}

Proof: Left as exercise.


Theorem: If A=UΣVTA = U\Sigma V^T (SVD of AA), then:

∥A∥2=σ1\boxed{\|A\|_2 = \sigma_1}

Proof:

∥A∥2=∥UΣVT∥2=∥ΣVT∥2=∥Σ∥2=σ1\|A\|_2 = \|U\Sigma V^T\|_2 = \|\Sigma V^T\|_2 = \|\Sigma\|_2 = \sigma_1

by the previous three lemmas.

Note: In general, calculating ∥A∥2\|A\|_2 is more expensive than ∥A∥1\|A\|_1 or ∥A∥∞\|A\|_\infty.

Analogy: The largest singular value tells you the maximum "stretching factor" of the matrix - how much it can amplify a vector at most.


Example 1

The singular value decomposition of:

A=[12−11]A = \begin{bmatrix} 1 & 2 \\ -1 & 1 \end{bmatrix}

is given by:

UΣVT=[0.95710.28980.2898−0.9571][2.3028001.3028][0.28980.95710.9571−0.2898]TU\Sigma V^T = \begin{bmatrix} 0.9571 & 0.2898 \\ 0.2898 & -0.9571 \end{bmatrix} \begin{bmatrix} 2.3028 & 0 \\ 0 & 1.3028 \end{bmatrix} \begin{bmatrix} 0.2898 & 0.9571 \\ 0.9571 & -0.2898 \end{bmatrix}^T

Question: What is ∥A∥2\|A\|_2?

Solution: ∥A∥2=2.3028\|A\|_2 = 2.3028, the largest singular value.


Solving Least-Squares Problems with SVD

  • SVD can be used to solve linear least squares, including when the matrix AA is not full rank or m<nm < n

Case 1: m>nm > n and Full Rank

Problem: Find xx that minimizes ∥Ax−b∥2\|Ax - b\|_2 where A∈Rm×nA \in \mathbb{R}^{m \times n}, m>nm > n, rank(A)=n\text{rank}(A) = n.

Approach:

  • Suppose A=UΣVTA = U\Sigma V^T is the SVD of AA
  • Let U1∈Rm×nU_1 \in \mathbb{R}^{m \times n} be the first nn columns of UU

Then:

A=UΣVT=[U1U2][Σ10]VT=U1Σ1VTA = U\Sigma V^T = \begin{bmatrix} U_1 & U_2 \end{bmatrix} \begin{bmatrix} \Sigma_1 \\ 0 \end{bmatrix} V^T = U_1 \Sigma_1 V^T

Note: U1TU1=IU_1^T U_1 = I as the columns of UU are orthonormal.

Claim:

x=VΣ1−1U1Tb\boxed{x = V\Sigma_1^{-1} U_1^T b}

is the solution to the normal equations ATAx=ATbA^T Ax = A^T b.


Proof of the claim:

A^T Ax &= (U_1 \Sigma_1 V^T)^T (U_1 \Sigma_1 V^T)(V\Sigma_1^{-1} U_1^T b) \\ &= V\Sigma_1^T \cancel{U_1^T U_1} \Sigma_1 \cancel{V^T V} \Sigma_1^{-1} U_1^T b \\ &= V\Sigma_1^T \cancel{\Sigma_1 \Sigma_1^{-1}} U_1^T b \\ &= V\Sigma_1^T U_1^T b \\ &= (U_1 \Sigma_1 V^T)^T b = A^T b \end{align}$$ --- ### Case 2: General Case (Any Shape or Rank) For $A$ of any shape or rank, the least squares solution to $Ax \cong b$ is: $$\boxed{x = \sum_{\sigma_i \neq 0} \frac{u_i^T b}{\sigma_i} v_i}$$ where: - $u_i$ is the $i$-th column of $U$ - $v_i$ is the $i$-th column of $V$ > **Analogy:** This formula "inverts" only the non-zero singular values, effectively finding the best solution even when the matrix doesn't have full rank - like trying to reverse a transformation that lost some information. --- ### Example 2 Solve the least-squares problem: $$\begin{bmatrix} 0 & 1.6 \\ 0 & 0 \\ 0 & -1.2 \end{bmatrix} x \cong \begin{bmatrix} -1 \\ 0 \\ 1 \end{bmatrix}$$ The SVD is: $$U\Sigma V^T = \begin{bmatrix} 0.8000 & 0 & 0.6000 \\ 0 & 1.0000 & 0 \\ -0.6000 & 0 & 0.8000 \end{bmatrix} \begin{bmatrix} 2 & 0 \\ 0 & 0 \\ 0 & 0 \end{bmatrix} \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}^T$$ **Solution:** Since only $\sigma_1 \neq 0$: $$x = \frac{u_1^T b}{\sigma_1} v_1 = \frac{\begin{bmatrix} 0.8 & 0 & -0.6 \end{bmatrix} \begin{bmatrix} -1 \\ 0 \\ 1 \end{bmatrix}}{2} \begin{bmatrix} 0 \\ 1 \end{bmatrix} = \begin{bmatrix} 0 \\ -0.7 \end{bmatrix}$$ --- ## Condition Number from SVD **Theorem:** If $\sigma_1, \ldots, \sigma_n$ are singular values of $A \in \mathbb{R}^{n \times n}$ and $A$ is invertible, then: $$\boxed{\|A^{-1}\|_2 = \frac{1}{\sigma_n}}$$ **Proof:** From the SVD $A = U\Sigma V^T$: $$A^{-1} = (U\Sigma V^T)^{-1} = V^{-T} \Sigma^{-1} U^{-1} = V\Sigma^{-1} U^T$$ Note that: $$\Sigma^{-1} = \begin{bmatrix} \frac{1}{\sigma_1} & 0 & \cdots & 0 \\ 0 & \frac{1}{\sigma_2} & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & \frac{1}{\sigma_n} \end{bmatrix}$$ --- However, $A^{-1} = V\Sigma^{-1} U^T$ is **not** an SVD of $A^{-1}$ because the diagonal entries of $\Sigma^{-1}$ are not in the correct order! Consider the permutation matrix: $$P = \begin{bmatrix} & & 1 \\ & \ddots & \\ 1 & & \end{bmatrix}$$ Then: $$P\Sigma^{-1} P = \begin{bmatrix} \frac{1}{\sigma_n} & \cdots & 0 \\ \vdots & \ddots & \vdots \\ 0 & \cdots & \frac{1}{\sigma_1} \end{bmatrix}$$ has diagonal entries in non-increasing order. **Note:** $PP = I$, $VP$ is orthogonal, and $PU^T$ is orthogonal. Therefore: $$A^{-1} = V\Sigma^{-1} U^T = (VP)(P\Sigma^{-1} P)(PU^T)$$ is the SVD of $A^{-1}$. Thus: $$\|A^{-1}\|_2 = \frac{1}{\sigma_n}$$ as $1/\sigma_n$ is the largest singular value of $A^{-1}$. --- ### Condition Number in 2-Norm So the condition number (in 2-norm) is: $$\boxed{\text{cond}_2(A) = \frac{\sigma_1}{\sigma_n}}$$ For **rectangular matrices** $A \in \mathbb{R}^{m \times n}$: $$\boxed{\text{cond}_2(A) = \frac{\sigma_1}{\sigma_{\min(m,n)}}}$$ > **Analogy:** The condition number is the ratio of maximum to minimum stretching - it tells you how "unbalanced" the transformation is. A high condition number means the matrix stretches very differently in different directions, making it sensitive to errors. --- ### Example 3 **Question:** What are the condition numbers in 2-norm for the matrices in Examples 1 and 2? **Solution:** For Example 1: $$\text{cond}_2(A) = \frac{\sigma_1}{\sigma_n} = \frac{2.3028}{1.3028} = 1.7676$$ For Example 2: The condition number is **infinity** because $\sigma_n = \sigma_2 = 0$. --- **Theorem:** Suppose $A \in \mathbb{R}^{m \times n}$ with $\text{rank}(A) = n$. Then: $$\boxed{\text{cond}_2(A^T A) = \text{cond}_2(A)^2}$$ **Proof:** Left as exercise. > This theorem gives intuition why the **method of normal equations** is only conditionally stable (and not backward stable) - it squares the condition number! --- ## Rank Determination **Theorem:** If $A = U\Sigma V^T$, then: $$\boxed{\text{rank}(A) = \text{number of nonzero singular values}}$$ - SVD is considered to be the **most reliable rank-determination algorithm** **Example:** $$A = \begin{bmatrix} 2 & 1 & 3 \\ 0 & 1 & 2 \\ 2 & 2 & 5 \end{bmatrix}$$ Its SVD is: $$A = \begin{bmatrix} -0.5158 & 0.6330 & -0.5774 \\ -0.2903 & -0.7632 & -0.5774 \\ -0.8061 & -0.1302 & 0.5774 \end{bmatrix} \begin{bmatrix} 7.1245 & 0 & 0 \\ 0 & 1.1141 & 0 \\ 0 & 0 & 0 \end{bmatrix} \begin{bmatrix} -0.3711 & 0.9026 & -0.2182 \\ -0.3394 & -0.3506 & -0.8729 \\ -0.8644 & -0.2498 & 0.4364 \end{bmatrix}$$ So $\text{rank}(A) = 2$ (two nonzero singular values). --- ### Example 4 **Question:** What are the ranks of the matrices in Examples 1 and 2? **Solution:** - Matrix in Example 1: rank = 2 - Matrix in Example 2: rank = 1 --- ## Low-Rank Approximation **Theorem:** Let $A \in \mathbb{R}^{m \times n}$ whose SVD is $A = U\Sigma V^T$. Note that: $$A = \sum_{i=1}^{\min(m,n)} \sigma_i u_i v_i^T$$ where $u_i$ is the $i$-th column of $U$, $v_i$ is the $i$-th column of $V$. Let: $$A_k = \sum_{i=1}^{k} \sigma_i u_i v_i^T$$ --- **Then:** 1. $\text{rank}(A_k) \leq k$ 2. $A_k$ is the **best approximation** to $A$ in the Frobenius norm among matrices whose rank is $\leq k$: $$\boxed{\|A - A_k\|_F = \min\{\|A - B\|_F : B \in \mathbb{R}^{m \times n} \text{ satisfying } \text{rank}(B) \leq k\}}$$ **Storage Benefits:** - By working with $A_k$, we only need to store: - First $k$ columns of $U$ - First $k$ singular values - First $k$ columns of $V$ - Use them to compute entries of $A_k$ as needed **Applications:** - Information retrieval - Web searching - Data compression > **Analogy:** Low-rank approximation is like creating a "compressed" version of a matrix that captures the most important patterns while discarding noise. It's similar to how JPEG compression keeps important image features while removing fine details. --- ### Example 5 Consider: $$A = \begin{bmatrix} 9 & 3 & 4 & 1 & 0 & 2 & 5 \\ 1 & 0 & 0 & 4 & 5 & 9 & 1 \\ 12 & 0 & 4 & 1 & 2 & 0 & 0 \\ 1 & 4 & 2 & 1 & 9 & 2 & 1 \\ 0 & 0 & 5 & 2 & 2 & 8 & 4 \end{bmatrix}$$ Its SVD is $A = U\Sigma V^T$ where: $$\Sigma = \begin{bmatrix} 18.9385 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 13.4871 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 8.1289 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 5.4722 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 3.0672 & 0 & 0 \end{bmatrix}$$ ($U$ and $V$ are omitted) --- The rank-2 approximation $A_2$ is: $$A_2 = \begin{bmatrix} 9.5405 & 1.5514 & 4.0262 & 1.1641 & 1.9063 & 1.6309 & 2.3872 \\ -0.2316 & 1.2427 & 2.2209 & 2.7946 & 5.5117 & 7.7769 & 2.3836 \\ 11.3902 & 1.5228 & 4.2103 & 0.6635 & 0.8461 & -0.0638 & 2.2219 \\ 1.4843 & 1.0788 & 2.1430 & 2.0275 & 3.9319 & 5.3663 & 1.9684 \\ 0.8863 & 1.2391 & 2.3571 & 2.5224 & 4.9305 & 6.8365 & 2.3099 \end{bmatrix}$$ Compared to the original: $$A = \begin{bmatrix} 9 & 3 & 4 & 1 & 0 & 2 & 5 \\ 1 & 0 & 0 & 4 & 5 & 9 & 1 \\ 12 & 0 & 4 & 1 & 2 & 0 & 0 \\ 1 & 4 & 2 & 1 & 9 & 2 & 1 \\ 0 & 0 & 5 & 2 & 2 & 8 & 4 \end{bmatrix}$$ Notice how $A_2$ captures the general structure of $A$ while using only 2 components instead of 5! --- ## Summary of Key Formulas ### SVD Decomposition $$\boxed{A = U\Sigma V^T}$$ ### Matrix 2-Norm $$\boxed{\|A\|_2 = \sigma_1}$$ ### Condition Number $$\boxed{\text{cond}_2(A) = \frac{\sigma_1}{\sigma_n}}$$ ### Rank Determination $$\boxed{\text{rank}(A) = \text{number of nonzero singular values}}$$ ### Least Squares Solution (General) $$\boxed{x = \sum_{\sigma_i \neq 0} \frac{u_i^T b}{\sigma_i} v_i}$$ ### Low-Rank Approximation $$\boxed{A_k = \sum_{i=1}^{k} \sigma_i u_i v_i^T}$$ ---