Conceptual/Graphical understanding of the Fourier Series.

I answered a related question on dsp.SE in which I pointed out that the Fourier coefficient $a_n$ is the number that minimizes the squared error $$\int_{-\pi}^{\pi} (f(x) - a_n\cos (nx))^2 \ \mathrm dx$$ between the function $f(x)$ and its approximation in terms of a multiple of $\cos (nx)$. The notation is slightly different and more engineering-oriented, though.


I think the most naturally visual interpretation of Fourier series is in a complex setting. The most basic example would be the vanishing of the integral of integer-scaled complex exponentials:

$$\int_{-\pi}^\pi e^{inx}dx=\oint_{\gamma}zdz=\delta_n.$$

The reason this is zero is simple: it traces out the unit circle in the complex plane ($n$ times), having symmetry in both reflection and rotation and thus must evaluate to the origin, geometrically speaking. When we create a linear combination of these functions, we can pinpoint the coefficient of $e^{inx}$ by multipling by its complex conjugate and then integrating (and normalizing): if we regard the function as a system of "clockwork," this process is calibrated to merely "delay" all the "pieces" of the system by the equivalent of what the $e^{inx}$ "gear" contributes to the clock; all of the other pieces will still be turning around and thus will evaluate to zero by the exact same considerations of symmetry, while the actual $e^{inx}$ gear will come to a standstill and thus we measure its coefficient.

This works because the "clockwork system" is a formal linear combination of "gears," and the act of integration is also linear and thus can distinguish between "running" versus "stopped" gears.

To bring this understanding down to the real setting, we project down by intermittently making the coefficients of the $e^{inx}$ gear and its conjugate $e^{-inx}$ the same. Conjugation reverses the direction of rotation, and when we add the effect of two gears rotating in opposite directions, their imaginary parts cancel out and we are left with a "real" gear: one that is a sinusoidal wave on $[-1,1]$ (after we average, anyway). This type of gear always decomposes into complex gears that are mirror images of each other, so there is the same visual picture at work as before, but it has "collapsed" down, like a fold-up tent into existing purely on the real line.

That works for $\cos (nx)$, but $\sin(nx)$ is created a little differently: one complex exponential minus another. Negation has the effect of reflection on a gear, so geometrically $e^{inx}-e^{-inx}$ will be a gear plus its "mirror image" again, but this time the "mirror" is the imaginary axis instead of the real axis. When we divide out by $2i$ we turn it onto the real line. Going from a complex Fourier series to a trig one is effectively decomposing its gears into real and imaginary sinusoids, then situating these sinusoids onto the same subspace of $\mathbb{C}$ by rotating the imaginary one onto it (and compensating by rotating the coefficients of these waves in the opposite direction, so that we represent the same function throughout). Going from the cosine-sine expansion to the complex one is therefore the exact reverse of this process: sieving out waves and putting up their corresponding tents.

Finally, how is it that we glean the coefficients of the sinusoids the same way we do it with complex exponentials? The explanation is simple: linearity. Obtaining the coefficients of the sinusoids is equivalent to obtaining the coefficients of the mirrored complex exponentials they decompose into and then putting them together. When we write the latter, we can put the two integrals together and get a single trigonometric one, i.e. the former.

Note that this graphical perspective interprets $x$ as "time." I'm also uncertain of how to "see" that complex exponentials or sinusoidal waves form a complete basis for $L^2\big([-\pi,\pi]\big)$...


Let's try a (possibly) original approach and show that Fourier series are not so much about regularities than about discontinuities of different orders. With this method the $a_n$ coefficients will be obtained without integration at all (at least for most common functions) !

The discontinuity of first order or jump discontinuity of the function $f$ at point $x$ is given, when the limit exists and is not zero, by : $\ \displaystyle \delta f(x)=\lim_{h\to 0}\ f\left(x+\frac h2\right)-f\left(x-\frac h2\right)$.

More generally the discontinuity of order $m$ (with $m>0$) will be given by : $$ \delta f^{(m-1)}(x)=\lim_{h\to 0}\ f^{(m-1)}\left(x+\frac h2\right)-f^{(m-1)}\left(x-\frac h2\right)$$

Let's consider a function $f$ of period $2\pi$. To simplify we'll suppose that $f$ is of class $C^\infty$ in $(-\pi,\pi]$ except at a finite number of points $x_1,x_2,\dotsc,x_l$ with discontinuities of orders $m_1,m_2,\dotsc,m_l$.

Then the Fourier series is obtained directly as a sum of contributions : one for each discontinuity of order $m_k$ at $x_k$ plus a constant term $C$ : $$f(x)=C+ \frac 1{\pi}\sum_{n=1}^{\infty} \sum_{k=1}^l \delta f^{(m_k-1)}(x_k)\times \Bigl\{\text{}m_k\text{-th integral}\int \cos(n(x-x_k)) dx\Bigr\}$$

( this result is a direct application of the formal 'Dirac comb' formula : $$\sum_{n=-\infty}^\infty \delta(x-x_k-2\pi n)=\frac 1{2\pi}+\frac 1{\pi}\sum_{n=1}^\infty \cos\left(n(x-x_k)\right)$$ with $\delta$ the Dirac delta distribution because the integral of $\delta(x)$ is $\operatorname{H}(x)$ the Heaviside step function, which integral is the ramp function and so on... )

Let's rewrite $f(x)$ as : $$f(x)=C+ \frac 1{\pi} \sum_{k=1}^l \delta f^{(m_k-1)}(x_k)\times\sum_{n=1}^{\infty} \frac{\cos\left(n(x-x_k)-m_k \frac{\pi}2\right)}{n^{m_k}}$$

To get the $a_n$ and $b_n$ coefficients for $\cos(nx)$ and $\sin(n)$ it remains only to use $\cos(a-b)=\cos(a)\cos(b)+\sin(a)\sin(b)$.

The constant term will be the reference, the $\displaystyle \frac 1n$ terms reveal the jump discontinuities of the original function (often at the transition $\pi\to -\pi$ but not only!), the $\displaystyle \frac 1{n^2}$ terms reveal the discontinuities of the derivative of $f(x)$ and so on...

Let's see this on simple examples :

  • Sawtooth wave : there is only a first order discontinuity of $f(x)=x$ in $(-\pi,\pi]$ at point $x=\pi$ with a jump of $\delta f(\pi)=-\pi-\pi=-2\pi\ $ so that : $$f(x)=C+ \frac {-2\pi}{\pi}\sum_{n=1}^{\infty}\frac{\cos\left(n(x-\pi)-1\frac{\pi}2\right)}{n}=-2\sum_{n=1}^{\infty}\frac{\sin(n(x-\pi))}{n}$$ $$=-2\sum_{n=1}^{\infty}\frac{(-1)^n\sin(nx)}{n}$$
  • parabola : $f(x)=x^2$ in $(-\pi,\pi]$ with a second-order discontinuity at $x=\pi$ : $\delta f'(x)= -2\pi-2\pi\ $ giving : $$f(x)=C- 4\sum_{n=1}^{\infty} \frac{\cos\left(n(x-\pi)-2\frac{\pi}2\right)}{n^2}=C+4\sum_{n=1}^{\infty} \frac{(-1)^n\cos\left(nx\right)}{n^2}$$ (with $C=\frac{\pi^2}3$ to get $f(0)=0$)
  • 'third order' : $f(x)=x^3$ in $(-\pi,\pi]$ has a first and third order discontinuity at $x=\pi$ : $\delta f(x)= -\pi^3-\pi^3$ and $\delta f''(x)= -6\pi-6\pi\ $ so that : $$f(x)=C+ \frac {-2\pi^3}{\pi}\sum_{n=1}^{\infty}\frac{\cos\left(n(x-\pi)-\frac{\pi}2\right)}{n}+\frac {-12\pi}{\pi}\sum_{n=1}^{\infty}\frac{\cos\left(n(x-\pi)-3\frac{\pi}2\right)}{n^3}$$ $$=-2\pi^2\sum_{n=1}^{\infty}\frac{(-1)^n\sin(nx)}n+12\sum_{n=1}^{\infty}\frac{(-1)^n\sin(nx)}{n^3}$$