Theory of univariate polynomials #
We define the multiset of roots of a polynomial, and prove basic results about it.
Main definitions #
Polynomial.roots p
: The multiset containing all the roots ofp
, including their multiplicities.Polynomial.rootSet p E
: The set of distinct roots ofp
in an algebraE
.
Main statements #
Polynomial.C_leadingCoeff_mul_prod_multiset_X_sub_C
: If a polynomial has as many roots as its degree, it can be written as the product of its leading coefficient with∏ (X - a)
wherea
ranges through its roots.
roots p
noncomputably gives a multiset containing all the roots of p
,
including their multiplicities.
Equations
- p.roots = if h : p = 0 then ∅ else Classical.choose ⋯
Instances For
The multiset nthRoots ↑n (1 : R)
as a Finset.
Equations
- Polynomial.nthRootsFinset n R = (Polynomial.nthRoots n 1).toFinset
Instances For
Given a polynomial p
with coefficients in a ring T
and a T
-algebra S
, aroots p S
is
the multiset of roots of p
regarded as a polynomial over S
.
Equations
- p.aroots S = (Polynomial.map (algebraMap T S) p).roots
Instances For
The set of distinct roots of p
in S
.
If you have a non-separable polynomial, use Polynomial.aroots
for the multiset
where multiple roots have the appropriate multiplicity.
Equations
- p.rootSet S = ↑(p.aroots S).toFinset
Instances For
Equations
- p.rootSetFintype S = FinsetCoe.fintype (p.aroots S).toFinset
The set of roots of all polynomials of bounded degree and having coefficients in a finite set is finite.
The product ∏ (X - a)
for a
inside the multiset p.roots
divides p
.
A Galois connection.
A polynomial p
that has as many roots as its degree
can be written p = p.leadingCoeff * ∏(X - a)
, for a
in p.roots
.
A monic polynomial p
that has as many roots as its degree
can be written p = ∏(X - a)
, for a
in p.roots
.
To check a monic polynomial is irreducible, it suffices to check only for divisors that have smaller degree.
See also: Polynomial.Monic.irreducible_iff_natDegree
.