Documentation

Mathlib.Analysis.Calculus.Deriv.Comp

One-dimensional derivatives of compositions of functions #

In this file we prove the chain rule for the following cases:

Here π•œ is the base normed field, E and F are normed spaces over π•œ and π•œ' is an algebra over π•œ (e.g., π•œ'=π•œ or π•œ=ℝ, π•œ'=β„‚).

For a more detailed overview of one-dimensional derivatives in mathlib, see the module docstring of analysis/calculus/deriv/basic.

Keywords #

derivative, chain rule

Derivative of the composition of a vector function and a scalar function #

We use scomp in lemmas on composition of vector valued and scalar valued functions, and comp in lemmas on composition of scalar valued functions, in analogy for smul and mul (and also because the comp version with the shorter name will show up much more often in applications). The formula for the derivative involves smul in scomp lemmas, which can be reduced to usual multiplication in comp lemmas.

theorem HasDerivAtFilter.scomp {π•œ : Type u} [NontriviallyNormedField π•œ] {F : Type v} [NormedAddCommGroup F] [NormedSpace π•œ F] (x : π•œ) {L : Filter π•œ} {π•œ' : Type u_1} [NontriviallyNormedField π•œ'] [NormedAlgebra π•œ π•œ'] [NormedSpace π•œ' F] [IsScalarTower π•œ π•œ' F] {h : π•œ β†’ π•œ'} {h' : π•œ'} {g₁ : π•œ' β†’ F} {g₁' : F} {L' : Filter π•œ'} (hg : HasDerivAtFilter g₁ g₁' (h x) L') (hh : HasDerivAtFilter h h' x L) (hL : Filter.Tendsto h L L') :
HasDerivAtFilter (g₁ ∘ h) (h' β€’ g₁') x L
theorem HasDerivWithinAt.scomp_hasDerivAt {π•œ : Type u} [NontriviallyNormedField π•œ] {F : Type v} [NormedAddCommGroup F] [NormedSpace π•œ F] (x : π•œ) {π•œ' : Type u_1} [NontriviallyNormedField π•œ'] [NormedAlgebra π•œ π•œ'] [NormedSpace π•œ' F] [IsScalarTower π•œ π•œ' F] {s' : Set π•œ'} {h : π•œ β†’ π•œ'} {h' : π•œ'} {g₁ : π•œ' β†’ F} {g₁' : F} (hg : HasDerivWithinAt g₁ g₁' s' (h x)) (hh : HasDerivAt h h' x) (hs : βˆ€ (x : π•œ), h x ∈ s') :
HasDerivAt (g₁ ∘ h) (h' β€’ g₁') x
theorem HasDerivWithinAt.scomp {π•œ : Type u} [NontriviallyNormedField π•œ] {F : Type v} [NormedAddCommGroup F] [NormedSpace π•œ F] (x : π•œ) {s : Set π•œ} {π•œ' : Type u_1} [NontriviallyNormedField π•œ'] [NormedAlgebra π•œ π•œ'] [NormedSpace π•œ' F] [IsScalarTower π•œ π•œ' F] {t' : Set π•œ'} {h : π•œ β†’ π•œ'} {h' : π•œ'} {g₁ : π•œ' β†’ F} {g₁' : F} (hg : HasDerivWithinAt g₁ g₁' t' (h x)) (hh : HasDerivWithinAt h h' s x) (hst : Set.MapsTo h s t') :
HasDerivWithinAt (g₁ ∘ h) (h' β€’ g₁') s x
theorem HasDerivAt.scomp {π•œ : Type u} [NontriviallyNormedField π•œ] {F : Type v} [NormedAddCommGroup F] [NormedSpace π•œ F] (x : π•œ) {π•œ' : Type u_1} [NontriviallyNormedField π•œ'] [NormedAlgebra π•œ π•œ'] [NormedSpace π•œ' F] [IsScalarTower π•œ π•œ' F] {h : π•œ β†’ π•œ'} {h' : π•œ'} {g₁ : π•œ' β†’ F} {g₁' : F} (hg : HasDerivAt g₁ g₁' (h x)) (hh : HasDerivAt h h' x) :
HasDerivAt (g₁ ∘ h) (h' β€’ g₁') x

The chain rule.

theorem HasStrictDerivAt.scomp {π•œ : Type u} [NontriviallyNormedField π•œ] {F : Type v} [NormedAddCommGroup F] [NormedSpace π•œ F] (x : π•œ) {π•œ' : Type u_1} [NontriviallyNormedField π•œ'] [NormedAlgebra π•œ π•œ'] [NormedSpace π•œ' F] [IsScalarTower π•œ π•œ' F] {h : π•œ β†’ π•œ'} {h' : π•œ'} {g₁ : π•œ' β†’ F} {g₁' : F} (hg : HasStrictDerivAt g₁ g₁' (h x)) (hh : HasStrictDerivAt h h' x) :
HasStrictDerivAt (g₁ ∘ h) (h' β€’ g₁') x
theorem HasDerivAt.scomp_hasDerivWithinAt {π•œ : Type u} [NontriviallyNormedField π•œ] {F : Type v} [NormedAddCommGroup F] [NormedSpace π•œ F] (x : π•œ) {s : Set π•œ} {π•œ' : Type u_1} [NontriviallyNormedField π•œ'] [NormedAlgebra π•œ π•œ'] [NormedSpace π•œ' F] [IsScalarTower π•œ π•œ' F] {h : π•œ β†’ π•œ'} {h' : π•œ'} {g₁ : π•œ' β†’ F} {g₁' : F} (hg : HasDerivAt g₁ g₁' (h x)) (hh : HasDerivWithinAt h h' s x) :
HasDerivWithinAt (g₁ ∘ h) (h' β€’ g₁') s x
theorem derivWithin.scomp {π•œ : Type u} [NontriviallyNormedField π•œ] {F : Type v} [NormedAddCommGroup F] [NormedSpace π•œ F] (x : π•œ) {s : Set π•œ} {π•œ' : Type u_1} [NontriviallyNormedField π•œ'] [NormedAlgebra π•œ π•œ'] [NormedSpace π•œ' F] [IsScalarTower π•œ π•œ' F] {t' : Set π•œ'} {h : π•œ β†’ π•œ'} {g₁ : π•œ' β†’ F} (hg : DifferentiableWithinAt π•œ' g₁ t' (h x)) (hh : DifferentiableWithinAt π•œ h s x) (hs : Set.MapsTo h s t') (hxs : UniqueDiffWithinAt π•œ s x) :
derivWithin (g₁ ∘ h) s x = derivWithin h s x β€’ derivWithin g₁ t' (h x)
theorem deriv.scomp {π•œ : Type u} [NontriviallyNormedField π•œ] {F : Type v} [NormedAddCommGroup F] [NormedSpace π•œ F] (x : π•œ) {π•œ' : Type u_1} [NontriviallyNormedField π•œ'] [NormedAlgebra π•œ π•œ'] [NormedSpace π•œ' F] [IsScalarTower π•œ π•œ' F] {h : π•œ β†’ π•œ'} {g₁ : π•œ' β†’ F} (hg : DifferentiableAt π•œ' g₁ (h x)) (hh : DifferentiableAt π•œ h x) :
deriv (g₁ ∘ h) x = deriv h x β€’ deriv g₁ (h x)

Derivative of the composition of a scalar and vector functions #

theorem HasDerivAtFilter.comp_hasFDerivAtFilter {π•œ : Type u} [NontriviallyNormedField π•œ] {E : Type w} [NormedAddCommGroup E] [NormedSpace π•œ E] {π•œ' : Type u_1} [NontriviallyNormedField π•œ'] [NormedAlgebra π•œ π•œ'] {hβ‚‚ : π•œ' β†’ π•œ'} {hβ‚‚' : π•œ'} {L' : Filter π•œ'} {f : E β†’ π•œ'} {f' : E β†’L[π•œ] π•œ'} (x : E) {L'' : Filter E} (hhβ‚‚ : HasDerivAtFilter hβ‚‚ hβ‚‚' (f x) L') (hf : HasFDerivAtFilter f f' x L'') (hL : Filter.Tendsto f L'' L') :
HasFDerivAtFilter (hβ‚‚ ∘ f) (hβ‚‚' β€’ f') x L''
theorem HasStrictDerivAt.comp_hasStrictFDerivAt {π•œ : Type u} [NontriviallyNormedField π•œ] {E : Type w} [NormedAddCommGroup E] [NormedSpace π•œ E] {π•œ' : Type u_1} [NontriviallyNormedField π•œ'] [NormedAlgebra π•œ π•œ'] {hβ‚‚ : π•œ' β†’ π•œ'} {hβ‚‚' : π•œ'} {f : E β†’ π•œ'} {f' : E β†’L[π•œ] π•œ'} (x : E) (hh : HasStrictDerivAt hβ‚‚ hβ‚‚' (f x)) (hf : HasStrictFDerivAt f f' x) :
HasStrictFDerivAt (hβ‚‚ ∘ f) (hβ‚‚' β€’ f') x
theorem HasDerivAt.comp_hasFDerivAt {π•œ : Type u} [NontriviallyNormedField π•œ] {E : Type w} [NormedAddCommGroup E] [NormedSpace π•œ E] {π•œ' : Type u_1} [NontriviallyNormedField π•œ'] [NormedAlgebra π•œ π•œ'] {hβ‚‚ : π•œ' β†’ π•œ'} {hβ‚‚' : π•œ'} {f : E β†’ π•œ'} {f' : E β†’L[π•œ] π•œ'} (x : E) (hh : HasDerivAt hβ‚‚ hβ‚‚' (f x)) (hf : HasFDerivAt f f' x) :
HasFDerivAt (hβ‚‚ ∘ f) (hβ‚‚' β€’ f') x
theorem HasDerivAt.comp_hasFDerivWithinAt {π•œ : Type u} [NontriviallyNormedField π•œ] {E : Type w} [NormedAddCommGroup E] [NormedSpace π•œ E] {π•œ' : Type u_1} [NontriviallyNormedField π•œ'] [NormedAlgebra π•œ π•œ'] {hβ‚‚ : π•œ' β†’ π•œ'} {hβ‚‚' : π•œ'} {f : E β†’ π•œ'} {f' : E β†’L[π•œ] π•œ'} {s : Set E} (x : E) (hh : HasDerivAt hβ‚‚ hβ‚‚' (f x)) (hf : HasFDerivWithinAt f f' s x) :
HasFDerivWithinAt (hβ‚‚ ∘ f) (hβ‚‚' β€’ f') s x
theorem HasDerivWithinAt.comp_hasFDerivWithinAt {π•œ : Type u} [NontriviallyNormedField π•œ] {E : Type w} [NormedAddCommGroup E] [NormedSpace π•œ E] {π•œ' : Type u_1} [NontriviallyNormedField π•œ'] [NormedAlgebra π•œ π•œ'] {hβ‚‚ : π•œ' β†’ π•œ'} {hβ‚‚' : π•œ'} {f : E β†’ π•œ'} {f' : E β†’L[π•œ] π•œ'} {s : Set E} {t : Set π•œ'} (x : E) (hh : HasDerivWithinAt hβ‚‚ hβ‚‚' t (f x)) (hf : HasFDerivWithinAt f f' s x) (hst : Set.MapsTo f s t) :
HasFDerivWithinAt (hβ‚‚ ∘ f) (hβ‚‚' β€’ f') s x

Derivative of the composition of two scalar functions #

theorem HasDerivAtFilter.comp {π•œ : Type u} [NontriviallyNormedField π•œ] (x : π•œ) {L : Filter π•œ} {π•œ' : Type u_1} [NontriviallyNormedField π•œ'] [NormedAlgebra π•œ π•œ'] {h : π•œ β†’ π•œ'} {hβ‚‚ : π•œ' β†’ π•œ'} {h' : π•œ'} {hβ‚‚' : π•œ'} {L' : Filter π•œ'} (hhβ‚‚ : HasDerivAtFilter hβ‚‚ hβ‚‚' (h x) L') (hh : HasDerivAtFilter h h' x L) (hL : Filter.Tendsto h L L') :
HasDerivAtFilter (hβ‚‚ ∘ h) (hβ‚‚' * h') x L
theorem HasDerivWithinAt.comp {π•œ : Type u} [NontriviallyNormedField π•œ] (x : π•œ) {s : Set π•œ} {π•œ' : Type u_1} [NontriviallyNormedField π•œ'] [NormedAlgebra π•œ π•œ'] {s' : Set π•œ'} {h : π•œ β†’ π•œ'} {hβ‚‚ : π•œ' β†’ π•œ'} {h' : π•œ'} {hβ‚‚' : π•œ'} (hhβ‚‚ : HasDerivWithinAt hβ‚‚ hβ‚‚' s' (h x)) (hh : HasDerivWithinAt h h' s x) (hst : Set.MapsTo h s s') :
HasDerivWithinAt (hβ‚‚ ∘ h) (hβ‚‚' * h') s x
theorem HasDerivAt.comp {π•œ : Type u} [NontriviallyNormedField π•œ] (x : π•œ) {π•œ' : Type u_1} [NontriviallyNormedField π•œ'] [NormedAlgebra π•œ π•œ'] {h : π•œ β†’ π•œ'} {hβ‚‚ : π•œ' β†’ π•œ'} {h' : π•œ'} {hβ‚‚' : π•œ'} (hhβ‚‚ : HasDerivAt hβ‚‚ hβ‚‚' (h x)) (hh : HasDerivAt h h' x) :
HasDerivAt (hβ‚‚ ∘ h) (hβ‚‚' * h') x

The chain rule.

theorem HasStrictDerivAt.comp {π•œ : Type u} [NontriviallyNormedField π•œ] (x : π•œ) {π•œ' : Type u_1} [NontriviallyNormedField π•œ'] [NormedAlgebra π•œ π•œ'] {h : π•œ β†’ π•œ'} {hβ‚‚ : π•œ' β†’ π•œ'} {h' : π•œ'} {hβ‚‚' : π•œ'} (hhβ‚‚ : HasStrictDerivAt hβ‚‚ hβ‚‚' (h x)) (hh : HasStrictDerivAt h h' x) :
HasStrictDerivAt (hβ‚‚ ∘ h) (hβ‚‚' * h') x
theorem HasDerivAt.comp_hasDerivWithinAt {π•œ : Type u} [NontriviallyNormedField π•œ] (x : π•œ) {s : Set π•œ} {π•œ' : Type u_1} [NontriviallyNormedField π•œ'] [NormedAlgebra π•œ π•œ'] {h : π•œ β†’ π•œ'} {hβ‚‚ : π•œ' β†’ π•œ'} {h' : π•œ'} {hβ‚‚' : π•œ'} (hhβ‚‚ : HasDerivAt hβ‚‚ hβ‚‚' (h x)) (hh : HasDerivWithinAt h h' s x) :
HasDerivWithinAt (hβ‚‚ ∘ h) (hβ‚‚' * h') s x
theorem derivWithin.comp {π•œ : Type u} [NontriviallyNormedField π•œ] (x : π•œ) {s : Set π•œ} {π•œ' : Type u_1} [NontriviallyNormedField π•œ'] [NormedAlgebra π•œ π•œ'] {s' : Set π•œ'} {h : π•œ β†’ π•œ'} {hβ‚‚ : π•œ' β†’ π•œ'} (hhβ‚‚ : DifferentiableWithinAt π•œ' hβ‚‚ s' (h x)) (hh : DifferentiableWithinAt π•œ h s x) (hs : Set.MapsTo h s s') (hxs : UniqueDiffWithinAt π•œ s x) :
derivWithin (hβ‚‚ ∘ h) s x = derivWithin hβ‚‚ s' (h x) * derivWithin h s x
theorem deriv.comp {π•œ : Type u} [NontriviallyNormedField π•œ] (x : π•œ) {π•œ' : Type u_1} [NontriviallyNormedField π•œ'] [NormedAlgebra π•œ π•œ'] {h : π•œ β†’ π•œ'} {hβ‚‚ : π•œ' β†’ π•œ'} (hhβ‚‚ : DifferentiableAt π•œ' hβ‚‚ (h x)) (hh : DifferentiableAt π•œ h x) :
deriv (hβ‚‚ ∘ h) x = deriv hβ‚‚ (h x) * deriv h x
theorem HasDerivAtFilter.iterate {π•œ : Type u} [NontriviallyNormedField π•œ] (x : π•œ) {L : Filter π•œ} {f : π•œ β†’ π•œ} {f' : π•œ} (hf : HasDerivAtFilter f f' x L) (hL : Filter.Tendsto f L L) (hx : f x = x) (n : β„•) :
HasDerivAtFilter f^[n] (f' ^ n) x L
theorem HasDerivAt.iterate {π•œ : Type u} [NontriviallyNormedField π•œ] (x : π•œ) {f : π•œ β†’ π•œ} {f' : π•œ} (hf : HasDerivAt f f' x) (hx : f x = x) (n : β„•) :
HasDerivAt f^[n] (f' ^ n) x
theorem HasDerivWithinAt.iterate {π•œ : Type u} [NontriviallyNormedField π•œ] (x : π•œ) {s : Set π•œ} {f : π•œ β†’ π•œ} {f' : π•œ} (hf : HasDerivWithinAt f f' s x) (hx : f x = x) (hs : Set.MapsTo f s s) (n : β„•) :
HasDerivWithinAt f^[n] (f' ^ n) s x
theorem HasStrictDerivAt.iterate {π•œ : Type u} [NontriviallyNormedField π•œ] (x : π•œ) {f : π•œ β†’ π•œ} {f' : π•œ} (hf : HasStrictDerivAt f f' x) (hx : f x = x) (n : β„•) :

Derivative of the composition of a function between vector spaces and a function on π•œ #

theorem HasFDerivWithinAt.comp_hasDerivWithinAt {π•œ : Type u} [NontriviallyNormedField π•œ] {F : Type v} [NormedAddCommGroup F] [NormedSpace π•œ F] {E : Type w} [NormedAddCommGroup E] [NormedSpace π•œ E] {f : π•œ β†’ F} {f' : F} (x : π•œ) {s : Set π•œ} {l : F β†’ E} {l' : F β†’L[π•œ] E} {t : Set F} (hl : HasFDerivWithinAt l l' t (f x)) (hf : HasDerivWithinAt f f' s x) (hst : Set.MapsTo f s t) :
HasDerivWithinAt (l ∘ f) (l' f') s x

The composition l ∘ f where l : F β†’ E and f : π•œ β†’ F, has a derivative within a set equal to the FrΓ©chet derivative of l applied to the derivative of f.

theorem HasFDerivAt.comp_hasDerivWithinAt {π•œ : Type u} [NontriviallyNormedField π•œ] {F : Type v} [NormedAddCommGroup F] [NormedSpace π•œ F] {E : Type w} [NormedAddCommGroup E] [NormedSpace π•œ E] {f : π•œ β†’ F} {f' : F} (x : π•œ) {s : Set π•œ} {l : F β†’ E} {l' : F β†’L[π•œ] E} (hl : HasFDerivAt l l' (f x)) (hf : HasDerivWithinAt f f' s x) :
HasDerivWithinAt (l ∘ f) (l' f') s x
theorem HasFDerivAt.comp_hasDerivAt {π•œ : Type u} [NontriviallyNormedField π•œ] {F : Type v} [NormedAddCommGroup F] [NormedSpace π•œ F] {E : Type w} [NormedAddCommGroup E] [NormedSpace π•œ E] {f : π•œ β†’ F} {f' : F} (x : π•œ) {l : F β†’ E} {l' : F β†’L[π•œ] E} (hl : HasFDerivAt l l' (f x)) (hf : HasDerivAt f f' x) :
HasDerivAt (l ∘ f) (l' f') x

The composition l ∘ f where l : F β†’ E and f : π•œ β†’ F, has a derivative equal to the FrΓ©chet derivative of l applied to the derivative of f.

theorem HasStrictFDerivAt.comp_hasStrictDerivAt {π•œ : Type u} [NontriviallyNormedField π•œ] {F : Type v} [NormedAddCommGroup F] [NormedSpace π•œ F] {E : Type w} [NormedAddCommGroup E] [NormedSpace π•œ E] {f : π•œ β†’ F} {f' : F} (x : π•œ) {l : F β†’ E} {l' : F β†’L[π•œ] E} (hl : HasStrictFDerivAt l l' (f x)) (hf : HasStrictDerivAt f f' x) :
HasStrictDerivAt (l ∘ f) (l' f') x
theorem fderivWithin.comp_derivWithin {π•œ : Type u} [NontriviallyNormedField π•œ] {F : Type v} [NormedAddCommGroup F] [NormedSpace π•œ F] {E : Type w} [NormedAddCommGroup E] [NormedSpace π•œ E] {f : π•œ β†’ F} (x : π•œ) {s : Set π•œ} {l : F β†’ E} {t : Set F} (hl : DifferentiableWithinAt π•œ l t (f x)) (hf : DifferentiableWithinAt π•œ f s x) (hs : Set.MapsTo f s t) (hxs : UniqueDiffWithinAt π•œ s x) :
derivWithin (l ∘ f) s x = (fderivWithin π•œ l t (f x)) (derivWithin f s x)
theorem fderiv.comp_deriv {π•œ : Type u} [NontriviallyNormedField π•œ] {F : Type v} [NormedAddCommGroup F] [NormedSpace π•œ F] {E : Type w} [NormedAddCommGroup E] [NormedSpace π•œ E] {f : π•œ β†’ F} (x : π•œ) {l : F β†’ E} (hl : DifferentiableAt π•œ l (f x)) (hf : DifferentiableAt π•œ f x) :
deriv (l ∘ f) x = (fderiv π•œ l (f x)) (deriv f x)