[Math] ‘Sign’ of normalized eigenvector for singular value decomposition

eigenvalues-eigenvectorslinear algebramatrix decompositionsvd

I'm working on an SV decomposition script in Python. I am getting incorrect results because of the 'indeterminacy' associated with normalizing the singular vectors.

I understand that the sign of the vectors does not matter in terms of their behaviour as eigenvectors, but it does give incorrect results for SV decomposition. My example is this matrix:

$$
A = \begin{bmatrix}
3 & 2\\
1 & -1\\
\end{bmatrix}
$$

When I use numpy.linalg.eig to calculate the normalized eigenvectors for the singular vectors, some of them are the opposite sign to the singular vectors returned by numpy.linalg.svd (i.e. negative of each other) – if I understand correctly both should be valid normalized eigenvectors. In all other respects my algorithm's results are the same as Numpy's.

When I expand the factorisation, a lot of the time mine is incorrect while Numpy's always is. I believe the problem is that numpy.linalg.eig just happens to return the 'wrongly signed' eigenvectors.

For singular value decomposition, is there any easy/deterministic way to check which 'sign' your singular vectors need to have?

Best Answer

Eigenvectors are not unique. Multiplying by any constant, including -1 (which simply changes the sign), gives another valid eigenvector.

See: https://stackoverflow.com/questions/18152052/matlab-eig-returns-inverted-signs-sometimes