I am interested in solving problems which involve finding the number of real roots of any polynomial.

Suppose I take a function $$f(x)=x^6+x^5+x^4+x^3+x^2+x+1$$ This does not have any real roots but I am trying to figure out if there is some analytical way that does not involve graphing to come to this conclusion.

Using Descartes' Rule of Signs, there are zero sign changes in $f$ so by virtue of which there are no positive roots to the polynomial. Considering $$f(-x) = x^6-x^5+x^4-x^3+x^2-x+1$$ I concluded that there are either 6 negative, 4 negative, 2 negative or zero negative roots. So I have 4 cases to consider :

  • 0 positive roots, 6 negative roots, 0 complex roots
  • 0 positive roots, 4 negative roots, 2 complex roots
  • 0 positive roots, 2 negative roots, 4 complex roots
  • 0 positive roots, 0 negative roots, 6 complex roots (The correct case)

I tried differentiating $f$ but the derivative is equally bad $$f'(x) = 6x^5+5x^4+4x^3+3x^2+2x+1$$ I am unable to conclude anything from this.

I tried going about the problem the other way. If a polynomial with an even degree is always positive or negative depending on the leading coefficient, it will not have any real roots but then again, finding the extrema of the function is proving to be extremely difficult.

I have tried using Bolzano's Intermediate Value Theorem. It guarantees the existence of at least one root but then again, there is a possibility that there might be more than one which can only be eliminated by monotonicity which again brings me back to the bad derivative.

I believe there need to be some general rules by virtue of which, we are able to calculate the number of roots for any polynomial.

  • Is graphing the best technique for polynomials like these and if it is, are there any ways by which a quick but accurate plot can be drawn?
  • While reading about the relevant theory, I came across Sturm's Method and the Newton-Raphson Method but haven't touched these yet. Is it absolutely required to know these concepts to effectively draw conclusions?
  • Have I missed something?

The best way to solve this is to use Sturm's theorem. This gives an algorithm for computing the number of distinct real roots of any polynomial. The Wikipedia page is quite good, but I'll outline the method here.

Let $f(x)$ be a polynomial. We define a sequence as follows: $$P_0=f$$ $$P_1=f'$$ $$P_{n+2}=-P_{n}\text{ mod }P_{n+1}$$ where $f'$ is the derivative of the polynomial and, for polynomials $P$ and $Q$, we define $P\text{ mod }Q$ to be the remainder of dividing $P$ by $Q$ - that is, the unique polynomial $R$ of degree less than $\deg Q$ such that $P=cQ+R$ for some other polynomial $c$. (This is also just the result you get by polynomial long division)

For instance, suppose we want to know how many roots $f(x)=x^3+2x+1$ has using this method - of course, we know the answer is $1$, but we should check. We get the following chain: $$P_0=x^3+2x+1$$ $$P_1=3x^2+2$$ $$P_2=-\frac{4}3x-1$$ $$P_3=\frac{-59}{16}.$$

For any real number $a$, we define $V(a)$ to be the number of sign changes in the sequence $P_0(a),P_1(a),P_2(a),P_3(a)$, where we ignore any zeros. Assuming neither $a$ or $b$ are themselves roots, Sturm's theorem states that $V(a)-V(b)$ is the number of real roots between $a$ and $b$.

Note that $V(-\infty)=\lim_{a\rightarrow-\infty}V(a)$ or $V(\infty)=\lim_{b\rightarrow\infty}V(b)$ are easy to compute by looking at the leading terms of each polynomial. For instance, here we have that $V(-\infty)=2$ since, towards $-\infty$ we have that $P_0$ tends to $-\infty$, $P_1$ to $\infty$, $P_2$ to $\infty$ and $P_3$ is negative - so two sign changes. Then $V(\infty)=1$ because $P_0$ and $P_1$ are positive near $\infty$ and $P_2$ and $P_3$ are negative. This polynomial has $V(-\infty)-V(\infty)=1$ roots, as expected, since it is an increasing function.

This can be a bit laborious to do by hand, but it always works for any polynomial.

The only trick to proving this, at least in the square-free case, is to consider what happens to sign changes in this sequence as one moves along the real line: The number of sign changes can only change near a root of one of the polynomials. However, note that, for some polynomial $c$, we have the following relationship: $$P_{n}=cP_{n+1}-P_{n+2}$$ Note that if $P_{n+1}$ has a root at a place where $P_n$ doesn't, then near that root, $P_n$ and $P_{n+2}$ must have opposite signs, since $P_n=-P_{n+2}$ at the root. So long as $P_0$ was squarefree (i.e. has no multiple roots), we can note that no consecutive terms share a root, so this always happens. As a result, the zero of $P_{n+1}$ does not affect the number of sign changes. However, if $P_0$ has a root, then the number of sign changes decreases by one there, since, near that root, $f$ and $f'$ have opposite signs prior to the root and equal signs after.

  • 1
    $\begingroup$ Just to add on the requirement that $f$ be squarefree: The multiple roots of $f$ are just the roots of the (more harmless) polynomial $\gcd(f,f')$ $\endgroup$ – Hagen von Eitzen May 5 at 5:22
  • $\begingroup$ Thank you for your suggestions. I went ahead and read about Sturm's Theorem. It is absolutely wonderful but what I observed was when I applied it to a polynomial, the steps where we are required to find the remainder took quite some time to compute $\endgroup$ – Aditya Sriram May 5 at 14:05

Your polynomial is a factor in $X^7-1 = (X-1)(X^6+X^5+X^4+X^3+X^2+X+1)$ and so the zeros are the 7th roots of units. There is only one 7th root of units which is real and this is $1$. The other are all complex.

  • $\begingroup$ Thanks for your response however I am looking for a generic method applicable to any polynomial not just the one above $\endgroup$ – Aditya Sriram May 4 at 14:34
  • 5
    $\begingroup$ @AdityaSriram: there isn't a generic method (or at least, nobody has found one). There are generic methods for some classes of polynomials (e.g. cyclotomic polynomials), but in general each case is sui generis. $\endgroup$ – NickD May 4 at 15:35
  • $\begingroup$ Seems to be an open question. $\endgroup$ – Wuestenfux May 4 at 15:37
  • 8
    $\begingroup$ @NickD That's not at all the case! This problem is very solved. I'll write an answer, but basically Sturm's theorem let one compute the number of real roots of any polynomial. $\endgroup$ – Milo Brandt May 4 at 18:43
  • $\begingroup$ @MiloBrandt: I'm looking forward to your answer! Thanks for the link too. $\endgroup$ – NickD May 4 at 19:52

While this method isn't guaranteed to work on all polynomials, it is surprisingly effective sometimes: notice that \begin{align*} [x^6+x^5+x^4+x^3+x^2+x+1] &= x^4\left(x+\tfrac{1}{2}\right)^2+\big[\tfrac{3}{4}x^4+x^3+x^2+x+1\big] \\ &= x^4\left(x+\tfrac{1}{2}\right)^2+\tfrac34x^2\left(x+\tfrac23\right)^2+\big[\tfrac{2}{3}x^2+x+1\big] \\ &= x^4\left(x+\tfrac{1}{2}\right)^2+\tfrac34x^2\left(x+\tfrac23\right)^2+\tfrac23\left(x+\tfrac34\right)^2+\tfrac58. \end{align*} (Each square was chosen to eliminate the top two terms of the preceding polynomial in square brackets; this is like "completing the square" from high school math.) In this form, the polynomial is clearly always positive.


There is a mild ambiguity in your problem statement. "the number of real roots" may, or may not, count multiple roots with multiplicity. For instance $x^2 = (x-0)^2$, has two indistinguishable roots at $0$, so you need to decide how you will account for repeated roots.

You could continue doing this with Descartes' Rule of signs and bisection through horizontally shifting your polynomial. But Sturm sequences are a much better way forward.

Regardless of your choice, you should arrange for all the roots of the polynomial to be simple roots (i.e., all have multiplicity $1$). So, first, we detect and eliminate repeated roots. Compute $$ g(x) = \gcd(f(x), f'(x)) \text{.} $$ If $g$ is a constant, then $f$ has no repeated roots. If $g$ is not a constant, Then we split to two subproblems: the real roots of $g$ are real roots of $f$ (with various multiplicites) and the real roots of $h(x) = f(x)/g(x)$ are simple real roots of $f$. For $g$, run the algorithm we are describing on it from the beginning. For $h$, proceed to the next step.

There are now two ways to proceed.

Method 1:

Shift your polynomial left and right and use Descarte's rule of signs to find out how many roots are to the left and right of zero. For instance, $$ h(x-1) = x^6 - 5 x^5 + 11 x^4 - 13 x^3 + 9 x^2 - 3x + 1 $$ has six sign changes. So all the real roots of $h$ lie between $-1$ and $0$. $h(x-1/2)$ has four sign changes, so at most two real zeroes lie in $(-1,-1/2)$ and at most four real zeroes lie in $(-1/2,0)$.

Now look at $h'(x)$ on the interval $(-1/2,0)$. We want to know if $h'$ has any roots in that interval, their multiplicity, and their locations, so we can determine whether the graph of $h$ looks more like $\pm(x^2+1)$ or $\pm(x^2-1)$ on that interval. (I have made no attempt to scale and shift these to that interval. Instead, we want to know if $h$ has zero or two roots and we will find out of $h$ is concave up or concave down on that interval.) Actually doing this can lead to a horrible tree of conditional cases.

Method 2:

Use Sturm's theorem. Construct the (Sturm) sequence of remainders in applying the Euclidean division algorithm to $h$ and $h'$. Let $V(\xi)$ be the number of sign alternations (ignoring zeroes) in the Sturm sequence when its members are evaluated at $x = \xi$. Then $V(ab) - V(b)$ is the number of real roots on the interval $(a,b]$.

  • $\begingroup$ I believe that would be $V(a) - V(b)$, at least according to the answer by Milo Brandt and wikipedia. $\endgroup$ – tomsmeding May 5 at 8:16
  • $\begingroup$ @tomsmeding : Thanks! I probably never would have caught that typo. $\endgroup$ – Eric Towers May 5 at 8:21



So, the roots of $f(x)=0$ are $e^{2m\pi i/7}$ where $m\equiv1,2,3,4,5,6\pmod7$

Now the imaginary part of $e^{2m\pi i/7}$ will be $0$ if $2m\pi/7=n\pi$ for some integer $n$

$\implies m=\dfrac{7n}2\implies n$ must be even $=2r$(say) $\implies7\mid m$

which gives a contradiction.

  • $\begingroup$ Thanks for your response however I am looking for a generic method applicable to any polynomial not just the one above $\endgroup$ – Aditya Sriram May 4 at 14:34
  • 1
    $\begingroup$ The question is clearly asking about the general case, using the given polynomial just as an example. This doesn't answer the question at all. $\endgroup$ – Nij May 4 at 21:46

Hint: $x=0$ is not a solution so we can write $$x^3+\frac{1}{x^3}+x+\frac{1}{x}+x^2+\frac{1}{x^2}+1$$ now substitute $$t=x+\frac{1}{x}$$ So you will get $$t^2-2=x^2+\frac{1}{x^2}$$ and $$t^3-3t=x^3+\frac{1}{x^3}$$

  • $\begingroup$ I appreciate your response but could you suggest some general techniques for solving such problems? $\endgroup$ – Aditya Sriram May 4 at 14:45
  • $\begingroup$ The question is clearly asking about the general case, using the given polynomial just as an example. This doesn't answer the question at all. $\endgroup$ – Nij May 4 at 21:44

Descarte's rule only gives you an upper bound. The method you are looking for is that of Sturm sequences (i.e. apply the Euclidean algorithm to the pair $(f(x),f'(x))$ and count the changes of sign across the intermediate polynomials).

If you want the number of real roots in $(-\infty,\infty)$, it suffices to consider the signs of the leading terms.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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