# Root and ToRadical[Root] do not preserve order of roots

When I look for roots to a quartic polynomial of the form $A - B x^3 + Cx^4$ for positive $A$, $B$, and $C$, it seems that ToRadicals does not preserve the root order given by Root. Here is a minimal example:

In:= Table[ToRadicals[Root[A - B #1^3 + C #1^4 &, k]], {k, 1, 4}]/.{A -> 10., B -> 20., C -> 3.}
Out:= {-0.409172 - 0.660503 I, -0.409172 + 0.660503 I, 0.829652, 6.65536}

In:= Table[Root[A - B #1^3 + C #1^4 &, k], {k, 1, 4}] /. {A -> 10., B -> 20., C -> 3.}
Out:= {0.829652, 6.65536, -0.409172 - 0.660503 I, -0.409172 + 0.660503 I}


These are the same roots, in a different order. Can anyone explain this to me? Is it a piece of functionality I don't understand? Or just a bug? I am using version 11.0.1.0 on OS X.

If it is intended functionality, is there any way to predict which root of the function given by Root maps to which root of the function given by ToRadical[Root]?

Thanks!

-Ben

Update

Per J.M.'s suggestion, a cubic example with one parameter:

In:= Table[ToRadicals[Root[2 - #1 - 2 #1^2 + a #1^3 &, k]], {k, 1, 3}] /. a -> 1.
Out:= {2. - 1.11022*10^-16 I, -1. - 5.55112*10^-17 I, 1. + 1.11022*10^-16 I}
In:= Table[Root[2 - #1 - 2 #1^2 + a #1^3 &, k], {k, 1, 3}] /. a -> 1.
Out:= {-1., 1., 2.}

• Even the cubic case might be enlightening: consider a cubic polynomial with one parameter that can make it have one real root or three real roots (casus irreducibilis), and try the same experiments you did. – J. M.'s ennui Apr 13 '17 at 3:13

## 2 Answers

I was confused by this at first too. I believe the reason for this behaviour is that the ordering used by Root is based on the numerical value of the roots. Real ones come first, followed by complex conjugate pairs. Beyond this, they are sorted by real part.

Is there even a consistent way to sort them without taking the numerical value into account?

ToRadicals generates an explicit formula in terms of (possibly symbolic) coefficients. When the coefficients are symbolic, there may not be a way to consistently order the roots without knowing anything about the value of the coefficients. This is exactly the case in your 3rd order example. ToRadicals will generate three explicit formulas, but which one of these will yield a real value depends on the value of a. Thus this particular list of formulas cannot be ordered.

The documentation even has a similar example about 2nd order equations. Look under Scope.

These expand directly to formulas, even though the coefficients are symbolic:

{Root[a #^2 + b # + c &, 1], Root[a #^2 + b # + c &, 2]}


$$\left\{-\frac{1}{2} \sqrt{\frac{b^2-4 a c}{a^2}}-\frac{b}{2 a},\frac{1}{2} \sqrt{\frac{b^2-4 a c}{a^2}}-\frac{b}{2 a}\right\}$$

These formulas look a bit different from the "standard" ones. Writing them in this form ensures a consistent ordering, regardless of the values of a, b and c. This is not the case with the "standard" formulas:

Roots[a x^2 + b x + c == 0, x]


$$x=\frac{-\sqrt{b^2-4 a c}-b}{2 a}\lor x=\frac{\sqrt{b^2-4 a c}-b}{2 a}$$

% /. {{a -> 1, b -> -3, c -> 2}, {a -> -1, b -> 3, c -> -2}}
(* {x == 1 || x == 2, x == 2 || x == 1} *)


Root will not automatically expand when there is no consistent ordering. You can force generating formulas with ToRadicals, but then ordering may be lost.

To get the same ordering, consistently apply the replacements for A, B, and C directly to the Root objects

Table[ToRadicals[
Root[A - B #1^3 + C #1^4 &, k] /. {A -> 10, B -> 20, C -> 3}], {k, 1, 4}] // N

(*  {0.829652, 6.65536, -0.409172 - 0.660503 I, -0.409172 + 0.660503 I}  *)

Table[Root[A - B #1^3 + C #1^4 &, k] /. {A -> 10., B -> 20., C -> 3.}, {k, 1,
4}]

(*  {0.829652, 6.65536, -0.409172 - 0.660503 I, -0.409172 + 0.660503 I}  *)

Table[ToRadicals[Root[2 - #1 - 2 #1^2 + a #1^3 &, k] /. a -> 1], {k, 1, 3}]

(*  {-1, 1, 2}  *)

Table[Root[2 - #1 - 2 #1^2 + a #1^3 &, k] /. a -> 1., {k, 1, 3}]

(*  {-1., 1., 2.}  *)