JOVANA
Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
All guides

Functions as sums of waves: orthogonality and Fourier coefficients

Why sines and cosines form an orthogonal system, and how that single fact hands you a formula for every Fourier coefficient.

The idea: listen to a function

A periodic function is like a chord: a single complicated sound that is secretly a superposition of pure tones. The dream of a Fourier series is to write a function f of period 2π as a trigonometric series a_0/2 + sum over n>=1 of (a_n cos nx + b_n sin nx). The pure tones are cos nx and sin nx; the numbers a_n, b_n say how loud each tone is. The whole subject begins with one question: given f, how do we recover those loudness numbers?

Orthogonality, proved

The system {1, cos x, sin x, cos 2x, sin 2x, …} is an orthogonal system: distinct tones are perpendicular under ⟨·,·⟩. This is not magic — it is a one-line integral once you use a product-to-sum identity. Everything downstream rests on it.

Claim: for integers m, n >= 1, integral over [-pi, pi] of cos(mx) cos(nx) dx = 0 when m != n.

Product-to-sum:  cos(mx) cos(nx) = (1/2)[ cos((m-n)x) + cos((m+n)x) ].

Integrate term by term over [-pi, pi].  For any integer k != 0,
   integral over [-pi, pi] of cos(kx) dx = [ sin(kx)/k ] from -pi to pi
                                         = ( sin(k pi) - sin(-k pi) ) / k = 0,
since sin(k pi) = 0 for every integer k.

Here m != n forces both k = m-n != 0 and k = m+n != 0, so BOTH integrals vanish:
   integral of cos(mx)cos(nx) dx = (1/2)(0 + 0) = 0.    QED

Same computation gives:
   integral cos(mx) sin(nx) dx = 0   for ALL m, n  (integrand is odd),
   integral sin(mx) sin(nx) dx = 0   for m != n.

Diagonal (m = n):  integral cos^2(nx) dx = pi  and  integral sin^2(nx) dx = pi.
So with the 1/pi weight, ⟨cos nx, cos nx⟩ = 1 and ⟨sin nx, sin nx⟩ = 1: the tones are unit-length.
Distinct trig tones are orthogonal; each cos nx, sin nx has squared norm π.

The coefficient formula falls out

Suppose for a moment f really does equal its series. Take the inner product of both sides with cos kx. Every tone except cos kx is orthogonal to it and dies; only the a_k term survives, scaled by ‖cos kx‖² = π. Solving gives the Euler–Fourier formulas — the definition of the Fourier coefficient.

  1. a_n = (1/π) integral over [−π, π] of f(x) cos nx dx, for n = 0, 1, 2, …
  2. b_n = (1/π) integral over [−π, π] of f(x) sin nx dx, for n = 1, 2, …
  3. The constant term is a_0/2; writing a_0 with the same 1/π makes the n = 0 case fit the cosine formula uniformly.