# Mathematica eigensystem incorrect?

• Mathematica

## Main Question or Discussion Point

I'm trying to compute the eigenvalues and eigenvectors of a 4x4 matrix using mathematica.
The problem comes when I try to check the values using the commands:

{vals, vecs} = Eigensystem[m]

TrueQ[m.vecs[] == vals[] vecs[]]

Which should return "True"; instead it returns "False"

I tested a different matrix and it returns true. So I'm not sure what to think about that. I would try it by hand, and might end up doing so, but I'm pressed for time and the calculation looks like it could get pretty hairy since the matrix is necessarily in symbolic form. Any help is appreciated. Thanks.

Related MATLAB, Maple, Mathematica, LaTeX News on Phys.org
phyzguy
Mathematica isn't always capable of recognizing that two expressions are equivalent if they are sufficiently complicated. Try:

TrueQ[m.vecs[] == vals[] vecs[]//Simplify]

or

TrueQ[m.vecs[] == vals[] vecs[]//FullSimplify]

Mathematica isn't always capable of recognizing that two expressions are equivalent if they are sufficiently complicated. Try:

TrueQ[m.vecs[] == vals[] vecs[]//Simplify]

or

TrueQ[m.vecs[] == vals[] vecs[]//FullSimplify]
Thanks! This works.

1) You probably shouldn't use TrueQ unless it's in the logic of some procedure where you need a definite True/False answer.

2) It's easier to test for a-b==0 than a==b

So I would write something like:

m = RandomReal[{0, 1}, {4, 4}]
{vals, vecs} = Eigensystem[m]
Table[(m - vals[] IdentityMatrix).vecs[], {i, 1, 4}] // Chop

and check that the result is all zeros.