Documentation

Mathlib.Analysis.Calculus.DerivativeTest

The First-Derivative Test #

We prove the first-derivative test from calculus, in the strong form given on Wikipedia.

The test is proved over the real numbers ℝ using monotoneOn_of_deriv_nonneg from [Mathlib.Analysis.Calculus.MeanValue].

The Second-Derivative Test #

We prove the Second-Derivative Test using the First-Derivative Test. Source: Wikipedia.

Main results #

Tags #

derivative test, calculus

theorem isLocalMax_of_deriv_Ioo {f : } {a b c : } (g₀ : a < b) (g₁ : b < c) (h : ContinuousAt f b) (hd₀ : DifferentiableOn f (Set.Ioo a b)) (hd₁ : DifferentiableOn f (Set.Ioo b c)) (h₀ : xSet.Ioo a b, 0 deriv f x) (h₁ : xSet.Ioo b c, deriv f x 0) :

The First-Derivative Test from calculus, maxima version. Suppose a < b < c, f : ℝ → ℝ is continuous at b, the derivative f' is nonnegative on (a,b), and the derivative f' is nonpositive on (b,c). Then f has a local maximum at a.

theorem isLocalMin_of_deriv_Ioo {f : } {a b c : } (g₀ : a < b) (g₁ : b < c) (h : ContinuousAt f b) (hd₀ : DifferentiableOn f (Set.Ioo a b)) (hd₁ : DifferentiableOn f (Set.Ioo b c)) (h₀ : xSet.Ioo a b, deriv f x 0) (h₁ : xSet.Ioo b c, 0 deriv f x) :

The First-Derivative Test from calculus, minima version.

theorem isLocalMax_of_deriv' {f : } {b : } (h : ContinuousAt f b) (hd₀ : ∀ᶠ (x : ) in nhdsWithin b (Set.Iio b), DifferentiableAt f x) (hd₁ : ∀ᶠ (x : ) in nhdsWithin b (Set.Ioi b), DifferentiableAt f x) (h₀ : ∀ᶠ (x : ) in nhdsWithin b (Set.Iio b), 0 deriv f x) (h₁ : ∀ᶠ (x : ) in nhdsWithin b (Set.Ioi b), deriv f x 0) :

The First-Derivative Test from calculus, maxima version, expressed in terms of left and right filters.

theorem isLocalMin_of_deriv' {f : } {b : } (h : ContinuousAt f b) (hd₀ : ∀ᶠ (x : ) in nhdsWithin b (Set.Iio b), DifferentiableAt f x) (hd₁ : ∀ᶠ (x : ) in nhdsWithin b (Set.Ioi b), DifferentiableAt f x) (h₀ : ∀ᶠ (x : ) in nhdsWithin b (Set.Iio b), deriv f x 0) (h₁ : ∀ᶠ (x : ) in nhdsWithin b (Set.Ioi b), deriv f x 0) :

The First-Derivative Test from calculus, minima version, expressed in terms of left and right filters.

theorem isLocalMax_of_deriv {f : } {b : } (h : ContinuousAt f b) (hd : ∀ᶠ (x : ) in nhdsWithin b {b}, DifferentiableAt f x) (h₀ : ∀ᶠ (x : ) in nhdsWithin b (Set.Iio b), 0 deriv f x) (h₁ : ∀ᶠ (x : ) in nhdsWithin b (Set.Ioi b), deriv f x 0) :

The First Derivative test, maximum version.

theorem isLocalMin_of_deriv {f : } {b : } (h : ContinuousAt f b) (hd : ∀ᶠ (x : ) in nhdsWithin b {b}, DifferentiableAt f x) (h₀ : ∀ᶠ (x : ) in nhdsWithin b (Set.Iio b), deriv f x 0) (h₁ : ∀ᶠ (x : ) in nhdsWithin b (Set.Ioi b), 0 deriv f x) :

The First Derivative test, minimum version.

theorem eventually_nhdsWithin_sign_eq_of_deriv_pos {f : } {x₀ : } (hf : deriv f x₀ > 0) (hx : f x₀ = 0) :
∀ᶠ (x : ) in nhds x₀, SignType.sign (f x) = SignType.sign (x - x₀)

If the derivative of f is positive at a root x₀ of f, then locally the sign of f x matches x - x₀.

theorem eventually_nhdsWithin_sign_eq_of_deriv_neg {f : } {x₀ : } (hf : deriv f x₀ < 0) (hx : f x₀ = 0) :
∀ᶠ (x : ) in nhds x₀, SignType.sign (f x) = SignType.sign (x₀ - x)

If the derivative of f is negative at a root x₀ of f, then locally the sign of f x matches x₀ - x.

theorem deriv_neg_left_of_sign_deriv {f : } {x₀ : } (h₀ : ∀ᶠ (x : ) in nhdsWithin x₀ {x₀}, SignType.sign (deriv f x) = SignType.sign (x - x₀)) :
∀ᶠ (b : ) in nhdsWithin x₀ (Set.Iio x₀), deriv f b < 0
theorem deriv_neg_right_of_sign_deriv {f : } {x₀ : } (h₀ : ∀ᶠ (x : ) in nhdsWithin x₀ {x₀}, SignType.sign (deriv f x) = SignType.sign (x₀ - x)) :
∀ᶠ (b : ) in nhdsWithin x₀ (Set.Ioi x₀), deriv f b < 0
theorem deriv_pos_right_of_sign_deriv {f : } {x₀ : } (h₀ : ∀ᶠ (x : ) in nhdsWithin x₀ {x₀}, SignType.sign (deriv f x) = SignType.sign (x - x₀)) :
∀ᶠ (b : ) in nhdsWithin x₀ (Set.Ioi x₀), deriv f b > 0
theorem deriv_pos_left_of_sign_deriv {f : } {x₀ : } (h₀ : ∀ᶠ (x : ) in nhdsWithin x₀ {x₀}, SignType.sign (deriv f x) = SignType.sign (x₀ - x)) :
∀ᶠ (b : ) in nhdsWithin x₀ (Set.Iio x₀), deriv f b > 0
theorem isLocalMax_of_sign_deriv {f : } {x₀ : } (h : ContinuousAt f x₀) (hf : ∀ᶠ (x : ) in nhdsWithin x₀ {x₀}, SignType.sign (deriv f x) = SignType.sign (x₀ - x)) :
IsLocalMax f x₀

The First Derivative test with a hypothesis on the sign of the derivative, maximum version.

theorem isLocalMin_of_sign_deriv {f : } {x₀ : } (h : ContinuousAt f x₀) (hf : ∀ᶠ (x : ) in nhdsWithin x₀ {x₀}, SignType.sign (deriv f x) = SignType.sign (x - x₀)) :
IsLocalMin f x₀

The First Derivative test with a hypothesis on the sign of the derivative, minimum version.

theorem isLocalMin_of_deriv_deriv_pos {f : } {x₀ : } (hf : deriv (deriv f) x₀ > 0) (hd : deriv f x₀ = 0) (hc : ContinuousAt f x₀) :
IsLocalMin f x₀

The Second-Derivative Test from calculus, minimum version. Applies to functions like x^2 + 1[x ≥ 0] as well as twice differentiable functions.

theorem isLocalMax_of_deriv_deriv_neg {f : } {x₀ : } (hf : deriv (deriv f) x₀ < 0) (hd : deriv f x₀ = 0) (hc : ContinuousAt f x₀) :
IsLocalMax f x₀

The Second-Derivative Test from calculus, maximum version.