In the first part of this series on series expansions (introduction), we defined several concepts from first-year linear algebra that we need to work in a general, abstract setting rather than having to repeat the same derivations over and over again. We are now looking at the topic at the centre of this series; generalising the Fourier series method.
Amazingly, the few definitions I gave in the previous article let us define a whole family of different functional series expansions. Like before, we will consider only continuous, finite functions defined on the interval [−1,1][-1, 1][−1,1]. Let’s say we have a basis of functions that are orthogonal under the inner product
⟨f,g⟩=∫−11f(x)g(x) dx. \langle f,g\rangle = \int_{-1}^1 f(x) g(x)\,\mathrm dx. ⟨f,g⟩=∫−11f(x)g(x)dx.One example of this is the trigonometric functions sin(kπx)\sin(k\pi x)sin(kπx) and cos(kπx)\cos(k \pi x)cos(kπx) for all non-negative integers kkk. It’s beyond the scope of undergraduate physics courses to prove that the trigonometric functions span this space, but they do, and you also can verify that the inner-product integral is indeed zero for any unequal pair. We’ll refer to elements of this basis as ϕn(x)\phi_n(x)ϕn(x), where nnn is just a unique label.
Now, since the functions span the space of functions we can write down any function fff in terms of our basis ϕn\phi_nϕn and some scalar coefficients cnc_ncn as
f(x)=∑n=0∞cnϕn(x), f(x) = \sum_{n=0}^\infty c_n \phi_n(x), f(x)=n=0∑∞cnϕn(x),and this series is unique. For convenience, we’ll call the series representation FfF_fFf to distinguish it from fff while we’re still determining the coefficients.
This isn’t very helpful without knowing what the cnc_ncn are, but since our tnt_ntn form an orthogonal basis, we can use some properties of the inner product to find them.
First we need a measure of how good our choice of cnc_ncn are. For this we use the idea of magnitude: define the “error” vector (function) rrr as
r(x)=f(x)−Ff(x)=f(x)−∑n=0∞cnϕn(x),\begin{aligned} r(x) &= f(x) - F_f(x) \\ &= f(x) - \sum_{n=0}^\infty c_n \phi_n(x), \end{aligned}r(x)=f(x)−Ff(x)=f(x)−n=0∑∞cnϕn(x),and now we want to minimise the magnitude squared ⟨r,r⟩\langle r,r \rangle⟨r,r⟩. Using the properties of the inner product, we find
⟨r,r⟩=⟨f−Ff,f−Ff⟩=⟨f,f⟩−2⟨f,Ff⟩+⟨Ff,Ff⟩(by linearity and symmetry)=⟨f,f⟩−2∑n=0∞cn⟨f,ϕn⟩+∑n=0∞∑m=0∞cncm⟨ϕn,ϕm⟩(by linearity)=⟨f,f⟩−2∑n=0∞cn⟨f,ϕn⟩+∑n0∞cn2⟨ϕn,ϕn⟩(by orthogonality).\begin{alignedat}2 \langle r, r\rangle &= \langle f-F_f, f-F_f \rangle && \\ &= \langle f,f\rangle - 2\langle f,F_f\rangle + \langle F_f,F_f\rangle &&\text{(by linearity and symmetry)}\\ &= \langle f,f\rangle - 2\sum_{n=0}^\infty c_n \langle f, \phi_n\rangle + \sum_{n=0}^\infty\sum_{m=0}^\infty c_n c_m \langle \phi_n,\phi_m\rangle &&\text{(by linearity)}\\ &= \langle f,f\rangle - 2\sum_{n=0}^\infty c_n\langle f,\phi_n\rangle + \sum_{n_0}^\infty c_n^2 \langle \phi_n,\phi_n\rangle &&\text{(by orthogonality).} \end{alignedat}⟨r,r⟩=⟨f−Ff,f−Ff⟩=⟨f,f⟩−2⟨f,Ff⟩+⟨Ff,Ff⟩=⟨f,f⟩−2n=0∑∞cn⟨f,ϕn⟩+n=0∑∞m=0∑∞cncm⟨ϕn,ϕm⟩=⟨f,f⟩−2n=0∑∞cn⟨f,ϕn⟩+n0∑∞cn2⟨ϕn,ϕn⟩(by linearity and symmetry)(by linearity)(by orthogonality).The last line follows because orthogonality of the functions implies
⟨ϕn,ϕm⟩={⟨ϕn,ϕn⟩if n=m0if n≠m. \langle \phi_n, \phi_m \rangle = \begin{cases} \langle \phi_n, \phi_n \rangle &\text{if $n = m$} \\ 0 &\text{if $n \ne m$.} \end{cases} ⟨ϕn,ϕm⟩={⟨ϕn,ϕn⟩0if n=mif n=m.Now we try to minimise ⟨r,r⟩\langle r,r\rangle⟨r,r⟩ with respect to each of the cnc_ncn by setting the derivatives to zero:
0=∂∂cn⟨r,r⟩=2cn⟨ϕn,ϕn⟩−2⟨f,ϕn⟩,\begin{aligned} 0 &= \frac\partial{\partial c_n}\langle r,r \rangle \\ &= 2c_n\langle\phi_n,\phi_n\rangle - 2\langle f,\phi_n\rangle, \end{aligned}0=∂cn∂⟨r,r⟩=2cn⟨ϕn,ϕn⟩−2⟨f,ϕn⟩,so we find that
cn=⟨f,ϕn⟩⟨ϕn,ϕn⟩. c_n = \frac{\langle f,\phi_n\rangle}{\langle\phi_n,\phi_n\rangle}. cn=⟨ϕn,ϕn⟩⟨f,ϕn⟩.We should make sure that this is a minimum, not a maximum. This is quite simple—since there’s only one value, we know that this is the only extreme point and that if we added on some really large number to all the cnc_ncn then the approximation would obviously be worse. This makes the single extremum a minimum for certain. We could also do the more rigorous second-derivative test, which would also show us that it is a minimum as ⟨ϕn,ϕn⟩>0\langle \phi_n,\phi_n\rangle > 0⟨ϕn,ϕn⟩>0 is a property of the inner product.
This solution for cnc_ncn is really a remarkable result. You can put in the trigonometric definitions of the ϕn\phi_nϕn and see that it retrieves the definitions of the Fourier series coefficients way up at the top of this article.
What’s more impressive, however, is that everything we did did not care what the ϕn\phi_nϕn were! In fact, they only had to be an orthogonal basis; the trigonometric functions were just one possibility.
Another valid basis we could have used is made up of polynomials; the monomials xnx^nxn themselves aren’t orthogonal under this inner product, but there is a method called the Gram–Schmidt procedure that can be used to turn them into an orthogonal basis. If you do this, you come up with a series of polynomials Pn(x)P_n(x)Pn(x) called the Legendre polynomials. The first few of these are
P0(x)=1,P1(x)=x,P2(x)=12(3x2−1),P3(x)=12(5x3−3x).\begin{aligned} P_0(x) &= 1,\\ P_1(x) &= x,\\ P_2(x) &= \frac12(3x^2 -1),\\ P_3(x) &= \frac12(5x^3 - 3x).\\ \end{aligned}P0(x)P1(x)P2(x)P3(x)=1,=x,=21(3x2−1),=21(5x3−3x).These appear in the expansion of the electrostatic potential around a multipole in Cartesian coordinates, and consequently in the spherical harmonic functions, which turn up all over physics.
Now this basis is also orthogonal, so if we want to make a “Fourier–Legendre” series expansion of fff called LfL_fLf
Lf(x)=∑n=0∞ℓnPn(x), L_f(x) = \sum_{n=0}^\infty \ell_n P_n(x), Lf(x)=n=0∑∞ℓnPn(x),then we already know that the coefficients ℓn\ell_nℓn are defined by
ℓn=⟨f,Pn⟩⟨Pn,Pn⟩. \ell_n = \frac{\langle f,P_n\rangle}{\langle P_n,P_n\rangle}. ℓn=⟨Pn,Pn⟩⟨f,Pn⟩.This is why abstract concepts in linear algebra are so useful; with no additional work we gained a whole new method of series expansion!
In the next part of this series, we’ll compare how this new Legendre series expansion behaves in comparison to the Fourier and Taylor series.
This article is the second part of a series. You can find all of the rest of the articles in this series here: