Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to find the eigenvector of a $20000 \times 20000$ sparse matrix associated with the smallest eigenvalue. I realized that the smallest eigenvalue might be negative; for example, if the eigenvalues of the matrix are $ \{-3,1,2,5 \}$, I want to find the eigenvector associated with $-3$, not $1$ or $5$. Therefore the commands Eigensystem[matrix,-1] or Eigensystem[matrix,1] cannot be guaranteed to return the desired result. Furthermore, I don't have a lower bound estimate for the possible smallest eigenvalue. Is there a way to find the eigenvectors efficiently?

share|improve this question
I would have suggested finding the eigenvectors of $I + \epsilon A$ for sufficiently small $\epsilon$, but since you don't have a lower bound for the smallest eigenvalue you can't be sure that $\epsilon$ is sufficiently small. And in any case this might amplify the numerical error you incur. – Rahul Mar 17 '14 at 3:52
Have you looked at the second argument of Eigenvectors? (I don't know if this is necessarily efficient...) – R. M. Mar 17 '14 at 3:55
@rm-rf, I thought of that but that's assuming the eigenvectors will be returned sorted by eigenvalue, which may not be the case. – RunnyKine Mar 17 '14 at 3:56
@rm-rf I think Eigenvectors[Matrix,-1] will give me the eigenvector associated with the smallest eigenvalue in magnitude. So in the example I gave in the question, this line of code will return the eigenvector associated with $1$, not $-10$. – SlipStream Mar 17 '14 at 3:58
@belisarius For large sparse matrix, mathematica will convert the matrix into a dense matrix when the second argument is not used. A dense $20000 \times 20000$ matrix just takes too much memory. – SlipStream Mar 17 '14 at 4:50
up vote 21 down vote accepted

You can always modify the matrix so that the most negative eigenvalue is also the one with the largest absolute value, and hence corresponds to the first in the list returned by EigenVectors.

An upper bound for the largest absolute value of any eigenvalue is the Hilbert-Schmidt norm. So you can rescale your matrix by subtracting this norm times the unit matrix. The eigenvalues will then be guaranteed to be no larger than zero, and therefore the most negative eigenvalue is the one with the largest absolute value.

Here I do this with the random matrix d, nicely constructed by @belisarius to be symmetric:

d = (# + Transpose@#) &@N@RandomInteger[{-10, 10}, {2000, 2000}];

nn = Norm[Flatten[d]]; 
Eigenvalues[d - nn IdentityMatrix[Dimensions[d]], 1] + nn

(* ==> {-762.081} *)

As mentioned, you can then also get the eigenvector this way:

ev = Eigenvectors[d - nn IdentityMatrix[Dimensions[d]], 1];

Update: version 10

In Mathematica version 10, there is another way to get the largest or smallest eigenvalues: using a Method setting with non-default "Criteria":

-Eigenvalues[-d, 1, Method -> {"Arnoldi", "Criteria" -> "RealPart"}]

(* ==> {-762.081} *)

The Arnoldi method is used when only a few eigenvalues of a large matrix are needed. By default it uses the "Magnitude" as the criteria for finding these eigenvalues. But if you specify "RealPart" instead, the eigenvalue with the largest real part is found. Since we wanted the smallest real part, I simply reversed the sign of the matrix and undid that reversal in the end.

share|improve this answer

The function sortify[] given in this question:

Should eigenvalues be ordered?

Tells you how to sort the eigenvalues AND eigenvectors in the canonical order for real numbers.

share|improve this answer
For the problem in this question, sorting the eigenvalues after the fact would be prohibitively slow. – Jens Sep 8 '14 at 15:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.