# Enumeration of the roots of a polynomial

In Root[f,k], how exactly are the roots of a polynomial f enumerated?

The Mathematica manual seems to only say that

The ordering used by Root[f,k] takes real roots to come before complex ones, and takes complex conjugate pairs of roots to be adjacent.

Of course, in general this does not completely determine the ordering/enumeration of the roots.

• Example of a real numeric root listed $\it{after}$ the numeric complex roots with MMA 12.0. Clear[a, b, c] ; Table[ FullSimplify[ ToRadicals@ Root[ (# - a) (# - b) (# - c) (#^5 + 32) &, k ], {a, b, c} \[Element] Reals], {k, 1, 8} ] Real symbolic roots also come last. – LouisB Feb 23 '20 at 21:18
• Strange example with only 3 complex roots (!) and they are sorted out of canonical order in MMA 12.0; Clear[a, b, c]; Table[ ToRadicals @ FullSimplify[ Root[ (# - a) (# - b) (# - c) (#^5 + 32) &, k ], {a, b, c} \[Element] Reals], {k, 1, 8} ] – LouisB Feb 23 '20 at 21:25
• @LouisB - The canonical ordering is done on the raw form, i.e., before you use the functions ToRadicals and FullSimplify. Similarly, Sort does not use N to sort numeric expressions unless you explicitly use SortBy[expr, N] – Bob Hanlon Feb 23 '20 at 22:59

sol = Solve[x^5 + x^3 + 1 == 0, x]


The roots are sorted in canonical order as verified by OrderedQ

OrderedQ@sol

(* True *)


The real roots are first, then the complex roots are sorted first by real part and then by imaginary part.

sol2 = Solve[x^5 + a x^3 + b == 0, x];


Again, the roots are sorted in canonical order

OrderedQ@sol2

(* True *)


Mathematica's canonical order is described in the documentation for Sort

• Thank you very much! I wish people like you wrote the manual. – Iosif Pinelis Feb 24 '20 at 1:04