Why am I getting incorrect Eigenvectors for my matrix? [closed]

When i try and compute the Eigensystem using Mathematica i am getting negative values for my Eigenvector, but my Eigenvalues are correct but my Eigenvectors are incorrect and i do know why is that?

$$\begin{bmatrix}.9&.01&.09\\.01&.9&.01\\.09&.09&.9\end{bmatrix}$$

This is what i type in mathematica

b = {{.90, .01, .09}, {.01, .90, .01}, {.09, .09, .90}}
Eigensystem[b]

My output:
{{1., .89, .81}, {-.6701, -.1399, -.729}, {.7071, -.7071, 2.138x10^-15}, {-.7071, -3.05x10^-16, .7071}}

I believe the correct EigenVectors should be:
{{.919192,.191919, 1}, {-1,0,1}, {-1,1,0}}


closed as off-topic by Daniel Lichtblau, MarcoB, user64494, garej, Henrik SchumacherMay 5 at 17:28

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Daniel Lichtblau, MarcoB, user64494, garej, Henrik Schumacher
If this question can be reworded to fit the rules in the help center, please edit the question.

• They're correct, up to floating-point rounding error. (1) Scaling an eigenvector by a nonzero real or complex number, yields another eigenvector. (2) Numbers on the order of 10^-15 should probably be neglected. You can use Chop[] to zero out such small errors. – Michael E2 May 5 at 14:11
• @MichaelE2 thanks so there know way of fixing the floating point rounding error in mathematica – user65420 May 5 at 14:21
• If you want exact answers, use rational numbers rather than floating point. For instance, there is no roundoff error with Eigensystem[Rationalize[b]] – bill s May 5 at 14:21
• @bills thank you! – user65420 May 5 at 14:23
• "[F]ixing the floating point rounding error"? Books have been written on the underlying numerical analysis, but a short answer is to note that "error", when used in this sense, is not the same as "wrong". – Daniel Lichtblau May 5 at 14:40

Sometimes working in floating-point is advisable. It is faster and uses less memory than exact methods. So getting familiar with round-off error is helpful in such cases. For instance, for a good algorithm for a function, the best result in double precision ($MachinePrecision in Mathematica) should be expected to have a rounding error up to 0.5 *$MachineEpsilon, which is around 10^-16. Since most algorithms call other such algorithms, the errors compound and a good algorithm will produce much greater errors.

Here's a way using ZeroTest that works with two of the three alternatives. It eliminates round-off error on the zero entries of the eigenvectors. It cannot reduce it on nonzero entries, except "by accident", that is, rounding errors that cancel each other out. For instance the true values of the first eigenvector below cannot be represented exactly in binary floating-point. The failure of the last variant suggests some limitations on the robustness of this approach in general:

esys = {evals, evecs} = Eigensystem[bb, ZeroTest -> (N[#] == 0 &)]
(*
{{1., 0.89, 0.81},
{{0.919192, 0.191919, 1.}, {-1., 1., 0.}, {-1., 0., 1.}}}
*)

esys = {evals, evecs} = Eigensystem[bb, ZeroTest -> (Abs[#] < \$MachineEpsilon &)]
(*
{{1., 0.89, 0.81},
{{0.919192, 0.191919, 1.}, {-1., 1., 0.}, {-1., 0., 1.}}}
*)

esys = {evals, evecs} = Eigensystem[bb, ZeroTest -> (# == 0 &)]
(*
{{1., 0.89, 0.81},
{{0.919192, 0.191919, 1.}, {-1., 1., 0.}, {-1., 6.58917*10^-15, 1.}}}
*)


Here is a way to measure the effect of rounding error on the result. As can be seen, the default method of Eigensystem produces a numerically more accurate result.

esys = {evals, evecs} = Eigensystem[b];
error = (b.evecs\[Transpose])\[Transpose] - Times @@ esys
(*
{{-6.66134*10^-16, -8.32667*10^-17, -3.33067*10^-16},
{ 3.33067*10^-16,  0.,              2.71176*10^-16},
{-1.11022*10^-16, -4.86828*10^-17, -3.33067*10^-16}}
*)

Norm[error, Infinity]/Norm[b, Infinity]
(*  1.00228*10^-15  -- relative error for default method *)

esys = {evals, evecs} = Eigensystem[b, ZeroTest -> (N[#1] == 0 &)];
error = (b.evecs\[Transpose])\[Transpose] - Times @@ esys;
Norm[error, Infinity]/Norm[b, Infinity]
(*  3.20731*10^-14  -- rel. error for the ZeroTest method (30x greater) *)


The operator infinity norm of a matrix is equal to the maximum absolute row sum (i.e. sum of the absolute value of the entries in each row):

Norm[error, Infinity]
Total[Abs[#]] & /@ error
(*
3.4639*10^-14
{9.99201*10^-16, 3.4639*10^-14, 1.11335*10^-14}
*)