MATLAB: Can’t I solve eigenvector correctly? (eigenvalue problem)

matrix eigenvalue eigenvector problem symbolic

The following matrix H is composed of two different constant a and b:
a, b, 0, 0, 0, b
b, a, b, 0, 0, 0
0, b, a, b, 0, 0
0, 0, b, a, b, 0
0, 0, 0, b, a, b
b, 0, 0, 0, b, a
When I enter [X,E] = eig(H), it returns me:
X =
-1, 1, -1, -1, -1, 1
-1, 0, 1, 0, 1, 1
0, -1, 0, 1, -1, 1
1, -1, -1, -1, 1, 1
1, 0, 1, 0, -1, 1
0, 1, 0, 1, 1, 1
E =
a + b, 0, 0, 0, 0, 0
0, a + b, 0, 0, 0, 0
0, 0, a - b, 0, 0, 0
0, 0, 0, a - b, 0, 0
0, 0, 0, 0, a - 2*b, 0
0, 0, 0, 0, 0, a + 2*b
I first thought this was right, but then I put actual number a = -11.7 and b = -0.7 and then I get
X =
-0.4082 -0.5000 0.2887 -0.5000 0.2887 0.4082
-0.4082 -0.5000 -0.2887 0.5000 0.2887 -0.4082
-0.4082 0.0000 -0.5774 -0.0000 -0.5774 0.4082
-0.4082 0.5000 -0.2887 -0.5000 0.2887 -0.4082
-0.4082 0.5000 0.2887 0.5000 0.2887 0.4082
-0.4082 0 0.5774 0 -0.5774 -0.4082
E =
-13.1000 0 0 0 0 0
0 -12.4000 0 0 0 0
0 0 -12.4000 0 0 0
0 0 0 -11.0000 0 0
0 0 0 0 -11.0000 0
0 0 0 0 0 -10.3000
Now if I enter a = -11.7 and b = -0.7 AFTER solving the eigenvalue problem, the Eigenvalue are still the same (except the order is different). However, the eigenvectors seems to be not consistent with each other.
Why am I not getting the right general solution when solving symbolically, and what can I do to do it correctly?

Best Answer

Any linear combination of eigenvectors (ignoring the all-zero vector) associated with an eigenvalue q is also an eigenvector associated with the eigenvalue q. So while this vector:
v1 = repmat(-0.4082, 6, 1);
looks very different from this vector:
v2 = -ones(6, 1);
they're both eigenvectors for the eigenvalue a + 2*b (which is -13.1000 in your numeric example.)
To take a look at something a little more challenging, while the fourth and fifth columns of the X matrix from your numerical calculations doesn't look like the third and fourth columns of the X matrix from your symbolic calculations they are all eigenvectors associated with the eigenvalue a-b (or -11 in your numeric example.)
Specifically, column 4 of the numeric X is 0.5 times column 3 of the symbolic X. Column 5 of the numeric X is 0.2887 times column 3 of the symbolic X minus 0.5774 times column 4 of the symbolic X.
So all the answers you received are correct, they just look a little different than you expected.