The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V15. Real analysis in one variable

Mathlib.Analysis.Calculus.LHopital

26 declarations. Mathlib docs · Source

L'Hôpital's rule for 0/0 indeterminate forms

In this file, we prove several forms of "L'Hôpital's rule" for computing 0/0 indeterminate forms. The proof of HasDerivAt.lhopital_zero_right_on_Ioo is based on the one given in the corresponding Wikibooks chapter, and all other statements are derived from this one by composing by carefully chosen functions.

Note that the filter f'/g' tends to isn't required to be one of 𝓝 a, atTop or atBot. In fact, we give a slightly stronger statement by allowing it to be any filter on ℝ.

Each statement is available in a HasDerivAt form and a deriv form, which is denoted by each statement being in either the HasDerivAt or the deriv namespace.

Tags

L'Hôpital's rule, L'Hopital's rule

Interval-based versions

We start by proving statements where all conditions (derivability, g' ≠ 0) have to be satisfied on an explicitly-provided interval.

Generic versions

The following statements no longer any explicit interval, as they only require conditions holding eventually.

theorem HasDerivAt.lhopital_zero_right_on_Ioo E1 #

∀ {a b : ℝ} {l : Filter ℝ} {f f' g g' : ℝ → ℝ},
  a < b →
    (∀ x ∈ Set.Ioo a b, HasDerivAt f (f' x) x) →
      (∀ x ∈ Set.Ioo a b, HasDerivAt g (g' x) x) →
        (∀ x ∈ Set.Ioo a b, g' x ≠ 0) →
          Filter.Tendsto f (nhdsWithin a (Set.Ioi a)) (nhds 0) →
            Filter.Tendsto g (nhdsWithin a (Set.Ioi a)) (nhds 0) →
              Filter.Tendsto (fun x ↦ f' x / g' x) (nhdsWithin a (Set.Ioi a)) l →
                Filter.Tendsto (fun x ↦ f x / g x) (nhdsWithin a (Set.Ioi a)) l

theorem HasDerivAt.lhopital_zero_right_on_Ico E1 #

∀ {a b : ℝ} {l : Filter ℝ} {f f' g g' : ℝ → ℝ},
  a < b →
    (∀ x ∈ Set.Ioo a b, HasDerivAt f (f' x) x) →
      (∀ x ∈ Set.Ioo a b, HasDerivAt g (g' x) x) →
        ContinuousOn f (Set.Ico a b) →
          ContinuousOn g (Set.Ico a b) →
            (∀ x ∈ Set.Ioo a b, g' x ≠ 0) →
              f a = 0 →
                g a = 0 →
                  Filter.Tendsto (fun x ↦ f' x / g' x) (nhdsWithin a (Set.Ioi a)) l →
                    Filter.Tendsto (fun x ↦ f x / g x) (nhdsWithin a (Set.Ioi a)) l

theorem HasDerivAt.lhopital_zero_left_on_Ioo E1 #

∀ {a b : ℝ} {l : Filter ℝ} {f f' g g' : ℝ → ℝ},
  a < b →
    (∀ x ∈ Set.Ioo a b, HasDerivAt f (f' x) x) →
      (∀ x ∈ Set.Ioo a b, HasDerivAt g (g' x) x) →
        (∀ x ∈ Set.Ioo a b, g' x ≠ 0) →
          Filter.Tendsto f (nhdsWithin b (Set.Iio b)) (nhds 0) →
            Filter.Tendsto g (nhdsWithin b (Set.Iio b)) (nhds 0) →
              Filter.Tendsto (fun x ↦ f' x / g' x) (nhdsWithin b (Set.Iio b)) l →
                Filter.Tendsto (fun x ↦ f x / g x) (nhdsWithin b (Set.Iio b)) l

theorem HasDerivAt.lhopital_zero_left_on_Ioc E1 #

∀ {a b : ℝ} {l : Filter ℝ} {f f' g g' : ℝ → ℝ},
  a < b →
    (∀ x ∈ Set.Ioo a b, HasDerivAt f (f' x) x) →
      (∀ x ∈ Set.Ioo a b, HasDerivAt g (g' x) x) →
        ContinuousOn f (Set.Ioc a b) →
          ContinuousOn g (Set.Ioc a b) →
            (∀ x ∈ Set.Ioo a b, g' x ≠ 0) →
              f b = 0 →
                g b = 0 →
                  Filter.Tendsto (fun x ↦ f' x / g' x) (nhdsWithin b (Set.Iio b)) l →
                    Filter.Tendsto (fun x ↦ f x / g x) (nhdsWithin b (Set.Iio b)) l

theorem HasDerivAt.lhopital_zero_atTop_on_Ioi E1 #

∀ {a : ℝ} {l : Filter ℝ} {f f' g g' : ℝ → ℝ},
  (∀ x ∈ Set.Ioi a, HasDerivAt f (f' x) x) →
    (∀ x ∈ Set.Ioi a, HasDerivAt g (g' x) x) →
      (∀ x ∈ Set.Ioi a, g' x ≠ 0) →
        Filter.Tendsto f Filter.atTop (nhds 0) →
          Filter.Tendsto g Filter.atTop (nhds 0) →
            Filter.Tendsto (fun x ↦ f' x / g' x) Filter.atTop l → Filter.Tendsto (fun x ↦ f x / g x) Filter.atTop l

theorem HasDerivAt.lhopital_zero_atBot_on_Iio E1 #

∀ {a : ℝ} {l : Filter ℝ} {f f' g g' : ℝ → ℝ},
  (∀ x ∈ Set.Iio a, HasDerivAt f (f' x) x) →
    (∀ x ∈ Set.Iio a, HasDerivAt g (g' x) x) →
      (∀ x ∈ Set.Iio a, g' x ≠ 0) →
        Filter.Tendsto f Filter.atBot (nhds 0) →
          Filter.Tendsto g Filter.atBot (nhds 0) →
            Filter.Tendsto (fun x ↦ f' x / g' x) Filter.atBot l → Filter.Tendsto (fun x ↦ f x / g x) Filter.atBot l

theorem deriv.lhopital_zero_right_on_Ioo E1 #

∀ {a b : ℝ} {l : Filter ℝ} {f g : ℝ → ℝ},
  a < b →
    DifferentiableOn ℝ f (Set.Ioo a b) →
      (∀ x ∈ Set.Ioo a b, deriv g x ≠ 0) →
        Filter.Tendsto f (nhdsWithin a (Set.Ioi a)) (nhds 0) →
          Filter.Tendsto g (nhdsWithin a (Set.Ioi a)) (nhds 0) →
            Filter.Tendsto (fun x ↦ deriv f x / deriv g x) (nhdsWithin a (Set.Ioi a)) l →
              Filter.Tendsto (fun x ↦ f x / g x) (nhdsWithin a (Set.Ioi a)) l

theorem deriv.lhopital_zero_right_on_Ico E1 #

∀ {a b : ℝ} {l : Filter ℝ} {f g : ℝ → ℝ},
  a < b →
    DifferentiableOn ℝ f (Set.Ioo a b) →
      ContinuousOn f (Set.Ico a b) →
        ContinuousOn g (Set.Ico a b) →
          (∀ x ∈ Set.Ioo a b, deriv g x ≠ 0) →
            f a = 0 →
              g a = 0 →
                Filter.Tendsto (fun x ↦ deriv f x / deriv g x) (nhdsWithin a (Set.Ioi a)) l →
                  Filter.Tendsto (fun x ↦ f x / g x) (nhdsWithin a (Set.Ioi a)) l

theorem deriv.lhopital_zero_left_on_Ioo E1 #

∀ {a b : ℝ} {l : Filter ℝ} {f g : ℝ → ℝ},
  a < b →
    DifferentiableOn ℝ f (Set.Ioo a b) →
      (∀ x ∈ Set.Ioo a b, deriv g x ≠ 0) →
        Filter.Tendsto f (nhdsWithin b (Set.Iio b)) (nhds 0) →
          Filter.Tendsto g (nhdsWithin b (Set.Iio b)) (nhds 0) →
            Filter.Tendsto (fun x ↦ deriv f x / deriv g x) (nhdsWithin b (Set.Iio b)) l →
              Filter.Tendsto (fun x ↦ f x / g x) (nhdsWithin b (Set.Iio b)) l

theorem deriv.lhopital_zero_atTop_on_Ioi E1 #

∀ {a : ℝ} {l : Filter ℝ} {f g : ℝ → ℝ},
  DifferentiableOn ℝ f (Set.Ioi a) →
    (∀ x ∈ Set.Ioi a, deriv g x ≠ 0) →
      Filter.Tendsto f Filter.atTop (nhds 0) →
        Filter.Tendsto g Filter.atTop (nhds 0) →
          Filter.Tendsto (fun x ↦ deriv f x / deriv g x) Filter.atTop l →
            Filter.Tendsto (fun x ↦ f x / g x) Filter.atTop l

theorem deriv.lhopital_zero_atBot_on_Iio E1 #

∀ {a : ℝ} {l : Filter ℝ} {f g : ℝ → ℝ},
  DifferentiableOn ℝ f (Set.Iio a) →
    (∀ x ∈ Set.Iio a, deriv g x ≠ 0) →
      Filter.Tendsto f Filter.atBot (nhds 0) →
        Filter.Tendsto g Filter.atBot (nhds 0) →
          Filter.Tendsto (fun x ↦ deriv f x / deriv g x) Filter.atBot l →
            Filter.Tendsto (fun x ↦ f x / g x) Filter.atBot l

theorem HasDerivAt.lhopital_zero_nhdsGT E1 #

∀ {a : ℝ} {l : Filter ℝ} {f f' g g' : ℝ → ℝ},
  (∀ᶠ (x : ℝ) in nhdsWithin a (Set.Ioi a), HasDerivAt f (f' x) x) →
    (∀ᶠ (x : ℝ) in nhdsWithin a (Set.Ioi a), HasDerivAt g (g' x) x) →
      (∀ᶠ (x : ℝ) in nhdsWithin a (Set.Ioi a), g' x ≠ 0) →
        Filter.Tendsto f (nhdsWithin a (Set.Ioi a)) (nhds 0) →
          Filter.Tendsto g (nhdsWithin a (Set.Ioi a)) (nhds 0) →
            Filter.Tendsto (fun x ↦ f' x / g' x) (nhdsWithin a (Set.Ioi a)) l →
              Filter.Tendsto (fun x ↦ f x / g x) (nhdsWithin a (Set.Ioi a)) l

L'Hôpital's rule for approaching a real from the right, HasDerivAt version

theorem HasDerivAt.lhopital_zero_nhdsLT E1 #

∀ {a : ℝ} {l : Filter ℝ} {f f' g g' : ℝ → ℝ},
  (∀ᶠ (x : ℝ) in nhdsWithin a (Set.Iio a), HasDerivAt f (f' x) x) →
    (∀ᶠ (x : ℝ) in nhdsWithin a (Set.Iio a), HasDerivAt g (g' x) x) →
      (∀ᶠ (x : ℝ) in nhdsWithin a (Set.Iio a), g' x ≠ 0) →
        Filter.Tendsto f (nhdsWithin a (Set.Iio a)) (nhds 0) →
          Filter.Tendsto g (nhdsWithin a (Set.Iio a)) (nhds 0) →
            Filter.Tendsto (fun x ↦ f' x / g' x) (nhdsWithin a (Set.Iio a)) l →
              Filter.Tendsto (fun x ↦ f x / g x) (nhdsWithin a (Set.Iio a)) l

L'Hôpital's rule for approaching a real from the left, HasDerivAt version

theorem HasDerivAt.lhopital_zero_nhdsNE E1 #

∀ {a : ℝ} {l : Filter ℝ} {f f' g g' : ℝ → ℝ},
  (∀ᶠ (x : ℝ) in nhdsWithin a {a}ᶜ, HasDerivAt f (f' x) x) →
    (∀ᶠ (x : ℝ) in nhdsWithin a {a}ᶜ, HasDerivAt g (g' x) x) →
      (∀ᶠ (x : ℝ) in nhdsWithin a {a}ᶜ, g' x ≠ 0) →
        Filter.Tendsto f (nhdsWithin a {a}ᶜ) (nhds 0) →
          Filter.Tendsto g (nhdsWithin a {a}ᶜ) (nhds 0) →
            Filter.Tendsto (fun x ↦ f' x / g' x) (nhdsWithin a {a}ᶜ) l →
              Filter.Tendsto (fun x ↦ f x / g x) (nhdsWithin a {a}ᶜ) l

L'Hôpital's rule for approaching a real, HasDerivAt version. This does not require anything about the situation at a

theorem HasDerivWithinAt.lhopital_zero_nhdsWithin_convex E1 #

∀ {a : ℝ} {l : Filter ℝ} {f f' g g' : ℝ → ℝ} {s : Set ℝ},
  Convex ℝ s →
    (∀ᶠ (x : ℝ) in nhdsWithin a (s \ {a}), HasDerivWithinAt f (f' x) (s \ {a}) x) →
      (∀ᶠ (x : ℝ) in nhdsWithin a (s \ {a}), HasDerivWithinAt g (g' x) (s \ {a}) x) →
        (∀ᶠ (x : ℝ) in nhdsWithin a (s \ {a}), g' x ≠ 0) →
          Filter.Tendsto f (nhdsWithin a (s \ {a})) (nhds 0) →
            Filter.Tendsto g (nhdsWithin a (s \ {a})) (nhds 0) →
              Filter.Tendsto (fun x ↦ f' x / g' x) (nhdsWithin a (s \ {a})) l →
                Filter.Tendsto (fun x ↦ f x / g x) (nhdsWithin a (s \ {a})) l

L'Hôpital's rule for approaching a real from within a convex set, HasDerivWithinAt version. This does not require anything about the situation at a

theorem HasDerivAt.lhopital_zero_nhds E1 #

∀ {a : ℝ} {l : Filter ℝ} {f f' g g' : ℝ → ℝ},
  (∀ᶠ (x : ℝ) in nhds a, HasDerivAt f (f' x) x) →
    (∀ᶠ (x : ℝ) in nhds a, HasDerivAt g (g' x) x) →
      (∀ᶠ (x : ℝ) in nhds a, g' x ≠ 0) →
        Filter.Tendsto f (nhds a) (nhds 0) →
          Filter.Tendsto g (nhds a) (nhds 0) →
            Filter.Tendsto (fun x ↦ f' x / g' x) (nhds a) l → Filter.Tendsto (fun x ↦ f x / g x) (nhdsWithin a {a}ᶜ) l

L'Hôpital's rule for approaching a real, HasDerivAt version

theorem HasDerivAt.lhopital_zero_atTop E1 #

∀ {l : Filter ℝ} {f f' g g' : ℝ → ℝ},
  (∀ᶠ (x : ℝ) in Filter.atTop, HasDerivAt f (f' x) x) →
    (∀ᶠ (x : ℝ) in Filter.atTop, HasDerivAt g (g' x) x) →
      (∀ᶠ (x : ℝ) in Filter.atTop, g' x ≠ 0) →
        Filter.Tendsto f Filter.atTop (nhds 0) →
          Filter.Tendsto g Filter.atTop (nhds 0) →
            Filter.Tendsto (fun x ↦ f' x / g' x) Filter.atTop l → Filter.Tendsto (fun x ↦ f x / g x) Filter.atTop l

L'Hôpital's rule for approaching +∞, HasDerivAt version

theorem HasDerivAt.lhopital_zero_atBot E1 #

∀ {l : Filter ℝ} {f f' g g' : ℝ → ℝ},
  (∀ᶠ (x : ℝ) in Filter.atBot, HasDerivAt f (f' x) x) →
    (∀ᶠ (x : ℝ) in Filter.atBot, HasDerivAt g (g' x) x) →
      (∀ᶠ (x : ℝ) in Filter.atBot, g' x ≠ 0) →
        Filter.Tendsto f Filter.atBot (nhds 0) →
          Filter.Tendsto g Filter.atBot (nhds 0) →
            Filter.Tendsto (fun x ↦ f' x / g' x) Filter.atBot l → Filter.Tendsto (fun x ↦ f x / g x) Filter.atBot l

L'Hôpital's rule for approaching -∞, HasDerivAt version

theorem derivWithin.lhopital_zero_nhdsWithin_convex E1 #

∀ {a : ℝ} {l : Filter ℝ} {f g : ℝ → ℝ} {s : Set ℝ},
  Convex ℝ s →
    (∀ᶠ (x : ℝ) in nhdsWithin a (s \ {a}), DifferentiableWithinAt ℝ f (s \ {a}) x) →
      (∀ᶠ (x : ℝ) in nhdsWithin a (s \ {a}), derivWithin g (s \ {a}) x ≠ 0) →
        Filter.Tendsto f (nhdsWithin a (s \ {a})) (nhds 0) →
          Filter.Tendsto g (nhdsWithin a (s \ {a})) (nhds 0) →
            Filter.Tendsto (fun x ↦ derivWithin f (s \ {a}) x / derivWithin g (s \ {a}) x) (nhdsWithin a (s \ {a})) l →
              Filter.Tendsto (fun x ↦ f x / g x) (nhdsWithin a (s \ {a})) l

L'Hôpital's rule for approaching a real from within a convex set, derivWithin version

theorem deriv.lhopital_zero_nhdsWithin_convex E1 #

∀ {a : ℝ} {l : Filter ℝ} {f g : ℝ → ℝ} {s : Set ℝ},
  Convex ℝ s →
    (∀ᶠ (x : ℝ) in nhdsWithin a (s \ {a}), DifferentiableAt ℝ f x) →
      (∀ᶠ (x : ℝ) in nhdsWithin a (s \ {a}), deriv g x ≠ 0) →
        Filter.Tendsto f (nhdsWithin a (s \ {a})) (nhds 0) →
          Filter.Tendsto g (nhdsWithin a (s \ {a})) (nhds 0) →
            Filter.Tendsto (fun x ↦ deriv f x / deriv g x) (nhdsWithin a (s \ {a})) l →
              Filter.Tendsto (fun x ↦ f x / g x) (nhdsWithin a (s \ {a})) l

L'Hôpital's rule for approaching a real from within a convex set, deriv version

theorem deriv.lhopital_zero_nhdsGT E1 #

∀ {a : ℝ} {l : Filter ℝ} {f g : ℝ → ℝ},
  (∀ᶠ (x : ℝ) in nhdsWithin a (Set.Ioi a), DifferentiableAt ℝ f x) →
    (∀ᶠ (x : ℝ) in nhdsWithin a (Set.Ioi a), deriv g x ≠ 0) →
      Filter.Tendsto f (nhdsWithin a (Set.Ioi a)) (nhds 0) →
        Filter.Tendsto g (nhdsWithin a (Set.Ioi a)) (nhds 0) →
          Filter.Tendsto (fun x ↦ deriv f x / deriv g x) (nhdsWithin a (Set.Ioi a)) l →
            Filter.Tendsto (fun x ↦ f x / g x) (nhdsWithin a (Set.Ioi a)) l

L'Hôpital's rule for approaching a real from the right, deriv version

theorem deriv.lhopital_zero_nhdsLT E1 #

∀ {a : ℝ} {l : Filter ℝ} {f g : ℝ → ℝ},
  (∀ᶠ (x : ℝ) in nhdsWithin a (Set.Iio a), DifferentiableAt ℝ f x) →
    (∀ᶠ (x : ℝ) in nhdsWithin a (Set.Iio a), deriv g x ≠ 0) →
      Filter.Tendsto f (nhdsWithin a (Set.Iio a)) (nhds 0) →
        Filter.Tendsto g (nhdsWithin a (Set.Iio a)) (nhds 0) →
          Filter.Tendsto (fun x ↦ deriv f x / deriv g x) (nhdsWithin a (Set.Iio a)) l →
            Filter.Tendsto (fun x ↦ f x / g x) (nhdsWithin a (Set.Iio a)) l

L'Hôpital's rule for approaching a real from the left, deriv version

theorem deriv.lhopital_zero_nhdsNE E1 #

∀ {a : ℝ} {l : Filter ℝ} {f g : ℝ → ℝ},
  (∀ᶠ (x : ℝ) in nhdsWithin a {a}ᶜ, DifferentiableAt ℝ f x) →
    (∀ᶠ (x : ℝ) in nhdsWithin a {a}ᶜ, deriv g x ≠ 0) →
      Filter.Tendsto f (nhdsWithin a {a}ᶜ) (nhds 0) →
        Filter.Tendsto g (nhdsWithin a {a}ᶜ) (nhds 0) →
          Filter.Tendsto (fun x ↦ deriv f x / deriv g x) (nhdsWithin a {a}ᶜ) l →
            Filter.Tendsto (fun x ↦ f x / g x) (nhdsWithin a {a}ᶜ) l

L'Hôpital's rule for approaching a real, deriv version. This does not require anything about the situation at a

theorem deriv.lhopital_zero_nhds E3 #

∀ {a : ℝ} {l : Filter ℝ} {f g : ℝ → ℝ},
  (∀ᶠ (x : ℝ) in nhds a, DifferentiableAt ℝ f x) →
    (∀ᶠ (x : ℝ) in nhds a, deriv g x ≠ 0) →
      Filter.Tendsto f (nhds a) (nhds 0) →
        Filter.Tendsto g (nhds a) (nhds 0) →
          Filter.Tendsto (fun x ↦ deriv f x / deriv g x) (nhds a) l →
            Filter.Tendsto (fun x ↦ f x / g x) (nhdsWithin a {a}ᶜ) l

L'Hôpital's rule for approaching a real, deriv version

theorem deriv.lhopital_zero_atTop E1 #

∀ {l : Filter ℝ} {f g : ℝ → ℝ},
  (∀ᶠ (x : ℝ) in Filter.atTop, DifferentiableAt ℝ f x) →
    (∀ᶠ (x : ℝ) in Filter.atTop, deriv g x ≠ 0) →
      Filter.Tendsto f Filter.atTop (nhds 0) →
        Filter.Tendsto g Filter.atTop (nhds 0) →
          Filter.Tendsto (fun x ↦ deriv f x / deriv g x) Filter.atTop l →
            Filter.Tendsto (fun x ↦ f x / g x) Filter.atTop l

L'Hôpital's rule for approaching +∞, deriv version

theorem deriv.lhopital_zero_atBot E1 #

∀ {l : Filter ℝ} {f g : ℝ → ℝ},
  (∀ᶠ (x : ℝ) in Filter.atBot, DifferentiableAt ℝ f x) →
    (∀ᶠ (x : ℝ) in Filter.atBot, deriv g x ≠ 0) →
      Filter.Tendsto f Filter.atBot (nhds 0) →
        Filter.Tendsto g Filter.atBot (nhds 0) →
          Filter.Tendsto (fun x ↦ deriv f x / deriv g x) Filter.atBot l →
            Filter.Tendsto (fun x ↦ f x / g x) Filter.atBot l

L'Hôpital's rule for approaching -∞, deriv version