Assume that there is a Fourier series converging to the function f defined by
\begin{array}{c}{{f(x)= \begin{cases} -x, & -2\leq x\lt 0, \\ x, & 0\leq x\lt2; \end{cases} }}\\ {{f(x+4)=f(x).}}\end{array} (15)
Determine the coefficients in this Fourier series.
This function represents a triangular wave (see Figure 10.2.2) and is periodic with period 4. Thus the Fourier series has the form
f(x)={\frac{a_{0}}{2}}+\sum_{m=1}^{\infty}\biggl(a_{m}\cos\biggl({\frac{m\pi x}{2}}\biggr)+b_{m}\sin\biggl({\frac{m\pi x}{2}}\biggr)\biggr), (16)
where the coefficients are computed from equations (13)
a_{n}=\frac{1}{L}\int_{-L}^{L}f(x)\cos\Bigl(\frac{n\pi x}{L}\Bigr)d x,\quad n=0,1,2,\dots\,. (13)
and (14)
b_{n}=\frac{1}{L}\int_{-L}^{L}f(x)\sin\Bigl(\frac{n\pi x}{L}\Bigr)d x,\quad n=1,2,3,\dots\,. (14)
with L = 2. Substituting for f(x) in equation (13) with m = 0, we have
a_{0}=\frac{1}{2}\int_{-2}^{0}(-x)d x+\frac{1}{2}\int_{0}^{2}x d x=1+1=2. (17)
For m > 0, equation (13) yields
a_{m}=\frac{1}{2}\int_{-2}^{0}(-x)\cos\biggl(\frac{m\pi x}{2}\biggr)d x+\frac{1}{2}\int_{0}^{2}x\cos\biggl(\frac{m\pi x}{2}\biggr)d x.
These integrals can be evaluated through integration by parts, with the result that
a_{m}=\left.\frac{1}{2}\left(-\frac{2}{m\pi}x\sin\left(\frac{m\pi x}{2}\right)-\left(\frac{2}{m\pi}\right)^{2}\cos\left(\frac{m\pi x}{2}\right)\right)\right|_{-2}^{0}\\ \left.+\frac{1}{2}\left(\frac{2}{m\pi}x\sin\left(\frac{m\pi x}{2}\right)+\left(\frac{2}{m\pi}\right)^{2}\cos\left(\frac{m\pi x}{2}\right)\right)\right|^{2}_{0}\\ ={\frac{1}{2}}\left(-\left({\frac{2}{m\pi}}\right)^{2}+\left({\frac{2}{m\pi}}\right)^{2}\cos(m\pi)+\left({\frac{2}{m\pi}}\right)^{2}\cos(m\pi)-\left({\frac{2}{m\pi}}\right)^{2}\right)\\ =\frac{4}{(m\pi)^{2}}(\cos(m\pi)-1),\quad m=1,\,2,\,\ldots \\ =\left\{ \begin{array}{c c}{{-\frac{8}{(m\pi)^{2},}}}&{{\text{m odd,}}}\\ {{0,}}&{{\text{m even.}}}\end{array}\right. (18)
Finally, from equation (14), it follows in a similar way that
b_{m}=0,\quad m=1,\,2,\,\dots\,. (19)
By substituting the coefficients from equations (17), (18), and (19) in the series (16), we obtain the Fourier series for f:
f(x)=1-{\frac{8}{\pi^{2}}}\Biggl(\cos\biggl({\frac{\pi x}{2}}\biggr)+{\frac{1}{3^{2}}}\cos\biggl({\frac{3\pi x}{2}}\biggr)+{\frac{1}{5^{2}}}\cos\biggl({\frac{5\pi x}{2}}\biggr)+\cdots\Biggr)\\=1-\frac{8}{\pi^{2}}\sum_{m=1,3,5,…}^{\infty}\frac{1}{m^{2}}\cos\left(\frac{m\pi x}{2}\right)\\=1-\frac{8}{\pi^{2}}\sum_{n=1}^{\infty}\frac{1}{(2n-1)^{2}}\cos\biggl(\frac{(2n-1)\pi x}{2}\biggr). (20)