I am trying to find the spectral decomposition of the following matrix:
$$
A=\begin{pmatrix}
4 & 0 & 0\\
0 & 2 & 0\\
2 & 3 & 0\\
\end{pmatrix}
$$
So I found the eigenvalues which are $\lambda_1 = 0, \lambda_2=2, \lambda_3=4$ and the eigenvectors for them $v_1 = \begin{pmatrix}0\\0\\1\\\end{pmatrix}, v_2 =\begin{pmatrix}0\\2\\3\\\end{pmatrix},v_3 =\begin{pmatrix}2\\0\\1\\\end{pmatrix}$ correspondingly.
Now from what I understood, I should normalize the vectors above like that:
$$
q = \frac{v}{||v||}
$$
And calculate this: $\lambda_1q_1q_1^T+\lambda_2q_2q_2^T+\lambda_3q_3q_3^T$
However, when I do that the answer is not the matrix $A$ from above, but another one. Shouldn't the spectral decomposition be equal to the matrix ?
I don't know what I'm doing wrong, I have checked the eigenvalues and vectors many times I can't find what's wrong with this.
Any help is appreciated, thank you 😀
Best Answer
The technique you use: $$\lambda_1q_1q_1^T+\lambda_2q_2q_2^T+\lambda_3q_3q_3^T$$ is only true for a symmetric matrix. You can easily check that the result of such a calculation will always be a symmetric matrix by taking the transpose operator.
The general technique is to form the matrix with columns that are your eigenvectors: $$P=\begin{pmatrix}v_3&|& v_2&|&v_1\end{pmatrix}= \begin{pmatrix}2&0&0\\0&2&0\\1&3&1\\\end{pmatrix}$$ and calculate its inverse with your favorite method (for example Gauss elimination with pivoting).
In this case, you should get: $$P^{-1}=\begin{pmatrix}\frac{1}{2}&0&0\\0&\frac{1}{2}&0\\-\frac{1}{2}&-\frac{3}{2}&1\\\end{pmatrix}$$
Then you will have $$A=P\begin{pmatrix}\lambda_3&0&0\\0&\lambda_2&0\\0&0&\lambda_1\\\end{pmatrix}P^{-1}$$
Note that the order you use for the columns of P need to be the same as the order for the diagonal matrix.