Consider the real, symmetric matrix
S = (2, 1; 1, 2)
From the characteristic equation |S - λ I|, we have the quadratic (2-λ)^2 - 1 = 0, whose solutions yield the eigenvalues 3 and 1. The corresponding eigenvectors are (1;-1) and (1;1).
octave:4> [V,lambda] = eig([2, 1; 1,2])
V =
-0.70711 0.70711
0.70711 0.70711
lambda =
Diagonal Matrix
1 0
0 3
Why are the eigenvectors in octave [-0.70711; 0.70711] and [0.70711; 0.70711]?
Given λ1 = 3 the corresponding eigenvector is:
| 2 1 | |x| |x|
| | * | | = 3 | | => x = y
| 1 2 | |y| |y|
I.e. any vector of the form [x, x]', for any non-zero real number x, is an eigenvector. So [0.70711, 0.70711]'
is an eigenvector as valid as [1, 1]'
.
Octave (but also Matlab) chooses the values such that the sum of the squares of the elements of each eigenvector equals unity (eigenvectors are normalized to have a norm of 1 and are chosen to be orthogonal, to be precise).
Of course the same is valid for λ2 = 1.