# Generalised Fourier Series

In all my time as a PhD student I have been involved with teaching undergraduate and postgraduate physics students at Imperial College London (they even gave me a prize in 2018!) as a teaching assistant in classroom-style tutorials and seminars. For my final year, though, I’ve also moved up into helping write the teaching materials, particularly for the differential equations part of the second-year course.

The first differential equations seminar we had was showing off some of the properties and uses of the Legendre polynomials, which the students had just met by solving Legendre’s equation. My part of the seminar was illustrating how any orthogonal basis of functions can be used to make a series expansion, and then getting the students to investigate how different types of functional expansion behave at different orders. If you just want to play with this, load up the Jupyter notebook on Colab or myBinder. The source code for this notebook is available on GitHub. You can see an example plot of these below. The end result we’ll achieve mathematically is an abstract way of making series expansions. In general, a series expansion approximates a function f(x)f(x) by using a (possibly infinite) sequence of terms, where each term is a constant multiplied by some basis function. Different series expansions use different bases and different methods of determining the coefficients.

Perhaps the most familiar example is the Taylor series. The Taylor series Tf(x)T_f(x) that approximates a function f(x)f(x) around some point x0x_0 is

Tf(x)=k=0f(k)(x0)k!(xx0)k, T_f(x) = \sum_{k=0}^\infty \frac{f^{(k)}(x_0)}{k!}{(x-x_0)}^k,

where the f(k)(x0)f^{(k)}(x_0) notation means the kkth derivative of f(x)f(x) with respect to xx, evaluated at x0x_0. This series uses the monomials (xmx^m for integer mm) as its basis, and it’s very common in physics to use finite approximations to the Taylor series (i.e. by taking only the first mm terms) to analyse behaviour of a complicated function around some point.

Taylor series are taught at A Level in the UK, and are the first functional approximation method most people come across. Early in undergraduate physics courses, we introduce another method, motivated by investigation of periodic functions: the Fourier series. For real-valued functions where the range 1x<1-1 \le x < 1 spans one period, this is generally written as

Ff(x)=12a0+k=1(akcos(kπx)+bksin(kπx)), F_f(x) = \frac12 a_0 + \sum_{k=1}^\infty \Bigl( a_k\cos(k\pi x) + b_k\sin(k\pi x) \Bigr),

where ak=11f(x)cos(kπx)dxa_k = \int_{-1}^1 f(x)\cos(k\pi x)\mathrm{d}x, and the bkb_k are the same except for sin\sin instead of cos\cos. The basis functions of this series are sin(mπx)\sin(m\pi x) and cos(mπx)\cos(m\pi x) for integer mm.

Fourier series are constructed by using an idea of “orthogonality” of its basis functions, whereas Taylor series come from locally approximating a function with successive polynomials. We haven’t yet seen why the Fourier coefficients are the way they are, but once we have, we can use the same method to make many different series expansions. First, though, we take an apparent detour into linear algebra and vectors—if you already know what an “inner-product space” is, there’s probably nothing new for you in the next part.

The next article of this series runs through the all the background maths for this part of the seminar, including some linear algebra results that the students learned in their first year at university. The rest of the series covers how to produce the arbitrary series expansions, then looks at the results I hoped the students would discover by playing around with the interactive notebook.