Zulip Chat Archive

Stream: Is there code for X?

Topic: Sign of a quadratic polynomial


Vincent Beffara (Mar 24 2024 at 17:39):

Do we have in Mathlib that a real quadratic polynomial with negative discriminant and positive coefficient of degree zero (or two) is positive everywhere?

Vincent Beffara (Mar 24 2024 at 17:50):

example (a b c x : ) (ha : 0 < a) (hΔ : discrim a b c < 0) : 0 < a * x * x + b * x + c := by
  have l1 : a * x * x + b * x + c = a * (x + b / (2 * a)) ^ 2 - discrim a b c / (4 * a) := by
    field_simp [discrim] ; ring
  have l2 : 0 < - discrim a b c := by linarith
  rw [l1, sub_eq_add_neg,  neg_div] ; positivity

Last updated: May 02 2025 at 03:31 UTC