# Find SVD of a matrix

Let A be a matrix, $$A= \begin{pmatrix} 0 & 1 & 0 \\ 0 & 0 & 2 \\ \end{pmatrix}$$ and it's SVD, $$A=USV^t$$.

Let $$U^1$$ be the first column of $$U$$ and $$V^1$$ the first column of $$V$$.

There are a bunch of options, but the correct answer is:

"The singular values of $$A$$ are $$\sigma _1 = 2$$ and $$\sigma _2 =1$$, $$U^1=(0,1)$$ and $$V^1=(0,0,1)$$"

And I think I get to the same matrix they're talking about, but in a different order?

1. I found $$A^tA$$=$$\begin{pmatrix} 0 & 0 \\ 1 & 0 \\ 0 & 2 \\ \end{pmatrix}\begin{pmatrix} 0 & 1 & 0 \\ 0 & 0 & 2 \\ \end{pmatrix}=\begin{pmatrix} 0 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 4 \\ \end{pmatrix}$$
2. I found the eigenvectors and eigenvalues of $$A^tA$$, $$\lambda_1=0$$, $$\lambda_2=1$$, $$\lambda_3=4$$. And their eigenvectors are $$S_0=[(1,0,0)]$$, $$S_1=[(0,1,0])$$, $$S_4=[(0,0,1)]$$.

I know I don't have to orthonormalize them, because they form the canonical basis.

So far, I have the singular values, which are $$\sigma _1 = 1$$ and $$\sigma _2 =2$$, $$S=\begin{pmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ \end{pmatrix}$$,$$V=V^t=\begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{pmatrix}$$

Now all I have to do is find $$U$$:

I find the columns for U:

$$u_1=\frac{T(v_1)}{\sigma_1}=\frac{Av_1}{\sigma_1}=\frac{(1,0)}{1}=(1,0)$$

$$u_2=\frac{T(v_2)}{\sigma_2}=\frac{Av_2}{\sigma_2}=\frac{(0,2)}{2}=(0,1)$$

Where $$v_1$$ and $$v_2$$ are the orthonormalized eigenvectors.

So $$U$$ must be $$U=\begin{pmatrix} 1 & 0 \\ 0 & 1 \\ \end{pmatrix}$$.

So I got that the singular values are $$\sigma _1 = 1$$ and $$\sigma _2 =2$$, $$U^1=(1,0)$$ and $$V^1=(1,0,0)$$ which are completly wrong by the correct answer I have.

What am I doing wrong?

I think you only used the wrong order. In the SVD one practically always arranges the singular values in descending order, so $$\sigma_1 = 2$$, $$\sigma_2=1$$. Therefore the diagonal matrix $$S$$ becomes $$S = \begin{pmatrix} 2 & 0 & 0 \\ 0 & 1 & 0 \end{pmatrix}$$ and putting the corresponding vectors $$v_1$$, $$v_2$$, $$v_3$$ in the according order in a matrix gives $$V = \begin{pmatrix} 0 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 0 & 0 \end{pmatrix}.$$ With this order, the vector $$u_1$$ becomes $$(0,1)$$.