# Why is MATLAB giving me these weird eigenvectors?

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?

-
Repeat your calculations using decimals instead of exact and see what you get. Just try one eigenvalue -0.5. There is nothing with the answer as it still forms a basis. – Amzoti Apr 3 '13 at 4:10
This is a good question. The answer is that eigenspaces of repeated eigenvalues do not a unique basis. The computer simply gave you a different basis (presented with a rounding error). – Potato Apr 3 '13 at 4:35

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.

-
Another way to see it is that they are both linearly independent and satisfy the relation that $x + y + z = 0$ so they must span the same space. – muzzlator Apr 3 '13 at 4:10

Try and convince yourself $M=A*B*A'$. This is because of the repeated eigenvalue $(-1/2)$. Thus the eigenspace corresponding to this eigenvalue has a dimension of $2$. Thus it can have any two orthogonal vectors from that space as the basis. You found one of them, MATLAB found a different one.

-

The eigenvectors are normalized to have a norm of 1 and are chosen to be orthogonal. They will be unique (up to scalar multiplication) only if they have different eigenvalues.

Here you have two eigenvectors that share the same eigenvalue.

-