<s>[INST] Eigenvalue Decomposition Error for the following matrix. Let us assume that $$A=\left[\begin{array}{rrr}2&-1&-1\\-1&2&-1\\-1&-1&2\end{array}\right].$$
Then, eigenvalues of $A$ is $0, 3, 3$.
For $\lambda_1=0$, I could find its eigenvector as $\begin{bmatrix}1\\ 1\\ 1\end{bmatrix}$.
For $\lambda_1=3$, I could find its eigenvector as $\left[\begin{array}r0\\ 1\\ -1\end{array}\right]$ and $\left[\begin{array}r0\\ -1\\ 1\end{array}\right]$.
Thus, I set $S=\left[\begin{array}{rrr}1&0&0\\1&1&-1\\1&-1&1\end{array}\right]$ and $\Lambda=\begin{bmatrix}0&0&0\\0&3&0\\0&0&3\end{bmatrix}$.
The problem is $S\times \Lambda \times S^{-1}$ does not give $A$.
By matlab, $S$ is given as $\left[\begin{array}{rrr}0.5774&0.7634&0.2895\\0.5774&-0.6325&0.5164\\0.5774&-0.1310&-0.8059\end{array}\right]$
Using $S$ given by matlab, $S\times \Lambda \times S^{-1}$ gives $A$.
The textbook said the $i$th column of $S$ must be the eigenvector corresponding the $i$th eigenvalue of $A$.
I think this problem happens because two lambdas are same as $3$.
How can I find correct $S$?
 [/INST] Directly:
$$|xI-A|=\begin{vmatrix}
x-2&1&1\\
1&x-2&1\\
1&1&x-2\end{vmatrix}=(x-2)^3+2-3(x-2)=x^3-6x^2+9x\implies$$
the eigenvalues are $\;0,\,3\;$, the last one of multiplicity two, and a basis for the corresponding eigenspaces is
$$\left\{\,\begin{pmatrix}1\\1\\1\end{pmatrix}\,,\;\begin{pmatrix}1\\\!-1\\0\end{pmatrix}\,,\;\begin{pmatrix}1\\0\\\!-1\end{pmatrix}\,\right\}$$
Try to take it from here now.
</s>