Calculus

Fourier Series

Fourier Series Logo

Even and Odd Extensions

Solved Problems

Example 3.

Find the Fourier Sine series of the function \(f\left( x \right) = \cos x\) defined on the interval \(\left[ {0,\pi } \right].\)

Solution.

Since we apply odd extension, the Fourier series has the form

\[f\left( x \right) = \sum\limits_{n = 1}^\infty {{b_n}\sin nx} .\]

The coefficients \({{b_n}}\) are

\[{b_n} = \frac{2}{\pi }\int\limits_0^\pi {f\left( x \right)\sin nxdx} = \frac{2}{\pi }\int\limits_0^\pi {\cos x\sin nxdx} = \frac{2}{\pi }\int\limits_0^\pi {\left[ {\sin \left( {nx + x} \right) + \sin \left( {nx - x} \right)} \right]dx} = - \frac{1}{\pi }\left[ {\frac{{\cos \left( {n + 1} \right)\pi }}{{n + 1}} - \frac{1}{{n + 1}} + \frac{{\cos \left( {n - 1} \right)\pi }}{{n - 1}} - \frac{1}{{n - 1}}} \right] = - \frac{1}{\pi }\left[ {\frac{{{{\left( { - 1} \right)}^{n + 1}} - 1}}{{n + 1}} + \frac{{{{\left( { - 1} \right)}^{n - 1}} - 1}}{{n - 1}}} \right] = \frac{1}{\pi }\left[ {1 + {{\left( { - 1} \right)}^n}} \right] \cdot \frac{{2n}}{{{n^2} - 1}} = \frac{{2n}}{\pi } \cdot \frac{{1 + {{\left( { - 1} \right)}^n}}}{{{n^2} - 1}}.\]

Here we took into account that

\[\left( { - 1} \right)^{n + 1} = \left( { - 1} \right)^{n - 1} = - {\left( { - 1} \right)^n}.\]

This expression for \({b_n}\) is valid for \(n \ge 2.\) If \(n = 1,\) we obtain

\[{b_1} = \frac{2}{\pi }\int\limits_0^\pi {\cos x\sin xdx} = \frac{1}{\pi }\int\limits_0^\pi {\sin 2xdx} = \frac{1}{\pi }\left[ {\left. {\left( { - \frac{{\cos 2x}}{2}} \right)} \right|_0^\pi } \right] = - \frac{1}{{2\pi }}\left( {\cos 2\pi - \cos 0} \right) = 0.\]

In addition, we see that \({b_{2k + 1}} = 0\) for odd \(n = 2k + 1.\) For even \(n = 2k,\)

\[{b_{2k}} = \frac{{4k}}{\pi } \cdot \frac{2}{{4{k^2} - 1}} = \frac{{8k}}{{\pi \left( {4{k^2} - 1} \right)}}.\]

Thus, the Fourier Sine series (Figure \(3\)) is given by

\[f\left( x \right) = \frac{8}{\pi }\sum\limits_{k = 1}^\infty {\frac{k}{{4{k^2} - 1}}\sin 2kx} .\]
Fourier sine series for the cosine function on the interval [0, pi]
Figure 3, n = 3, n = 10

Example 4.

Find the Fourier Sine series of the function \(f\left( x \right) = x\sin x\) defined on the interval \(\left[ {0,\pi } \right].\)

Solution.

For the odd extension,

\[f\left( x \right) = x\sin x = \sum\limits_{n = 1}^\infty {{b_n}\sin nx} .\]

Find the coefficients \({b_n}:\)

\[{b_n} = \frac{2}{\pi }\int\limits_0^\pi {f\left( x \right)\sin nxdx} = \frac{2}{\pi }\int\limits_0^\pi {x\sin x\sin nxdx} = \frac{1}{\pi }\int\limits_0^\pi {x\left[ {\cos \left( {nx - x} \right) - \cos\left( {nx + x} \right)} \right]dx} = \frac{1}{\pi }\int\limits_0^\pi {\left[ {x\cos \left( {n - 1} \right)x - x\cos\left( {n + 1} \right)x} \right]dx} .\]

Next, we use integration by parts. Then

\[ {b_n} = \frac{1}{\pi }\left[ {\left. {\left( {\frac{{x\sin \left( {n - 1} \right)x}}{{n - 1}}} \right)} \right|_0^\pi } - \frac{1}{{n - 1}}\int\limits_0^\pi {\sin \left( {n - 1} \right)xdx} - \left. {\left( {\frac{{x\sin \left( {n + 1} \right)x}}{{n + 1}}} \right)} \right|_0^\pi + {\frac{1}{{n + 1}}\int\limits_0^\pi {\sin \left( {n + 1} \right)xdx} } \right] = \frac{1}{\pi }\left[ {\left. {\left( {\frac{{x\sin \left( {n - 1} \right)x}}{{n - 1}}} \right)} \right|_0^\pi } + {\left( {\frac{{\cos\left( {n - 1} \right)x}}{{{{\left( {n - 1} \right)}^2}}}} \right)} \right|_0^\pi - \left. {\left( {\frac{{x\sin \left( {n + 1} \right)x}}{{n + 1}}} \right)} \right|_0^\pi + \left. {\left. {\left( {\frac{{\cos\left( {n + 1} \right)x}}{{{{\left( {n + 1} \right)}^2}}}} \right)} \right|_0^\pi } \right] = \frac{1}{\pi }\left[ {\frac{{\pi \sin \left( {n - 1} \right)\pi }}{{n - 1}}} + \frac{{\cos \left( {n - 1} \right)\pi - 1}}{{{{\left( {n - 1} \right)}^2}}} - \frac{{\pi \sin \left( {n + 1} \right)\pi }}{{n + 1}} - {\frac{{\cos \left( {n + 1} \right)\pi - 1}}{{{{\left( {n + 1} \right)}^2}}}} \right].\]

Since

\[\sin \left( {n - 1} \right)\pi = \sin \left( {n + 1} \right)\pi = 0\;\;\text{and}\;\; \cos \left( {n - 1} \right)\pi = \cos \left( {n + 1} \right)\pi = {\left( { - 1} \right)^{n + 1}},\]

the expression for coefficients \({b_n}\) can be simplified:

\[{b_n} = \frac{1}{\pi }\left[ {\frac{{{{\left( { - 1} \right)}^{n + 1}} - 1}}{{{{\left( {n - 1} \right)}^2}}} - \frac{{{{\left( { - 1} \right)}^{n + 1}} - 1}}{{{{\left( {n + 1} \right)}^2}}}} \right] = \frac{1}{\pi }\left( {{{\left( { - 1} \right)}^{n + 1}} - 1} \right) \left[ {\frac{1}{{{{\left( {n - 1} \right)}^2}}} - \frac{1}{{{{\left( {n + 1} \right)}^2}}}} \right] = \frac{1}{\pi }\left( {{{\left( { - 1} \right)}^{n + 1}} - 1} \right)\frac{{4n}}{{{{\left( {{n^2} - 1} \right)}^2}}}.\]

The last formula is valid for \(n \ge 2.\) We notice that for even \(n = 2k,\) \({b_{2k}} = - \frac{{16k}}{{\pi {{\left( {4{k^2} - 1} \right)}^2}}},\) while for odd \(n = 2 k + 1,\) \({b_{2k + 1}} = 0,\) where \(k = 1,2,3, \ldots\)

We calculate separately the coefficient \({b_1}:\)

\[{b_1} = \frac{2}{\pi }\int\limits_0^\pi {x\sin x\sin xdx} = \frac{2}{\pi }\int\limits_0^\pi {x\,{{\sin }^2}xdx} = \frac{1}{\pi }\int\limits_0^\pi {x\left( {1 - \cos 2x} \right)dx} = \frac{1}{\pi }\int\limits_0^\pi {\left( {x - x\cos 2x} \right)dx} = \frac{1}{\pi }\left[ {\left. {\left( {\frac{{{x^2}}}{2}} \right)} \right|_0^\pi - \left. {\left( {\frac{{x\sin 2x}}{2}} \right)} \right|_0^\pi + \frac{1}{2}\int\limits_0^\pi {\sin 2xdx} } \right] = \frac{1}{{2\pi }}\left[ {\left. {\left( {{x^2} - x\sin 2x - \frac{{\cos 2x}}{2}} \right)} \right|_0^\pi } \right] = \frac{1}{{2\pi }}\left( {{\pi ^2} - \pi \sin 2\pi - \frac{{\cos 2\pi }}{2} + \frac{1}{2}} \right) = \frac{\pi }{2}.\]

Hence, the Fourier Sine series of the function is

\[f\left( x \right) = x\sin x = \frac{\pi }{2}\sin x - \frac{{16}}{\pi }\sum\limits_{k = 1}^\infty {\frac{k}{{{{\left( {4{k^2} - 1} \right)}^2}}}\sin 2kx} .\]

The Figure \(4\) below illustrates the original function and its Fourier approximation for \(n = 1\) and \(n = 2.\)

Fourier sine series of the function f(x)=xsin(x) on the interval [0,pi]
Figure 4, n = 1, n = 2
Page 1 Page 2