mathlib documentation

algebra.​quadratic_discriminant

algebra.​quadratic_discriminant

Quadratic discriminants and roots of a quadratic

This file defines the discriminant of a quadratic and gives the solution to a quadratic equation.

Main definition

The discriminant of a quadratic a*x*x + b*x + c is b*b - 4*a*c.

Main statements

• Roots of a quadratic can be written as (-b + s) / (2 * a) or (-b - s) / (2 * a), where s is the square root of the discriminant. • If the discriminant has no square root, then the corresponding quadratic has no root. • If a quadratic is always non-negative, then its discriminant is non-positive.

Tags

polynomial, quadratic, discriminant, root

theorem exists_le_mul_self {α : Type u_1} [linear_ordered_field α] (a : α) :
∃ (x : α), a x * x

theorem exists_lt_mul_self {α : Type u_1} [linear_ordered_field α] (a : α) :
∃ (x : α), a < x * x

def discrim {α : Type u_1} [linear_ordered_field α] [ring α] :
α → α → α → α

Discriminant of a quadratic

Equations
theorem quadratic_eq_zero_iff_discrim_eq_square {α : Type u_1} [linear_ordered_field α] {a b c : α} (ha : a 0) (x : α) :
a * x * x + b * x + c = 0 discrim a b c = (2 * a * x + b) ^ 2

A quadratic has roots if and only if its discriminant equals some square.

theorem quadratic_eq_zero_iff {α : Type u_1} [linear_ordered_field α] {a b c : α} (ha : a 0) {s : α} (h : discrim a b c = s * s) (x : α) :
a * x * x + b * x + c = 0 x = (-b + s) / (2 * a) x = (-b - s) / (2 * a)

Roots of a quadratic

theorem exist_quadratic_eq_zero {α : Type u_1} [linear_ordered_field α] {a b c : α} :
a 0(∃ (s : α), discrim a b c = s * s)(∃ (x : α), a * x * x + b * x + c = 0)

A quadratic has roots if its discriminant has square roots

theorem quadratic_eq_zero_iff_of_discrim_eq_zero {α : Type u_1} [linear_ordered_field α] {a b c : α} (ha : a 0) (h : discrim a b c = 0) (x : α) :
a * x * x + b * x + c = 0 x = -b / (2 * a)

Root of a quadratic when its discriminant equals zero

theorem quadratic_ne_zero_of_discrim_ne_square {α : Type u_1} [linear_ordered_field α] {a b c : α} (ha : a 0) (h : ∀ (s : α), discrim a b c s * s) (x : α) :
a * x * x + b * x + c 0

A quadratic has no root if its discriminant has no square root.

theorem discriminant_le_zero {α : Type u_1} [linear_ordered_field α] {a b c : α} :
(∀ (x : α), 0 a * x * x + b * x + c)discrim a b c 0

If a polynomial of degree 2 is always nonnegative, then its discriminant is nonpositive

theorem discriminant_lt_zero {α : Type u_1} [linear_ordered_field α] {a b c : α} :
a 0(∀ (x : α), 0 < a * x * x + b * x + c)discrim a b c < 0

If a polynomial of degree 2 is always positive, then its discriminant is negative, at least when the coefficient of the quadratic term is nonzero.