1
votes

I read about Singular Value Decomposition. To quote wikipedia :

The left-singular vectors of M are eigenvectors of MM∗.
The right-singular vectors of M are eigenvectors of M∗M.
The non-zero singular values of M (found on the diagonal entries of Σ) 
are the square roots of the non-zero eigenvalues of both M∗M and MM∗

I wrote this octave code (console output is shown here) :

a is the matrix whose svd is being calculated.

octave:1> a = [1,3;3,1]
a =

   1   3
   3   1

octave:3> [U,S,V] = svd(a)
U =

  -0.70711  -0.70711
  -0.70711   0.70711

S =

Diagonal Matrix

   4   0
   0   2

V =

  -0.70711   0.70711
  -0.70711  -0.70711

Check if svd really works ..

octave:4> U*S*V
ans =

   3.00000  -1.00000
   1.00000  -3.00000

octave:5> U*S*V'
ans =

   1.00000   3.00000
   3.00000   1.00000

Now try first principle (wikipedia) style :

octave:6> b = a*a'
b =

   10    6
    6   10

octave:7> c = a'*a
c =

   10    6
    6   10

octave:8> [E1,L1] = eig(b)
E1 =

  -0.70711   0.70711
   0.70711   0.70711

L1 =

Diagonal Matrix

    4    0
    0   16

octave:9> [E2,L2] = eig(c)
E2 =

  -0.70711   0.70711
   0.70711   0.70711

L2 =

Diagonal Matrix

    4    0
    0   16

I can see that eigen-values of b and c are squares of singular-values of a. This is cool. But left-singular-vectors and right-singular-vectors are coming wrong... sign problem.

What extra step is required to get the right values ?

1

1 Answers

0
votes

you already have the right values.

Eigenvectors are defined up to a multiplicative constant. This is obvious from their definition. So in your case [-0.70711; -0.70711] and [0.70711; 0.70711] are equivalent.

And in both cases the [-1; 1] eigenvector corresponds to the sqrt(4) = 2 eigenvalue, while the [1; 1] eigenvector corresponds to the sqrt(16) = 4 eigenvalue.