Linear Algebra – Problem with Singular Value Decomposition

linear algebramatrix decomposition

I have a very trivial SVD Example, but I'm not sure what's going wrong.

The typical way to get an SVD for a matrix $A = UDV^T$ is to compute the eigenvectors of $A^TA$ and $AA^T$. The eigenvectors of $A^TA$ make up the columns of $U$ and the eigenvectors of $AA^T$ make up the column of $V$. From what I've read, the singular values in $D$ are square roots of eigenvalues from $AA^T$ or $A^TA$, and must be non-negative.

However, for the simple example $A = \left[\begin{matrix} 1 & 0 \\ 0 & -1 \end{matrix}\right]$, $A^TA$ and $AA^T$ are both the identity, and thus have eigenvectors $\bigg\lbrace \left[\begin{matrix} 1 \\ 0 \end{matrix}\right]\ ,\ \left[\begin{matrix} 0 \\ 1 \end{matrix}\right]\bigg\rbrace$. Clearly, the eigenvalues are 1 and 1, so our decomposition ought to be:
\begin{align}
\left[\begin{matrix} 1 & 0 \\ 0 & -1 \end{matrix}\right] = \left[\begin{matrix} 1 & 0 \\ 0 & 1 \end{matrix}\right]\left[\begin{matrix} 1 & 0 \\ 0 & 1 \end{matrix}\right]\left[\begin{matrix} 1 & 0 \\ 0 & 1 \end{matrix}\right]
\end{align}

What has gone wrong?

Best Answer

You're right that the columns of $U$ and $V$ are the eigenvectors of $AA^T$ and $A^TA$ (repectively). However, that information alone does not completely determine the SVD.

Analogously: in an eigendecomposition $A = PDP^{-1}$, the columns of $P$ are eigenvectors and the entries of $D$ are eigenvalues. Nevertheless, $$ \pmatrix{0&1\\1&0}\pmatrix{1\\&2}\pmatrix{0&1\\1&0}^{-1} \neq \pmatrix{1&0\\0&1}\pmatrix{1\\&2}\pmatrix{1&0\\0&1}^{-1} $$ Once we've found a valid choice of $V$ (with eigenvectors in order corresponding to the eigenvalues of $A^TA$ in descending order), it remains to solve for a satisfactory $U$. If $A$ is invertible, then $$ A = U DV^T \implies U = AVD^{-1} $$ even if $A$ is not invertible, some of the columns of $U$ will be determined by our choice of $V$.

To put it precisely: the $i$th column of $U$ is given by $u_i = \frac 1{\sigma_i}Av_i$ whenever $\sigma_i$ is non-zero. To see that these columns are orthonormal, note that $$ u_i^Tu_j = \frac{1}{\sigma_i\sigma_j} v_i^TA^TAv_j $$