9.3: Fourier Series
Our solution of the diffusion and wave equations will require use of a Fourier series. A periodic function \(f(x)\) with period \(2L\), can be represented as a Fourier series in the form \[\label{eq:1}f(x)=\frac{a_0}{2}+\sum\limits_{n=1}^\infty\left(a_n\cos\frac{n\pi x}{L}+b_n\sin\frac{n\pi x}{L}\right).\]
Determination of the coefficients \(a_0,\: a_1,\: a_2,\ldots\) and \(b_1,\: b_2,\: b_3,\ldots\) makes use of orthogonality relations for sine and cosine. We first define the widely used Kronecker delta \(\delta_{nm}\) as \[\delta_{nm}=\left\{\begin{array}{rl}1&\text{if }n=m; \\ 0&\text{otherwise.}\end{array}\right.\nonumber\]
The orthogonality relations for \(n\) and \(m\) positive integers are then given with compact notation as the integration formulas \[\label{eq:2} \int_{-L}^L\cos\left(\frac{m\pi x}{L}\right)\cos\left(\frac{n\pi x}{L}\right)dx=L\delta_{nm},\] \[\label{eq:3}\int_{-L}^L\sin\left(\frac{m\pi x}{L}\right)\sin\left(\frac{n\pi x}{L}\right)dx=L\delta_{nm},\] \[\label{eq:4}\int_{-L}^L\cos\left(\frac{m\pi x}{L}\right)\sin\left(\frac{n\pi x}{L}\right)dx=0.\]
To illustrate the integration technique used to obtain these results, we derive \(\eqref{eq:3}\) assuming that \(n\) and \(m\) are positive integers with \(n\neq m\). Changing variables to \(ξ = \pi x/L\), we obtain \[\begin{aligned}\int_{-L}^L\sin&\left(\frac{m\pi x}{L}\right)\sin\left(\frac{n\pi x}{L}\right)dx \\ &=\frac{L}{\pi}\int_{-\pi}^\pi\sin(m\xi)\sin(n\xi)d\xi \\ &=\frac{L}{2\pi}\int_{-\pi}^\pi [\cos ((m-n)\xi)-\cos((m+n)\xi)]d\xi \\ &=\frac{L}{2\pi}\left[\frac{1}{m-n}\sin((m-n)\xi)-\frac{1}{m+n}\sin((m+n)\xi)\right]_{-\pi}^\pi \\ &=0.\end{aligned}\]
For \(m=n\), however, \[\begin{aligned}\int_{-L}^L\sin^2\left(\frac{n\pi x}{L}\right)dx&=\frac{L}{\pi}\int_{-\pi}^\pi\sin^2(n\xi)d\xi \\ &=\frac{L}{2\pi}\int_{-\pi}^\pi(1-\cos(2n\xi))d\xi \\ &=\frac{L}{2\pi}\left[\xi-\frac{1}{2n}\sin 2n\xi\right]_{-\pi}^\pi \\ &=L.\end{aligned}\]
Integration formulas given by \(\eqref{eq:2}\) and \(\eqref{eq:4}\) can be similarly derived.
To determine the coefficient \(a_n\), we multiply both sides of \(\eqref{eq:1}\) by \(\cos (n\pi x/L)\) with \(n\) a nonnegative integer, and change the dummy summation variable from \(n\) to \(m\). Integrating over \(x\) from \(−L\) to \(L\) and assuming that the integration can be done term by term in the infinite sum, we obtain \[\begin{aligned}\int_{-L}^Lf(x)\cos &\frac{n\pi x}{L}dx=\frac{a_0}{2}\int_{-L}^L\cos\frac{n\pi x}{L}dx \\ &+\sum\limits_{m=1}^\infty\left\{a_m\int_{-L}^L\cos\frac{n\pi x}{L}\cos\frac{m\pi x}{L}dx+b_m\int_{-L}^L\cos\frac{n\pi x}{L}\sin\frac{m\pi x}{L}dx\right\}.\end{aligned}\]
If \(n = 0\), then the second and third integrals on the right-hand-side are zero and the first integral is \(2L\) so that the right-hand-side becomes \(La_0\). If \(n\) is a positive integer, then the first and third integrals on the right-hand-side are zero, and the second integral is \(L\delta_{nm}\). For this case, we have \[\begin{aligned}\int_{-L}^Lf(x)\cos\frac{n\pi x}{L}dx&=\sum\limits_{m=1}^\infty La_m\delta_{nm} \\ &=La_n,\end{aligned}\] where all the terms in the summation except \(m = n\) are zero by virtue of the Kronecker delta. We therefore obtain for \(n = 0, 1, 2,\ldots\) \[\label{eq:5}a_n=\frac{1}{L}\int_{-L}^L f(x)\cos\frac{n\pi x}{L}dx.\]
To determine the coefficients \(b_1,\: b_2,\: b_3,\ldots\), we multiply both sides of \(\eqref{eq:1}\) by \(\sin (n\pi x/L)\), with \(n\) a positive integer, and again change the dummy summation variable from \(n\) to \(m\). Integrating, we obtain \[\begin{aligned}\int_{-L}^L f(x)\sin &\frac{n\pi x}{L}dx=\frac{a_0}{2}\int_{-L}^L\sin\frac{n\pi x}{L}dx \\ &+\sum\limits_{m=1}^\infty\left\{a_m\int_{-L}^L\sin\frac{n\pi x}{L}\cos\frac{m\pi x}{L}dx+b_m\int_{-L}^L\sin\frac{n\pi x}{L}\sin\frac{m\pi x}{L}dx\right\}.\end{aligned}\]
Here, the first and second integrals on the right-hand-side are zero, and the third integral is \(L\delta_{nm}\) so that \[\begin{aligned}\int_{-L}^L f(x)\sin\frac{n\pi x}{L}dx&=\sum\limits_{m=1}^\infty Lb_m\delta_{nm} \\ &=Lb_n.\end{aligned}\]
Hence, for \(n = 1,\: 2,\: 3,\ldots\), \[\label{eq:6}b_n=\frac{1}{L}\int_{-L}^L f(x)\sin\frac{n\pi x}{L}dx.\]
Our results for the Fourier series of a function \(f(x)\) with period \(2L\) are thus given by \(\eqref{eq:1}\), \(\eqref{eq:5}\) and \(\eqref{eq:6}\).