How Many Real Roots? A 19th-Century Algorithm That Never Fails
Counting Real Roots Without Solving: Sturm's Theorem How many real roots does the polynomial x^5 - 3x^2 + 1 have? Not how many complex roots — the Fundamental Theorem of Algebra...
Counting Real Roots Without Solving: Sturm's Theorem
How many real roots does the polynomial have? Not how many complex roots — the Fundamental Theorem of Algebra already answers that (five, with multiplicity). The real question is subtler: of those five, how many live on the real line?
Remarkably, there is an algorithm from 1829 that answers this exactly — without finding a single root, without graphing, and without any approximation. It is Sturm's Theorem, and it remains one of the most elegant results in classical algebra.
The Problem
The Fundamental Theorem of Algebra tells us a degree- polynomial has exactly roots in . But it gives no procedure to determine how many of them are real, or where they lie. Sturm's theorem fills exactly this gap:
Given a real polynomial , it counts the number of distinct real roots in any interval — and can isolate each root in an arbitrarily small interval.
The Sturm Sequence
Start with a square-free polynomial (if has repeated roots, just divide by first). Build a chain of polynomials using a sign-flipped version of the Euclidean algorithm:
In words: each new term is the negative of the remainder when you divide the previous two. Keep going until you reach a nonzero constant.
The Counting Rule
For a real number , let be the number of sign changes in the list
(skipping any zeros). Then the number of distinct real roots in is:
Taking and counts all real roots. At infinity, the sign of each is just the sign of its leading term.
Why does it work?
As increases past a root of , the leading pair loses exactly one sign change. The construction guarantees that passing a root of any inner term produces in . So decreases by exactly each time crosses a real root — counting them precisely.
A Worked Example
Let's count the real roots of
Step 1 — Build the Sturm sequence.
Dividing by leaves remainder , so
Dividing by leaves remainder , so (a positive constant).
Step 2 — Count all real roots (signs at ).
So all three roots are real! (Confirmed by the discriminant .)
Step 3 — Locate them. How many lie in ?
Exactly one root lies in . Indeed, the three roots are approximately — and only falls in that interval. ✓
What Sturm Misses: Multiplicity
There is one subtlety that trips up everyone the first time:
Sturm's theorem counts each real root only once, regardless of its multiplicity.
For , Sturm reports 2 real roots (the values and ), not 3. To count real roots , two classical tools complete the picture.
Tool 1 — Square-free decomposition (separating roots by multiplicity)
All repeated-root information lives in : a root of multiplicity in has multiplicity in , so it survives in the gcd. Writing
with each square-free (e.g. via Yun's algorithm, just repeated gcd's), the factor collects exactly the roots of multiplicity . Then:
and each "distinct real roots of " is found by ordinary Sturm (each is square-free).
Tool 2 — The Budan–Fourier theorem (counts with multiplicity directly)
Instead of Sturm's special chain, use the successive derivatives . If is the number of sign changes in that list, then the number of real roots in , , is
The parity is always correct, so it pins the count down up to an even slack.
Worked example:
Square-free decomposition. , and is the square-free part. Sturm on it gives real roots.
| factor | multiplicity | distinct real roots | contribution |
|---|---|---|---|
| 1 | 1 |
Total with multiplicity
Budan–Fourier cross-check. . Signs give and , so the count with multiplicity is . ✓ The double root is counted — exactly what Sturm does not do.
Complete Classification of a Cubic
A real cubic (with ) admits a remarkably clean classification, because its single
is also its center of symmetry — and any triple root must sit exactly there.
Two facts drive everything:
- A real cubic always has at least one real root (odd degree), so the "0 real roots" case is impossible.
- The discriminant detects multiple roots: iff has a repeated root.
| Sturm distinct count | Extra test | Real roots (with multiplicity) | Discriminant |
|---|---|---|---|
| 3 | — | (three simple) | |
| 2 | — (forced) | (one double + one simple) |
Notes.
- When Sturm gives 2, degree 3 forces the pattern — no extra test needed.
- The triple-root test only truly needs and ; the condition is automatic at the inflection point.
Examples. Triple root: with and . Double+simple: . Three distinct: . One real + two complex: (here , but ).
Quartics: Degree 4
For , two things change.
- Parity. Degree 4 is even, and complex roots come in conjugate pairs, so the number of real roots counted with multiplicity is always even: , , or .
- No single-point trick. Unlike the cubic, a quartic has (in general) two inflection points and no single center of symmetry, so the elegant "inflection-point" shortcut does not generalize. Instead, use the full toolkit: Sturm for the distinct count, square-free decomposition / Budan–Fourier for multiplicities, and the discriminant for a quick nature-of-roots check.
Sturm still works — worked example
This factors as , so we expect 4 distinct real roots.
✓ All four roots are real and distinct.
Quick classification by discriminant
Define the discriminant together with the auxiliary quantities
| Condition | Nature of the roots |
|---|---|
| 2 distinct real + 2 complex conjugate | |
For the example above, and with → , matching Sturm. ✓
Multiplicities for quartics
As with the cubic, recover multiplicities by combining Sturm with square-free decomposition (or Budan–Fourier). The possible real-root multiplicity patterns are the partitions of the real part of the root multiset:
| Sturm distinct | Possible multiplicity patterns (real part) |
|---|---|
| 4 | |
| 3 | |
| 2 | , or , or (+ a complex pair) |
Sturm alone cannot separate these — the discriminant table above (or a square-free decomposition) resolves which pattern actually occurs.
Why It Still Matters
For everyday computation, methods based on Descartes' Rule of Signs are faster. But Sturm's theorem has a unique virtue: it works over any real closed field, which makes it foundational for the theory of quantifier elimination and decidability in the first-order theory of the reals. It is also the oldest real-root isolation algorithm — the ancestor of the root-finders inside modern computer algebra systems.
Not bad for an idea from 1829.
References
- J. C. F. Sturm, Mémoire sur la résolution des équations numériques (1835).
- S. Basu, R. Pollack, M.-F. Roy, Algorithms in Real Algebraic Geometry, Springer (2006).
- H. Cohen, A Course in Computational Algebraic Number Theory, Springer.
- Sturm's theorem — Wikipedia
- Quartic function (nature of the roots) — Wikipedia