On this page
Say you want to know how many times x³ − 3x + 1 crosses the x-axis before you try to solve it. It has no rational roots (p(1) = −1, p(−1) = 3), so factoring fails. Sturm's theorem answers with nothing but division and counting signs. It is named after Jacques Charles François Sturm, whose paper *Mémoire sur la résolution des équations numériques*, on counting the real roots of an equation in an interval, was published in 1829 (MacTutor History of Mathematics).
What is a Sturm sequence?
The Sturm sequence of p starts with p and its derivative, and each later term is minus the remainder of dividing the two terms before it (Wikipedia: Sturm's theorem). As a recipe:
p₀ = p.
p₁ = p′.
Divide p₀ by p₁, take the remainder and flip its sign: that is p₂.
Repeat: p₃ = −(remainder of p₁ ÷ p₂), and so on.
Stop when you reach a constant.
It is the Euclidean algorithm for the HCF, run on polynomials, plus a minus sign at each step. Forget it and the count goes wrong.
How do you count real roots with Sturm's theorem?
Write V(x) for the number of sign changes in the list p₀(x), p₁(x), p₂(x), ..., ignoring any zeros. For a polynomial with no repeated roots and a < b, the number of distinct real roots in (a, b] is V(a) − V(b) (Wikipedia: Sturm's theorem). If p does have repeated roots, the same difference still counts the distinct roots, as long as neither a nor b is itself a repeated root.
To count every real root, use a = −∞ and b = +∞. There each term has the sign of its leading coefficient at +∞, and at −∞ that sign flipped if its degree is odd.
Keep the arithmetic in fractions. MathWorld warns that care is needed when computing the quotients, to avoid spurious results from roundoff (Wolfram MathWorld: Sturm function).
Worked example: how many real roots does x³ − 3x + 1 have?
Build the sequence:
p₀ = x³ − 3x + 1
p₁ = 3x² − 3
x³ − 3x + 1 = (x/3)(3x² − 3) + (−2x + 1), so p₂ = 2x − 1
3x² − 3 = (3x/2 + 3/4)(2x − 1) − 9/4, so p₃ = 9/4
Now list the signs of p₀, p₁, p₂, p₃ at a few points:
x → −∞: −, +, −, +, so V = 3
x = −2: values −1, 9, −5, 9/4, signs −, +, −, +, so V = 3
x = 0: values 1, −3, −1, 9/4, signs +, −, −, +, so V = 2
x = 2: values 3, 9, 3, 9/4, all +, so V = 0
x → +∞: all +, so V = 0
So V(−∞) − V(+∞) = 3 real roots in all: none below −2, one in (−2, 0] and two in (0, 2].
To separate those two, test x = 1: the values are −1, 0, 1, 9/4. Drop the zero and the signs −, +, + give V = 1. So (0, 1] and (1, 2] hold one root each, and each can now be closed in on by the bisection method, step by step.
Check it: put x = 2cos θ, and the cubic becomes 2cos 3θ + 1 = 0, so the roots are 2cos 40°, 2cos 80° and 2cos 160°, about 1.532, 0.347 and −1.879. Each lies where Sturm said it would.
Sturm's theorem vs Descartes' rule of signs: which should you use?
Descartes' rule of signs, from his *La Géométrie*, says the number of positive roots equals the number of sign changes in the coefficients, or is less than it by an even number (Wikipedia: Descartes' rule of signs). For negative roots, apply it to p(−x).
On our cubic, x³ − 3x + 1 has coefficient signs +, −, +: two changes, so 2 or 0 positive roots. p(−x) = −x³ + 3x + 1 has signs −, +, +: one change, so exactly one negative root. Descartes cannot tell 2 from 0. Sturm can: V(0) − V(+∞) = 2.
A simple way to choose:
Start with Descartes: it needs no division, and zero or one sign change gives an exact count.
Switch to Sturm when Descartes leaves a choice ("2 or 0"), or you need the count in an interval such as (0, 1].
In software, methods based on Descartes' rule are more efficient at isolating roots, so Sturm sequences are now rarely used for that job (Wikipedia: Sturm's theorem).
How can you practise this?
Try the recipe on x³ − x + 1 (one real root) and x³ − 6x + 2 (three), then confirm each with the discriminant. Sturm counts real roots only; the fundamental theorem of algebra accounts for the complex ones, and Newton's identities let you work with roots you never compute.
If a division step goes wrong, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer.



