Documentation

Mathlib.Analysis.Calculus.FDeriv.Symmetric

Symmetry of the second derivative #

We show that, over the reals, the second derivative is symmetric.

The most precise result is Convex.second_derivative_within_at_symmetric. It asserts that, if a function is differentiable inside a convex set s with nonempty interior, and has a second derivative within s at a point x, then this second derivative at x is symmetric. Note that this result does not require continuity of the first derivative.

The following particular cases of this statement are especially relevant:

second_derivative_symmetric_of_eventually asserts that, if a function is differentiable on a neighborhood of x, and has a second derivative at x, then this second derivative is symmetric.

second_derivative_symmetric asserts that, if a function is differentiable, and has a second derivative at x, then this second derivative is symmetric.

There statements are given over โ„ or โ„‚, the general version being deduced from the real version. We also give statements in terms of fderiv and fderivWithin, called respectively ContDiffAt.isSymmSndFDerivAt and ContDiffWithinAt.isSymmSndFDerivWithinAt (the latter requiring that the point under consideration is accumulated by points in the interior of the set). These are written using ad hoc predicates IsSymmSndFDerivAt and IsSymmSndFDerivWithinAt, which increase readability of statements in differential geometry where they show up a lot.

Implementation note #

For the proof, we obtain an asymptotic expansion to order two of f (x + v + w) - f (x + v), by using the mean value inequality applied to a suitable function along the segment [x + v, x + v + w]. This expansion involves f'' โฌ w as we move along a segment directed by w (see Convex.taylor_approx_two_segment).

Consider the alternate sum f (x + v + w) + f x - f (x + v) - f (x + w), corresponding to the values of f along a rectangle based at x with sides v and w. One can write it using the two sides directed by w, as (f (x + v + w) - f (x + v)) - (f (x + w) - f x). Together with the previous asymptotic expansion, one deduces that it equals f'' v w + o(1) when v, w tends to 0. Exchanging the roles of v and w, one instead gets an asymptotic expansion f'' w v, from which the equality f'' v w = f'' w v follows.

In our most general statement, we only assume that f is differentiable inside a convex set s, so a few modifications have to be made. Since we don't assume continuity of f at x, we consider instead the rectangle based at x + v + w with sides v and w, in Convex.isLittleO_alternate_sum_square, but the argument is essentially the same. It only works when v and w both point towards the interior of s, to make sure that all the sides of the rectangle are contained in s by convexity. The general case follows by linearity, though.

def IsSymmSndFDerivWithinAt (๐•œ : Type u_1) [NontriviallyNormedField ๐•œ] {E : Type u_2} {F : Type u_3} [NormedAddCommGroup E] [NormedSpace ๐•œ E] [NormedAddCommGroup F] [NormedSpace ๐•œ F] (f : E โ†’ F) (s : Set E) (x : E) :

Definition recording that a function has a symmetric second derivative within a set at a point. This is automatic in most cases of interest (open sets over real or complex vector fields, or general case for analytic functions), but we can express theorems of calculus using this as a general assumption, and then specialize to these situations.

Equations
Instances For
    def IsSymmSndFDerivAt (๐•œ : Type u_1) [NontriviallyNormedField ๐•œ] {E : Type u_2} {F : Type u_3} [NormedAddCommGroup E] [NormedSpace ๐•œ E] [NormedAddCommGroup F] [NormedSpace ๐•œ F] (f : E โ†’ F) (x : E) :

    Definition recording that a function has a symmetric second derivative at a point. This is automatic in most cases of interest (open sets over real or complex vector fields, or general case for analytic functions), but we can express theorems of calculus using this as a general assumption, and then specialize to these situations.

    Equations
    Instances For
      theorem IsSymmSndFDerivWithinAt.eq {๐•œ : Type u_1} [NontriviallyNormedField ๐•œ] {E : Type u_2} {F : Type u_3} [NormedAddCommGroup E] [NormedSpace ๐•œ E] [NormedAddCommGroup F] [NormedSpace ๐•œ F] {s : Set E} {f : E โ†’ F} {x : E} (h : IsSymmSndFDerivWithinAt ๐•œ f s x) (v w : E) :
      ((fderivWithin ๐•œ (fderivWithin ๐•œ f s) s x) v) w = ((fderivWithin ๐•œ (fderivWithin ๐•œ f s) s x) w) v
      theorem IsSymmSndFDerivAt.eq {๐•œ : Type u_1} [NontriviallyNormedField ๐•œ] {E : Type u_2} {F : Type u_3} [NormedAddCommGroup E] [NormedSpace ๐•œ E] [NormedAddCommGroup F] [NormedSpace ๐•œ F] {f : E โ†’ F} {x : E} (h : IsSymmSndFDerivAt ๐•œ f x) (v w : E) :
      ((fderiv ๐•œ (fderiv ๐•œ f) x) v) w = ((fderiv ๐•œ (fderiv ๐•œ f) x) w) v
      theorem fderivWithin_fderivWithin_eq_of_mem_nhdsWithin {๐•œ : Type u_1} [NontriviallyNormedField ๐•œ] {E : Type u_2} {F : Type u_3} [NormedAddCommGroup E] [NormedSpace ๐•œ E] [NormedAddCommGroup F] [NormedSpace ๐•œ F] {s t : Set E} {f : E โ†’ F} {x : E} (h : t โˆˆ nhdsWithin x s) (hf : ContDiffWithinAt ๐•œ 2 f t x) (hs : UniqueDiffOn ๐•œ s) (ht : UniqueDiffOn ๐•œ t) (hx : x โˆˆ s) :
      fderivWithin ๐•œ (fderivWithin ๐•œ f s) s x = fderivWithin ๐•œ (fderivWithin ๐•œ f t) t x
      theorem fderivWithin_fderivWithin_eq_of_eventuallyEq {๐•œ : Type u_1} [NontriviallyNormedField ๐•œ] {E : Type u_2} {F : Type u_3} [NormedAddCommGroup E] [NormedSpace ๐•œ E] [NormedAddCommGroup F] [NormedSpace ๐•œ F] {s t : Set E} {f : E โ†’ F} {x : E} (h : s =แถ [nhds x] t) :
      fderivWithin ๐•œ (fderivWithin ๐•œ f s) s x = fderivWithin ๐•œ (fderivWithin ๐•œ f t) t x
      theorem fderivWithin_fderivWithin_eq_of_mem_nhds {๐•œ : Type u_1} [NontriviallyNormedField ๐•œ] {E : Type u_2} {F : Type u_3} [NormedAddCommGroup E] [NormedSpace ๐•œ E] [NormedAddCommGroup F] [NormedSpace ๐•œ F] {f : E โ†’ F} {x : E} {s : Set E} (h : s โˆˆ nhds x) :
      fderivWithin ๐•œ (fderivWithin ๐•œ f s) s x = fderiv ๐•œ (fderiv ๐•œ f) x
      @[simp]
      theorem isSymmSndFDerivWithinAt_univ {๐•œ : Type u_1} [NontriviallyNormedField ๐•œ] {E : Type u_2} {F : Type u_3} [NormedAddCommGroup E] [NormedSpace ๐•œ E] [NormedAddCommGroup F] [NormedSpace ๐•œ F] {f : E โ†’ F} {x : E} :
      IsSymmSndFDerivWithinAt ๐•œ f Set.univ x โ†” IsSymmSndFDerivAt ๐•œ f x
      theorem IsSymmSndFDerivWithinAt.mono_of_mem_nhdsWithin {๐•œ : Type u_1} [NontriviallyNormedField ๐•œ] {E : Type u_2} {F : Type u_3} [NormedAddCommGroup E] [NormedSpace ๐•œ E] [NormedAddCommGroup F] [NormedSpace ๐•œ F] {s t : Set E} {f : E โ†’ F} {x : E} (h : IsSymmSndFDerivWithinAt ๐•œ f t x) (hst : t โˆˆ nhdsWithin x s) (hf : ContDiffWithinAt ๐•œ 2 f t x) (hs : UniqueDiffOn ๐•œ s) (ht : UniqueDiffOn ๐•œ t) (hx : x โˆˆ s) :
      IsSymmSndFDerivWithinAt ๐•œ f s x
      theorem IsSymmSndFDerivWithinAt.congr_set {๐•œ : Type u_1} [NontriviallyNormedField ๐•œ] {E : Type u_2} {F : Type u_3} [NormedAddCommGroup E] [NormedSpace ๐•œ E] [NormedAddCommGroup F] [NormedSpace ๐•œ F] {s t : Set E} {f : E โ†’ F} {x : E} (h : IsSymmSndFDerivWithinAt ๐•œ f s x) (hst : s =แถ [nhds x] t) :
      IsSymmSndFDerivWithinAt ๐•œ f t x
      theorem isSymmSndFDerivWithinAt_congr_set {๐•œ : Type u_1} [NontriviallyNormedField ๐•œ] {E : Type u_2} {F : Type u_3} [NormedAddCommGroup E] [NormedSpace ๐•œ E] [NormedAddCommGroup F] [NormedSpace ๐•œ F] {s t : Set E} {f : E โ†’ F} {x : E} (hst : s =แถ [nhds x] t) :
      theorem IsSymmSndFDerivAt.isSymmSndFDerivWithinAt {๐•œ : Type u_1} [NontriviallyNormedField ๐•œ] {E : Type u_2} {F : Type u_3} [NormedAddCommGroup E] [NormedSpace ๐•œ E] [NormedAddCommGroup F] [NormedSpace ๐•œ F] {s : Set E} {f : E โ†’ F} {x : E} (h : IsSymmSndFDerivAt ๐•œ f x) (hf : ContDiffAt ๐•œ 2 f x) (hs : UniqueDiffOn ๐•œ s) (hx : x โˆˆ s) :
      IsSymmSndFDerivWithinAt ๐•œ f s x
      theorem Convex.taylor_approx_two_segment {E : Type u_1} {F : Type u_2} [NormedAddCommGroup E] [NormedSpace โ„ E] [NormedAddCommGroup F] [NormedSpace โ„ F] {s : Set E} (s_conv : Convex โ„ s) {f : E โ†’ F} {f' : E โ†’ E โ†’L[โ„] F} {f'' : E โ†’L[โ„] E โ†’L[โ„] F} (hf : โˆ€ x โˆˆ interior s, HasFDerivAt f (f' x) x) {x : E} (xs : x โˆˆ s) (hx : HasFDerivWithinAt f' f'' (interior s) x) {v w : E} (hv : x + v โˆˆ interior s) (hw : x + v + w โˆˆ interior s) :
      (fun (h : โ„) => f (x + h โ€ข v + h โ€ข w) - f (x + h โ€ข v) - h โ€ข (f' x) w - h ^ 2 โ€ข (f'' v) w - (h ^ 2 / 2) โ€ข (f'' w) w) =o[nhdsWithin 0 (Set.Ioi 0)] fun (h : โ„) => h ^ 2

      Assume that f is differentiable inside a convex set s, and that its derivative f' is differentiable at a point x. Then, given two vectors v and w pointing inside s, one can Taylor-expand to order two the function f on the segment [x + h v, x + h (v + w)], giving a bilinear estimate for f (x + hv + hw) - f (x + hv) in terms of f' w and of f'' โฌ w, up to o(h^2).

      This is a technical statement used to show that the second derivative is symmetric.

      theorem Convex.isLittleO_alternate_sum_square {E : Type u_1} {F : Type u_2} [NormedAddCommGroup E] [NormedSpace โ„ E] [NormedAddCommGroup F] [NormedSpace โ„ F] {s : Set E} (s_conv : Convex โ„ s) {f : E โ†’ F} {f' : E โ†’ E โ†’L[โ„] F} {f'' : E โ†’L[โ„] E โ†’L[โ„] F} (hf : โˆ€ x โˆˆ interior s, HasFDerivAt f (f' x) x) {x : E} (xs : x โˆˆ s) (hx : HasFDerivWithinAt f' f'' (interior s) x) {v w : E} (h4v : x + 4 โ€ข v โˆˆ interior s) (h4w : x + 4 โ€ข w โˆˆ interior s) :
      (fun (h : โ„) => f (x + h โ€ข (2 โ€ข v + 2 โ€ข w)) + f (x + h โ€ข (v + w)) - f (x + h โ€ข (2 โ€ข v + w)) - f (x + h โ€ข (v + 2 โ€ข w)) - h ^ 2 โ€ข (f'' v) w) =o[nhdsWithin 0 (Set.Ioi 0)] fun (h : โ„) => h ^ 2

      One can get f'' v w as the limit of h ^ (-2) times the alternate sum of the values of f along the vertices of a quadrilateral with sides h v and h w based at x. In a setting where f is not guaranteed to be continuous at f, we can still get this if we use a quadrilateral based at h v + h w.

      theorem Convex.second_derivative_within_at_symmetric_of_mem_interior {E : Type u_1} {F : Type u_2} [NormedAddCommGroup E] [NormedSpace โ„ E] [NormedAddCommGroup F] [NormedSpace โ„ F] {s : Set E} (s_conv : Convex โ„ s) {f : E โ†’ F} {f' : E โ†’ E โ†’L[โ„] F} {f'' : E โ†’L[โ„] E โ†’L[โ„] F} (hf : โˆ€ x โˆˆ interior s, HasFDerivAt f (f' x) x) {x : E} (xs : x โˆˆ s) (hx : HasFDerivWithinAt f' f'' (interior s) x) {v w : E} (h4v : x + 4 โ€ข v โˆˆ interior s) (h4w : x + 4 โ€ข w โˆˆ interior s) :
      (f'' w) v = (f'' v) w

      Assume that f is differentiable inside a convex set s, and that its derivative f' is differentiable at a point x. Then, given two vectors v and w pointing inside s, one has f'' v w = f'' w v. Superseded by Convex.second_derivative_within_at_symmetric, which removes the assumption that v and w point inside s.

      theorem Convex.second_derivative_within_at_symmetric {E : Type u_1} {F : Type u_2} [NormedAddCommGroup E] [NormedSpace โ„ E] [NormedAddCommGroup F] [NormedSpace โ„ F] {s : Set E} (s_conv : Convex โ„ s) (hne : (interior s).Nonempty) {f : E โ†’ F} {f' : E โ†’ E โ†’L[โ„] F} {f'' : E โ†’L[โ„] E โ†’L[โ„] F} (hf : โˆ€ x โˆˆ interior s, HasFDerivAt f (f' x) x) {x : E} (xs : x โˆˆ s) (hx : HasFDerivWithinAt f' f'' (interior s) x) (v w : E) :
      (f'' v) w = (f'' w) v

      If a function is differentiable inside a convex set with nonempty interior, and has a second derivative at a point of this convex set, then this second derivative is symmetric.

      theorem second_derivative_symmetric_of_eventually_of_real {E : Type u_1} {F : Type u_2} [NormedAddCommGroup E] [NormedSpace โ„ E] [NormedAddCommGroup F] [NormedSpace โ„ F] {x : E} {f : E โ†’ F} {f' : E โ†’ E โ†’L[โ„] F} {f'' : E โ†’L[โ„] E โ†’L[โ„] F} (hf : โˆ€แถ  (y : E) in nhds x, HasFDerivAt f (f' y) y) (hx : HasFDerivAt f' f'' x) (v w : E) :
      (f'' v) w = (f'' w) v

      If a function is differentiable around x, and has two derivatives at x, then the second derivative is symmetric. Version over โ„. See second_derivative_symmetric_of_eventually for a version over โ„ or โ„‚.

      theorem second_derivative_symmetric_of_eventually {๐•œ : Type u_1} [NontriviallyNormedField ๐•œ] [IsRCLikeNormedField ๐•œ] {E : Type u_2} {F : Type u_3} [NormedAddCommGroup E] [NormedSpace ๐•œ E] [NormedAddCommGroup F] [NormedSpace ๐•œ F] {f : E โ†’ F} {f' : E โ†’ E โ†’L[๐•œ] F} {x : E} {f'' : E โ†’L[๐•œ] E โ†’L[๐•œ] F} (hf : โˆ€แถ  (y : E) in nhds x, HasFDerivAt f (f' y) y) (hx : HasFDerivAt f' f'' x) (v w : E) :
      (f'' v) w = (f'' w) v
      theorem second_derivative_symmetric {๐•œ : Type u_1} [NontriviallyNormedField ๐•œ] [IsRCLikeNormedField ๐•œ] {E : Type u_2} {F : Type u_3} [NormedAddCommGroup E] [NormedSpace ๐•œ E] [NormedAddCommGroup F] [NormedSpace ๐•œ F] {f : E โ†’ F} {f' : E โ†’ E โ†’L[๐•œ] F} {f'' : E โ†’L[๐•œ] E โ†’L[๐•œ] F} {x : E} (hf : โˆ€ (y : E), HasFDerivAt f (f' y) y) (hx : HasFDerivAt f' f'' x) (v w : E) :
      (f'' v) w = (f'' w) v

      If a function is differentiable, and has two derivatives at x, then the second derivative is symmetric.

      theorem ContDiffAt.isSymmSndFDerivAt {๐•œ : Type u_1} [NontriviallyNormedField ๐•œ] [IsRCLikeNormedField ๐•œ] {E : Type u_2} {F : Type u_3} [NormedAddCommGroup E] [NormedSpace ๐•œ E] [NormedAddCommGroup F] [NormedSpace ๐•œ F] {f : E โ†’ F} {x : E} {n : โ„•โˆž} (hf : ContDiffAt ๐•œ n f x) (hn : 2 โ‰ค n) :
      IsSymmSndFDerivAt ๐•œ f x

      If a function is C^2 at a point, then its second derivative there is symmetric.

      theorem ContDiffWithinAt.isSymmSndFDerivWithinAt {๐•œ : Type u_1} [NontriviallyNormedField ๐•œ] [IsRCLikeNormedField ๐•œ] {E : Type u_2} {F : Type u_3} [NormedAddCommGroup E] [NormedSpace ๐•œ E] [NormedAddCommGroup F] [NormedSpace ๐•œ F] {s : Set E} {f : E โ†’ F} {x : E} {n : โ„•โˆž} (hf : ContDiffWithinAt ๐•œ n f s x) (hn : 2 โ‰ค n) (hs : UniqueDiffOn ๐•œ s) (hx : x โˆˆ closure (interior s)) (h'x : x โˆˆ s) :
      IsSymmSndFDerivWithinAt ๐•œ f s x

      If a function is C^2 within a set at a point, and accumulated by points in the interior of the set, then its second derivative there is symmetric.