Documentation

Mathlib.RingTheory.Polynomial.Resultant.Basic

Resultant of two polynomials #

This file contains basic facts about resultant of two polynomials over commutative rings.

Main definitions #

TODO #

def Polynomial.sylvester {R : Type u_1} [Semiring R] (f g : Polynomial R) (m n : ) :
Matrix (Fin (m + n)) (Fin (m + n)) R

The Sylvester matrix of two polynomials f and g of degrees m and n respectively is a (m+n) × (m+n) matrix with the coefficients of f and g arranged in a specific way. Here, m and n are free variables, not necessarily equal to the actual degrees of the polynomials f and g.

Note that the natural definition would be a Matrix (Fin (m + n)) (Fin m ⊕ Fin n) R but we prefer having this as a square matrix to take determinants later on.

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    @[simp]
    theorem Polynomial.sylvester_zero_left_deg {R : Type u_1} [Semiring R] (f g : Polynomial R) (m : ) :
    f.sylvester g 0 m = Matrix.diagonal fun (x : Fin (0 + m)) => f.coeff 0
    theorem Polynomial.sylvester_map_map {R : Type u_1} {S : Type u_2} [Semiring R] [Semiring S] (f g : Polynomial R) (m n : ) (φ : R →+* S) :
    (map φ f).sylvester (map φ g) m n = φ.mapMatrix (f.sylvester g m n)
    noncomputable def Polynomial.sylvesterDeriv {R : Type u_1} [Semiring R] (f : Polynomial R) :

    The Sylvester matrix for f and f.derivative, modified by dividing the bottom row by the leading coefficient of f. Important because its determinant is (up to a sign) the discriminant of f.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      We can get the usual Sylvester matrix of f and f.derivative back from the modified one by multiplying the last row by the leading coefficient of f.

      def Polynomial.resultant {R : Type u_1} [CommRing R] (f g : Polynomial R) (m : := f.natDegree) (n : := g.natDegree) :
      R

      The resultant of two polynomials f and g is the determinant of the Sylvester matrix of f and g. The size arguments m and n are implemented as optParam, meaning that the default values are f.natDegree and g.natDegree respectively, but they can also be specified to be other values.

      Equations
      Instances For
        @[simp]
        theorem Polynomial.resultant_map_map {R : Type u_1} {S : Type u_2} [CommRing R] [CommRing S] (f g : Polynomial R) (m n : ) (φ : R →+* S) :
        (map φ f).resultant (map φ g) m n = φ (f.resultant g m n)
        @[simp]
        theorem Polynomial.resultant_zero_left_deg {R : Type u_1} [CommRing R] (f g : Polynomial R) (m : ) :
        f.resultant g 0 m = f.coeff 0 ^ m
        theorem Polynomial.resultant_C_zero_left {R : Type u_1} [CommRing R] (g : Polynomial R) (r : R) (m : ) :
        (C r).resultant g 0 m = r ^ m

        For polynomial f and constant a, Res(f, a) = a ^ m.

        theorem Polynomial.resultant_comm {R : Type u_1} [CommRing R] (f g : Polynomial R) (m n : ) :
        f.resultant g m n = (-1) ^ (m * n) * g.resultant f n m

        Res(f, g) = (-1)ᵐⁿ Res(g, f)

        @[simp]
        theorem Polynomial.resultant_zero_right_deg {R : Type u_1} [CommRing R] (f g : Polynomial R) (m : ) :
        f.resultant g m 0 = g.coeff 0 ^ m
        theorem Polynomial.resultant_C_zero_right {R : Type u_1} [CommRing R] (f : Polynomial R) (m : ) (r : R) :
        f.resultant (C r) m 0 = r ^ m

        Res(a, g) = a ^ deg g

        @[simp]
        theorem Polynomial.resultant_zero_right {R : Type u_1} [CommRing R] (f : Polynomial R) (m n : ) :
        f.resultant 0 m n = 0 ^ m * f.coeff 0 ^ n
        @[simp]
        theorem Polynomial.resultant_zero_left {R : Type u_1} [CommRing R] (g : Polynomial R) (m n : ) :
        resultant 0 g m n = 0 ^ n * g.coeff 0 ^ m
        theorem Polynomial.resultant_zero_zero {R : Type u_1} [CommRing R] (m n : ) :
        resultant 0 0 m n = 0 ^ (m + n)
        theorem Polynomial.resultant_add_mul_right {R : Type u_1} [CommRing R] (f g p : Polynomial R) (m n : ) (hp : p.natDegree + m n) (hf : f.natDegree m) :
        f.resultant (g + f * p) m n = f.resultant g m n

        Res(f, g + fp) = Res(f, g) if deg f + deg p ≤ deg g.

        theorem Polynomial.resultant_add_mul_left {R : Type u_1} [CommRing R] (f g p : Polynomial R) (m n : ) (hk : p.natDegree + n m) (hg : g.natDegree n) :
        (f + g * p).resultant g m n = f.resultant g m n

        Res(f + gp, g) = Res(f, g) if deg g + deg p ≤ deg f.

        theorem Polynomial.resultant_C_mul_right {R : Type u_1} [CommRing R] (f g : Polynomial R) (m n : ) (r : R) :
        f.resultant (C r * g) m n = r ^ m * f.resultant g m n

        Res(f, a • g) = a ^ {deg f} * Res(f, g).

        theorem Polynomial.resultant_C_mul_left {R : Type u_1} [CommRing R] (f g : Polynomial R) (m n : ) (r : R) :
        (C r * f).resultant g m n = r ^ n * f.resultant g m n

        Res(a • f, g) = a ^ {deg g} * Res(f, g).

        theorem Polynomial.resultant_succ_left_deg {R : Type u_1} [CommRing R] (f g : Polynomial R) (m n : ) (hf : f.natDegree m) :
        f.resultant g (m + 1) n = (-1) ^ n * g.coeff n * f.resultant g m n
        theorem Polynomial.resultant_add_left_deg {R : Type u_1} [CommRing R] (f g : Polynomial R) (m n k : ) (hf : f.natDegree m) :
        f.resultant g (m + k) n = (-1) ^ (n * k) * g.coeff n ^ k * f.resultant g m n
        theorem Polynomial.resultant_add_right_deg {R : Type u_1} [CommRing R] (f g : Polynomial R) (m n k : ) (hg : g.natDegree n) :
        f.resultant g m (n + k) = f.coeff m ^ k * f.resultant g m n
        theorem Polynomial.resultant_eq_zero_of_lt_lt {R : Type u_1} [CommRing R] (f g : Polynomial R) (m n : ) (hf : f.natDegree < m) (hg : g.natDegree < n) :
        f.resultant g m n = 0
        @[simp]
        theorem Polynomial.resultant_C_left {R : Type u_1} [CommRing R] (g : Polynomial R) (m n : ) (r : R) :
        (C r).resultant g m n = (-1) ^ (m * n) * g.coeff n ^ m * r ^ n
        @[simp]
        theorem Polynomial.resultant_C_right {R : Type u_1} [CommRing R] (f : Polynomial R) (m n : ) (r : R) :
        f.resultant (C r) m n = f.coeff m ^ n * r ^ m
        @[simp]
        theorem Polynomial.resultant_one_left {R : Type u_1} [CommRing R] (g : Polynomial R) (m n : ) :
        resultant 1 g m n = (-1) ^ (m * n) * g.coeff n ^ m
        @[simp]
        theorem Polynomial.resultant_one_right {R : Type u_1} [CommRing R] (f : Polynomial R) (m n : ) :
        f.resultant 1 m n = f.coeff m ^ n
        theorem Polynomial.resultant_X_sub_C_left {R : Type u_1} [CommRing R] (g : Polynomial R) (n : ) (r : R) (hg : g.natDegree n) :
        (X - C r).resultant g 1 n = eval r g

        Res(X - r, g) = g(r)

        theorem Polynomial.resultant_X_sub_C_right {R : Type u_1} [CommRing R] (f : Polynomial R) (m : ) (r : R) (hf : f.natDegree m) :
        f.resultant (X - C r) m 1 = (-1) ^ m * eval r f

        Res(f, X - r) = (-1)^{deg f} * f(r)

        noncomputable def Polynomial.discr {R : Type u_1} [CommRing R] (f : Polynomial R) :
        R

        The discriminant of a polynomial, defined as the determinant of f.sylvesterDeriv modified by a sign. The sign is chosen so polynomials over with all roots real have non-negative discriminant.

        Equations
        Instances For
          @[deprecated Polynomial.discr (since := "2025-10-20")]
          def Polynomial.disc {R : Type u_1} [CommRing R] (f : Polynomial R) :
          R

          Alias of Polynomial.discr.


          The discriminant of a polynomial, defined as the determinant of f.sylvesterDeriv modified by a sign. The sign is chosen so polynomials over with all roots real have non-negative discriminant.

          Equations
          Instances For
            @[simp]
            theorem Polynomial.discr_C {R : Type u_1} [CommRing R] (r : R) :
            (C r).discr = 1

            The discriminant of a constant polynomial is 1.

            theorem Polynomial.discr_of_degree_eq_one {R : Type u_1} [CommRing R] {f : Polynomial R} (hf : f.degree = 1) :
            f.discr = 1

            The discriminant of a linear polynomial is 1.

            theorem Polynomial.discr_of_degree_eq_two {R : Type u_1} [CommRing R] {f : Polynomial R} (hf : f.degree = 2) :
            f.discr = f.coeff 1 ^ 2 - 4 * f.coeff 0 * f.coeff 2

            Standard formula for the discriminant of a quadratic polynomial.

            @[deprecated Polynomial.discr_C (since := "2025-10-20")]
            theorem Polynomial.disc_C {R : Type u_1} [CommRing R] (r : R) :
            (C r).discr = 1

            Alias of Polynomial.discr_C.


            The discriminant of a constant polynomial is 1.

            @[deprecated Polynomial.discr_of_degree_eq_one (since := "2025-10-20")]
            theorem Polynomial.disc_of_degree_eq_one {R : Type u_1} [CommRing R] {f : Polynomial R} (hf : f.degree = 1) :
            f.discr = 1

            Alias of Polynomial.discr_of_degree_eq_one.


            The discriminant of a linear polynomial is 1.

            @[deprecated Polynomial.discr_of_degree_eq_two (since := "2025-10-20")]
            theorem Polynomial.disc_of_degree_eq_two {R : Type u_1} [CommRing R] {f : Polynomial R} (hf : f.degree = 2) :
            f.discr = f.coeff 1 ^ 2 - 4 * f.coeff 0 * f.coeff 2

            Alias of Polynomial.discr_of_degree_eq_two.


            Standard formula for the discriminant of a quadratic polynomial.

            theorem Polynomial.resultant_deriv {R : Type u_1} [CommRing R] {f : Polynomial R} (hf : 0 < f.degree) :

            Relation between the resultant and the discriminant.

            (Note this is actually false when f is a constant polynomial not equal to 1, so the assumption on the degree is genuinely needed.)

            theorem Polynomial.discr_of_degree_eq_three {R : Type u_1} [CommRing R] {f : Polynomial R} (hf : f.degree = 3) :
            f.discr = f.coeff 2 ^ 2 * f.coeff 1 ^ 2 - 4 * f.coeff 3 * f.coeff 1 ^ 3 - 4 * f.coeff 2 ^ 3 * f.coeff 0 - 27 * f.coeff 3 ^ 2 * f.coeff 0 ^ 2 + 18 * f.coeff 3 * f.coeff 2 * f.coeff 1 * f.coeff 0

            Standard formula for the discriminant of a cubic polynomial.

            @[deprecated Polynomial.discr_of_degree_eq_three (since := "2025-10-20")]
            theorem Polynomial.disc_of_degree_eq_three {R : Type u_1} [CommRing R] {f : Polynomial R} (hf : f.degree = 3) :
            f.discr = f.coeff 2 ^ 2 * f.coeff 1 ^ 2 - 4 * f.coeff 3 * f.coeff 1 ^ 3 - 4 * f.coeff 2 ^ 3 * f.coeff 0 - 27 * f.coeff 3 ^ 2 * f.coeff 0 ^ 2 + 18 * f.coeff 3 * f.coeff 2 * f.coeff 1 * f.coeff 0

            Alias of Polynomial.discr_of_degree_eq_three.


            Standard formula for the discriminant of a cubic polynomial.