# Reliably computing the signature of a matrix with small eigenvalues

When asked to compute the eigenvalues of the following matrix

m = {{-2, 1, 0, 1, 1, 0, 0, 0, 0, 0},
{1, -2, 1, 0, 0, 0, 0, 0, 0, 0},
{0, 1, -2, 0, 0, 0, 0, 0, 0, 0},
{1, 0, 0, -2, 0, 0, 0, 0, 0, 0},
{1, 0, 0, 0, -2, 1, 0, 0, 0, 0},
{0, 0, 0, 0, 1, -2, 1, 0, 0, 0},
{0, 0, 0, 0, 0, 1, -2, 1, 0, 0},
{0, 0, 0, 0, 0, 0, 1, -2, 1, 0},
{0, 0, 0, 0, 0, 0, 0, 1, -2, 1},
{0, 0, 0, 0, 0, 0, 0, 0, 1, -3}}


Mathematica returns

{-4.02739, -3.86914, -3.40114, -2.83334, -2.49755,
-1.81699, -1.32353, -0.901255, -0.333358, 0.00369045}


Are these decimal approximations provably the actual decimal approximations of the eigenvalues(i.e. up to the same term)? In particular, can I be assured that the only positive eigenvalue is actually $>0$? The matrix is non-singular (Mathematica can check it has $|\operatorname{det}|=1$ and I can prove this using non-computational techniques), so there is no possibility the last eigenvalue is zero. Still, I need to rule out the chance that the last eigenvalue is negative.

• One check you can do is see if the trace stays the same, since it is invariant under orthogonal transformations that are used to diagonalize the matrix. Total[Eigenvalues[m] // N] properly gives -21. in this case, which means that the numerics worked out reliably enough to each displayed decimal. – Kagaratsch Dec 3 '15 at 0:55

To obtain the signature, there is no need to diagonalize the matrix first, since the determinant stays invariant. Whether you multiply all eigenvalues or compute the determinant beforehand, the result is guaranteed to be the same. In this case we get

Det[m]


-1

Since the determinant is negative and the matrix is of even dimension (10x10 to be precise), it is therefore guaranteed that an odd number of eigenvalues must be positive, and the remaining odd number of eigenvalues must be negative.

In particular this means that at least one eigenvalue must be positive and at least one eigenvalue must be negative.

• Note by signature, I mean the number of positive eigenvalues minus the number of negative eigenvalues (so one does still need to diagonalize or use Sylvester's Law). Of course though this is enough to ease most of my worry as now I know there does exist some positive eigenvalue, and I'm inclined to believe the computations of the negative eigenvalues are close enough. – PVAL Dec 3 '15 at 1:10
• You could also increase the numeric precision by use of N[Eigenvalues[m],precision] with the desired number of digits for precision, in case if your use of the results breaks down due to numerics. – Kagaratsch Dec 3 '15 at 1:23

Actually, Mathematica gives exact algebraic numbers as eigenvalues in this case. You must have used N[] to turn them into approximate numbers. But you can ask Mathematica about the properties of the exact numbers.

e = Eigenvalues[m];


e is a list of algebraic numbers represented as Root[] objects. There is generally no simpler exact representation. However, Mathematica can tell whether they are real, complex, positive, etc.

Map[# > 0 &, e]
(* {False, False, False, False, False, False, False, False, False, True} *)


This is an exact result.

• When I computed the eigenvalues exactly I just got the numbered roots of the characteristic polynomial (so no information on what the exact algebraic numbers are). How does Mathematica tell whether they are real, complex, positive? – PVAL Dec 3 '15 at 6:06
• The numbered roots are the exact numbers, similar in behavior to other exact irrational numbers like Pi. Since they have no names and no decimal or rational representation, their representation is necessarily messy. Mathematica has exact "root isolation" methods for identifying these and computing rational intervals containing such numbers to any precision. From that, it can determine whether they are real, complex, positive, etc. – John Doty Dec 3 '15 at 16:55