Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Fourier coefficient

Definition
Fejer_fourierCoeff

by Elsie66 · Sep 7, 2026 · Mathlib 0df444a (Lean v4.33.1)

fourier-seriesharmonic-analysis

The nnn-th Fourier coefficient of f:R→Cf:\mathbb R\to\mathbb Cf:R→C, f^(n)=12π∫−ππf(θ)e−inθ dθ\hat f(n) = \frac{1}{2\pi}\int_{-\pi}^{\pi} f(\theta) e^{-in\theta}\,d\thetaf^​(n)=2π1​∫−ππ​f(θ)e−inθdθ.

Definition code
import Mathlib

namespace Fejer

/-- The `n`-th Fourier coefficient of `f : ℝ → ℂ`,
`f̂(n) = (1/2π) ∫_{-π}^{π} f(θ) e^{-inθ} dθ`. -/
noncomputable def fourierCoeff (f : ℝ → ℂ) (n : ℤ) : ℂ :=
  (1 / (2 * Real.pi)) * ∫ θ in (-Real.pi)..Real.pi, f θ * Complex.exp (-(n : ℂ) * θ * Complex.I)

end Fejer
Source
L. Fejér, "Untersuchungen über Fouriersche Reihen," Math. Ann. 58 (1904); E. M. Stein & R. Shakarchi, Fourier Analysis: An Introduction, Ch. 2.
Read-back

What the Lean code literally says, in plain math · claude-sonnet-5

For an arbitrary function f:R→Cf : \mathbb{R} \to \mathbb{C}f:R→C (no continuity, periodicity, or integrability assumption is imposed anywhere in this definition) and an arbitrary integer n∈Zn \in \mathbb{Z}n∈Z (which may be positive, negative, or zero), the definition sets

fourierCoeff(f,n)  =  12π∫−ππf(θ) exp⁡ ⁣(−inθ) dθ  ∈  C,\mathrm{fourierCoeff}(f,n) \;=\; \frac{1}{2\pi} \int_{-\pi}^{\pi} f(\theta)\,\exp\!\big(-in\theta\big)\, d\theta \;\in\; \mathbb{C},fourierCoeff(f,n)=2π1​∫−ππ​f(θ)exp(−inθ)dθ∈C,

where every piece is to be read literally as follows: π\piπ is the real constant Real.pi\mathrm{Real.pi}Real.pi; the scalar factor 1/(2π)1/(2\pi)1/(2π) is the real number 1/(2π)1/(2\pi)1/(2π) regarded as a complex number (zero imaginary part), multiplying everything that follows; the integer nnn is cast to a complex number and the real integration variable θ\thetaθ is likewise cast to a complex number solely for forming the exponent, so the exponent is exactly the complex number −(n)⋅θ⋅i-(n)\cdot\theta\cdot i−(n)⋅θ⋅i, i.e. exp⁡(−inθ)=cos⁡(nθ)−isin⁡(nθ)\exp(-in\theta) = \cos(n\theta) - i\sin(n\theta)exp(−inθ)=cos(nθ)−isin(nθ) by Euler's formula, a point on the unit circle in C\mathbb{C}C; and ∫−ππ(⋅) dθ\int_{-\pi}^{\pi}(\cdot)\,d\theta∫−ππ​(⋅)dθ denotes Mathlib's interval integral with lower limit −π-\pi−π and upper limit π\piπ, which — since −π<π-\pi<\pi−π<π always — is here simply the ordinary (positively oriented, no sign reversal) integral of the complex-valued integrand θ↦f(θ)exp⁡(−inθ)\theta \mapsto f(\theta)\exp(-in\theta)θ↦f(θ)exp(−inθ) over [−π,π][-\pi,\pi][−π,π]; f(θ)f(\theta)f(θ) and exp⁡(−inθ)\exp(-in\theta)exp(−inθ) are multiplied together as complex numbers before integrating. Because Mathlib's interval integral is a total (junk-valued) operator and fff carries no integrability hypothesis, if θ↦f(θ)exp⁡(−inθ)\theta \mapsto f(\theta)\exp(-in\theta)θ↦f(θ)exp(−inθ) is not interval-integrable on [−π,π][-\pi,\pi][−π,π] the integral is simply assigned the junk value 0∈C0 \in \mathbb{C}0∈C, and consequently fourierCoeff(f,n)=12π⋅0=0\mathrm{fourierCoeff}(f,n) = \tfrac{1}{2\pi}\cdot 0 = 0fourierCoeff(f,n)=2π1​⋅0=0 in that case, with no error, exception, or further condition raised — this includes, in particular, any fff for which f(θ)exp⁡(−inθ)f(\theta)\exp(-in\theta)f(θ)exp(−inθ) is unbounded, discontinuous in a bad way, or otherwise fails Bochner-integrability on that interval. In the case n=0n=0n=0, the exponential factor collapses identically to exp⁡(0)=1\exp(0)=1exp(0)=1, so the formula reduces to fourierCoeff(f,0)=12π∫−ππf(θ) dθ\mathrm{fourierCoeff}(f,0) = \tfrac{1}{2\pi}\int_{-\pi}^{\pi} f(\theta)\,d\thetafourierCoeff(f,0)=2π1​∫−ππ​f(θ)dθ (again equal to 000 if that plain integral of fff fails to exist in the integrability sense). For a negative index, writing n=−mn=-mn=−m with mmm a positive integer, the coerced quantity −(n:C)-(n:\mathbb C)−(n:C) equals +m+m+m, so the exponent becomes +imθ+im\theta+imθ rather than −imθ-im\theta−imθ — i.e. passing from a positive index to its negation exactly reverses the sign in the exponent, with no complex-conjugation, absolute value, or other transformation of fff or of the integral applied anywhere; the same single closed formula above is evaluated verbatim for every integer nnn (positive, negative, or zero) and every function fff, with the stated real-to-complex casts of nnn, θ\thetaθ, and π\piπ, and the junk-value convention on non-integrable integrands, being the only implicit steps.

Human review
  • Endorsed by marwahaha · Sep 7, 2026

  • Endorsed by Shuze Chen · Sep 7, 2026

  • Endorsed by Elsie66 · Sep 7, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactJoin Slack© 2026 Prove2Me