Skip to content

Commit f21e0f6

Browse files
Tom's Jan 7 edits of SVD lecture
1 parent 75b7e4e commit f21e0f6

File tree

1 file changed

+36
-12
lines changed

1 file changed

+36
-12
lines changed

lectures/svd_intro.md

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,7 @@ Thus,
132132
133133
We'll apply this circle of ideas later in this lecture when we study Dynamic Mode Decomposition.
134134
135-
Three popular **matrix norms** of an $m \times n$ matrix $X$ can be expressed in terms of the singular values of $X$
136135
137-
* the **spectral** or $l^2$ norm $|| X ||_2 = \max_{y \in \textbf{R}^n} \frac{||X y ||}{||y||} = \sigma_1$
138-
* the **Frobenius** norm $||X ||_F = \sqrt{\sigma_1^2 + \cdots + \sigma_p^2}$
139-
* the **nuclear** norm $ || X ||_N = \sigma_1 + \cdots + \sigma_p $
140136
141137
142138
@@ -345,6 +341,36 @@ print("Row space:\n", row_space.T)
345341
print("Right null space:\n", null_space.T)
346342
```
347343
344+
## Eckart-Young Theorem
345+
346+
Suppose that we want to construct the best rank $r$ approximation of an $m \times n$ matrix $X$.
347+
348+
By best we mean a matrix $X_r$ of rank $r < p$ that, among all rank $r$ matrices, minimizes
349+
350+
$$ || X - X_r || $$
351+
352+
where $ || \cdot || $ denotes a norm of a matrix $X$ and where $X_r$ belongs to the space of all rank $r$ matrices
353+
of dimension $m \times n$.
354+
355+
356+
357+
Three popular **matrix norms** of an $m \times n$ matrix $X$ can be expressed in terms of the singular values of $X$
358+
359+
* the **spectral** or $l^2$ norm $|| X ||_2 = \max_{y \in \textbf{R}^n} \frac{||X y ||}{||y||} = \sigma_1$
360+
* the **Frobenius** norm $||X ||_F = \sqrt{\sigma_1^2 + \cdots + \sigma_p^2}$
361+
* the **nuclear** norm $ || X ||_N = \sigma_1 + \cdots + \sigma_p $
362+
363+
The Eckart-Young theorem states that for each of these three norms, same rank $r$ matrix is best and that it equals
364+
365+
$$
366+
\hat X_r = \sigma_1 U_1 V_1^T + \sigma_2 U_2 V_2^T + \cdots + \sigma_r U_r V_r^T
367+
$$ (eq:Ekart)
368+
369+
370+
You can read about the Eckart-Young theorem and some of its uses here <https://en.wikipedia.org/wiki/Low-rank_approximation>.
371+
372+
We'll make use of this theorem when we discuss principal components analysis (PCA) and also dynamic mode decomposition (DMD).
373+
348374
349375
350376
@@ -473,11 +499,7 @@ UhatUhatT, UhatTUhat
473499
The cells above illustrate application of the `fullmatrices=True` and `full-matrices=False` options.
474500
Using `full-matrices=False` returns a reduced singular value decomposition.
475501
476-
This option implements an optimal reduced rank approximation of a matrix, in the sense of minimizing the Frobenius
477-
norm of the discrepancy between the approximating matrix and the matrix being approximated.
478-
479-
480-
Optimality in this sense is established in the celebrated Eckart–Young theorem. See <https://en.wikipedia.org/wiki/Low-rank_approximation>.
502+
The **full** and **reduced** SVd's both accurately decompose an $m \times n$ matrix $X$
481503
482504
When we study Dynamic Mode Decompositions below, it will be important for us to remember the preceding properties of full and reduced SVD's in such tall-skinny cases.
483505
@@ -487,7 +509,7 @@ When we study Dynamic Mode Decompositions below, it will be important for us to
487509
488510
Now let's turn to a short-fat case.
489511
490-
To illustrate this case, we'll set $m = 2 < 5 = n $
512+
To illustrate this case, we'll set $m = 2 < 5 = n $ and compute both full and reduced SVD's.
491513
492514
```{code-cell} ipython3
493515
import numpy as np
@@ -502,11 +524,13 @@ U, S, V
502524
print('Uhat, Shat, Vhat = ')
503525
Uhat, Shat, Vhat
504526
```
527+
Let's verify that our reduced SVD accurately represents $X$
505528
506529
```{code-cell} ipython3
507-
rr = np.linalg.matrix_rank(X)
508-
print(f'rank X = {rr}')
530+
SShat=np.diag(Shat)
531+
np.allclose(X, Uhat@SShat@Vhat)
509532
```
533+
510534
## Polar Decomposition
511535
512536
A **reduced** singular value decomposition (SVD) of $X$ is related to a **polar decomposition** of $X$

0 commit comments

Comments
 (0)