Descartes' Rule of Signs #
We define the "sign changes" in the coefficients of a polynomial, and prove Descartes' Rule of Signs: a real polynomial has at most as many positive roots as there are sign changes. A sign change is when there is a positive coefficient followed by a negative coefficient, or vice versa, with any number of zero coefficients in between.
Main Definitions #
Polynomial.signVariations
: The number of sign changes in a polynomial's coefficients, where0
coefficients are ignored.
Main theorem #
Polynomial.roots_countP_pos_le_signVariations
. States thatP.roots.countP (0 < ·) ≤ P.signVariations
, so that positive roots are counted with multiplicity. It's currently proved for anyCommRing
withIsStrictOrderedRing
. There is likely some correct statement in terms of a (noncommutative)Ring
, butPolynomial.roots
is only defined for commutative rings.
Reference #
Counts the number of times that the coefficients in a polynomial change sign, with the convention that 0 can count as either sign.
Equations
- P.signVariations = (List.destutter (fun (x1 x2 : SignType) => x1 ≠ x2) (List.filter (fun (x : SignType) => decide (x ≠ 0)) (List.map (⇑SignType.sign) P.coeffList))).length - 1
Instances For
Sign variations of a monomial are always zero.
If the first two signs are the same, then sign_variations is unchanged by eraseLead
If we drop the leading coefficient, the sign changes drop by 0 or 1 depending on whether the first two nonzero coeffients match.
We can only lose, not gain, sign changes if we drop the leading coefficient.
We can only lose at most one sign changes if we drop the leading coefficient.
The number of sign changes does not change if we negate.
The number of sign changes does not change if we multiply by any nonzero scalar.
If P's coefficients start with signs [+, -, ...]
, then multiplying by a binomial X - η
commutes with eraseLead
in the number of sign changes. This is because the product of
P
and X - η
has the pattern [+, -, ...]
as well, so then P.eraseLead
starts with
[-,...]
, and multiplying by X - η
gives [-, ...]
too.
This lemma is really a specialization of succ_signVariations_le_sub_mul
to monomials.
If a polynomial starts with two positive coefficients, then the sign changes in the product
(X - η) * P
is the same as (X - η) * P.eraseLead
. This lemma lets us do induction on the
degree of P when P starts with matching coefficient signs. Of course this is also true when the
first two coefficients of P are negative, but we just prove the case where they're positive
since it's cleaner and sufficient for the later use.
Multiplying a polynomial by a linear term X - η
adds at least one sign change. This is the
basis for the induction in roots_countP_pos_le_signVariations
.
Descartes' Rule of Signs: the number of positive roots is at most the number of sign variations.