# mathlib3documentation

analysis.calculus.deriv.comp

# One-dimensional derivatives of compositions of functions #

THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.

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

• has_deriv_at.comp etc: f : 𝕜' → 𝕜' composed with g : 𝕜 → 𝕜';
• has_deriv_at.scomp etc: f : 𝕜' → E composed with g : 𝕜 → 𝕜';
• has_fderiv_at.comp_has_deriv_at etc: f : E → F composed with g : 𝕜 → E;

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 has_deriv_at_filter.scomp {𝕜 : Type u} {F : Type v} [ F] (x : 𝕜) {L : filter 𝕜} {𝕜' : Type u_1} [ 𝕜'] [ F] [ 𝕜' F] {h : 𝕜 𝕜'} {h' : 𝕜'} {g₁ : 𝕜' F} {g₁' : F} {L' : filter 𝕜'} (hg : g₁' (h x) L') (hh : x L) (hL : L') :
has_deriv_at_filter (g₁ h) (h' g₁') x L
theorem has_deriv_within_at.scomp_has_deriv_at {𝕜 : Type u} {F : Type v} [ F] (x : 𝕜) {𝕜' : Type u_1} [ 𝕜'] [ F] [ 𝕜' F] {s' : set 𝕜'} {h : 𝕜 𝕜'} {h' : 𝕜'} {g₁ : 𝕜' F} {g₁' : F} (hg : g₁' s' (h x)) (hh : h' x) (hs : (x : 𝕜), h x s') :
has_deriv_at (g₁ h) (h' g₁') x
theorem has_deriv_within_at.scomp {𝕜 : Type u} {F : Type v} [ F] (x : 𝕜) {s : set 𝕜} {𝕜' : Type u_1} [ 𝕜'] [ F] [ 𝕜' F] {t' : set 𝕜'} {h : 𝕜 𝕜'} {h' : 𝕜'} {g₁ : 𝕜' F} {g₁' : F} (hg : g₁' t' (h x)) (hh : s x) (hst : s t') :
has_deriv_within_at (g₁ h) (h' g₁') s x
theorem has_deriv_at.scomp {𝕜 : Type u} {F : Type v} [ F] (x : 𝕜) {𝕜' : Type u_1} [ 𝕜'] [ F] [ 𝕜' F] {h : 𝕜 𝕜'} {h' : 𝕜'} {g₁ : 𝕜' F} {g₁' : F} (hg : g₁' (h x)) (hh : h' x) :
has_deriv_at (g₁ h) (h' g₁') x

The chain rule.

theorem has_strict_deriv_at.scomp {𝕜 : Type u} {F : Type v} [ F] (x : 𝕜) {𝕜' : Type u_1} [ 𝕜'] [ F] [ 𝕜' F] {h : 𝕜 𝕜'} {h' : 𝕜'} {g₁ : 𝕜' F} {g₁' : F} (hg : g₁' (h x)) (hh : x) :
has_strict_deriv_at (g₁ h) (h' g₁') x
theorem has_deriv_at.scomp_has_deriv_within_at {𝕜 : Type u} {F : Type v} [ F] (x : 𝕜) {s : set 𝕜} {𝕜' : Type u_1} [ 𝕜'] [ F] [ 𝕜' F] {h : 𝕜 𝕜'} {h' : 𝕜'} {g₁ : 𝕜' F} {g₁' : F} (hg : g₁' (h x)) (hh : s x) :
has_deriv_within_at (g₁ h) (h' g₁') s x
theorem deriv_within.scomp {𝕜 : Type u} {F : Type v} [ F] (x : 𝕜) {s : set 𝕜} {𝕜' : Type u_1} [ 𝕜'] [ F] [ 𝕜' F] {t' : set 𝕜'} {h : 𝕜 𝕜'} {g₁ : 𝕜' F} (hg : t' (h x)) (hh : x) (hs : s t') (hxs : x) :
deriv_within (g₁ h) s x = s x t' (h x)
theorem deriv.scomp {𝕜 : Type u} {F : Type v} [ F] (x : 𝕜) {𝕜' : Type u_1} [ 𝕜'] [ F] [ 𝕜' F] {h : 𝕜 𝕜'} {g₁ : 𝕜' F} (hg : g₁ (h x)) (hh : x) :
deriv (g₁ h) x = x deriv g₁ (h x)

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

theorem has_deriv_at_filter.comp_has_fderiv_at_filter {𝕜 : Type u} {E : Type w} [ E] {𝕜' : Type u_1} [ 𝕜'] {h₂ : 𝕜' 𝕜'} {h₂' : 𝕜'} {L' : filter 𝕜'} {f : E 𝕜'} {f' : E →L[𝕜] 𝕜'} (x : E) {L'' : filter E} (hh₂ : h₂' (f x) L') (hf : x L'') (hL : L'' L') :
has_fderiv_at_filter (h₂ f) (h₂' f') x L''
theorem has_strict_deriv_at.comp_has_strict_fderiv_at {𝕜 : Type u} {E : Type w} [ E] {𝕜' : Type u_1} [ 𝕜'] {h₂ : 𝕜' 𝕜'} {h₂' : 𝕜'} {f : E 𝕜'} {f' : E →L[𝕜] 𝕜'} (x : E) (hh : h₂' (f x)) (hf : x) :
has_strict_fderiv_at (h₂ f) (h₂' f') x
theorem has_deriv_at.comp_has_fderiv_at {𝕜 : Type u} {E : Type w} [ E] {𝕜' : Type u_1} [ 𝕜'] {h₂ : 𝕜' 𝕜'} {h₂' : 𝕜'} {f : E 𝕜'} {f' : E →L[𝕜] 𝕜'} (x : E) (hh : h₂' (f x)) (hf : f' x) :
has_fderiv_at (h₂ f) (h₂' f') x
theorem has_deriv_at.comp_has_fderiv_within_at {𝕜 : Type u} {E : Type w} [ E] {𝕜' : Type u_1} [ 𝕜'] {h₂ : 𝕜' 𝕜'} {h₂' : 𝕜'} {f : E 𝕜'} {f' : E →L[𝕜] 𝕜'} {s : set E} (x : E) (hh : h₂' (f x)) (hf : s x) :
has_fderiv_within_at (h₂ f) (h₂' f') s x
theorem has_deriv_within_at.comp_has_fderiv_within_at {𝕜 : Type u} {E : Type w} [ E] {𝕜' : Type u_1} [ 𝕜'] {h₂ : 𝕜' 𝕜'} {h₂' : 𝕜'} {f : E 𝕜'} {f' : E →L[𝕜] 𝕜'} {s : set E} {t : set 𝕜'} (x : E) (hh : h₂' t (f x)) (hf : s x) (hst : s t) :
has_fderiv_within_at (h₂ f) (h₂' f') s x

### Derivative of the composition of two scalar functions #

theorem has_deriv_at_filter.comp {𝕜 : Type u} (x : 𝕜) {L : filter 𝕜} {𝕜' : Type u_1} [ 𝕜'] {h : 𝕜 𝕜'} {h₂ : 𝕜' 𝕜'} {h' h₂' : 𝕜'} {L' : filter 𝕜'} (hh₂ : h₂' (h x) L') (hh : x L) (hL : L') :
has_deriv_at_filter (h₂ h) (h₂' * h') x L
theorem has_deriv_within_at.comp {𝕜 : Type u} (x : 𝕜) {s : set 𝕜} {𝕜' : Type u_1} [ 𝕜'] {s' : set 𝕜'} {h : 𝕜 𝕜'} {h₂ : 𝕜' 𝕜'} {h' h₂' : 𝕜'} (hh₂ : h₂' s' (h x)) (hh : s x) (hst : s s') :
has_deriv_within_at (h₂ h) (h₂' * h') s x
theorem has_deriv_at.comp {𝕜 : Type u} (x : 𝕜) {𝕜' : Type u_1} [ 𝕜'] {h : 𝕜 𝕜'} {h₂ : 𝕜' 𝕜'} {h' h₂' : 𝕜'} (hh₂ : h₂' (h x)) (hh : h' x) :
has_deriv_at (h₂ h) (h₂' * h') x

The chain rule.

theorem has_strict_deriv_at.comp {𝕜 : Type u} (x : 𝕜) {𝕜' : Type u_1} [ 𝕜'] {h : 𝕜 𝕜'} {h₂ : 𝕜' 𝕜'} {h' h₂' : 𝕜'} (hh₂ : h₂' (h x)) (hh : x) :
has_strict_deriv_at (h₂ h) (h₂' * h') x
theorem has_deriv_at.comp_has_deriv_within_at {𝕜 : Type u} (x : 𝕜) {s : set 𝕜} {𝕜' : Type u_1} [ 𝕜'] {h : 𝕜 𝕜'} {h₂ : 𝕜' 𝕜'} {h' h₂' : 𝕜'} (hh₂ : h₂' (h x)) (hh : s x) :
has_deriv_within_at (h₂ h) (h₂' * h') s x
theorem deriv_within.comp {𝕜 : Type u} (x : 𝕜) {s : set 𝕜} {𝕜' : Type u_1} [ 𝕜'] {s' : set 𝕜'} {h : 𝕜 𝕜'} {h₂ : 𝕜' 𝕜'} (hh₂ : s' (h x)) (hh : x) (hs : s s') (hxs : x) :
deriv_within (h₂ h) s x = s' (h x) * s x
theorem deriv.comp {𝕜 : Type u} (x : 𝕜) {𝕜' : Type u_1} [ 𝕜'] {h : 𝕜 𝕜'} {h₂ : 𝕜' 𝕜'} (hh₂ : h₂ (h x)) (hh : x) :
deriv (h₂ h) x = deriv h₂ (h x) * x
@[protected]
theorem has_deriv_at_filter.iterate {𝕜 : Type u} (x : 𝕜) {L : filter 𝕜} {f : 𝕜 𝕜} {f' : 𝕜} (hf : x L) (hL : L) (hx : f x = x) (n : ) :
(f' ^ n) x L
@[protected]
theorem has_deriv_at.iterate {𝕜 : Type u} (x : 𝕜) {f : 𝕜 𝕜} {f' : 𝕜} (hf : f' x) (hx : f x = x) (n : ) :
(f' ^ n) x
@[protected]
theorem has_deriv_within_at.iterate {𝕜 : Type u} (x : 𝕜) {s : set 𝕜} {f : 𝕜 𝕜} {f' : 𝕜} (hf : s x) (hx : f x = x) (hs : s s) (n : ) :
(f' ^ n) s x
@[protected]
theorem has_strict_deriv_at.iterate {𝕜 : Type u} (x : 𝕜) {f : 𝕜 𝕜} {f' : 𝕜} (hf : x) (hx : f x = x) (n : ) :
(f' ^ n) x

### Derivative of the composition of a function between vector spaces and a function on 𝕜#

theorem has_fderiv_within_at.comp_has_deriv_within_at {𝕜 : Type u} {F : Type v} [ F] {E : Type w} [ E] {f : 𝕜 F} {f' : F} (x : 𝕜) {s : set 𝕜} {l : F E} {l' : F →L[𝕜] E} {t : set F} (hl : t (f x)) (hf : s x) (hst : s t) :
has_deriv_within_at (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 has_fderiv_at.comp_has_deriv_within_at {𝕜 : Type u} {F : Type v} [ F] {E : Type w} [ E] {f : 𝕜 F} {f' : F} (x : 𝕜) {s : set 𝕜} {l : F E} {l' : F →L[𝕜] E} (hl : l' (f x)) (hf : s x) :
has_deriv_within_at (l f) (l' f') s x
theorem has_fderiv_at.comp_has_deriv_at {𝕜 : Type u} {F : Type v} [ F] {E : Type w} [ E] {f : 𝕜 F} {f' : F} (x : 𝕜) {l : F E} {l' : F →L[𝕜] E} (hl : l' (f x)) (hf : f' x) :
has_deriv_at (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 has_strict_fderiv_at.comp_has_strict_deriv_at {𝕜 : Type u} {F : Type v} [ F] {E : Type w} [ E] {f : 𝕜 F} {f' : F} (x : 𝕜) {l : F E} {l' : F →L[𝕜] E} (hl : (f x)) (hf : x) :
has_strict_deriv_at (l f) (l' f') x
theorem fderiv_within.comp_deriv_within {𝕜 : Type u} {F : Type v} [ F] {E : Type w} [ E] {f : 𝕜 F} (x : 𝕜) {s : set 𝕜} {l : F E} {t : set F} (hl : (f x)) (hf : x) (hs : s t) (hxs : x) :
deriv_within (l f) s x = l t (f x)) s x)
theorem fderiv.comp_deriv {𝕜 : Type u} {F : Type v} [ F] {E : Type w} [ E] {f : 𝕜 F} (x : 𝕜) {l : F E} (hl : (f x)) (hf : x) :
deriv (l f) x = (fderiv 𝕜 l (f x)) (deriv f x)