8

Question

Are there general methods to compare the largest real roots of two integer-coefficient polynomials using only their expressions?

Example 1:
Consider:

  • $P_{1}\left ( x \right )= x^{5}- 20x^{4}+ 147x^{3}- 505x^{2}+ 784x- 432$
  • $P_{2}\left ( x \right )= x^{5}- 20x^{4}+ 146x^{3}- 498x^{2}+ 769x- 420$

Evaluations show $P_{1}$'s largest real root is in $\left ( 5.9, 5.95 \right )$, and $P_{2}$'s is in $\left ( 5.8, 5.9 \right )$, both less than $6$. At $x= 6$:

  • $P_{1}\left ( 6 \right )= -300$
  • $P_{1}\left ( 6 \right )= -3462$

Since $\left| P_{1}\left ( 6 \right ) \right|< \left| P_{2}\left ( 6 \right ) \right|$, $P_{1}\left ( x \right )$'s largest root seems closer to 6, suggesting it’s larger.

Example 2:
Consider:

  • $f_{1}\left ( x \right )= x^{3}- 17x^{2}+ 95x- 174$
  • $f_{2}\left ( x \right )= x^{3}- 17x^{2}+ 94x- 172$

Numerically, the largest roots are:

  • $\alpha_{1}\approx 5.92$
  • $\alpha_{2}\approx 5.85$

Near $x= 6$, $f_{1}\left ( x \right )> f_{2}\left ( x \right )$, suggesting $f_{1}$'s root is closer to $6$.

Question

Is there a general method to compare the largest real roots of two polynomials with integer coefficients, using only their coefficients, when the roots are less than a specific value? The inverse problem (Part III) suggests evaluating polynomials at a point. Is this reliable for determining which polynomial has the larger largest root?

Any references to similar problems would be appreciated. Thank you!


New question — when the power iteration method is insufficient for comparing the largest real roots, the question is here.

Dang Dang
  • 320
  • 2
    Are you sure the polynomials in Example 1 have roots less than $6$ and one near $6$? $P_1$'s largest (real) root is about $8.51$ and $P_2$'s is about $8.72$... – Eric Towers Apr 29 '25 at 15:23
  • @BenjaminWright Copy that, sir, thank you sincerely for pointing out my mistake. I've already corrected it. – Dang Dang Jun 18 '25 at 01:58
  • 1
    How about using Sturm's theorem or Vincent's theorem for real-root isolation? – Dilemian Jun 19 '25 at 09:43
  • @Dilemian Yes, I agree that we need something like the Cauchy bound for evaluation. Specifically, when both polynomials have the same degree and leading coefficient sign, we evaluate at a point greater than the Cauchy bound (to ensure it's beyond all roots). But in some cases like this problem where the polynomial degrees differ, I don't know how to proceed. – Dang Dang Jun 19 '25 at 09:59

2 Answers2

8

The companion matrix of a polynomial is a matrix having the polynomial as its characteristic polynomial.

The eigenvalues of a diagonalizable matrix are the roots of its characteristic polynomial. Be careful if one of the polynomials has a double (or higher multiplicity) largest root, since this breaks diagonalizability. (It turns out that multiplicity of the other, smaller, roots doesn't matter here.) Multiple roots can be detected: Let $f'$ be the derivative of the polynomial $f$. Then the polynomial GCD, $\mathrm{gcd}(f,f')$, has only the multiple roots of $f$ as roots. (Then use the method of this Answer to determine the GCD's largest real root to see if that's blinding the method. See here for more about detecting and possibly removing multiple roots.)

Power iteration can be used to find the largest eigenvalue, which is the largest root. Note that the companion matrix is sparse, so smarter than general purpose matrix multiplication can be used to find its products.

For your Example 1, the companion matrices are $$ c_1 = \begin{pmatrix} 0 & 0 & 0 & 0 & 432 \\ 1 & 0 & 0 & 0 & -784 \\ 0 & 1 & 0 & 0 & 505 \\ 0 & 0 & 1 & 0 & -147 \\ 0 & 0 & 0 & 1 & 20 \\ \end{pmatrix} $$ and $$ c_2 = \begin{pmatrix} 0 & 0 & 0 & 0 & 420 \\ 1 & 0 & 0 & 0 & -769 \\ 0 & 1 & 0 & 0 & 498 \\ 0 & 0 & 1 & 0 & -146 \\ 0 & 0 & 0 & 1 & 20 \\ \end{pmatrix} $$

Starting with the random vector $\begin{pmatrix} -4.83668 \\ -1.11942 \\ 0.47052 \\ -0.410958 \\ -1.86399 \end{pmatrix}$ and applying power iteration ten times, we get the vectors \begin{align*} v_1 &= \begin{pmatrix} -0.453067 \\ 0.768942 \\ -0.439173 \\ 0.102499 \\ -0.00891463 \end{pmatrix} \\ v_2 &= \begin{pmatrix} -0.448205 \\ 0.769188 \\ -0.443133 \\ 0.104923 \\ -0.00929481 \end{pmatrix} \end{align*} Then, dividing elementwise, and also comparing by (vector, Euclidean) norms, \begin{align*} \frac{c_1 \cdot v_1}{v_1} &= \begin{pmatrix} 8.5001{\dots} \\ 8.4999{\dots} \\ 8.4999{\dots} \\ 8.5003{\dots} \\ 8.5021{\dots} \end{pmatrix} \\ \frac{||c_1 \cdot v_1||}{||v_1||} &= 8.5000{\dots} \\ \frac{c_2 \cdot v_2}{v_2} &= \begin{pmatrix} 8.7098{\dots} \\ 8.7098{\dots} \\ 8.7098{\dots} \\ 8.7102{\dots} \\ 8.7116{\dots} \end{pmatrix} \\ \frac{||c_2 \cdot v_2||}{||v_2||} &= 8.70989{\dots} \end{align*} The agreement of the elementwise division tells us that ten iterations was sufficient. The norm tells us that the largest root of $P_1$ is near $8.50$ (limiting to the number of digits of agreement in the elementwise division). (The actual largest root of $P_1$ is $8.50828316{\dots}$.) Likewise, the largest root of $P_2$ is near $8.71$ (actual: $8.71565660{\dots}$). So the iteration has told us that $P_2$ has the largest real root.

Notes:

  • We cannot guarantee that the elementwise division gives a range of values containing the root -- the ratios could all be to one side of the root. However, the root is no further from the ends of that interval than the square root of the degree of the polynomial times the width of that interval (so constrained in an interval $1+2\sqrt{6}$ times wider than the range of ratios for this example).
  • One can re-use power iteration with its output to get a refinement of the eigenvector, which a corresponding refinement to the estimate of the largest eigenvalue (i.e., root). If the two estimated roots are too close (the interval of estimated locations overlaps), do this to refine the eigenvectors (to shrink the intervals until they don't overlap).
  • The "random vector" was five random floating point numbers chosen independently and uniformly from the interval $[-5,5]$. There is nothing magical about this particular interval and pretty much any interval (symmetric around $0$) can be used.
  • Power iteration can behave badly if the initial vector is perpendicular to the eigenvector with largest eigenvalue. One way to guard against this is to try a few random vectors (and make sure they're actually pointing in different directions).
Eric Towers
  • 70,953
  • 2
    Wow this is wild. I wonder why I've never seen this before. This feels like magic. – Cameron L. Williams Apr 29 '25 at 16:03
  • 1
    @CameronL.Williams : Well, ..., it can be slow for large degrees. And the "poor" bound on the location of the actual root isn't as nice as the rapid convergence for, say, Newton's method. I considered giving an answer for "simultaneous" Newton's method to detect the difference in direction of the root when the approximate root is between the roots. But this answer seemed more fun. – Eric Towers Apr 29 '25 at 16:05
  • 1
    Simultaneous Newton is also known as the Durand-Kerner method from the 1960s developed by Weierstraß in the 1850s. There is also the similar but higher-order Aberth-Ehrlich method. – Lutz Lehmann Apr 29 '25 at 16:47
  • My apologies, sir. I redirected my question, but I realize now that it may have also redirected yours. If my new question is unclear or distracting from your answer, I can edit it to include my original question. – Dang Dang Jun 17 '25 at 11:12
  • 1
    @DangDang : Well, the method in this Answer will still work for your revised Question. – Eric Towers Jun 17 '25 at 17:43
  • Yes, I understand. However, the power iteration method is not sufficient to prove $\lambda_{1}\left ( \ell \right )> \lambda_{2}\left ( \ell \right )$ for a general $\ell$. I see that the relationships in the highlighted parts are all linear, but I'm unsure how to use the companion matrix to prove this, or how to compare the convergence rates of the solutions. – Dang Dang Jun 18 '25 at 02:05
  • 2
    @DangDang : Then ... I might suggest that your total overhaul of the Question has changed it entirely and probably should have been submitted as a separate Question (especially since the original formulation had a responsive Answer). You might consider reverting the changes to this settled Question and posting the reformulation as a new Question. – Eric Towers Jun 18 '25 at 03:14
  • @EricTowers Yes, I have rolled back the original question and created a new one. Thank you very much, sir. – Dang Dang Jun 18 '25 at 04:20
3

With example 1, let $x_j$ be the largest real root of $P_j$. Note that $P_j(8)<0$ and $P_j(x)\to\infty$ as $x\to\infty$, hence $x_j>8$. By Descartes' rule of signs, the two polynomials $$P_1(x+8)=x^5+20x^4+147x^3+463x^2+448x-368$$ and $$P_2(x+8)=x^5+20x^4+146x^3+446x^2+353x-540$$ both have exactly one positive real root, whereas $$ P_1(x+8)-P_2(x+8) = x^3+17x^2+95x+172$$ has no positive real root and is positive for all positive $x$. It follows that $P_1$ becomes positive earlier than $P_2$, i.e., $x_1<x_2$.


The above method can be generalized to cases where we find a simple (preferably integer) value $a$ (here, $a=8$) such that both polynomials have at most one root in $(a,\infty$). In other words, polynomials with many nearby roots in a short interval may render this method less practical. On the other hand, multiple roots are less of a problem because these are roots of $\gcd(f(x), f'(x))$ of lower multiplicity and can be divided out /dealt with separately.

  • 1
    Yes, thanks to your solution, I realized that in the linked question, we always have that $q_{2}\left ( x, \ell \right )$ becomes positive earlier than $q_{1}\left ( x, \ell \right )$. Now I'm checking whether this is always equivalent to $\lambda_{1}\left ( \ell \right )> \lambda_{2}\left ( \ell \right )$. Thank you very, very much for your answer. – Dang Dang Jun 18 '25 at 05:58