Is there any order to the symbolic eigenvalues of a matrix returned by the command Eigenvalues[...]?

While numerical eigenvalues are listed in descending order (i.e., $\lambda_1 \ge \lambda_2 \ge \cdots \ge \lambda_N $), this is not the case for functional eigenvalues (see two examples below). The examples suggest that the ordering may be the reverse, although this cannot be positively inferred from two examples. Do functional eigenvalues have the order $\lambda_1 \le \lambda_2 \le \cdots \lambda_N$, another ordering (based on eigenvectors, for instance), or no ordering at all?

Examples showing that functional eigenvalues are not sorted in descending order.

(1) As a trivial example,

Eigenvalues[{{Exp[x], Exp[x]}, {Exp[x], Exp[x]}}]

returns $\left\{0,2 e^x\right\}$. For real inputs, the latter is always greater than or equal to the former.

(2) As another example, consider

Eigenvalues[{{Exp[x], Exp[x]}, {Exp[x], Exp[x/2]}}]

which returns

$$\left\{\frac{1}{2} \left(e^{x/2}+e^x-e^{x/2} \sqrt{1-2 e^{x/2}+5 e^x}\right),\frac{1}{2} \left(e^{x/2}+e^x+e^{x/2} \sqrt{1-2 e^{x/2}+5 e^x}\right)\right\}.$$

Again, for real inputs, the latter is always greater than or equal to the former:

Plot[%, {x, -10, 10}]

enter image description here

  • $\begingroup$ Is this a duplicate? mathematica.stackexchange.com/q/1831/121 $\endgroup$
    – Mr.Wizard
    Commented Mar 20, 2012 at 18:05
  • $\begingroup$ How can they have any order if they are still symbolical? $\endgroup$
    – Rojo
    Commented Mar 20, 2012 at 18:11
  • $\begingroup$ The eigenvalues are functions. But they could still have an order. For instance, $\log 3x \ge \log 2x \ge \log x$. $\endgroup$
    – user001
    Commented Mar 20, 2012 at 18:18
  • $\begingroup$ But what if they were Sin[x] and Cos[x]? You'd have to use OrderedQ, like Sort does, which would sort them as {Cos[x], Sin[x]}. But then if you define x to be some number, the list will not be ordered for around half the possible values of x. $\endgroup$
    – acl
    Commented Mar 20, 2012 at 20:51
  • $\begingroup$ @acl: Right, in such a case, ordering by magnitude would not make any sense. But in cases like those posited above, there is clearly a function that is greater than or equal to the other. $\endgroup$
    – user001
    Commented Mar 20, 2012 at 20:53

2 Answers 2


My strong hunch is that when the eigenvalues cannot be treated as numbers, the eigenvalues are always ordered according to "Sort". Thus, they are sorted in MMA's "canonical" order, some of which is described in this question: https://mathematica.stackexchange.com/a/2730/360.

For your specific example:

In[48]:= Sort[{Log[x], Log[2 x], Log[3 x]}]

Out[48]= {Log[x], Log[2 x], Log[3 x]}

In[49]:= Sort@Eigenvalues[{{Exp[x], Exp[x]}, {Exp[x], Exp[x/2]}}] == 
 Eigenvalues[{{Exp[x], Exp[x]}, {Exp[x], Exp[x/2]}}]

Out[49]= True

For mixed eigenvalues, the numeric ones are listed first:

In[63]:= m = ({{1000, 0, 1}, {1, Log[3 x], 0}, {0, 0, Log[2 x]}});

Out[64]= {1000, Log[2 x], Log[3 x]}
  • 1
    $\begingroup$ That's what I thought too, but didn't answer because I couldn't convincingly explain why this list: {Log[x] - Exp[x], Log[99 x], Log[x]} is sorted as {Log[x], Log[x] - Exp[x], Log[99 x]} — i.e., why isn't Log[x] - Exp[x] the last? Looking at TreeForm, Length and LeafCount of the list above all remain unconvincing thus far (to me)... $\endgroup$
    – rm -rf
    Commented Mar 20, 2012 at 19:26
  • $\begingroup$ Well, if it compares depth first, Log[x] only has x at the deepest level. Then it compares {e,x} and {99,x} and e<99 so it goes first. At least that would be my argument. But that is more of a post-hoc argument, since I thought that it compares at the same level. $\endgroup$
    – tkott
    Commented Mar 20, 2012 at 19:32
  • $\begingroup$ But that's not what the Sort documentation says... it says it sorts by length first and then, in case of a tie, it compares depth first. "Sort usually orders expressions by putting shorter ones first, and then comparing parts in a depth-first manner" $\endgroup$
    – rm -rf
    Commented Mar 20, 2012 at 19:39
  • $\begingroup$ @R.M oops missed that caveat. I guess my only defense is the "usually" in there :) $\endgroup$
    – tkott
    Commented Mar 20, 2012 at 19:41
  • 2
    $\begingroup$ ha, that "usually" is a stinker — WRI's get-out-of-jail card ;) $\endgroup$
    – rm -rf
    Commented Mar 20, 2012 at 19:46

From Documentation:


In the section "More information":

"If they are numeric, eigenvalues are sorted in order of decreasing absolute value."

Even when we have "exact" form (perhaps what you mean by symbolic) the are still sorted in decreasing order:

m = Partition[Sin[#] & /@ Range[9], 3]; m // MatrixForm

enter image description here

Eigenvalues[m] // FullSimplify // Column

enter image description here


Out[1]:= 0.0756954

================ Comment reply ================

Your specific case is easy to check:

m = ({{Log[3 x], 0, 1},{1, Log[x], 0},{0, 0, Log[2 x]}}); m // MatrixForm

enter image description here

In[1]:= ev = Eigenvalues[m]

Out[1]= {Log[x], Log[2 x], Log[3 x]}

So, you see, - it does not hold. It sorts them differently.

  • $\begingroup$ How about for symbolic eigenvalues that are functions? $\endgroup$
    – user001
    Commented Mar 20, 2012 at 18:19
  • $\begingroup$ @user001: Functions of what? And what do you mean when you ask in this case about sorting in descending order? $\endgroup$
    – murray
    Commented Mar 20, 2012 at 18:25
  • $\begingroup$ @murray: Suppose the eigenvalues were $\log x$, $\log 2x$, and $\log 3x$. I wish to know if the order returned by Mathematica would necessarily be $\log 3x$, $\log 2x$, $\log x$. $\endgroup$
    – user001
    Commented Mar 20, 2012 at 18:27
  • $\begingroup$ @VitaliyKaurov: The example you provided is still numerical, even if it is in symbolic form. $\endgroup$
    – user001
    Commented Mar 20, 2012 at 18:36
  • $\begingroup$ @user001: No, expressions such as Log[3x] are $not$ numeric, as you can directly check by using NumericQ. $\endgroup$
    – murray
    Commented Mar 21, 2012 at 20:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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