I am doing a problem which involves finding the eigenvalues and eigenvectors of the matrix $$ M=\begin{bmatrix} 0 & 1/2 & 1/2 \\ 1/2 & 0 & 1/2 \\ 1/2 & 1/2 & 0 \end{bmatrix}$$
When I compute by hand, I get eigenvalues of 1, -1/2, -1/2 with corresponding eigenvectors $\begin{bmatrix}1\\1\\1\end{bmatrix},\begin{bmatrix}-1\\1\\0\end{bmatrix},\begin{bmatrix}-1\\0\\1\end{bmatrix}$, but when I try to compute in MATLAB I get
>>[A B] = eig(M)
A =
-0.7152 0.3938 0.5774
0.0166 -0.8163 0.5774
0.6987 0.4225 0.5774
B =
-0.5000 0 0
0 -0.5000 0
0 0 1.0000
The last eigenvector makes sense, but the first two aren't scalar multiples of the ones I got, which I figured they should be. Why are these also eigenvectors?
You have a repeated eigenvalue. The vectors $$\begin{bmatrix}-1\\1\\0\end{bmatrix},\begin{bmatrix}-1\\0\\1\end{bmatrix}$$ form a basis for the eigenspace associated to the eigenvalue $-\frac{1}{2}$. If you check the first two eigenvectors that matlab has given you then you will find that they are also a basis for this space. At least they would be if they were calculated exactly. There's going to be some rounding error.