singular value decomposition - computer graphics · 2013-10-21 · av = u = )columns of u...

45
Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA Singular Value Decomposition CS 205A: Mathematical Methods for Robotics, Vision, and Graphics Justin Solomon CS 205A: Mathematical Methods Singular Value Decomposition 1 / 33

Upload: others

Post on 13-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Singular Value Decomposition

CS 205A:Mathematical Methods for Robotics, Vision, and Graphics

Justin Solomon

CS 205A: Mathematical Methods Singular Value Decomposition 1 / 33

Page 2: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Understanding the Geometry ofA ∈ Rm×n

Critical points of the ratio:

R(~x) =‖A~x‖2

‖~x‖2

I R(α~x) = R(~x) =⇒ take ‖~x‖2 = 1

I R(~x) ≥ 0 =⇒ study R2(~x) instead

CS 205A: Mathematical Methods Singular Value Decomposition 2 / 33

Page 3: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Understanding the Geometry ofA ∈ Rm×n

Critical points of the ratio:

R(~x) =‖A~x‖2

‖~x‖2

I R(α~x) = R(~x) =⇒ take ‖~x‖2 = 1

I R(~x) ≥ 0 =⇒ study R2(~x) instead

CS 205A: Mathematical Methods Singular Value Decomposition 2 / 33

Page 4: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Once Again...

Critical points satisfy

A>A~xi = λi~xi

Properties:

I λi ≥ 0∀iI Basis is full and orthonormal

CS 205A: Mathematical Methods Singular Value Decomposition 3 / 33

Page 5: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Once Again...

Critical points satisfy

A>A~xi = λi~xi

Properties:

I λi ≥ 0∀i

I Basis is full and orthonormal

CS 205A: Mathematical Methods Singular Value Decomposition 3 / 33

Page 6: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Once Again...

Critical points satisfy

A>A~xi = λi~xi

Properties:

I λi ≥ 0∀iI Basis is full and orthonormal

CS 205A: Mathematical Methods Singular Value Decomposition 3 / 33

Page 7: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Geometric Question

How is ~xi related to thegeometry of A rather

than that of A>A?

Object of study: ~yi = A~xi

CS 205A: Mathematical Methods Singular Value Decomposition 4 / 33

Page 8: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Geometric Question

How is ~xi related to thegeometry of A rather

than that of A>A?

Object of study: ~yi = A~xi

CS 205A: Mathematical Methods Singular Value Decomposition 4 / 33

Page 9: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Observation

Lemma

Either ~yi = ~0 or ~yi is an eigenvector of AA> with

‖~yi‖ =√λi‖~xi‖.

CS 205A: Mathematical Methods Singular Value Decomposition 5 / 33

Page 10: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Corresponding Eigenvalues

k = number of λi > 0

A>A~xi = λi~xi

AA>~yi = λi~yi

U ∈ Rn×k = matrix of ~xi’s

V ∈ Rm×k = matrix of ~yi’s

Lemma

U>AV ~ei =√λi~ei

CS 205A: Mathematical Methods Singular Value Decomposition 6 / 33

Page 11: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Corresponding Eigenvalues

k = number of λi > 0

A>A~xi = λi~xi

AA>~yi = λi~yi

U ∈ Rn×k = matrix of ~xi’s

V ∈ Rm×k = matrix of ~yi’s

Lemma

U>AV ~ei =√λi~ei

CS 205A: Mathematical Methods Singular Value Decomposition 6 / 33

Page 12: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Observation

Lemma

U>AV ~ei =√λi~ei

Σ ≡ diag(√λ1, . . . ,

√λk)

Corollary

U>AV = Σ

CS 205A: Mathematical Methods Singular Value Decomposition 7 / 33

Page 13: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Observation

Lemma

U>AV ~ei =√λi~ei

Σ ≡ diag(√λ1, . . . ,

√λk)

Corollary

U>AV = Σ

CS 205A: Mathematical Methods Singular Value Decomposition 7 / 33

Page 14: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Completing the Basis

Add ~xi with A>A~xi = ~0 and ~yi with AA>~yi = ~0

U ∈ Rm×k, V ∈ Rn×k 7→U ∈ Rm×m, V ∈ Rn×n

Σij ≡{ √

λi i = j and i ≤ k

0 otherwise

CS 205A: Mathematical Methods Singular Value Decomposition 8 / 33

Page 15: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Completing the Basis

Add ~xi with A>A~xi = ~0 and ~yi with AA>~yi = ~0

U ∈ Rm×k, V ∈ Rn×k 7→U ∈ Rm×m, V ∈ Rn×n

Σij ≡{ √

λi i = j and i ≤ k

0 otherwise

CS 205A: Mathematical Methods Singular Value Decomposition 8 / 33

Page 16: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Completing the Basis

Add ~xi with A>A~xi = ~0 and ~yi with AA>~yi = ~0

U ∈ Rm×k, V ∈ Rn×k 7→U ∈ Rm×m, V ∈ Rn×n

Σij ≡{ √

λi i = j and i ≤ k

0 otherwise

CS 205A: Mathematical Methods Singular Value Decomposition 8 / 33

Page 17: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Singular Value Decomposition

A = UΣV >

CS 205A: Mathematical Methods Singular Value Decomposition 9 / 33

Page 18: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

SVD Vocabulary

A = UΣV >

I Left singular vectors: Columns of U ; span

colA

I Right singular vectors Columns of V ; span

rowA

I Singular values: Diagonal σi of Σ; sort

σ1 ≥ σ2 ≥ · · · ≥ 0.

CS 205A: Mathematical Methods Singular Value Decomposition 10 / 33

Page 19: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Geometry of Linear Transformations

A = UΣV >

1. Rotate (V >)

2. Scale (Σ)

3. Rotate (U)CS 205A: Mathematical Methods Singular Value Decomposition 11 / 33

Page 20: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Computing SVD: Simple Strategy

1. Columns of V are eigenvectors of A>A

2. AV = UΣ =⇒ columns of U

corresponding to nonzero singular values are

normalized columns of AV

3. Remaining columns of U satisfy AA>~ui = ~0.

∃ more specialized methods!

CS 205A: Mathematical Methods Singular Value Decomposition 12 / 33

Page 21: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Computing SVD: Simple Strategy

1. Columns of V are eigenvectors of A>A

2. AV = UΣ =⇒ columns of U

corresponding to nonzero singular values are

normalized columns of AV

3. Remaining columns of U satisfy AA>~ui = ~0.

∃ more specialized methods!

CS 205A: Mathematical Methods Singular Value Decomposition 12 / 33

Page 22: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Solving Linear Systems withA = UΣV >

A~x = ~b

=⇒ UΣV >~x = ~b

=⇒ ~x = V Σ−1U>~b

What is Σ−1?

CS 205A: Mathematical Methods Singular Value Decomposition 13 / 33

Page 23: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Solving Linear Systems withA = UΣV >

A~x = ~b

=⇒ UΣV >~x = ~b

=⇒ ~x = V Σ−1U>~b

What is Σ−1?

CS 205A: Mathematical Methods Singular Value Decomposition 13 / 33

Page 24: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Uniting Short/Tall Matrices

minimize ‖~x‖22

such that A>A~x = A>~b

CS 205A: Mathematical Methods Singular Value Decomposition 14 / 33

Page 25: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Simplification

A>A = V Σ2V >

A>A~x = A>~b⇔ Σ~y = ~d

~y ≡ V >~x

~d ≡ U>~b

CS 205A: Mathematical Methods Singular Value Decomposition 15 / 33

Page 26: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Simplification

A>A = V Σ2V >

A>A~x = A>~b⇔ Σ~y = ~d

~y ≡ V >~x

~d ≡ U>~b

CS 205A: Mathematical Methods Singular Value Decomposition 15 / 33

Page 27: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Resulting Optimization

minimize ‖~y‖22

such that Σ~y = ~d

CS 205A: Mathematical Methods Singular Value Decomposition 16 / 33

Page 28: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Solution

Σ+ij ≡

{1/σi i = j, σi 6= 0, and i ≤ k

0 otherwise

=⇒ ~y = Σ+~d

=⇒ ~x = V Σ+U>~b

CS 205A: Mathematical Methods Singular Value Decomposition 17 / 33

Page 29: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Pseudoinverse

A+ = V Σ+U>

CS 205A: Mathematical Methods Singular Value Decomposition 18 / 33

Page 30: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Pseudoinverse Properties

I A square and invertible =⇒ A+ = A−1

I A overdetermined =⇒ A+~b gives least-squaressolution to A~x ≈ ~b

I A underdetermined =⇒ A+~b gives least-squaressolution to A~x ≈ ~b with least (Euclidean) norm

CS 205A: Mathematical Methods Singular Value Decomposition 19 / 33

Page 31: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Alternative Form

A = UΣV > =⇒ A =∑i=1

σi~ui~v>i

` ≡ min{m,n}

CS 205A: Mathematical Methods Singular Value Decomposition 20 / 33

Page 32: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Outer Product

~u⊗ ~v ≡ ~u~v>

CS 205A: Mathematical Methods Singular Value Decomposition 21 / 33

Page 33: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Computing A~x

A~x =∑i

σi(~vi · ~x)~ui

Trick:Ignore small σi.

CS 205A: Mathematical Methods Singular Value Decomposition 22 / 33

Page 34: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Computing A~x

A~x =∑i

σi(~vi · ~x)~ui

Trick:Ignore small σi.

CS 205A: Mathematical Methods Singular Value Decomposition 22 / 33

Page 35: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Computing A+~x

A+ =∑σi 6=0

~vi~u>i

σi

Trick:Ignore large σi.

CS 205A: Mathematical Methods Singular Value Decomposition 23 / 33

Page 36: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Even Better Trick

Do not compute large(small) σi at all!

CS 205A: Mathematical Methods Singular Value Decomposition 24 / 33

Page 37: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Eckart-Young Theorem

Theorem

Suppose A is obtained from A = UΣV > by

truncating all but the k largest singular values σiof A to zero. Then, A minimizes both

‖A− A‖Fro and ‖A− A‖2 subject to the

constraint that the column space of A has at

most dimension k.

CS 205A: Mathematical Methods Singular Value Decomposition 25 / 33

Page 38: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Matrix Norm Expressions

‖A‖2Fro =

∑j

σ2j

‖A‖2 = max{σi}condA =

σmax

σmin

CS 205A: Mathematical Methods Singular Value Decomposition 26 / 33

Page 39: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Rigid Alignment

http://www.pointclouds.org/blog/_images/GICPRegistrationTopView.png

CS 205A: Mathematical Methods Singular Value Decomposition 27 / 33

Page 40: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Procrustes Problem

http://en.wikipedia.org/wiki/Procrustes

CS 205A: Mathematical Methods Singular Value Decomposition 28 / 33

Page 41: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Procrustes via SVD

Orthogonal Procrustes TheoremThe orthogonal matrix R minimizing

‖RX − Y ‖2 is given by V U>, where SVD is

applied to factor Y X> = UΣV >.

Proved in notes.

CS 205A: Mathematical Methods Singular Value Decomposition 29 / 33

Page 42: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Application: As-Rigid-As-Possible

As-Rigid-As-Possible Surface ModelingOlga Sorkine and Marc Alexa

Eurographics/ACM SIGGRAPH Symposium onGeometry Processing 2007.

http://www.youtube.com/watch?v=ltX-qUjbkdc

CS 205A: Mathematical Methods Singular Value Decomposition 30 / 33

Page 43: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Recall: Statistics Problem

Given: Collection of data points ~xiI Age

I Weight

I Blood pressure

I Heart rate

Find: Correlations between different dimensions

CS 205A: Mathematical Methods Singular Value Decomposition 31 / 33

Page 44: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

Simplest Model

One-dimensional subspace~xi ≈ ci~v

CS 205A: Mathematical Methods Singular Value Decomposition 32 / 33

Page 45: Singular Value Decomposition - Computer Graphics · 2013-10-21 · AV = U = )columns of U corresponding to nonzero singular values are normalized columns of AV 3. Remaining columns

Motivation SVD Pseudoinverses Low-Rank Approximation Matrix Norms Procrustes Problem PCA

More General Statement

Principal Components Analysis

The matrix C ∈ Rn×d minimizing ‖X − CC>X‖Frosubject to C>C = Id×d is given by the first d columnsof U , for X = UΣV >.

Proved in notes.Next

CS 205A: Mathematical Methods Singular Value Decomposition 33 / 33