eig versus svd functions?

98 views (last 30 days)
Traian Preda on 18 Jul 2014
Hi,
I would like to ask what is the difference between the function eig and svd and what is the difference between the right eigenvectors and the right singular eigenvectors of these functions?
Thank you

Alfonso Nieto-Castanon on 18 Jul 2014
Edited: Alfonso Nieto-Castanon on 18 Jul 2014
SVD is a decomposition for arbitrary-size matrices, while EIG applies only to square matrices. They are very much related:
The right singular vectors of A are the eigenvectors of A'*A, and the left singular vectors of A are the eigenvectors of A*A'.
Similarly the singular values of A are the square root of the eigenvalues of A*A' (or A'*A, the eigenvalues of those are just the same)
Alfonso Nieto-Castanon on 18 Jul 2014
not exactly, there are simply no "eigenvectors" of a non-square matrix (eigenvalues/eigenvectors are only defined for square matrices)

Traian Preda on 18 Jul 2014
Hi again,
For example for this A matrix (square) I get using eig different right eigenvectors than by using svd. Seems that the sign of the ones produces by svd are the correct ones. Why this is happen?
-0,309435400000000 0,0211961600000000 0,0136410800000000 0,00743749000000000 0,00982272000000000 0,0111470200000000 0,00231817000000000 0,00864246000000000 0,00882075000000000 0,00284796000000000 0,00218905000000000 0,000430500000000000 0,000376470000000000 -0,113049800000000 0,00313088000000000 0,00149085000000000 0,00262337000000000 0,00311209000000000 -0,000262570000000000 0,00274903000000000 0,00264655000000000 0,000447630000000000 -0,000306180000000000 -0,00343315000000000 0,0103301100000000 0,0146587200000000 -0,324318800000000 0,00848285000000000 0,0167109100000000 0,0201004200000000 -0,00347676000000000 0,00632566000000000 0,00637912000000000 0,00186275000000000 0,00111713000000000 -0,00141243000000000 0,0464070100000000 0,0700929900000000 0,0900204400000000 -1,25637600000000 0,0836402500000000 0,103855100000000 -0,0114356300000000 0,0277253900000000 0,0280522900000000 0,00843094000000000 0,00547936000000000 -0,00411460000000000 0,0343002800000000 0,0606666900000000 0,0772628000000000 0,0388068100000000 -0,983633200000000 0,101284700000000 0,000288840000000000 0,0190463800000000 0,0194692000000000 0,00636249000000000 0,00501263000000000 0,00161963000000000 0,0216479800000000 0,0390856900000000 0,0497280000000000 0,0259531400000000 0,0538816600000000 -0,620819600000000 0,000968680000000000 0,0118906800000000 0,0121738400000000 0,00402735000000000 0,00325024000000000 0,00144150000000000 0,0560331100000000 0,0322143500000000 0,0452270700000000 0,00474108000000000 0,0665512800000000 0,0879651100000000 -1,14406400000000 0,0420314600000000 0,0413540800000000 0,00940455000000000 0,000919950000000000 -0,0325435900000000 0,0651720900000000 0,148360900000000 0,0550088600000000 0,0311400300000000 0,0376528500000000 0,0420123000000000 0,0135666400000000 -1,51919300000000 0,0778850700000000 -0,0322261000000000 0,0138896200000000 0,0193712200000000 0,0669056200000000 0,140490500000000 0,0573799400000000 0,0320810700000000 0,0399603600000000 0,0448506100000000 0,0126767400000000 0,0401568300000000 -1,54203000000000 -0,119447500000000 -0,000335680000000000 0,00939138000000000 0,0818470500000000 0,154808700000000 0,0715045300000000 0,0394081700000000 0,0507693800000000 0,0573505200000000 0,0137023800000000 -0,0385798100000000 -0,184705900000000 -1,07855600000000 -0,0214767400000000 -0,00365997000000000 0,0835618100000000 0,118544600000000 0,0760379600000000 0,0406107300000000 0,0561993500000000 0,0643053400000000 0,00980772000000000 0,0875483300000000 0,0746029100000000 -0,0136161900000000 -1,29450700000000 -0,0388254600000000 0,00108525000000000 0,000792020000000000 0,00104497000000000 0,000534560000000000 0,000812510000000000 0,000944030000000000 4,82500000000000e-05 0,000902380000000000 0,000866900000000000 0,000141640000000000 -0,000112090000000000 -0,174199600000000
Alfonso Nieto-Castanon on 18 Jul 2014
the eigenvectors of a square matrix are not generally the same as any of the singular vectors of that same matrix (they are equal/equivalent only when the matrix is symmetric)

Traian Preda on 18 Jul 2014
OK, then this can be reason that when I try to rebuilt the A matrix, I cannot succeed by using the V, D eigenvectors ([V,D]=eig(A)), but I can rebuilt it when I use V,S,D ([V,S,D]=svd(A))?
Thank you very much
Alfonso Nieto-Castanon on 18 Jul 2014
You can reconstruct A from its eigenvectors only if A is normal (A'*A==A*A'). You can reconstruct A from its singular vectors for any matrix A.