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.Real.Pi.Wallis

9 declarations. Mathlib docs · Source

The Wallis formula for Pi

This file establishes the Wallis product for π (Real.tendsto_prod_pi_div_two). Our proof is largely about analyzing the behaviour of the sequence ∫ x in 0..π, sin x ^ n as n → ∞. See: https://en.wikipedia.org/wiki/Wallis_product

The proof can be broken down into two pieces. The first step (carried out in Mathlib/Analysis/SpecialFunctions/Integrals/Basic.lean) is to use repeated integration by parts to obtain an explicit formula for this integral, which is rational if n is odd and a rational multiple of π if n is even.

The second step, carried out here, is to estimate the ratio ∫ (x : ℝ) in 0..π, sin x ^ (2 * k + 1) / ∫ (x : ℝ) in 0..π, sin x ^ (2 * k) and prove that it converges to one using the squeeze theorem. The final product for π is obtained after some algebraic manipulation.

Main statements

  • Real.Wallis.W: the product of the first k terms in Wallis' formula for π.
  • Real.Wallis.W_eq_integral_sin_pow_div_integral_sin_pow: express W n as a ratio of integrals.
  • Real.Wallis.W_le and Real.Wallis.le_W: upper and lower bounds for W n.
  • Real.tendsto_prod_pi_div_two: the Wallis product formula.

def Real.Wallis.W E3 #

ℕ → ℝ

The product of the first k terms in Wallis' formula for π.

theorem Real.Wallis.W_succ E1 #

∀ (k : ℕ), Real.Wallis.W (k + 1) = Real.Wallis.W k * ((2 * ↑k + 2) / (2 * ↑k + 1) * ((2 * ↑k + 2) / (2 * ↑k + 3)))

theorem Real.Wallis.W_pos E1 #

∀ (k : ℕ), 0 < Real.Wallis.W k

theorem Real.Wallis.W_eq_factorial_ratio E1 #

∀ (n : ℕ), Real.Wallis.W n = 2 ^ (4 * n) * ↑n.factorial ^ 4 / (↑(2 * n).factorial ^ 2 * (2 * ↑n + 1))

theorem Real.Wallis.W_eq_integral_sin_pow_div_integral_sin_pow E3 #

∀ (k : ℕ),
  (Real.pi / 2)⁻¹ * Real.Wallis.W k =
    (∫ (x : ℝ) in 0..Real.pi, Real.sin x ^ (2 * k + 1)) / ∫ (x : ℝ) in 0..Real.pi, Real.sin x ^ (2 * k)

theorem Real.Wallis.W_le E3 #

∀ (k : ℕ), Real.Wallis.W k ≤ Real.pi / 2

theorem Real.Wallis.le_W E3 #

∀ (k : ℕ), (2 * ↑k + 1) / (2 * ↑k + 2) * (Real.pi / 2) ≤ Real.Wallis.W k

theorem Real.Wallis.tendsto_W_nhds_pi_div_two E1 #

Filter.Tendsto Real.Wallis.W Filter.atTop (nhds (Real.pi / 2))

theorem Real.tendsto_prod_pi_div_two E3 #

Filter.Tendsto (fun k ↦ ∏ i ∈ Finset.range k, (2 * ↑i + 2) / (2 * ↑i + 1) * ((2 * ↑i + 2) / (2 * ↑i + 3))) Filter.atTop
  (nhds (Real.pi / 2))

Wallis' product formula for π / 2.