SVD - UCSD DSP Lab - UC San Diego
SVD - UCSD DSP Lab - UC San Diego
SVD - UCSD DSP Lab - UC San Diego
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Lecture 9 – ECE 275A<br />
Singular Value Decomposition (<strong>SVD</strong>)<br />
ECE 275AB Lecture 9 – Fall 2008 – V1.1 – c○ K. Kreutz-Delgado, <strong>UC</strong> <strong>San</strong> <strong>Diego</strong> – p. 1/1
Eigenstructure of A H A<br />
Let A : X = C n → Y = C m be an m × n matrix operator mapping between two<br />
Cartesian complex Hilbert spaces.<br />
Recall that (with A H = A ∗ for A a mapping between Cartesian spaces)<br />
r(AA H ) = r(A) = r(A H ) = r(A H A)<br />
Therefore the number of nonzero (and hence strictly positive) eigenvalues of<br />
AA H : C m → C m and A H A : C n → C n must both be equal to r = r(A).<br />
Let the nonnegative eigenvalues of A H A be denoted and ordered as<br />
σ 2 1 ≥ · · · ≥ σ 2 r > σ 2 r+1 = · · · = σ 2 n = 0<br />
<br />
eigenvalue 0 has multiplicity ν = n − r<br />
with corresponding n-dimensional orthonormal eigenvectors<br />
v1 · · · vr<br />
<br />
span of R(A H ) = N(A) ⊥<br />
vr+1 · · · vn<br />
<br />
spans N(A) = N(A H A)<br />
ECE 275AB Lecture 9 – Fall 2008 – V1.1 – c○ K. Kreutz-Delgado, <strong>UC</strong> <strong>San</strong> <strong>Diego</strong> – p. 2/1
Thus we have<br />
and<br />
Eigenstructure of A H A – Cont.<br />
(A H A)vi = σ 2 i vi with σ 2 i<br />
> 0 for i = 1, · · · , r<br />
(A H A)vi = 0 for i = r + 1, · · · , n<br />
The eigenvectors vr+1 · · · vn can be chosen to be any orthonormal set spanning N(A).<br />
An eigenvectors vi associated with a distinct nonzero eigenvalues σ 2 i<br />
unique up to sign vi ↦→ ±vi.<br />
, 1 ≤ i ≤ r, is<br />
Eigenvectors vi associated with the same nondistinct nonzero eigenvalue σ 2 i with<br />
multiplicity p can be chosen to be any orthonormal set that spans the p-dimensional<br />
eigenspace associated with that eigenvalue.<br />
Thus we see that there is a lack of uniqueness in the eigen-decomposition of A H A. This<br />
lack of uniqueness (as we shall see) will carry over to a related lack of uniqueness in the<br />
<strong>SVD</strong>.<br />
What is unique are the values of the nonzero eigenvalues, the eigenspaces associated<br />
with those eigenvalues, and any projection operators we construct from the eigenvectors<br />
(uniqueness of projection operators).<br />
ECE 275AB Lecture 9 – Fall 2008 – V1.1 – c○ K. Kreutz-Delgado, <strong>UC</strong> <strong>San</strong> <strong>Diego</strong> – p. 3/1
Eigenstructure of A H A – Cont.<br />
In particular, we uniquely have<br />
where<br />
and<br />
Note that<br />
V1 <br />
<br />
<br />
V <br />
PR(AH ) = V1 V H<br />
1 and PN(A) = V2 V H<br />
2<br />
v1 · · · vr<br />
V1 V2<br />
<br />
=<br />
<br />
<br />
∈ C n×r<br />
V2 <br />
<br />
vr+1 · · · vn<br />
v1 · · · vr vr+1 · · · vn<br />
<br />
<br />
∈ C n×ν<br />
∈ C n×n<br />
R(V1) = R(A H ), R(V2) = N(A), R(V ) = X = C n<br />
I<br />
n×n = V H V = V V H = V1V H<br />
1<br />
I<br />
r×r<br />
= V H<br />
1 V1, I<br />
ν×ν<br />
It is straightforward to show that V1 V H<br />
1 and V2 V H<br />
2<br />
+ V2V H<br />
2 = P R(A H ) + P N(A)<br />
= V H<br />
2 V2<br />
are idempotent and self-adjoint.<br />
ECE 275AB Lecture 9 – Fall 2008 – V1.1 – c○ K. Kreutz-Delgado, <strong>UC</strong> <strong>San</strong> <strong>Diego</strong> – p. 4/1
Eigenstructure of A H A – Cont.<br />
We now prove two identities that will prove useful when deriving the <strong>SVD</strong>.<br />
<br />
Taking σi = σ2 i define<br />
Then<br />
can be written as<br />
which yields<br />
We also note that<br />
S<br />
r×r diag(σ1 · · · σr)<br />
A H Avi = σ 2 i vi<br />
A H AV1 = V1S 2<br />
1 ≤ i ≤ r<br />
I<br />
r×r = S−1V H<br />
1 A H AV1S −1<br />
A H Avi = 0 ⇔ Avi ∈ R(A) ∩ N(A H ) = {0}<br />
so that A H Avi = 0, i = r + 1, · · · , n yields<br />
0<br />
m×ν<br />
= AV2<br />
(2)<br />
ECE 275AB Lecture 9 – Fall 2008 – V1.1 – c○ K. Kreutz-Delgado, <strong>UC</strong> <strong>San</strong> <strong>Diego</strong> – p. 5/1<br />
(1)
Eigenstructure of AA H<br />
The eigenstructure of A H A determined above places constraints on the eigenstructure<br />
of AA H .<br />
Above we have shown that<br />
where σ 2 i<br />
(A H A)vi = σ 2 i vi i = 1, · · · , r<br />
, 1 ≤ i ≤ r, are nonzero. If we multiply both sides of this equation by A we get<br />
(recall that r = r(AA H ) ≤ m<br />
Showing that Avi and σ 2 i<br />
(AA H )(Avi) = σ 2 (Avi) i = 1, · · · , r<br />
are eigenvector-eigenvalue pairs.<br />
Since AA H is hermitian, the vectors Avi must be orthogonal. In fact, the vectors<br />
are orthonormal.<br />
ui 1<br />
σi<br />
Avi<br />
1 ≤ i ≤ r<br />
ECE 275AB Lecture 9 – Fall 2008 – V1.1 – c○ K. Kreutz-Delgado, <strong>UC</strong> <strong>San</strong> <strong>Diego</strong> – p. 6/1
Eigenstructure of AA H – Cont.<br />
This follows from defining<br />
which is equivalent to<br />
U1 =<br />
<br />
u1 · · · ur<br />
<br />
U1 = AV1S −1<br />
∈ C m×r<br />
and noting that Equation (1) yields orthogonality of the columns of U1<br />
Note from the above that<br />
U H 1 U1 = S −1 V H<br />
1 AH AV1S −1 = I<br />
S<br />
r×r = UH 1 AV1<br />
Also note that a determination of V1 (based on a resolution of the ambiguities described<br />
above) completely specifies U1 = AV1S −1 . Contrawise, it can be shown that a<br />
specification of U1 provides a unique determination of V1.<br />
ECE 275AB Lecture 9 – Fall 2008 – V1.1 – c○ K. Kreutz-Delgado, <strong>UC</strong> <strong>San</strong> <strong>Diego</strong> – p. 7/1<br />
(3)
Eigenstructure of AA H - Cont.<br />
Because ui correspond to the nonzero eigenvalues of AA H they must span<br />
R(AA H ) = R(A). Therefore<br />
R(U1) = R(A) and P R(A) = U1U H 1<br />
Complete the set ui, i = 1, · · · , r, to include a set of orthonormal vectors, ui,<br />
i = r + 1, · · · m, orthogonal to R(U1) (this can be done via random selection of new<br />
vectors in C m followed b Gram-Schimdt orthonormalization.) Let<br />
with µ = m − r.<br />
By construction<br />
and therefore<br />
and<br />
U2<br />
m×µ<br />
=<br />
<br />
ur+1 · · · um<br />
R(U2) = R(U1) ⊥ = R(A) ⊥ = N(A H )<br />
0<br />
n×µ = AH U2<br />
P N(A H ) = U2U H 2<br />
<br />
ECE 275AB Lecture 9 – Fall 2008 – V1.1 – c○ K. Kreutz-Delgado, <strong>UC</strong> <strong>San</strong> <strong>Diego</strong> – p. 8/1<br />
(4)
Setting<br />
we have<br />
Eigenstructure of AA H – Cont.<br />
U =<br />
<br />
u1 · · · ur ur+1 · · · um<br />
<br />
=<br />
<br />
U1 U2<br />
I<br />
m×m = UH U = UU H = U1U H 1 + U2U H 2 = P R(A) + P N(A H )<br />
<br />
ECE 275AB Lecture 9 – Fall 2008 – V1.1 – c○ K. Kreutz-Delgado, <strong>UC</strong> <strong>San</strong> <strong>Diego</strong> – p. 9/1
or<br />
Derivation of the <strong>SVD</strong><br />
Σ<br />
m×n UH AV =<br />
Note that<br />
A =<br />
<br />
U H 1<br />
U H 2<br />
<br />
<br />
<br />
A<br />
U1 U2<br />
V1 V2<br />
<br />
=<br />
A = UΣV H<br />
<br />
S 0<br />
0 0<br />
<br />
<br />
UH 1 AV1 U1AV2<br />
UH 2 AV1 UH 2 AV2<br />
<br />
V H<br />
1<br />
V H<br />
2<br />
<br />
= U1SV H<br />
1<br />
This yields the Singular Value Decomposition (<strong>SVD</strong>) factorization of A<br />
<strong>SVD</strong>: A = UΣV H = U1SV H<br />
1<br />
=<br />
<br />
<br />
S 0<br />
0 0<br />
Note that when A is square and full rank, we have U = U1, V = V1, Σ = S, and<br />
A = USV H<br />
ECE 275AB Lecture 9 – Fall 2008 – V1.1 – c○ K. Kreutz-Delgado, <strong>UC</strong> <strong>San</strong> <strong>Diego</strong> – p. 10/1
<strong>SVD</strong> Properties<br />
The matrix U is unitary, U −1 = U H , and its columns form an orthonormal basis for the<br />
codomain Y = C m wrt to the standard inner product. (Its rows are also orthonormal.) If<br />
we denote the columns of U, known as the left singular vectors, by ui, i = 1, · · · , m,<br />
the first r lsv’s comprise the columns of the m × r matrix U1, while the remaining lsv’s<br />
comprise the columns of the m × µ matrix U2, where µ = m − r is the dimension of the<br />
nullspace of A ∗ . The lsv ui is in one-to-one correspondence with the singular value σi<br />
for i = 1, · · · , r.<br />
The matrix V is unitary, V −1 = U H , and its columns form an orthonormal basis for the<br />
domain X = C n wrt to the standard inner product. (Its rows are also orthonormal.) If we<br />
denote the columns of V , known as the right singular vectors, by vi, i = 1, · · · , m, the<br />
first r rsv’s comprise the columns of the n × r matrix V1, while the remaining rsv’s<br />
comprise the columns of the n × ν matrix V2, where ν = n − r is the nullity (dimension<br />
of the nullspace) of A. The rsv vi is in one-to-one correspondence with the singular<br />
value σi for i = 1, · · · , r.<br />
We have<br />
A = U1SV H<br />
1 =<br />
<br />
u1 · · · ur<br />
<br />
⎛<br />
⎜<br />
⎝<br />
σ1<br />
. ..<br />
σr<br />
⎞ ⎛<br />
⎟ ⎜<br />
⎟ ⎜<br />
⎠ ⎝<br />
v H 1<br />
.<br />
v H r<br />
⎞<br />
⎟<br />
⎠ = σ1u1v H 1 + · · · + σrurv H r<br />
Each term in this dyadic expansion is unique (i.e., does not depend on how the<br />
ambiguities mentioned above are resolved).<br />
ECE 275AB Lecture 9 – Fall 2008 – V1.1 – c○ K. Kreutz-Delgado, <strong>UC</strong> <strong>San</strong> <strong>Diego</strong> – p. 11/1
<strong>SVD</strong> Properties – Cont.<br />
We can use the <strong>SVD</strong> to gain geometric intuition of the action of the matrix operator<br />
A : X = C n → Y = C m on the space X = R(A H ) + N(A).<br />
The action of A on N(A) = R(V2) is trivial to understand from its action on the right<br />
singular vectors which form a basis for N(A),<br />
Avi = 0 i = r + 1, · · · , n<br />
In class we discussed the geometric interpretation of the action of the operator A on<br />
R(A H ) based on the dyadic expansion<br />
A = σ1u1v H 1 + · · · + σrurv H r<br />
as a mapping of a hypersphere in R(A H ) to an associated hyperellipsoid in R(A)<br />
induced by the basis vector mappings<br />
vi A → σiui<br />
i = 1, · · · , r<br />
ECE 275AB Lecture 9 – Fall 2008 – V1.1 – c○ K. Kreutz-Delgado, <strong>UC</strong> <strong>San</strong> <strong>Diego</strong> – p. 12/1
<strong>SVD</strong> Properties – Cont.<br />
When A is square and presumably full rank, r = n, this allows us to measure the<br />
numerical conditioning of A via the quantity (the condition number of A)<br />
cond(A) = σ1<br />
This measures the degree of ‘flattening’ (distortion) of the hypersphere induced by the<br />
mapping A. A perfectly conditioned matrix A has cond(A) = 1, and an infinitely<br />
ill-conditioned matrix has cond(A) = +∞.<br />
Using the fact that for square matrices det A = det A T and det AB = det Adet B, we<br />
note that<br />
1 = det I = det UU H = det Udet U = |det U| 2<br />
or<br />
σn<br />
|det U| = 1<br />
and similarly for the unitary matrices U H , V , and V H . (Note BTW that this implies for a<br />
unitary matrix U, det U = e jφ for some φ ∈ R. When U is real and orthogonal,<br />
U −1 = U T , this reduces to det U = ±1.) Thus for a square matrix A.<br />
|det A| = det USU H = |det U| · | det S| · | det U| = det S = σ1σ1 · · · σn<br />
ECE 275AB Lecture 9 – Fall 2008 – V1.1 – c○ K. Kreutz-Delgado, <strong>UC</strong> <strong>San</strong> <strong>Diego</strong> – p. 13/1
<strong>SVD</strong> Properties – Cont.<br />
Exploiting identities provable from the M-P Theorem (see Lecture 7 and Homework 3)<br />
we have<br />
A + = V Σ + U H<br />
=<br />
<br />
V1 V2<br />
= V1S −1 U H 1<br />
=<br />
<br />
v1 · · · vr<br />
<br />
<br />
S + <br />
0<br />
<br />
U<br />
0 0<br />
H 1 UH 2<br />
⎛<br />
⎜<br />
⎝<br />
1<br />
σ1<br />
. ..<br />
= 1<br />
v1u<br />
σ1<br />
H 1 + · · · + 1<br />
vru<br />
σr<br />
H r<br />
1<br />
σr<br />
⎞ ⎛<br />
⎟ ⎜<br />
⎟ ⎜<br />
⎠ ⎝<br />
Note that this construction works regardless of the value of the rank r. This shows that<br />
knowledge of the <strong>SVD</strong> of a matrix A allows us to determine its p-inv even in the<br />
rank-deficient case. Also note that the pseudoinverse is unique, regardless of the<br />
particular <strong>SVD</strong> variant (i.e., it does not depend on how the ambiguities mentioned above<br />
are resolved).<br />
<br />
u H 1<br />
.<br />
u H r<br />
⎞<br />
⎟<br />
⎠<br />
ECE 275AB Lecture 9 – Fall 2008 – V1.1 – c○ K. Kreutz-Delgado, <strong>UC</strong> <strong>San</strong> <strong>Diego</strong> – p. 14/1
<strong>SVD</strong> Properties – Cont.<br />
Note that having an <strong>SVD</strong> factorization of A at hand provides us with an orthonormal<br />
basis for X = C n (the columns of V ), an orthonormal basis for R(A H ) (the columns of<br />
V1), an orthonormal basis for N(A) (the columns of V2), an orthonormal basis for<br />
Y = C m (the columns of U), an orthonormal basis for R(A) (the columns of U1), and an<br />
orthonormal basis for N(A H ) (the columns of U2).<br />
Although the <strong>SVD</strong> factorization, the bases mentioned above, are not uniquely defined, it<br />
is the case that the orthogonal projectors constructed from the basis are unique (from<br />
uniqueness of projection operators). Thus we can construct the unique orthogonal<br />
projection operators via<br />
P R(A) = U1U H 1 P N(A H ) = U2U H 2 P R(A H ) = V1V H<br />
1<br />
P N(A) = V2V H<br />
2<br />
Obviously having access to the <strong>SVD</strong> is tremendously useful. With the background we<br />
have now covered, one can now can greatly appreciate the utility of the Matlab<br />
command svd(A) which returns the singular values, left singular vectors, and right<br />
singular vectors of A, from which one can construct all of the entities described above.<br />
(Note that the singular vectors returned by Matlab will not necessarily all agree with the<br />
ones you construct by other means because of the ambiguites mentioned above.<br />
However, the singular values will be the same, and the left and right singular vector<br />
associated with the same, distinct singular value should only differ from yours by a sign<br />
at most.) Another useful Matlab command is pinv(A) which returns the pseudoinverse of<br />
A regardless of the value of the rank of A.<br />
ECE 275AB Lecture 9 – Fall 2008 – V1.1 – c○ K. Kreutz-Delgado, <strong>UC</strong> <strong>San</strong> <strong>Diego</strong> – p. 15/1
Two Simple <strong>SVD</strong> Examples<br />
In the third homework assignment you are asked to produce the <strong>SVD</strong> for some simple<br />
matrices by hand and then construct the four projection operators for each matrix as well<br />
as the pseudoinverse.<br />
The problems in Homework 3 have been carefully designed so that you do not have to<br />
perform eigendecompositions to obtain the <strong>SVD</strong>’s. Rather, you can easily force the<br />
matrices into <strong>SVD</strong> factored form via a series of simple steps based on understanding the<br />
geometry underlying the <strong>SVD</strong>.<br />
<br />
1<br />
Example 1. A = . First note that m = 2, n = 1, r = r(A) = 1 (obviously),<br />
2<br />
ν = n − r = 0, and µ = m − r = 1. This immediately tells us that V = V1 = v1 = 1.<br />
We have<br />
<br />
1 √5<br />
1<br />
= 2<br />
2 √<br />
5<br />
<br />
U1<br />
· √ 5 · 1<br />
<br />
S V H<br />
=<br />
<br />
1√5 √ <br />
X 5<br />
√<br />
2 · · 1<br />
X 0 <br />
5<br />
V<br />
Σ<br />
H<br />
U1 U2<br />
=<br />
<br />
√5<br />
1<br />
√<br />
2<br />
5<br />
√<br />
2<br />
5<br />
− 1<br />
<br />
√ <br />
5<br />
· · 1<br />
√ 0 <br />
5<br />
V<br />
<br />
U1 U2<br />
<br />
U<br />
<br />
Σ<br />
H<br />
Note that we exploit the fact that we know the dimensions of the various matrices we<br />
have to compute. Here we first filled out Σ before determining the unknown values of<br />
U2 = u2, which was later done using the fact that u2 ⊥ u1 = U1.<br />
ECE 275AB Lecture 9 – Fall 2008 – V1.1 – c○ K. Kreutz-Delgado, <strong>UC</strong> <strong>San</strong> <strong>Diego</strong> – p. 16/1
Example 2. A =<br />
Two Simple <strong>SVD</strong> Examples – Cont.<br />
<br />
1<br />
1<br />
1<br />
1<br />
. Note that m = 2, n = 2, r = r(A) = 1 (obviously),<br />
ν = n − r = 1, and µ = m − r = 1. Unlike the previous example, here we have a<br />
nontrivial nullspace.<br />
<br />
1 1 1<br />
<br />
= 1 1<br />
1 1 1<br />
=<br />
<br />
√2<br />
1<br />
1<br />
√ 2<br />
<br />
<br />
U1<br />
<br />
· 2 · √2<br />
1<br />
<br />
S<br />
<br />
√<br />
1<br />
2<br />
<br />
V T 1<br />
=<br />
<br />
<br />
<br />
<br />
<br />
<br />
√2<br />
1<br />
X<br />
1√2 1√ 2 0<br />
√<br />
1 · · 2<br />
X 0 0 X X<br />
2<br />
<br />
Σ<br />
U1 U2<br />
Exploiting the facts that U1 = u1 ⊥ u2 = U2 and V1 = v1 ⊥ v2 = V2 we easily<br />
determine that<br />
<br />
1<br />
1<br />
<br />
1 √2<br />
1<br />
=<br />
1 √<br />
1<br />
2<br />
√<br />
1<br />
2<br />
− 1<br />
<br />
<br />
<br />
2 0 √2<br />
1<br />
· ·<br />
√ 0 0 √<br />
1<br />
2<br />
2<br />
<br />
Σ<br />
<br />
√<br />
1<br />
2<br />
− 1 <br />
<br />
√<br />
2<br />
<br />
U1 U2<br />
<br />
U<br />
Note the ± sign ambiguity in the choice of U2 and V2.<br />
V T 1<br />
V T 2<br />
<br />
V T<br />
ECE 275AB Lecture 9 – Fall 2008 – V1.1 – c○ K. Kreutz-Delgado, <strong>UC</strong> <strong>San</strong> <strong>Diego</strong> – p. 17/1<br />
V T 1<br />
V T 2