Fourier Series and Periodic Functions

A periodic function repeats — f(x+L)=f(x)f(x+L)=f(x) for every xx — and periodicity is everywhere physics looks: the plucked string, the alternating voltage in a mains circuit, the electron density of a crystal lattice, the temperature around an insulated ring. The Fourier series is the claim that any reasonable function of period LL is a superposition of pure oscillations whose frequencies are integer multiples of the fundamental 1/L1/L. Decomposing a signal into these harmonics is the native language of vibration, diffraction, and every linear wave phenomenon, converting the analytic problem "understand ff" into the algebraic one "list its amplitudes". The engine underneath is orthogonality. The exponentials {e2πinx/L}n∈Z\{e^{2\pi i n x/L}\}_{n\in\mathbb{Z}} are mutually perpendicular under the inner product ⟨f,g⟩=∫0Lf‾ g dx\langle f,g\rangle=\int_0^L\overline f\,g\,\mathrm dx, and after normalisation they form a complete orthonormal basis of the Hilbert space L2[0,L]L^2[0,L] of square-integrable periodic functions. A Fourier coefficient is then nothing more exotic than a coordinate — the projection of the vector ff onto one basis axis, exactly as resolving a force into x^,y^,z^\hat x,\hat y,\hat z components, but in infinitely many dimensions. Everything else, from Parseval's energy identity to the differentiation rule that diagonalises d/dx\mathrm d/\mathrm dx, is linear algebra read in this basis. Two questions then organise the subject. First, in what sense does the series equal ff? Convergence in the mean holds for every L2L^2 function; pointwise convergence needs more, and near a jump the partial sums overshoot by a fixed fraction — the Gibbs phenomenon. Second, letting L→∞L\to\infty turns the discrete spectrum {n/L}\{n/L\} into a continuum and the series into the Fourier transform, with Parseval passing into Plancherel. Fourier introduced all of this to solve the heat equation, and it remains the prototype for separation of variables, spectral methods, and every orthogonal-function expansion in physics.

Key takeaways
  • A function of period LL expands as an infinite sum of harmonics — cos⁡(2πnx/L)\cos(2\pi nx/L) and sin⁡(2πnx/L)\sin(2\pi nx/L), or complex exponentials e2πinx/Le^{2\pi i nx/L} — one term per integer multiple of the fundamental frequency 1/L1/L.
  • Each coefficient is a projection: multiply ff by the conjugate harmonic and average over one period, exploiting orthogonality.
  • The complex form f=∑ncne2πinx/Lf=\sum_n c_n e^{2\pi i nx/L} is cleanest — one integral gives cnc_n, and exponentials multiply trivially.
  • Parseval's theorem equates the energy 1L∫∣f∣2\frac1L\int|f|^2 with ∑∣cn∣2\sum|c_n|^2, so the Fourier basis is an orthonormal coordinate system in which Pythagoras holds.
  • Smoothness equals decay: a jump gives cn∼1/nc_n\sim 1/n, a corner ∼1/n2\sim 1/n^2, a smooth periodic function faster than any power — why spectral methods are so accurate.
  • Key idea: the harmonics e2πinx/Le^{2\pi i nx/L} are mutually orthogonal over one period, so a Fourier coefficient is just the projection cn=1L∫0Lf(x) e−2πinx/L dxc_n=\frac1L\int_0^L f(x)\,e^{-2\pi i nx/L}\,\mathrm dx — Fourier analysis is linear algebra in an infinite-dimensional inner-product space.

Where this lives today

Fourier's ring of iron has become the arithmetic of the digital age. Every JPEG image and MP3 file is stored as truncated Fourier-type coefficients — the discrete cosine transform keeps the perceptually important low harmonics and discards the rest, the smoothness-equals-decay principle used as a compression law. The fast Fourier transform (Cooley–Tukey, 1965) computes these coefficients in O(Nlog⁡N)O(N\log N) operations instead of O(N2)O(N^2) and is routinely called one of the most important algorithms ever devised; it runs inside every phone's radio and every Wi-Fi link's OFDM modulation. In magnetic-resonance imaging the scanner does not measure the picture at all — it measures its Fourier coefficients in "kk-space," and an inverse transform reconstructs the anatomy. Spectral methods integrate the equations of weather, climate, and turbulence by advancing each Fourier mode of the flow, exploiting the exponential accuracy smooth fields guarantee. Crystallographers read a protein's structure from the squared Fourier coefficients of its electron density in X-ray spots, and gravitational-wave observatories sift a chirp from noise by comparing power spectra bin by bin, Parseval underwriting the matched filter. Two centuries on, the claim that everything periodic is a sum of pure tones is not a theorem students admire but an instruction processors execute billions of times a second.

The physical picture

Think of a periodic signal as a chord. The Fourier series is the list of pure tones inside it: the fundamental sets the pitch, and the higher harmonics — with their amplitudes and phases — shape the timbre. Reconstructing ff means stacking those tones back up. The first figure builds a square wave this way, one harmonic at a time, and shows the one stubborn feature no finite stack can smooth out: the overshoot at each jump.

Figure
Building a square wave from its harmonics. One term (4/π)sin x is a lone bump; three terms (4/π)(sin x + sin3x/3) already flattens the plateaus; nineteen odd harmonics track the wave everywhere except at the jumps, where the partial sum overshoots to 1.179 — an 8.95 percent excess of the jump height that never disappears, the Gibbs phenomenon
A square wave is a sum of odd harmonics: f(x) = (4/π) Σ sin(nx)/n over odd n x f +1 −1 0 −π +π 1.179 (Gibbs overshoot) 1 term 2 terms 19 terms

Geometrically the picture is even simpler. L2[0,L]L^2[0,L] is an infinite-dimensional Euclidean space, and the normalised exponentials are perpendicular unit axes: finding cnc_n drops a perpendicular from ff onto the nn-th axis, and Parseval is just Pythagoras, ∥f∥2=∑∣cn∣2\|f\|^2=\sum|c_n|^2. What the second figure shows is that this coordinate list is not arbitrary — its rate of decay is dictated by the smoothness of ff. The square wave has jumps, so its amplitudes fall off only as 1/n1/n, which is why the Gibbs ears refuse to go away.

Figure
The amplitude spectrum of the square wave. Only odd harmonics are present, with bₙ = 4/(πn): b₁ = 1.273, b₃ = 0.424, b₅ = 0.255, b₇ = 0.182, b₉ = 0.141. The envelope decays as 1/n — the slow decay characteristic of a jump discontinuity — so truncating the series always leaves a visible ripple
Amplitude spectrum bₙ = 4/(πn): a jump gives 1/n decay (slow) 0 1.0 harmonic number n amplitude bₙ 1.273 1 2 0.424 3 4 0.255 5 6 0.182 7 8 0.141 9 envelope ∝ 1/n

Smoothness is the hidden variable: differentiating the series multiplies each cnc_n by 2πin/L2\pi i n/L, so a jump decays as 1/n1/n, a corner as 1/n21/n^2, and an infinitely differentiable periodic function faster than any power — a smooth curve needs a handful of tones while a sharp edge needs a symphony.

The core equations

There are two equivalent languages for a Fourier series — real trigonometric and complex exponential — with a dictionary between them. We open with the real form, what a first course writes down and an oscilloscope displays: a mean value plus a sum of cosines and sines at every integer multiple of the fundamental.

f(x)=a02+∑n=1∞[ancos⁡2πnxL+bnsin⁡2πnxL](1)f(x)=\frac{a_0}{2}+\sum_{n=1}^{\infty}\left[a_n\cos\frac{2\pi n x}{L}+b_n\sin\frac{2\pi n x}{L}\right] \qquad (1)

where: f(x)f(x) — periodic function, f(x+L)=f(x)f(x+L)=f(x); LL — the period; an,bna_n,b_n — real cosine and sine amplitudes of harmonic nn; a0/2a_0/2 — the average, or DC, value over one period. Reading it: the sum rebuilds ff tone by tone, n=1n=1 the fundamental and larger nn the overtones. The amplitudes are computed, not guessed, by the Euler–Fourier formulas — each an average of ff against the harmonic it measures, normalised so a pure cos⁡(2πnx/L)\cos(2\pi nx/L) returns amplitude one.

an=2L∫0Lf(x)cos⁡2πnxL dx,bn=2L∫0Lf(x)sin⁡2πnxL dx(2)a_n=\frac{2}{L}\int_{0}^{L} f(x)\cos\frac{2\pi n x}{L}\,\mathrm dx,\qquad b_n=\frac{2}{L}\int_{0}^{L} f(x)\sin\frac{2\pi n x}{L}\,\mathrm dx \qquad (2)

where: ∫0L\int_0^L — an integral over any one full period (the start point is immaterial); 2/L2/L — the normalisation forced by ∫0Lcos⁡2=∫0Lsin⁡2=L/2\int_0^L\cos^2=\int_0^L\sin^2=L/2. Reading it: correlate ff with a harmonic and average to read off its amount. The complex exponential form is the one professionals use. It merges the twin sums (1) into a single sum over all integers and reduces the two integrals (2) to one.

f(x)=∑n=−∞∞cn e2πinx/L,cn=1L∫0Lf(x) e−2πinx/L dx(3)f(x)=\sum_{n=-\infty}^{\infty} c_n\,e^{2\pi i n x/L},\qquad c_n=\frac{1}{L}\int_{0}^{L} f(x)\,e^{-2\pi i n x/L}\,\mathrm dx \qquad (3)

where: cnc_n — the complex coefficient of harmonic nn, carrying amplitude and phase; nn — any integer, so negative frequencies appear explicitly; e2πinx/Le^{2\pi i nx/L} — the orthogonal basis function of frequency n/Ln/L. Reading it: one integral computes one coordinate of ff. The two languages are connected by a dictionary: a real cosine–sine pair repackages into a conjugate pair of complex coefficients at ±n\pm n, and vice versa.

c0=a02,cn=an−ibn2,c−n=an+ibn2(n>0)(4)c_0=\frac{a_0}{2},\qquad c_n=\frac{a_n-i b_n}{2},\qquad c_{-n}=\frac{a_n+i b_n}{2}\quad(n>0) \qquad (4)

where: c−n=cn‾c_{-n}=\overline{c_n} — the conjugate-symmetry relation, which holds if and only if ff is real-valued. Reading it: a real signal spends two reals per harmonic, an amplitude and a phase. Everything above rests on a single orthonormality relation — the exponentials are perpendicular unit vectors. It is the one integral to memorise, since every coefficient formula and Parseval fall straight out of it.

1L∫0Le2πi(m−n)x/L dx=δmn(5)\frac{1}{L}\int_{0}^{L} e^{2\pi i (m-n) x/L}\,\mathrm dx=\delta_{mn} \qquad (5)

where: δmn\delta_{mn} — the Kronecker delta, equal to 11 when m=nm=n and 00 otherwise. Reading it: distinct harmonics average to nothing over a period, so only the matching one survives. Parseval's theorem is the energy accountant. The average of ∣f∣2|f|^2 — a power per unit length — equals the sum of the powers carried by the harmonics, with no cross terms because the basis is orthogonal.

1L∫0L∣f(x)∣2 dx=∑n=−∞∞∣cn∣2(6)\frac{1}{L}\int_{0}^{L}|f(x)|^2\,\mathrm dx=\sum_{n=-\infty}^{\infty}|c_n|^2 \qquad (6)

where: ∣f∣2|f|^2 — energy (power) density; ∣cn∣2|c_n|^2 — the power in harmonic nn. Reading it: total energy is the Pythagorean sum of the mode energies — the norm is basis-independent. Finally, the differentiation rule makes Fourier series indispensable for differential equations: on the exponential basis, d/dx\mathrm d/\mathrm dx is not an operator to invert but a number to multiply.

(f′)^n=2πinL cn(7)\widehat{(f')}_n=\frac{2\pi i n}{L}\,c_n \qquad (7)

where: f′f' — the derivative of ff (itself periodic); 2πin/L2\pi i n/L — the eigenvalue of d/dx\mathrm d/\mathrm dx on harmonic nn. Reading it: differentiation is diagonal in the Fourier basis, turning a constant-coefficient ODE into algebra, mode by mode.

Derivation AThe Euler–Fourier coefficient formula by orthogonal projection

The goal is to prove that the coefficient integral in equation (3) really extracts a single amplitude from the whole superposition, for exactly the reason that x^⋅v⃗\hat x\cdot\vec v extracts one Cartesian component of a vector. We assume the series converges well enough to integrate term by term, then project it onto one basis exponential and watch orthogonality annihilate every term but one — the calculation that justifies calling cnc_n a coordinate.

Step 1. Start from the assumed expansion f(x)=∑mcm e2πimx/Lf(x)=\sum_m c_m\,e^{2\pi i m x/L}, multiply both sides by the conjugate basis function e−2πinx/Le^{-2\pi i n x/L}, and integrate over one period: 1L∫0Lf(x)e−2πinx/L dx=1L∫0L∑mcm e2πi(m−n)x/L dx\frac1L\int_0^L f(x)e^{-2\pi i nx/L}\,\mathrm dx=\frac1L\int_0^L\sum_m c_m\,e^{2\pi i(m-n)x/L}\,\mathrm dx. Why: projecting onto the nn-th axis means taking the inner product with the nn-th basis vector — multiplying by its conjugate and integrating is precisely ⟨en,f⟩\langle e_n,f\rangle.

Step 2. Exchange the sum and the integral (legitimate for a uniformly convergent series) and apply the orthonormality relation (5): ∑mcm 1L∫0Le2πi(m−n)x/L dx=∑mcm δmn\sum_m c_m\,\frac1L\int_0^L e^{2\pi i(m-n)x/L}\,\mathrm dx=\sum_m c_m\,\delta_{mn}. Why: each cross term with m≠nm\neq n is an exponential completing a whole number of cycles over the period, so it averages to zero; only the resonant m=nm=n term has a nonzero mean.

Step 3. Collapse the sum against the Kronecker delta, which selects the single term m=nm=n: ∑mcm δmn=cn\sum_m c_m\,\delta_{mn}=c_n. This is the boxed result cn=1L∫0Lf(x) e−2πinx/L dxc_n=\frac1L\int_0^L f(x)\,e^{-2\pi i nx/L}\,\mathrm dx. Why: the delta is the discrete identity — sifting a sum against it returns the one matching entry, exactly as the projection returns one coordinate. *Verified: reduces to the real Euler–Fourier integrals (2) through the dictionary (4); cross-checked against Arfken–Weber–Harris ch. 19 and Riley–Hobson–Bence ch. 12.*

Go deeper · Derivation B · 1 minParseval's theorem from completeness of the basis
Derivation BParseval's theorem from completeness of the basis

The aim is to show that the energy of a signal is the sum of the energies of its harmonics, with no cross terms, and to make explicit that the equality (rather than the mere inequality of Bessel) is a statement of completeness — that the exponentials leave no direction of L2L^2 unrepresented. We expand ∣f∣2|f|^2 using two copies of the series, collapse the double sum with orthonormality, and identify what survives as the sawtooth energy check below.

Step 1. Write the energy density as ∣f∣2=ff‾|f|^2=f\overline f and substitute both expansions: 1L∫0Lff‾ dx=1L∫0L(∑mcme2πimx/L)(∑ncn‾ e−2πinx/L)dx\frac1L\int_0^L f\overline f\,\mathrm dx=\frac1L\int_0^L\big(\sum_m c_m e^{2\pi i mx/L}\big)\big(\sum_n \overline{c_n}\,e^{-2\pi i nx/L}\big)\mathrm dx. Why: energy is quadratic in ff, so it must involve two factors of the series — one for ff and one for its conjugate f‾\overline f, whose exponents carry the opposite sign.

Step 2. Interchange the sums with the integral and apply orthonormality (5) to the product of exponentials: ∑m,ncmcn‾ 1L∫0Le2πi(m−n)x/L dx=∑m,ncmcn‾ δmn\sum_{m,n}c_m\overline{c_n}\,\frac1L\int_0^L e^{2\pi i(m-n)x/L}\,\mathrm dx=\sum_{m,n}c_m\overline{c_n}\,\delta_{mn}. Why: the double sum is a matrix of all mode–mode products, but orthogonality kills every off-diagonal m≠nm\neq n entry — different harmonics store energy independently.

Step 3. Collapse the diagonal with the delta to get ∑ncncn‾=∑n∣cn∣2\sum_n c_n\overline{c_n}=\sum_n|c_n|^2, the boxed identity 1L∫0L∣f∣2 dx=∑n∣cn∣2\frac1L\int_0^L|f|^2\,\mathrm dx=\sum_n|c_n|^2. Why: that this is an equality and not just ≥\geq (Bessel's inequality) is exactly the completeness of the exponential basis — there is no missing part of ff hiding outside the span, so no energy is unaccounted for. *Verified: the equivalent real form is 1L∫0L∣f∣2=a024+12∑n≥1(an2+bn2)\frac1L\int_0^L|f|^2=\frac{a_0^2}{4}+\frac12\sum_{n\geq1}(a_n^2+b_n^2); matches Stone & Goldbart ch. 2 and 8, and is checked numerically against the sawtooth (Basel sum) below.*

Go deeper · Derivation C · 1 minWhy smoothness controls the rate of coefficient decay
Derivation CWhy smoothness controls the rate of coefficient decay

The goal is to turn the slogan "smoother functions have faster-decaying coefficients" into a theorem by tracking what repeated integration by parts does to the coefficient integral. Each pass trades a factor of 1/n1/n for a derivative of ff but leaves a boundary term measuring the mismatch at the period's ends — and that term is precisely a discontinuity. The result explains both figures: the square wave's 1/n1/n tail and the exponential accuracy of spectral methods.

Step 1. Integrate cn=1L∫0Lf(x)e−2πinx/L dxc_n=\frac1L\int_0^L f(x)e^{-2\pi i nx/L}\,\mathrm dx by parts once, differentiating ff and integrating the exponential (which brings down L/(2πin)L/(2\pi i n)): cn=12πin[boundary term]+12πin⋅1L∫0Lf′(x)e−2πinx/L dxc_n=\frac{1}{2\pi i n}\Big[\text{boundary term}\Big]+\frac{1}{2\pi i n}\cdot\frac1L\int_0^L f'(x)e^{-2\pi i nx/L}\,\mathrm dx. Why: integrating the oscillatory factor is what produces the 1/n1/n — every integration by parts against a wave of frequency nn costs the amplitude a factor of nn.

Step 2. If ff is continuous and periodic, the boundary term [f(x)e−2πinx/L]0L\big[f(x)e^{-2\pi i nx/L}\big]_0^L vanishes because f(L)=f(0)f(L)=f(0) and the exponential is LL-periodic, leaving cn=12πin (f′)^nc_n=\frac{1}{2\pi i n}\,\widehat{(f')}_n — one clean power of 1/n1/n times the coefficients of f′f'. Why: this is the differentiation rule (7) read backwards; each derivative that stays periodic buys one more factor of 1/n1/n of decay.

Step 3. Iterate. A function with kk continuous periodic derivatives gives ∣cn∣≤Ck∣n∣−k−1|c_n|\leq C_k|n|^{-k-1}; an infinitely smooth periodic function beats every power, ∣cn∣≤Ck∣n∣−k|c_n|\leq C_k|n|^{-k} for all kk. But a jump makes the very first boundary term survive, contributing a term ∝1/n\propto 1/n that no further integration removes — so a discontinuity pins the decay at 1/n1/n. Why: the boundary term is the size of the jump; a discontinuity is a source the smoothing machinery cannot integrate away, which is exactly why the square wave's spectrum crawls down as 1/n1/n and its Gibbs ears persist. *Verified: square-wave bn=4/(πn)∝1/nb_n=4/(\pi n)\propto1/n (jump) versus triangle-wave ∝1/n2\propto1/n^2 (corner); consistent with the decay hierarchy in Körner, Fourier Analysis, and Stone & Goldbart ch. 8.*

Limiting cases

Special structures collapse the general series, and the boundaries of the whole framework are themselves instructive.

CaseResultMeaning
Even functionf(−x)=f(x) ⇒ bn=0f(-x)=f(x)\ \Rightarrow\ b_n=0Only cosines survive — a pure cosine expansion.
Odd functionf(−x)=−f(x) ⇒ an=0f(-x)=-f(x)\ \Rightarrow\ a_n=0Only sines survive — natural for functions vanishing at the ends.
Real functionc−n=cn‾c_{-n}=\overline{c_n}Complex coefficients come in conjugate pairs, one amplitude and one phase per harmonic.
Smooth periodic∣cn∣≤Ck∣n∣−k ∀k\lvert c_n\rvert\leq C_k\lvert n\rvert^{-k}\ \forall kFaster-than-any-power decay; the series converges uniformly and absolutely.
Jump discontinuitycn∼1/nc_n\sim 1/n, series →12[f(x+)+f(x−)]\to\tfrac12[f(x^+)+f(x^-)]Slow decay and the Gibbs overshoot; convergence to the midpoint, not either side.
Period L→∞L\to\infty∑ncne2πinx/L → ∫f~(k) e2πikx dk\sum_n c_n e^{2\pi i nx/L}\ \to\ \int\tilde f(k)\,e^{2\pi i kx}\,\mathrm dkDiscrete spectrum becomes a continuum: the Fourier transform, with Parseval becoming Plancherel.

Worked examples

1 · The square wave, the Leibniz series, and Gibbs (fully worked)

Expand the odd square wave f(x)=+1f(x)=+1 on (0,π)(0,\pi) and −1-1 on (−π,0)(-\pi,0), period 2π2\pi. Find its coefficients, evaluate at x=π/2x=\pi/2, and quantify the overshoot at the jump.

Step 1. With L=2πL=2\pi the harmonics are sin⁡nx,cos⁡nx\sin nx,\cos nx. Since ff is odd, all an=0a_n=0 and we need only bn=1π∫−ππfsin⁡nx dx=2π∫0πsin⁡nx dxb_n=\frac1\pi\int_{-\pi}^{\pi}f\sin nx\,\mathrm dx=\frac2\pi\int_0^{\pi}\sin nx\,\mathrm dx, doubling the half-range because fsin⁡nxf\sin nx is even.

Step 2. Integrate: ∫0πsin⁡nx dx=[−cos⁡nxn]0π=1−cos⁡nπn=1−(−1)nn\int_0^\pi\sin nx\,\mathrm dx=\big[-\tfrac{\cos nx}{n}\big]_0^\pi=\frac{1-\cos n\pi}{n}=\frac{1-(-1)^n}{n}, which is 2/n2/n for odd nn and 00 for even nn. Hence bn=4πn (n odd),bn=0 (n even)\boxed{b_n=\dfrac{4}{\pi n}\ (n\ \text{odd}),\quad b_n=0\ (n\ \text{even})} and f(x)=4π(sin⁡x+sin⁡3x3+sin⁡5x5+⋯)f(x)=\dfrac4\pi\Big(\sin x+\dfrac{\sin 3x}{3}+\dfrac{\sin 5x}{5}+\cdots\Big). Numerically b1=1.2732b_1=1.2732, b3=0.4244b_3=0.4244, b5=0.2546b_5=0.2546 — the spectrum drawn above.

Step 3. Evaluate at x=π/2x=\pi/2, where f=+1f=+1: sin⁡(nπ/2)\sin(n\pi/2) runs +1,−1,+1,…+1,-1,+1,\dots over odd nn, so 1=4π(1−13+15−17+⋯)1=\frac4\pi\big(1-\tfrac13+\tfrac15-\tfrac17+\cdots\big). Rearranging gives the Leibniz series 1−13+15−⋯=π4=0.78539816341-\tfrac13+\tfrac15-\cdots=\dfrac{\pi}{4}=\mathbf{0.7853981634} — a first-principles value of π\pi falling out of a square wave.

Step 4. The jump at x=0x=0 has height 22 (from −1-1 to +1+1), and the series there converges to the midpoint 12(−1+1)=0\tfrac12(-1+1)=0, not to either value. Near the jump the partial sums peak at 2π Si(π)=2π(1.851937)=1.17898\tfrac2\pi\,\mathrm{Si}(\pi)=\tfrac2\pi(1.851937)=\mathbf{1.17898} times the half-jump — an overshoot of 0.178980.17898 of the half-jump, i.e. 8.95%\mathbf{8.95\%} of the full jump height. Result: bₙ = 4/(πn) for odd n, the Leibniz sum π/4 = 0.7854, and a Gibbs overshoot of 8.95%.

2 · The sawtooth and the Basel problem (fully worked)

Expand f(x)=xf(x)=x on (−π,π)(-\pi,\pi), period 2π2\pi — the sawtooth — then use Parseval to sum ∑1/n2\sum 1/n^2.

Step 1. ff is odd, so an=0a_n=0 and bn=1π∫−ππxsin⁡nx dx=2π∫0πxsin⁡nx dxb_n=\frac1\pi\int_{-\pi}^{\pi}x\sin nx\,\mathrm dx=\frac2\pi\int_0^\pi x\sin nx\,\mathrm dx.

Step 2. Integrate by parts: ∫0πxsin⁡nx dx=[−xcos⁡nxn]0π+1n∫0πcos⁡nx dx=−πcos⁡nπn=−π(−1)nn\int_0^\pi x\sin nx\,\mathrm dx=\big[-\tfrac{x\cos nx}{n}\big]_0^\pi+\tfrac1n\int_0^\pi\cos nx\,\mathrm dx=-\tfrac{\pi\cos n\pi}{n}=-\tfrac{\pi(-1)^n}{n}, since ∫0πcos⁡nx dx=0\int_0^\pi\cos nx\,\mathrm dx=0. Thus bn=2π⋅(−π(−1)nn)=2(−1)n+1nb_n=\frac2\pi\cdot\big(-\tfrac{\pi(-1)^n}{n}\big)=\dfrac{2(-1)^{n+1}}{n}, giving x=2∑n=1∞(−1)n+1nsin⁡nx\boxed{x=2\sum_{n=1}^{\infty}\dfrac{(-1)^{n+1}}{n}\sin nx} on (−π,π)(-\pi,\pi).

Step 3. Apply Parseval in real form, 12π∫−ππx2 dx=12∑n≥1bn2\frac1{2\pi}\int_{-\pi}^{\pi}x^2\,\mathrm dx=\frac12\sum_{n\geq1}b_n^2. The left side is 12π⋅2π33=π23\frac1{2\pi}\cdot\frac{2\pi^3}{3}=\frac{\pi^2}{3}; the right side is 12∑n≥14n2=2∑n≥11n2\frac12\sum_{n\geq1}\frac{4}{n^2}=2\sum_{n\geq1}\frac1{n^2}.

Step 4. Equate: 2∑1/n2=π2/32\sum 1/n^2=\pi^2/3, so ∑n=1∞1n2=π26=1.6449340668\sum_{n=1}^{\infty}\dfrac1{n^2}=\dfrac{\pi^2}{6}=\mathbf{1.6449340668} — the Basel problem, solved by Euler in 1735 and here recovered as a one-line consequence of the energy identity. Result: sawtooth bₙ = 2(−1)ⁿ⁺¹/n, and Parseval yields Σ1/n² = π²/6 = 1.6449.

Physics of the portrait

The Fourier series is where physics learned to trust an infinite sum. Its author was not a pure mathematician but an engineer of empire — a man who followed Napoleon to Egypt, governed a French département, and wrote down the equation of heat and the audacious claim that any temperature profile could be built from sines and cosines.

Origins · 1 minJoseph Fourier and how this was discovered
JF
Joseph Fourier
1768–1830 · heat conduction and the birth of harmonic analysis

Jean-Baptiste Joseph Fourier was orphaned young, narrowly escaped the guillotine during the Revolution, and joined Napoleon's 1798 expedition to Egypt as secretary of the Institut d'Égypte. It was afterwards, as prefect of the Isère, that he did his decisive work. In an 1807 memoir on the conduction of heat in solids he introduced both the heat equation and the method that would carry his name: expand the initial temperature distribution as an infinite series of trigonometric functions, and each mode then decays independently in time. The claim that an arbitrary function — even one with corners and jumps — could be so represented struck his examiners as reckless; Lagrange, Laplace, and Legendre withheld full endorsement, and the memoir went unpublished for years. Fourier persevered, and his 1822 treatise Théorie analytique de la chaleur became one of the most influential books in mathematical physics, praised by Maxwell as "a great mathematical poem." The rigorous convergence theory he lacked was supplied by Dirichlet in 1829 and completed only in the twentieth century by the Lebesgue integral and the Riesz–Fischer theorem, which recast his intuition as the completeness of an orthonormal basis in a Hilbert space. He died in Paris in 1830, having turned a problem about a cooling ring of iron into the universal language of waves.

History
1807
— Fourier submits his memoir on heat conduction, claiming any function is a sum of sines and cosines
1822
— Théorie analytique de la chaleur is published, founding harmonic analysis
1829
— Dirichlet proves the first rigorous convergence theorem for Fourier series
1848
— Wilbraham first notices the overshoot of partial sums at a jump
1899
— Gibbs explains the persistent overshoot, now the Gibbs phenomenon
1907
— the Riesz–Fischer theorem establishes completeness of the trigonometric basis in L²

Going further

Texts. Stone & Goldbart, Mathematics for Physics, ch. 2 (function spaces) and ch. 8 (Fourier series) · Arfken, Weber & Harris, Mathematical Methods for Physicists, 7th ed., ch. 19 · Hassani, Mathematical Physics, ch. 8 · Byron & Fuller, Mathematics of Classical and Quantum Physics, ch. 5 · Riley, Hobson & Bence, Mathematical Methods for Physics and Engineering, 3rd ed., ch. 12 · Körner, Fourier Analysis (Cambridge, 1988) for the convergence theory.

Provenance. The coefficient formulas, the orthonormality integral (5), the real–complex dictionary (4), Parseval (6) and the differentiation rule (7) are standard and re-derivable from the single relation 1L∫0Le2πi(m−n)x/Ldx=δmn\frac1L\int_0^L e^{2\pi i(m-n)x/L}\mathrm dx=\delta_{mn}; cross-checked against Stone & Goldbart ch. 8, Arfken–Weber–Harris ch. 19, and Riley–Hobson–Bence ch. 12. A verifier should reconfirm: (i) the orthonormality relation itself; (ii) the square-wave coefficients bn=4/(πn)b_n=4/(\pi n) for odd nn and the resulting Leibniz sum π/4=0.7853981634\pi/4=0.7853981634; (iii) the sawtooth coefficients bn=2(−1)n+1/nb_n=2(-1)^{n+1}/n and the Parseval-derived Basel sum ∑1/n2=π2/6=1.6449340668\sum1/n^2=\pi^2/6=1.6449340668; (iv) the Gibbs overshoot 2πSi(π)=1.17898\tfrac2\pi\mathrm{Si}(\pi)=1.17898, i.e. 8.95% of the jump; (v) the Dirichlet midpoint value at jumps.

Prerequisites. Inner-product (Hilbert) spaces · Riemann/Lebesgue integration · Complex exponentials and Euler's formula. Leads to. Convergence of Fourier Series · The Fourier Transform · Parseval's and Plancherel's Theorems · The Dirac Delta Function · Solving Differential Equations by Transform Methods.

Ask the tutor: Want to see how the same projection idea turns into the Fourier transform, or how Parseval underwrites signal energy and quantum probability — just ask.

Is the Fourier series just an approximation, or does it exactly equal the function

Both, depending on how you read "equal." For any square-integrable periodic function the series converges to ff in the mean-square sense — the error energy ∫∣f−SN∣2\int|f-S_N|^2 goes to zero — and this is exact, not approximate. Where ff is smooth it also equals ff pointwise; the only places the equality can fail pointwise are discontinuities, where the series returns the midpoint of the jump. So a Fourier series is an exact representation of the function as an element of L2L^2; the word "approximation" properly refers only to a truncated partial sum SNS_N.

What actually is the Gibbs phenomenon, and can I get rid of it

Near a jump the partial sums overshoot by a fixed fraction — about 8.95 percent of the jump height — and this overshoot does not shrink as you add terms; it only narrows into an ever-tighter spike beside the jump. It is a genuine feature of truncating an orthogonal expansion of a discontinuous function, not a bug in your arithmetic. You can suppress it by filtering: multiplying the coefficients by a smoothly tapering window (Fejér, Lanczos, or Gaussian σ-factors) trades the overshoot for a slightly blurred edge — which is why signal processors rarely use a raw truncation and why image codecs blend block edges.

When can I differentiate or integrate a Fourier series term by term

Integration is almost always safe: it divides each coefficient by 2πin/L2\pi i n/L and so speeds the decay, giving a series that converges even faster. Differentiation is the dangerous direction — it multiplies each coefficient by 2πin/L2\pi i n/L, amplifying high harmonics and possibly destroying convergence. Term-by-term differentiation is valid only when the differentiated series still converges uniformly, requiring ff continuous and periodic with a well-behaved derivative. A jump in ff makes the derivative series diverge — the true derivative then contains a Dirac delta at the jump.

Why use complex exponentials when sines and cosines are more intuitive

Because the algebra is far cleaner. Products of exponentials simply add exponents, eiaeib=ei(a+b)e^{ia}e^{ib}=e^{i(a+b)}, whereas products of sines and cosines need trigonometric identities at every step. The exponential form also merges the two integrals for ana_n and bnb_n into one formula for cnc_n and makes the differentiation rule a single multiplication by 2πin/L2\pi i n/L; for real signals you recover the sine–cosine picture through c−n=cn‾c_{-n}=\overline{c_n}. Physically e2πinx/Le^{2\pi i nx/L} is the natural object — the eigenfunction of translation and of d/dx\mathrm d/\mathrm dx, which is why it diagonalises every constant-coefficient linear operator.

What does it mean that the exponentials form a complete basis

Completeness means the exponentials span all of L2[0,L]L^2[0,L] — the only square-integrable periodic function orthogonal to every one of them is zero. Practically, it guarantees that the Fourier series of ff actually reconstructs ff (in the mean-square sense) rather than only some projection of it, and it is what upgrades Bessel's inequality ∑∣cn∣2≤1L∫∣f∣2\sum|c_n|^2\leq\frac1L\int|f|^2 to Parseval's equality — without it, energy in ff could hide where no harmonic captures it. The completeness of the trigonometric system was the hard analytic fact that took a century to establish rigorously, culminating in the Riesz–Fischer theorem of 1907.

How does the Fourier series become the Fourier transform

Let the period LL grow without bound. The allowed frequencies n/Ln/L are spaced by 1/L1/L, so as L→∞L\to\infty that spacing shrinks to zero and the discrete comb of harmonics fills in to a continuum. The sum ∑ncne2πinx/L\sum_n c_n e^{2\pi i nx/L} becomes an integral ∫f~(k)e2πikx dk\int\tilde f(k)e^{2\pi i kx}\,\mathrm dk, the coefficient cnc_n becomes the spectral density f~(k)\tilde f(k), and Parseval's sum becomes Plancherel's integral ∫∣f∣2=∫∣f~∣2\int|f|^2=\int|\tilde f|^2. This is the precise sense in which a Fourier series is the periodic special case of the Fourier transform, and why a non-periodic pulse has a continuous spectrum rather than discrete lines.

Where this leads