Documentation

Mathlib.Analysis.SpecialFunctions.Log.Deriv

Derivative and series expansion of real logarithm #

In this file we prove that Real.log is infinitely smooth at all nonzero x : โ„. We also prove that the series โˆ‘' n : โ„•, x ^ (n + 1) / (n + 1) converges to (-Real.log (1 - x)) for all x : โ„, |x| < 1.

Tags #

logarithm, derivative

theorem HasDerivWithinAt.log {f : โ„ โ†’ โ„} {x f' : โ„} {s : Set โ„} (hf : HasDerivWithinAt f f' s x) (hx : f x โ‰  0) :
HasDerivWithinAt (fun (y : โ„) => Real.log (f y)) (f' / f x) s x
theorem HasDerivAt.log {f : โ„ โ†’ โ„} {x f' : โ„} (hf : HasDerivAt f f' x) (hx : f x โ‰  0) :
HasDerivAt (fun (y : โ„) => Real.log (f y)) (f' / f x) x
theorem HasStrictDerivAt.log {f : โ„ โ†’ โ„} {x f' : โ„} (hf : HasStrictDerivAt f f' x) (hx : f x โ‰  0) :
HasStrictDerivAt (fun (y : โ„) => Real.log (f y)) (f' / f x) x
theorem derivWithin.log {f : โ„ โ†’ โ„} {x : โ„} {s : Set โ„} (hf : DifferentiableWithinAt โ„ f s x) (hx : f x โ‰  0) (hxs : UniqueDiffWithinAt โ„ s x) :
derivWithin (fun (x : โ„) => Real.log (f x)) s x = derivWithin f s x / f x
@[simp]
theorem deriv.log {f : โ„ โ†’ โ„} {x : โ„} (hf : DifferentiableAt โ„ f x) (hx : f x โ‰  0) :
deriv (fun (x : โ„) => Real.log (f x)) x = deriv f x / f x
theorem Real.deriv_log_comp_eq_logDeriv {f : โ„ โ†’ โ„} {x : โ„} (hโ‚ : DifferentiableAt โ„ f x) (hโ‚‚ : f x โ‰  0) :

The derivative of log โˆ˜ f is the logarithmic derivative provided f is differentiable and f x โ‰  0.

theorem HasFDerivWithinAt.log {E : Type u_1} [NormedAddCommGroup E] [NormedSpace โ„ E] {f : E โ†’ โ„} {x : E} {f' : StrongDual โ„ E} {s : Set E} (hf : HasFDerivWithinAt f f' s x) (hx : f x โ‰  0) :
HasFDerivWithinAt (fun (x : E) => Real.log (f x)) ((f x)โปยน โ€ข f') s x
theorem HasFDerivAt.log {E : Type u_1} [NormedAddCommGroup E] [NormedSpace โ„ E] {f : E โ†’ โ„} {x : E} {f' : StrongDual โ„ E} (hf : HasFDerivAt f f' x) (hx : f x โ‰  0) :
HasFDerivAt (fun (x : E) => Real.log (f x)) ((f x)โปยน โ€ข f') x
theorem HasStrictFDerivAt.log {E : Type u_1} [NormedAddCommGroup E] [NormedSpace โ„ E] {f : E โ†’ โ„} {x : E} {f' : StrongDual โ„ E} (hf : HasStrictFDerivAt f f' x) (hx : f x โ‰  0) :
HasStrictFDerivAt (fun (x : E) => Real.log (f x)) ((f x)โปยน โ€ข f') x
theorem DifferentiableWithinAt.log {E : Type u_1} [NormedAddCommGroup E] [NormedSpace โ„ E] {f : E โ†’ โ„} {x : E} {s : Set E} (hf : DifferentiableWithinAt โ„ f s x) (hx : f x โ‰  0) :
DifferentiableWithinAt โ„ (fun (x : E) => Real.log (f x)) s x
@[simp]
theorem DifferentiableAt.log {E : Type u_1} [NormedAddCommGroup E] [NormedSpace โ„ E] {f : E โ†’ โ„} {x : E} (hf : DifferentiableAt โ„ f x) (hx : f x โ‰  0) :
DifferentiableAt โ„ (fun (x : E) => Real.log (f x)) x
theorem ContDiffAt.log {E : Type u_1} [NormedAddCommGroup E] [NormedSpace โ„ E] {f : E โ†’ โ„} {x : E} {n : WithTop โ„•โˆž} (hf : ContDiffAt โ„ n f x) (hx : f x โ‰  0) :
ContDiffAt โ„ n (fun (x : E) => Real.log (f x)) x
theorem ContDiffWithinAt.log {E : Type u_1} [NormedAddCommGroup E] [NormedSpace โ„ E] {f : E โ†’ โ„} {x : E} {s : Set E} {n : WithTop โ„•โˆž} (hf : ContDiffWithinAt โ„ n f s x) (hx : f x โ‰  0) :
ContDiffWithinAt โ„ n (fun (x : E) => Real.log (f x)) s x
theorem ContDiffOn.log {E : Type u_1} [NormedAddCommGroup E] [NormedSpace โ„ E] {f : E โ†’ โ„} {s : Set E} {n : WithTop โ„•โˆž} (hf : ContDiffOn โ„ n f s) (hs : โˆ€ x โˆˆ s, f x โ‰  0) :
ContDiffOn โ„ n (fun (x : E) => Real.log (f x)) s
theorem ContDiff.log {E : Type u_1} [NormedAddCommGroup E] [NormedSpace โ„ E] {f : E โ†’ โ„} {n : WithTop โ„•โˆž} (hf : ContDiff โ„ n f) (h : โˆ€ (x : E), f x โ‰  0) :
ContDiff โ„ n fun (x : E) => Real.log (f x)
theorem DifferentiableOn.log {E : Type u_1} [NormedAddCommGroup E] [NormedSpace โ„ E] {f : E โ†’ โ„} {s : Set E} (hf : DifferentiableOn โ„ f s) (hx : โˆ€ x โˆˆ s, f x โ‰  0) :
DifferentiableOn โ„ (fun (x : E) => Real.log (f x)) s
@[simp]
theorem Differentiable.log {E : Type u_1} [NormedAddCommGroup E] [NormedSpace โ„ E] {f : E โ†’ โ„} (hf : Differentiable โ„ f) (hx : โˆ€ (x : E), f x โ‰  0) :
Differentiable โ„ fun (x : E) => Real.log (f x)
theorem fderivWithin.log {E : Type u_1} [NormedAddCommGroup E] [NormedSpace โ„ E] {f : E โ†’ โ„} {x : E} {s : Set E} (hf : DifferentiableWithinAt โ„ f s x) (hx : f x โ‰  0) (hxs : UniqueDiffWithinAt โ„ s x) :
@[simp]
theorem fderiv.log {E : Type u_1} [NormedAddCommGroup E] [NormedSpace โ„ E] {f : E โ†’ โ„} {x : E} (hf : DifferentiableAt โ„ f x) (hx : f x โ‰  0) :
fderiv โ„ (fun (x : E) => Real.log (f x)) x = (f x)โปยน โ€ข fderiv โ„ f x
theorem Real.abs_log_sub_add_sum_range_le {x : โ„} (h : |x| < 1) (n : โ„•) :
|โˆ‘ i โˆˆ Finset.range n, x ^ (i + 1) / (โ†‘i + 1) + log (1 - x)| โ‰ค |x| ^ (n + 1) / (1 - |x|)

A crude lemma estimating the difference between log (1-x) and its Taylor series at 0, where the main point of the bound is that it tends to 0. The goal is to deduce the series expansion of the logarithm, in hasSum_pow_div_log_of_abs_lt_1.

TODO: use one of generic theorems about Taylor's series to prove this estimate.

theorem Real.hasDerivAt_half_log_one_add_div_one_sub_sub_sum_range {y : โ„} (n : โ„•) (hyโ‚ : -1 < y) (hyโ‚‚ : y < 1) :
HasDerivAt (fun (x : โ„) => 1 / 2 * log ((1 + x) / (1 - x)) - โˆ‘ i โˆˆ Finset.range n, x ^ (2 * i + 1) / (2 * โ†‘i + 1)) ((y ^ 2) ^ n / (1 - y ^ 2)) y

Compute the derivative of the difference between $\frac{1}{2} * \log(\frac{1+x}{1-x})$ and its Taylor series at 0 up to order n. This is an auxiliary lemma for sum_range_sub_log_div_le and sum_range_le_log_div. Note that thanks to the geometric series, the derivative has a particularly simple form, and means that it is more convenient to avoid Taylor's theorem.

theorem Real.sum_range_sub_log_div_le {x : โ„} (h : |x| < 1) (n : โ„•) :
|1 / 2 * log ((1 + x) / (1 - x)) - โˆ‘ i โˆˆ Finset.range n, x ^ (2 * i + 1) / (2 * โ†‘i + 1)| โ‰ค |x| ^ (2 * n + 1) / (1 - x ^ 2)

A lemma estimating the difference between $\frac{1}{2} * \log(\frac{1+x}{1-x})$ and its Taylor series at 0, where the bound tends to 0. This bound is particularly useful for explicit estimates of logarithms.

Note that thanks to the geometric series, the derivative has a particularly simple form, and means that it is more convenient to avoid Taylor's theorem for this proof.

theorem Real.sum_range_le_log_div {x : โ„} (hโ‚€ : 0 โ‰ค x) (h : x < 1) (n : โ„•) :
โˆ‘ i โˆˆ Finset.range n, x ^ (2 * i + 1) / (2 * โ†‘i + 1) โ‰ค 1 / 2 * log ((1 + x) / (1 - x))

For 0 โ‰ค x < 1, the partial sums of the series expansion of $\frac{1}{2} * \log(\frac{1+x}{1-x})$ at 0 form a lower bound for it. This shows that the absolute value in sum_range_sub_log_div_le can be dropped, and gives explicit lower bounds for logarithms.

theorem Real.log_div_le_sum_range_add {x : โ„} (hโ‚€ : 0 โ‰ค x) (h : x < 1) (n : โ„•) :
1 / 2 * log ((1 + x) / (1 - x)) โ‰ค โˆ‘ i โˆˆ Finset.range n, x ^ (2 * i + 1) / (2 * โ†‘i + 1) + x ^ (2 * n + 1) / (1 - x ^ 2)
theorem Real.hasSum_pow_div_log_of_abs_lt_one {x : โ„} (h : |x| < 1) :
HasSum (fun (n : โ„•) => x ^ (n + 1) / (โ†‘n + 1)) (-log (1 - x))

Power series expansion of the logarithm around 1.

theorem Real.hasSum_log_sub_log_of_abs_lt_one {x : โ„} (h : |x| < 1) :
HasSum (fun (k : โ„•) => 2 * (1 / (2 * โ†‘k + 1)) * x ^ (2 * k + 1)) (log (1 + x) - log (1 - x))

Power series expansion of log(1 + x) - log(1 - x) for |x| < 1.

theorem Real.hasSum_log_one_add_inv {a : โ„} (h : 0 < a) :
HasSum (fun (k : โ„•) => 2 * (1 / (2 * โ†‘k + 1)) * (1 / (2 * a + 1)) ^ (2 * k + 1)) (log (1 + aโปยน))

Expansion of log (1 + aโปยน) as a series in powers of 1 / (2 * a + 1).

theorem Real.hasSum_log_one_add {a : โ„} (h : 0 โ‰ค a) :
HasSum (fun (k : โ„•) => 2 * (1 / (2 * โ†‘k + 1)) * (a / (a + 2)) ^ (2 * k + 1)) (log (1 + a))

Expansion of log (1 + a) as a series in powers of a / (a + 2).

theorem Real.lt_log_one_add_of_pos {x : โ„} (hx : 0 < x) :
2 * x / (x + 2) < log (1 + x)