Fourier Series: Rigorous Foundations

Can a vibrating string, a temperature distribution, or any reasonably well-behaved periodic signal be decomposed into pure sine and cosine waves? This question was first attacked seriously by Joseph Fourier while studying heat conduction. It forces us to confront a deep issue in analysis. Given a 2π2\pi-periodic function ff, can we find coefficients an,bna_n, b_n so that

f(x)=a02+∑n=1∞(ancos⁡nx+bnsin⁡nx),f(x) = \frac{a_0}{2} + \sum_{n=1}^{\infty} \left(a_n \cos nx + b_n \sin nx\right),

and in what sense does this series actually converge to ff? The answer turns out to be subtle. The naive hope that every periodic function equals its Fourier series pointwise is false in general. Making the theory rigorous requires the full strength of the Riemann Integral. It also needs careful limit arguments from the theory of Uniform Convergence and Integration. This matters because of Fourier's idea. He proposed that "arbitrary" functions decompose into elementary oscillations. This became one of the most productive ideas in mathematics and physics. It underlies the analysis of heat, sound, light, and (much later) digital signal processing and quantum mechanics. The trigonometric system {1,cos⁡x,sin⁡x,cos⁡2x,sin⁡2x,… }\{1, \cos x, \sin x, \cos 2x, \sin 2x, \dots\} has a remarkable orthogonality structure on any interval of length 2π2\pi. This is exactly the tool needed to extract the coefficients an,bna_n, b_n from ff by integration. This works regardless of whether the resulting series converges back to ff. The big picture is this: we first define the Fourier coefficients of any Riemann-integrable periodic function purely formally. This is done via explicit integral formulas, with no convergence assumed. We then form the partial sums SN(f)S_N(f) of the resulting series. We study them as ordinary functions built from finitely many trigonometric terms. Only after this scaffolding is in place does the harder question make sense. Coefficients must be well-defined, partial sums well-defined, and orthogonality proven. Then we can ask when and how SN(f)→fS_N(f) \to f. This question belongs to the theory of convergence of Fourier series. It is treated separately. This article delivers the rigorous foundational layer. It gives the precise definition of Fourier coefficients for Riemann-integrable periodic functions. It covers the algebraic and integral structure of the trigonometric system. It also presents the Riemann–Lebesgue-type integrability facts needed to make sense of the coefficients. Finally, it gives a fully proved orthogonality theorem that underlies everything downstream. This includes Bessel's Inequality and the eventual convergence theorems.

Key takeaways
  • Fourier coefficients an,bna_n, b_n of a 2π2\pi-periodic, Riemann-integrable ff are defined by explicit integral formulas — no convergence is assumed a priori.
  • The trigonometric system {1,cos⁡nx,sin⁡nx}n≥1\{1,\cos nx,\sin nx\}_{n\ge1} is orthogonal on any interval of length 2π2\pi, which is the algebraic engine behind the coefficient formulas.
  • Partial sums SN(f)(x)=a02+∑n=1N(ancos⁡nx+bnsin⁡nx)S_N(f)(x) = \tfrac{a_0}{2} + \sum_{n=1}^N (a_n\cos nx + b_n \sin nx) are trigonometric polynomials of degree ≤N\le N, always well-defined and continuous.
  • Riemann integrability of ff guarantees the coefficients exist and are finite, via boundedness plus integrability of ff times bounded continuous functions.
  • The orthogonality theorem is proved directly from elementary trigonometric product-to-sum identities and definite integrals — no circularity, no appeal to convergence results.
  • Key idea: separate the algebra of extracting coefficients (rigorous, always works) from the analysis of whether the series reconstructs ff (subtle, treated afterward).

Where this lives today

Fourier's coefficient formulas and the orthogonality of the trigonometric system underlie an enormous range of modern mathematics and applied science. In pure analysis, they are the launching point for Bessel's Inequality and Parseval's theorem, which show the Fourier map is an isometry between periodic L2L^2 functions and square-summable coefficient sequences — a cornerstone of Hilbert space theory. In partial differential equations, separation of variables for the heat and wave equations on bounded domains produces exactly the trigonometric eigenfunctions Fourier used, making this the standard tool for solving boundary value problems. In signal processing and electrical engineering, the discrete and fast Fourier transforms (algorithmic descendants of the same coefficient formulas) underlie audio compression (MP3), image compression (JPEG's use of the related discrete cosine transform), and digital filtering. In cryptography and number theory, Fourier analysis on finite groups underlies primality testing algorithms and the Fast Fourier Transform speeds polynomial multiplication used in RSA and other cryptosystems. In statistics and time-series analysis, spectral density estimation decomposes a random process into frequency components using the same orthogonality principle. In quantum mechanics, Fourier series and transforms relate position and momentum representations of a wavefunction, a direct descendant of the position/frequency duality Fourier first isolated for heat.

:::faq[Why use [−π,π][-\pi,\pi] instead of [0,2π][0,2\pi] for the defining integrals?] Any interval of length 2π2\pi gives the same coefficients, because ff, and hence f(x)cos⁡(nx)f(x)\cos(nx) and f(x)sin⁡(nx)f(x)\sin(nx), are 2π2\pi-periodic, and the integral of a periodic function over any interval of length equal to one full period is the same regardless of where that interval starts. This is a direct consequence of periodicity and additivity of the Riemann integral over adjacent subintervals. The interval [−π,π][-\pi,\pi] is often chosen for convenience because it is symmetric about 00, which simplifies computations for even or odd functions (as seen in the worked examples), but [0,2π][0,2\pi] or any shifted interval works equally well and yields identical numbers.

Ask the tutor: How does the best-approximation property proved here get upgraded into a full convergence theorem for Fourier series?

DefinitionFourier coefficients and partial sums

Let f:R→Rf:\mathbb{R}\to\mathbb{R} (or C\mathbb{C}) be periodic with period 2π2\pi, and suppose ff is Riemann integrable on [−π,π][-\pi,\pi] (equivalently on any interval of length 2π2\pi, by periodicity). The Fourier coefficients of ff are the real numbers

an=1π∫−ππf(x)cos⁡(nx) dx,n=0,1,2,…a_n = \frac{1}{\pi}\int_{-\pi}^{\pi} f(x)\cos(nx)\, dx, \qquad n = 0,1,2,\dots
bn=1π∫−ππf(x)sin⁡(nx) dx,n=1,2,3,…b_n = \frac{1}{\pi}\int_{-\pi}^{\pi} f(x)\sin(nx)\, dx, \qquad n = 1,2,3,\dots

The Fourier series of ff is the formal trigonometric series

a02+∑n=1∞(ancos⁡nx+bnsin⁡nx),\frac{a_0}{2} + \sum_{n=1}^{\infty}\left(a_n \cos nx + b_n \sin nx\right),

and its NN-th partial sum is the trigonometric polynomial

SN(f)(x)=a02+∑n=1N(ancos⁡nx+bnsin⁡nx).S_N(f)(x) = \frac{a_0}{2} + \sum_{n=1}^{N}\left(a_n \cos nx + b_n \sin nx\right).

We write f∼a02+∑n=1∞(ancos⁡nx+bnsin⁡nx)f \sim \dfrac{a_0}{2} + \sum_{n=1}^\infty (a_n\cos nx + b_n \sin nx) to denote this formal association, deliberately using ∼\sim rather than ==, since at this stage no claim of convergence or equality is made. Equivalently, in complex form, defining cn=12π∫−ππf(x)e−inx dxc_n = \frac{1}{2\pi}\int_{-\pi}^{\pi} f(x) e^{-inx}\,dx for n∈Zn \in \mathbb{Z}, we have f∼∑n=−∞∞cneinxf \sim \sum_{n=-\infty}^{\infty} c_n e^{inx}, with c0=a0/2c_0 = a_0/2, cn=(an−ibn)/2c_n = (a_n - ib_n)/2, c−n=(an+ibn)/2c_{-n} = (a_n+ib_n)/2 for n≥1n \geq 1.

Intuition

Think of the trigonometric functions cos⁡nx\cos nx and sin⁡nx\sin nx as an infinite family of "pure tones," analogous to the way a musical chord decomposes into individual notes. The claim behind Fourier's construction is that these tones form a kind of coordinate system for periodic functions, and that the coefficients an,bna_n, b_n measure "how much" of the frequency-nn tone is present in ff. This is directly analogous to finding the components of a vector along orthogonal axes in Rn\mathbb{R}^n: if {e1,…,en}\{e_1,\dots,e_n\} is an orthonormal basis, the kk-th component of a vector vv is ⟨v,ek⟩\langle v, e_k\rangle. The integral

⟨f,g⟩:=∫−ππf(x)g(x) dx\langle f, g\rangle := \int_{-\pi}^{\pi} f(x) g(x)\, dx

plays the role of an inner product on the (infinite-dimensional) space of Riemann-integrable periodic functions, and the trigonometric system is orthogonal with respect to it — meaning distinct basis functions have inner product zero. The coefficient formulas for ana_n and bnb_n are then nothing but "take the inner product of ff with the nn-th basis function, and divide by the squared length of that basis function" — exactly the Gram–Schmidt/orthogonal-projection formula from linear algebra, transplanted into an infinite-dimensional integral setting. The crucial subtlety, which the rest of the Fourier theory is built to resolve, is that in infinite dimensions "expressing ff in the basis" is not automatic: unlike in Rn\mathbb{R}^n, a function need not equal the sum of its projections onto the basis vectors, even when there are infinitely many of them. That is precisely why this foundational article stops short of claiming SN(f)→fS_N(f) \to f; it only builds the machinery — coefficients, orthogonality, well-defined partial sums — on which such convergence theorems can later rest.

Figure
The trigonometric system as an orthogonal "coordinate grid" for periodic functions
cos x sin x cos 2x sin 2x ∫₋π^π cos(mx)cos(nx) dx = 0 and ∫₋π^π cos(mx)sin(nx) dx = 0 whenever m ≠ n (or always, resp.)
TheoremOrthogonality of the trigonometric system

For all integers m,n≥0m, n \geq 0 and m,n≥1m,n \geq 1 as appropriate, the following integrals over [−π,π][-\pi,\pi] hold: 1. ∫−ππcos⁡(mx)cos⁡(nx) dx={0m≠nπm=n≥12πm=n=0\displaystyle\int_{-\pi}^{\pi} \cos(mx)\cos(nx)\,dx = \begin{cases} 0 & m \neq n \\ \pi & m = n \geq 1 \\ 2\pi & m=n=0\end{cases} 2. ∫−ππsin⁡(mx)sin⁡(nx) dx={0m≠nπm=n≥1\displaystyle\int_{-\pi}^{\pi} \sin(mx)\sin(nx)\,dx = \begin{cases} 0 & m \neq n \\ \pi & m=n\geq 1\end{cases} (and both sides are 00 if m=0m=0 or n=0n=0, taking sin⁡0x≡0\sin 0x \equiv 0) 3. ∫−ππcos⁡(mx)sin⁡(nx) dx=0\displaystyle\int_{-\pi}^{\pi} \cos(mx)\sin(nx)\, dx = 0 for all integers m≥0,n≥1m \geq 0, n \geq 1. Consequently, if ff is Riemann integrable and 2π2\pi-periodic with Fourier coefficients an,bna_n, b_n as above, then for every N≥0N \geq 0 the partial sum

SN(f)(x)=a02+∑n=1N(ancos⁡nx+bnsin⁡nx)S_N(f)(x) = \frac{a_0}{2} + \sum_{n=1}^N (a_n\cos nx + b_n \sin nx)

is precisely the unique trigonometric polynomial T(x)=c02+∑n=1N(cncos⁡nx+dnsin⁡nx)T(x) = \frac{c_0}{2} + \sum_{n=1}^N(c_n\cos nx + d_n \sin nx) of degree ≤N\leq N minimizing the mean-square error

∫−ππ(f(x)−T(x))2dx\int_{-\pi}^{\pi} \left(f(x) - T(x)\right)^2 dx

among all such trigonometric polynomials of degree ≤N\le N.

Proof

Part 1: the orthogonality integrals. We use the product-to-sum identities, valid for all real xx and all integers m,nm,n:

cos⁡(mx)cos⁡(nx)=12[cos⁡((m−n)x)+cos⁡((m+n)x)],\cos(mx)\cos(nx) = \tfrac12\big[\cos((m-n)x) + \cos((m+n)x)\big],
sin⁡(mx)sin⁡(nx)=12[cos⁡((m−n)x)−cos⁡((m+n)x)],\sin(mx)\sin(nx) = \tfrac12\big[\cos((m-n)x) - \cos((m+n)x)\big],
cos⁡(mx)sin⁡(nx)=12[sin⁡((m+n)x)−sin⁡((m−n)x)].\cos(mx)\sin(nx) = \tfrac12\big[\sin((m+n)x) - \sin((m-n)x)\big].

These are elementary consequences of the angle-addition formulas cos⁡(A±B)=cos⁡Acos⁡B∓sin⁡Asin⁡B\cos(A\pm B) = \cos A\cos B \mp \sin A \sin B and sin⁡(A±B)=sin⁡Acos⁡B±cos⁡Asin⁡B\sin(A\pm B) = \sin A \cos B \pm \cos A \sin B, added or subtracted appropriately; we take them as known. We also record two elementary integrals, for any integer kk:

∫−ππcos⁡(kx) dx={2πk=0[sin⁡kxk]−ππ=0k≠0,∫−ππsin⁡(kx) dx=0 for all k,\int_{-\pi}^{\pi} \cos(kx)\,dx = \begin{cases} 2\pi & k = 0 \\ \left[\frac{\sin kx}{k}\right]_{-\pi}^{\pi} = 0 & k \neq 0\end{cases}, \qquad \int_{-\pi}^{\pi} \sin(kx)\, dx = 0 \text{ for all } k,

the second because sin⁡(kx)\sin(kx) is an odd function of xx, and an odd, Riemann-integrable function has zero integral over any interval symmetric about 00 (indeed, the substitution x↦−xx \mapsto -x shows ∫−ππsin⁡(kx) dx=−∫−ππsin⁡(kx) dx\int_{-\pi}^\pi \sin(kx)\,dx = -\int_{-\pi}^\pi \sin(kx)\,dx, forcing the integral to vanish); if k=0k=0 the integrand is identically 00.

Proof of (1). If m≠nm \neq n, both mm and −n-n, and m+nm+n, are integers, and by the product-to-sum identity,

∫−ππcos⁡(mx)cos⁡(nx) dx=12∫−ππcos⁡((m−n)x) dx+12∫−ππcos⁡((m+n)x) dx.\int_{-\pi}^{\pi}\cos(mx)\cos(nx)\,dx = \tfrac12\int_{-\pi}^\pi \cos((m-n)x)\,dx + \tfrac12\int_{-\pi}^\pi\cos((m+n)x)\,dx.

Since m≠nm \ne n, m−n≠0m - n \neq 0, so the first integral is 00 by the computation above. If additionally m+n≠0m+n \neq 0 (which holds automatically since m,n≥0m,n\geq 0 and m≠nm\ne n forces m+n>0m+n>0 unless m=n=0m=n=0, excluded), the second integral is also 00. Hence the sum is 00. If m=n≥1m = n \geq 1: the identity gives 12∫−ππcos⁡(0⋅x) dx+12∫−ππcos⁡(2nx) dx=12(2π)+12(0)=π\tfrac12\int_{-\pi}^\pi \cos(0\cdot x)\,dx + \tfrac12\int_{-\pi}^\pi \cos(2nx)\,dx = \tfrac12(2\pi) + \tfrac12(0) = \pi, using 2n≠02n \ne 0. If m=n=0m=n=0: ∫−ππcos⁡(0)cos⁡(0) dx=∫−ππ1 dx=2π\int_{-\pi}^\pi \cos(0)\cos(0)\,dx = \int_{-\pi}^\pi 1\,dx = 2\pi.

Proof of (2). Analogously, for m,n≥1m,n\geq 1,

∫−ππsin⁡(mx)sin⁡(nx) dx=12∫−ππcos⁡((m−n)x) dx−12∫−ππcos⁡((m+n)x) dx.\int_{-\pi}^\pi \sin(mx)\sin(nx)\,dx = \tfrac12\int_{-\pi}^\pi\cos((m-n)x)\,dx - \tfrac12\int_{-\pi}^\pi \cos((m+n)x)\,dx.

If m≠nm \ne n: m−n≠0m - n \ne 0 so the first term is 00; and m+n≥2>0m+n \ge 2 > 0 so the second term is also 00. Total: 00. If m=n≥1m = n\geq 1: first term is 12(2π)=π\tfrac12(2\pi) = \pi (since m−n=0m-n=0); second term is −12(0)=0-\tfrac12(0)=0 (since m+n=2m≠0m+n = 2m \ne 0). Total: π\pi. If m=0m=0 or n=0n=0, the corresponding "sine" factor is identically 00 by convention, so the integral is trivially 00, consistent with the stated formula.

Proof of (3). For m≥0,n≥1m \geq 0, n \geq 1,

∫−ππcos⁡(mx)sin⁡(nx) dx=12∫−ππsin⁡((m+n)x) dx−12∫−ππsin⁡((m−n)x) dx.\int_{-\pi}^\pi \cos(mx)\sin(nx)\,dx = \tfrac12\int_{-\pi}^\pi \sin((m+n)x)\,dx - \tfrac12\int_{-\pi}^\pi\sin((m-n)x)\,dx.

Both integrands are sines of integer multiples of xx (note m+n≥1m+n \geq 1 is a nonzero integer, and m−nm - n is some integer, possibly 00, in which case sin⁡(0⋅x)≡0\sin(0\cdot x)\equiv 0 and the integral is trivially 00). In every case each integral of the form ∫−ππsin⁡(kx) dx\int_{-\pi}^\pi \sin(kx)\,dx vanishes, as shown above (either because k≠0k\ne 0 giving an antiderivative that returns to 00, or because k=0k=0 giving the zero function). Hence the whole expression is 00. This proves all three orthogonality relations.

Part 2: the minimization property. Fix N≥0N \geq 0 and let T(x)=c02+∑n=1N(cncos⁡nx+dnsin⁡nx)T(x) = \frac{c_0}{2} + \sum_{n=1}^N (c_n \cos nx + d_n\sin nx) be an arbitrary trigonometric polynomial of degree ≤N\leq N with real coefficients c0,…,cN,d1,…,dNc_0,\dots,c_N,d_1,\dots,d_N. Since ff is Riemann integrable and TT is continuous (hence Riemann integrable), f−Tf - T is Riemann integrable, so ∫−ππ(f−T)2 dx\int_{-\pi}^\pi (f-T)^2\,dx is a well-defined finite real number (integrability of (f−T)2(f-T)^2 follows because products and squares of Riemann-integrable functions are Riemann integrable — a standard fact from the theory of the Riemann Integral). Expand:

∫−ππ(f−T)2 dx=∫−ππf2 dx−2∫−ππfT dx+∫−ππT2 dx.\int_{-\pi}^\pi (f - T)^2\,dx = \int_{-\pi}^\pi f^2\,dx - 2\int_{-\pi}^\pi f T\,dx + \int_{-\pi}^\pi T^2\,dx.

We compute the cross term using linearity of the integral and the definitions of an,bna_n, b_n:

∫−ππfT dx=c02∫−ππf dx+∑n=1N(cn∫−ππfcos⁡nx dx+dn∫−ππfsin⁡nx dx).\int_{-\pi}^\pi f T\,dx = \frac{c_0}{2}\int_{-\pi}^\pi f\,dx + \sum_{n=1}^N \left(c_n \int_{-\pi}^\pi f\cos nx\,dx + d_n\int_{-\pi}^\pi f \sin nx\,dx\right).

Since ∫−ππf dx=πa0\int_{-\pi}^\pi f\,dx = \pi a_0 and ∫−ππfcos⁡nx dx=πan\int_{-\pi}^\pi f\cos nx\,dx = \pi a_n, ∫−ππfsin⁡nx dx=πbn\int_{-\pi}^\pi f \sin nx\,dx = \pi b_n by definition, this becomes

∫−ππfT dx=π(c0a02+∑n=1N(cnan+dnbn)).\int_{-\pi}^\pi fT\,dx = \pi\left(\frac{c_0 a_0}{2} + \sum_{n=1}^N (c_n a_n + d_n b_n)\right).

Next, using the orthogonality relations from Part 1 (all cross terms between different trigonometric functions, and between cos⁡\cos and sin⁡\sin, vanish, and ∫(cos⁡0)2=2π\int(\cos 0)^2 = 2\pi while ∫cos⁡2(nx)=∫sin⁡2(nx)=π\int \cos^2(nx) = \int\sin^2(nx) = \pi for n≥1n\geq 1):

∫−ππT2 dx=c024(2π)+∑n=1N(cn2π+dn2π)=π(c022+∑n=1N(cn2+dn2)).\int_{-\pi}^\pi T^2\,dx = \frac{c_0^2}{4}(2\pi) + \sum_{n=1}^N \left(c_n^2 \pi + d_n^2 \pi\right) = \pi\left(\frac{c_0^2}{2} + \sum_{n=1}^N (c_n^2+d_n^2)\right).

Putting these together,

∫−ππ(f−T)2 dx=∫−ππf2 dx−2π(c0a02+∑n=1N(cnan+dnbn))+π(c022+∑n=1N(cn2+dn2)).\int_{-\pi}^\pi (f-T)^2\,dx = \int_{-\pi}^\pi f^2\,dx - 2\pi\left(\frac{c_0a_0}{2}+\sum_{n=1}^N(c_na_n+d_nb_n)\right) + \pi\left(\frac{c_0^2}{2}+\sum_{n=1}^N(c_n^2+d_n^2)\right).

Group by each coefficient and complete the square. For the constant term:

π(c022−c0a0)=π2(c0−a0)2−π2a02.\pi\left(\frac{c_0^2}{2} - c_0 a_0\right) = \frac{\pi}{2}(c_0 - a_0)^2 - \frac{\pi}{2}a_0^2.

For each n≥1n \geq 1:

π(cn2−2cnan)=π(cn−an)2−πan2,π(dn2−2dnbn)=π(dn−bn)2−πbn2.\pi\left(c_n^2 - 2c_na_n\right) = \pi(c_n-a_n)^2 - \pi a_n^2, \qquad \pi\left(d_n^2 - 2d_nb_n\right) = \pi(d_n-b_n)^2 - \pi b_n^2.

Substituting back,

∫−ππ(f−T)2 dx=∫−ππf2 dx−π2a02−π∑n=1N(an2+bn2)+π2(c0−a0)2+π∑n=1N[(cn−an)2+(dn−bn)2].\int_{-\pi}^\pi (f-T)^2\,dx = \int_{-\pi}^\pi f^2\,dx - \frac{\pi}{2}a_0^2 - \pi\sum_{n=1}^N(a_n^2+b_n^2) + \frac{\pi}{2}(c_0-a_0)^2 + \pi\sum_{n=1}^N\big[(c_n-a_n)^2+(d_n-b_n)^2\big].

The first three terms on the right do not depend on the choice of ci,dic_i, d_i at all — they depend only on ff and NN. The remaining sum of squares is manifestly ≥0\geq 0, and equals 00 if and only if c0=a0c_0 = a_0 and cn=an,dn=bnc_n = a_n, d_n = b_n for all 1≤n≤N1\le n\le N, i.e. if and only if T=SN(f)T = S_N(f). Therefore ∫−ππ(f−T)2 dx\int_{-\pi}^\pi (f-T)^2\,dx is minimized over all trigonometric polynomials TT of degree ≤N\leq N exactly when T=SN(f)T = S_N(f), and this minimizer is unique. ■\blacksquare

∎

Worked examples

Example 1: the sawtooth-type function f(x)=x2f(x) = x^2 on (−π,π](-\pi,\pi], extended 2π2\pi-periodically. Let ff be the 2π2\pi-periodic extension of f(x)=x2f(x) = x^2 for x∈(−π,π]x \in (-\pi,\pi]. This ff is continuous (check: at x=πx=\pi, the left-hand value from the formula is π2\pi^2; periodicity forces f(π)=f(−π)f(\pi) = f(-\pi), and indeed the formula gives f(−π)=(−π)2=π2f(-\pi) = (-\pi)^2 = \pi^2 too, so there is no jump), hence certainly Riemann integrable on [−π,π][-\pi,\pi], so its Fourier coefficients are well-defined. Since ff is even (f(−x)=(−x)2=x2=f(x)f(-x) = (-x)^2 = x^2 = f(x)), and sin⁡(nx)\sin(nx) is odd, the product f(x)sin⁡(nx)f(x)\sin(nx) is odd, so bn=1π∫−ππf(x)sin⁡(nx) dx=0b_n = \frac{1}{\pi}\int_{-\pi}^\pi f(x)\sin(nx)\,dx = 0 for all n≥1n \geq 1 (using the odd-function-vanishing fact established in the proof above). Compute a0a_0:

a0=1π∫−ππx2 dx=1π[x33]−ππ=1π⋅2π33=2π23.a_0 = \frac{1}{\pi}\int_{-\pi}^\pi x^2\,dx = \frac{1}{\pi}\left[\frac{x^3}{3}\right]_{-\pi}^\pi = \frac{1}{\pi}\cdot \frac{2\pi^3}{3} = \frac{2\pi^2}{3}.

Compute ana_n for n≥1n \geq 1 via integration by parts twice. Let u=x2u = x^2, dv=cos⁡(nx) dxdv = \cos(nx)\,dx, so du=2x dxdu = 2x\,dx, v=sin⁡(nx)/nv = \sin(nx)/n:

∫−ππx2cos⁡(nx) dx=[x2sin⁡(nx)n]−ππ−2n∫−ππxsin⁡(nx) dx.\int_{-\pi}^\pi x^2\cos(nx)\,dx = \left[\frac{x^2\sin(nx)}{n}\right]_{-\pi}^\pi - \frac{2}{n}\int_{-\pi}^\pi x\sin(nx)\,dx.

The boundary term vanishes since sin⁡(nπ)=0\sin(n\pi) = 0 and sin⁡(−nπ)=0\sin(-n\pi)=0 for integer nn. For the remaining integral, let u=xu=x, dv=sin⁡(nx) dxdv = \sin(nx)\,dx, du=dxdu=dx, v=−cos⁡(nx)/nv = -\cos(nx)/n:

∫−ππxsin⁡(nx) dx=[−xcos⁡(nx)n]−ππ+1n∫−ππcos⁡(nx) dx.\int_{-\pi}^\pi x \sin(nx)\,dx = \left[-\frac{x\cos(nx)}{n}\right]_{-\pi}^{\pi} + \frac{1}{n}\int_{-\pi}^\pi \cos(nx)\,dx.

The remaining integral is 00 (shown earlier, n≠0n \neq 0). The boundary term:

−πcos⁡(nπ)n−(−(−π)cos⁡(−nπ)n)=−πcos⁡(nπ)n−πcos⁡(nπ)n=−2πcos⁡(nπ)n,-\frac{\pi\cos(n\pi)}{n} - \left(-\frac{(-\pi)\cos(-n\pi)}{n}\right) = -\frac{\pi\cos(n\pi)}{n} - \frac{\pi\cos(n\pi)}{n} = -\frac{2\pi\cos(n\pi)}{n},

using cos⁡(−nπ)=cos⁡(nπ)\cos(-n\pi)=\cos(n\pi). Since cos⁡(nπ)=(−1)n\cos(n\pi) = (-1)^n, this equals −2π(−1)nn-\dfrac{2\pi(-1)^n}{n}. So ∫−ππxsin⁡(nx) dx=−2π(−1)nn\int_{-\pi}^\pi x\sin(nx)\,dx = -\dfrac{2\pi(-1)^n}{n}, and therefore

∫−ππx2cos⁡(nx) dx=−2n⋅(−2π(−1)nn)=4π(−1)nn2.\int_{-\pi}^\pi x^2\cos(nx)\,dx = -\frac{2}{n}\cdot\left(-\frac{2\pi(-1)^n}{n}\right) = \frac{4\pi(-1)^n}{n^2}.

Hence

an=1π⋅4π(−1)nn2=4(−1)nn2,n≥1.a_n = \frac{1}{\pi}\cdot \frac{4\pi(-1)^n}{n^2} = \frac{4(-1)^n}{n^2}, \qquad n \geq 1.

So the Fourier series of this ff is

f(x)∼π23+∑n=1∞4(−1)nn2cos⁡(nx).f(x) \sim \frac{\pi^2}{3} + \sum_{n=1}^\infty \frac{4(-1)^n}{n^2}\cos(nx).

As a numerical check, the first coefficient is a1=−4a_1 = -4 and a2=1a_2 = 1; note a0/2=π2/3≈3.2899a_0/2 = \pi^2/3 \approx 3.2899, matching the average value of x2x^2 over the interval, a sensible sanity check since a0/2a_0/2 is always the mean of ff over one period.

Example 2: an asymmetric, discontinuous function — a shifted, scaled step function. Let ff be 2π2\pi-periodic with

f(x)={3,−π<x<0−1,0≤x<π.f(x) = \begin{cases} 3, & -\pi < x < 0 \\ -1, & 0 \le x < \pi\end{cases}.

This ff is bounded and has only one discontinuity per period (a jump at x=0x=0, and correspondingly at x=π≡−πx=\pi \equiv -\pi), so it is Riemann integrable on [−π,π][-\pi,\pi] by the standard criterion that a bounded function with finitely many discontinuities on a compact interval is Riemann integrable. Compute a0a_0:

a0=1π(∫−π03 dx+∫0π(−1) dx)=1π(3π−π)=2.a_0 = \frac{1}{\pi}\left(\int_{-\pi}^0 3\,dx + \int_0^\pi (-1)\,dx\right) = \frac{1}{\pi}\left(3\pi - \pi\right) = 2.

Compute ana_n, n≥1n\geq 1:

an=1π(3∫−π0cos⁡(nx) dx−∫0πcos⁡(nx) dx)=1π(3[sin⁡nxn]−π0−[sin⁡nxn]0π).a_n = \frac{1}{\pi}\left(3\int_{-\pi}^0 \cos(nx)\,dx - \int_0^\pi \cos(nx)\,dx\right) = \frac{1}{\pi}\left(3\left[\frac{\sin nx}{n}\right]_{-\pi}^0 - \left[\frac{\sin nx}{n}\right]_0^\pi\right).

Since sin⁡(n⋅0)=0\sin(n\cdot 0)=0 and sin⁡(±nπ)=0\sin(\pm n\pi)=0 for integer nn, every bracket evaluates to 00. So an=0a_n = 0 for all n≥1n \geq 1. Compute bnb_n, n≥1n \geq 1:

bn=1π(3∫−π0sin⁡(nx) dx−∫0πsin⁡(nx) dx).b_n = \frac{1}{\pi}\left(3\int_{-\pi}^0 \sin(nx)\,dx - \int_0^\pi \sin(nx)\,dx\right).

Now ∫−π0sin⁡(nx) dx=[−cos⁡nxn]−π0=−1n+cos⁡(nπ)n⋅(−1)⋅(−1)\int_{-\pi}^0 \sin(nx)\,dx = \left[-\frac{\cos nx}{n}\right]_{-\pi}^0 = -\frac{1}{n} + \frac{\cos(n\pi)}{n}\cdot(-1)\cdot(-1); let's be careful:

∫−π0sin⁡(nx) dx=[−cos⁡(nx)n]−π0=−cos⁡0n−(−cos⁡(−nπ)n)=−1n+(−1)nn=(−1)n−1n.\int_{-\pi}^0 \sin(nx)\,dx = \left[-\frac{\cos(nx)}{n}\right]_{-\pi}^{0} = -\frac{\cos 0}{n} - \left(-\frac{\cos(-n\pi)}{n}\right) = -\frac{1}{n} + \frac{(-1)^n}{n} = \frac{(-1)^n - 1}{n}.

And

∫0πsin⁡(nx) dx=[−cos⁡(nx)n]0π=−(−1)nn+1n=1−(−1)nn.\int_0^\pi \sin(nx)\,dx = \left[-\frac{\cos(nx)}{n}\right]_0^\pi = -\frac{(-1)^n}{n} + \frac{1}{n} = \frac{1-(-1)^n}{n}.

So

bn=1π(3⋅(−1)n−1n−1−(−1)nn)=1πn(3(−1)n−3−1+(−1)n)=4(−1)n−4πn.b_n = \frac{1}{\pi}\left(3\cdot\frac{(-1)^n-1}{n} - \frac{1-(-1)^n}{n}\right) = \frac{1}{\pi n}\Big(3(-1)^n - 3 - 1 + (-1)^n\Big) = \frac{4(-1)^n - 4}{\pi n}.

When nn is even, (−1)n=1(-1)^n=1, giving bn=0b_n = 0. When nn is odd, (−1)n=−1(-1)^n=-1, giving bn=−8πnb_n = \dfrac{-8}{\pi n}. So

bn={0n even−8πnn odd.b_n = \begin{cases} 0 & n \text{ even} \\ -\dfrac{8}{\pi n} & n \text{ odd}\end{cases}.

As a check, b1=−8/π≈−2.546b_1 = -8/\pi \approx -2.546, and the series so far reads

f(x)∼1−8πsin⁡x−83πsin⁡3x−85πsin⁡5x−⋯ ,f(x) \sim 1 - \frac{8}{\pi}\sin x - \frac{8}{3\pi}\sin 3x - \frac{8}{5\pi}\sin 5x - \cdots,

consistent with a0/2=1a_0/2 = 1 being the mean of ff (mean of 33 on half the interval and −1-1 on the other half is indeed 11), a useful numerical sanity check on the computation.

Counterexampledropping Riemann integrability breaks the definition itself

The theorem's proof, and even the definition of Fourier coefficients, presupposes that ff is Riemann integrable on [−π,π][-\pi,\pi]. Drop this hypothesis and the coefficients may fail to exist at all — not merely fail to converge back to ff. Let D:[−π,π]→RD:[-\pi,\pi]\to\mathbb{R} be the Dirichlet-type function

D(x)={1x∈Q∩[−π,π]0x∉Q,D(x) = \begin{cases} 1 & x \in \mathbb{Q}\cap[-\pi,\pi] \\ 0 & x \notin \mathbb{Q}\end{cases},

extended 2π2\pi-periodically (note DD is indeed periodic since rationality of xx is equivalent to rationality of x+2πx+2\pi only if we are careful — instead, more simply, take f(x)=D(x)f(x) = D(x) directly as a function on R\mathbb{R} defined by f(x)=1f(x)=1 if x∈Qx\in\mathbb{Q} and f(x)=0f(x)=0 otherwise; this ff is not exactly 2π2\pi-periodic in a literal sense unless we restrict attention to one period and repeat the pattern, which we do: define ff on [−π,π)[-\pi,\pi) by f(x)=1f(x)=1 for x∈Qx \in \mathbb{Q}, f(x)=0f(x)=0 otherwise, and extend 2π2\pi-periodically). This ff is bounded (values in {0,1}\{0,1\}) but is famously not Riemann integrable on [−π,π][-\pi,\pi]: for any partition, every subinterval contains both rational and irrational points (density of Q\mathbb{Q} and R∖Q\mathbb{R}\setminus\mathbb{Q}), so every upper Darboux sum is 2π2\pi (using the value 11 on each subinterval) while every lower Darboux sum is 00. Hence the upper and lower integrals differ (2π≠02\pi \ne 0), so ff fails the Riemann criterion. Consequently the expression

an=1π∫−ππf(x)cos⁡(nx) dxa_n = \frac{1}{\pi}\int_{-\pi}^\pi f(x)\cos(nx)\,dx

is not merely hard to compute — the Riemann integral on the right side does not exist, so ana_n is undefined. The entire apparatus of Fourier coefficients collapses without the integrability hypothesis: there is no formal series to even write down, let alone ask whether it converges. This shows precisely why "Riemann integrable" is not a decorative hypothesis in the definition, but the load-bearing assumption that makes the coefficients well-defined numbers in the first place. (One remedy in more advanced treatments is to replace the Riemann integral with the Lebesgue integral, which does assign an integral to many non-Riemann-integrable bounded functions, though not to this particular pathological example in a way that helps — this function is Lebesgue integrable, with Lebesgue integral 00 since Q\mathbb{Q} has Lebesgue measure zero, illustrating that even the choice of integration theory is a hypothesis worth naming.)

Scope, edge cases & common traps

SituationWhat happensWhy
ff continuous and 2π2\pi-periodicCoefficients always well-defined; SN(f)S_N(f) well-defined for every NNContinuous ⇒\Rightarrow Riemann integrable on compact intervals
ff bounded with finitely many jump discontinuities per periodCoefficients well-definedBounded + finitely many discontinuities ⇒\Rightarrow Riemann integrable
ff unbounded (even if "integrable" in an improper sense)Formulas for an,bna_n, b_n may not make sense as Riemann integralsRiemann integration requires boundedness on a compact interval
ff bounded but wildly discontinuous (e.g. Dirichlet-type)Coefficients may fail to existRiemann integrability can fail even for bounded functions
Asking whether SN(f)→fS_N(f) \to f pointwiseNot addressed by this theoremConvergence requires separate hypotheses (e.g. piecewise smoothness) — a distinct theorem
Using SN(f)=fS_N(f) = f as if automaticA common errorOrthogonality only shows SN(f)S_N(f) is the best degree-NN approximation in mean square, not that the limit recovers ff pointwise or uniformly

The mathematician behind it

Origins · 1 minJean-Baptiste Joseph Fourier and how this was discovered
JJ
Jean-Baptiste Joseph Fourier
1768–1830 · Napoleonic France, mathematical physics of heat

Fourier was a French mathematician and physicist whose 1822 treatise Théorie analytique de la chaleur ("The Analytic Theory of Heat") introduced the claim that arbitrary periodic functions could be represented as infinite sums of sines and cosines, in order to solve the heat equation on physical domains. His argument was not rigorous by modern standards — the notion of function, the concept of convergence, and the theory of the integral were all still being developed — but the mathematical content it forced into existence (orthogonality, convergence of infinite series of functions, the need for a precise theory of integration) reshaped 19th-century analysis. Fourier also served as a scientific advisor on Napoleon's Egyptian expedition and later as prefect of the Isère department, only returning fully to mathematical physics work in his final years.

History
- 1807: Fourier submits a memoir to the French Academy claiming arbitrary functions decompose into trigonometric series; the claim is met with skepticism (Lagrange objects).
- 1822: Fourier publishes Théorie analytique de la chaleur, cementing the trigonometric series method for solving the heat equation.
- 1829: Dirichlet gives the first rigorous convergence conditions for Fourier series (piecewise monotonic functions), putting Fourier's claims on partially solid footing.
- 1854: Riemann's habilitation work develops the Riemann integral partly in order to make precise sense of Fourier coefficients for more general functions.
- 1873: du Bois-Reymond constructs a continuous function whose Fourier series diverges at a point, showing pointwise convergence is genuinely delicate and not automatic from continuity alone.
Why do we require ff to be Riemann integrable rather than continuous?

Continuity is sufficient but far stronger than necessary. Many functions of genuine interest — square waves, sawtooth signals, piecewise-defined physical models — have jump discontinuities, yet remain perfectly well-behaved for integration purposes: bounded with finitely many discontinuities on any bounded interval. The Riemann integrability criterion (a bounded function is Riemann integrable iff its set of discontinuities has measure zero, or more simply, iff it has at most finitely many discontinuities on a compact interval in the elementary case) is exactly the right level of generality to make the coefficient integrals ∫fcos⁡(nx) dx\int f\cos(nx)\,dx and ∫fsin⁡(nx) dx\int f \sin(nx)\,dx well-defined, without requiring the unnecessary luxury of continuity. This is why the foundational definition uses Riemann integrability rather than continuity as its hypothesis.

Does this article prove that Fourier series converge to the original function?

No, and deliberately so. This article establishes only the foundational layer: that the Fourier coefficients are well-defined real numbers whenever ff is Riemann integrable and periodic, that the trigonometric system is orthogonal, and that the partial sum SN(f)S_N(f) is the best mean-square approximation to ff among trigonometric polynomials of degree at most NN. Whether SN(f)S_N(f) actually converges to ff — pointwise, uniformly, or in mean square — is a separate and considerably subtler question, requiring additional hypotheses (such as piecewise continuous differentiability for pointwise convergence, or general density/completeness arguments for mean-square convergence). That material belongs to the theory of convergence of Fourier series.

What is the geometric meaning of the orthogonality relations?

They say that distinct members of the trigonometric system {1,cos⁡x,sin⁡x,cos⁡2x,sin⁡2x,… }\{1, \cos x, \sin x, \cos 2x, \sin 2x, \dots\} have zero "inner product" with respect to the pairing ⟨f,g⟩=∫−ππfg dx\langle f,g\rangle = \int_{-\pi}^\pi fg\,dx, exactly as orthogonal vectors in Euclidean space have zero dot product. This makes the trigonometric system behave like an orthogonal basis for an infinite-dimensional inner product space of periodic functions. The Fourier coefficient formulas are then the exact analogue of computing components of a vector along orthogonal axes: divide the inner product with a basis vector by that basis vector's squared length. This geometric viewpoint is what makes the minimization theorem (best mean-square approximation) essentially a Pythagorean-theorem argument in disguise.

Are the coefficients an,bna_n, b_n unique given ff?

Yes, trivially, because they are defined by an explicit formula (a specific Riemann integral) applied to ff; there is no ambiguity or choice involved. Uniqueness of representation is a different and subtler question: could two different Riemann-integrable functions f≠gf \ne g (differing on a "small" set) have exactly the same Fourier coefficients? The answer is yes in general for arbitrary Riemann-integrable functions differing on a measure-zero set (e.g. at finitely many points), since altering finitely many values does not change any of the defining integrals. However, if ff and gg are both continuous and have identical Fourier coefficients, then f=gf = g everywhere — this stronger uniqueness statement follows from later convergence theorems, not from the coefficient definitions alone.

What role does linearity of the integral play in defining Fourier coefficients?

Linearity of the Riemann integral is used constantly and silently throughout: it justifies splitting ∫−ππfT dx\int_{-\pi}^\pi fT\,dx into a sum of simpler integrals against cos⁡(nx)\cos(nx) and sin⁡(nx)\sin(nx) in the proof of the minimization theorem, it justifies computing ana_n and bnb_n term-by-term for piecewise-defined ff, and it underlies the very fact that the map sending ff to its sequence of Fourier coefficients is a linear map. Without linearity of integration — which itself rests on the additive and scaling properties proved when the Riemann integral is first constructed — none of the coefficient extraction machinery would be algebraically well-behaved.

How does this connect to Bessel's Inequality mentioned as a "leads to" topic?

The minimization theorem proved here shows ∫−ππ(f−SN(f))2 dx≤∫−ππf2 dx\int_{-\pi}^\pi (f-S_N(f))^2\,dx \le \int_{-\pi}^\pi f^2\,dx once the completed-square computation in the proof is examined closely: since the "error" term after minimizing is ∫f2 dx−π2a02−π∑n=1N(an2+bn2)\int f^2\,dx - \frac{\pi}{2}a_0^2 - \pi\sum_{n=1}^N(a_n^2+b_n^2), and this quantity must remain non-negative (it is a sum of squares, the minimum mean-square error), rearranging gives a022+∑n=1N(an2+bn2)≤1π∫−ππf2 dx\frac{a_0^2}{2} + \sum_{n=1}^N (a_n^2+b_n^2) \le \frac{1}{\pi}\int_{-\pi}^\pi f^2\,dx for every NN. Letting N→∞N \to \infty yields exactly Bessel's Inequality, showing the foundational orthogonality result proved in this article is the direct algebraic ancestor of that later theorem.

Before this

Where this leads