Calculus

Fourier Series

Fourier Series Logo

Definition of Fourier Series and Typical Examples

Solved Problems

Click or tap a problem to see the solution.

Example 3

Find the Fourier series for the sawtooth wave defined on the interval \(\left[ { - \pi ,\pi } \right]\) and having period \(2\pi.\)

Example 4

Let \(f\left( x \right)\) be a \(2\pi\)-periodic function such that \(f\left( x \right) = {x^2}\) for \(x \in \left[ { - \pi ,\pi } \right].\) Find the Fourier series for the parabolic wave.

Example 5

Find the Fourier series for the triangle wave

\[ f\left( x \right) = \begin{cases} \frac{\pi }{2} + x, & \text{if} & - \pi \le x \le 0 \\ \frac{\pi }{2} - x, & \text{if} & 0 \lt x \le \pi \end{cases},\]

defined on the interval \(\left[ { - \pi ,\pi } \right].\)

Example 6

Find the Fourier series for the function

\[ f\left( x \right) = \begin{cases} -1, & \text{if} & - \pi \le x \le - \frac{\pi }{2} \\ 0, & \text{if} & - \frac{\pi }{2} \lt x \le \frac{\pi }{2} \\ 1, & \text{if} & \frac{\pi }{2} \lt x \le \pi \end{cases},\]

defined on the interval \(\left[ { - \pi ,\pi } \right].\)

Example 3.

Find the Fourier series for the sawtooth wave defined on the interval \(\left[ { - \pi ,\pi } \right]\) and having period \(2\pi.\)

Solution.

Calculate the Fourier coefficients for the sawtooth wave. Since this function is odd (Figure \(3\)), then \({a_0} = {a_n} = 0.\) Find the coefficients \({b_n}:\)

\[{b_n} = \frac{1}{\pi }\int\limits_{ - \pi }^\pi {f\left( x \right)\sin nxdx} = \frac{1}{\pi }\int\limits_{ - \pi }^\pi {x\sin nxdx} .\]

To calculate the latter integral we use integration by parts formula:

\[\int\limits_{ - \pi }^\pi {udv} = \left. {\left( {uv} \right)} \right|_{ - \pi }^\pi - \int\limits_{ - \pi }^\pi {vdu} .\]

Let \(u = x,\) \(dv = \sin nxdx.\) Then \(du = dx,\) \(v = \int {\sin nxdx} = - {\frac{{\cos nx}}{n}},\) so the integral becomes

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

Substituting \(\sin n\pi = 0\) and \(\cos n\pi = {\left( { - 1} \right)^n}\) for all integer values of \(n,\) we obtain

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

Thus, the Fourier series expansion of the sawtooth wave (Figure \(3\)) is

\[x = \sum\limits_{n = 1}^\infty {\frac{2}{n}{{\left( { - 1} \right)}^{n + 1}}\sin nx} .\]
Fourier series for the sawtooth wave
Figure 3, n = 5, n = 10

Example 4.

Let \(f\left( x \right)\) be a \(2\pi\)-periodic function such that \(f\left( x \right) = {x^2}\) for \(x \in \left[ { - \pi ,\pi } \right].\) Find the Fourier series for the parabolic wave.

Solution.

Since this function is even, the coefficients \({b_n} = 0.\) Then

\[{a_0} = \frac{1}{\pi }\int\limits_{ - \pi }^\pi {f\left( x \right)dx} = \frac{1}{\pi }\int\limits_{ - \pi }^\pi {{x^2}dx} = \frac{2}{\pi }\int\limits_0^\pi {{x^2}dx} = \frac{2}{\pi } \cdot \left[ {\left. {\left( {\frac{{{x^3}}}{3}} \right)} \right|_0^\pi } \right] = \frac{2}{\pi } \cdot \frac{{{\pi ^3}}}{3} = \frac{{2{\pi ^2}}}{3},\]
\[{a_n} = \frac{1}{\pi }\int\limits_{ - \pi }^\pi {f\left( x \right)\cos nxdx} = \frac{2}{\pi }\int\limits_0^\pi {f\left( x \right)\cos nxdx} = \frac{2}{\pi }\int\limits_0^\pi {{x^2}\cos nxdx} .\]

Apply integration by parts twice to find:

\[ {a_n} = \frac{2}{\pi }\int\limits_0^\pi {{x^2}\cos nxdx} = \left[ {\begin{array}{*{20}{l}} {u = {x^2}}\\ {dv = \cos nxdx}\\ {du = 2xdx}\\ {v = \int {\cos nxdx} = \frac{{\sin nx}}{n}} \end{array}} \right] = \frac{2}{\pi }\left[ {\left. {\left( {\frac{{{x^2}\sin nx}}{n}} \right)} \right|_0^\pi - \int\limits_0^\pi {2x\frac{{\sin nx}}{n}dx} } \right] = \frac{2}{{\pi n}}\left[ {{\pi ^2}\sin n\pi - {{\left( { - \pi } \right)}^2}\sin \left( { - n\pi } \right) - 2\int\limits_0^\pi {x\sin nxdx} } \right] = \frac{2}{{\pi n}}\left[ {2{\pi ^2}\sin n\pi - 2\int\limits_0^\pi {x\sin nxdx} } \right] = - \frac{4}{{\pi n}}\int\limits_0^\pi {x\sin nxdx} = \left[ {\begin{array}{*{20}{l}} {u = x}\\ {dv = \sin nxdx}\\ {du = dx}\\ {v = \int {\sin nxdx} = - \frac{{\cos nx}}{n}} \end{array}} \right] = - \frac{4}{{\pi n}}\left[ {\left. {\left( { - \frac{{x\cos nx}}{n}} \right)} \right|_0^\pi - \int\limits_0^\pi {\left( { - \frac{{\cos nx}}{n}} \right)dx} } \right] = \frac{4}{{\pi {n^2}}}\left[ {\pi \cos n\pi - \int\limits_0^\pi {\cos nxdx} } \right] = \frac{4}{{\pi {n^2}}}\left[ {\pi \cos n\pi - \left. {\left( {\frac{{\sin nx}}{n}} \right)} \right|_0^\pi } \right] = \frac{4}{{\pi {n^2}}}\left[ {\pi \cos n\pi - \frac{{\sin n\pi }}{n}} \right].\]

As \(\sin n\pi = 0\) and \(\cos n\pi = {\left( { - 1} \right)^n}\) for integer \(n,\) we have

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

Then the Fourier series expansion for the parabolic wave (Figure \(4\)) is

\[{x^2} = \frac{{{\pi ^2}}}{3} + \sum\limits_{n = 1}^\infty {\frac{4}{{{n^2}}}{{\left( { - 1} \right)}^n}\cos nx} .\]
Fourier series for the parabolic wave
Figure 4, n = 2, n = 5

Example 5.

Find the Fourier series for the triangle wave

\[ f\left( x \right) = \begin{cases} \frac{\pi }{2} + x, & \text{if} & - \pi \le x \le 0 \\ \frac{\pi }{2} - x, & \text{if} & 0 \lt x \le \pi \end{cases},\]

defined on the interval \(\left[ { - \pi ,\pi } \right].\)

Solution.

The constant \({a_0}\) is

\[{a_0} = \frac{1}{\pi }\int\limits_{ - \pi }^\pi {f\left( x \right)dx} = \frac{1}{\pi }\left[ {\int\limits_{ - \pi }^0 {\left( {\frac{\pi }{2} + x} \right)dx} + \int\limits_0^\pi {\left( {\frac{\pi }{2} - x} \right)dx} } \right] = \frac{1}{\pi }\left[ {\left. {\left( {\frac{\pi }{2}x + \frac{{{x^2}}}{2}} \right)} \right|_{ - \pi }^0 + \left. {\left( {\frac{\pi }{2}x - \frac{{{x^2}}}{2}} \right)} \right|_0^\pi } \right] = \frac{1}{\pi }\left[ {0 - \left( { - \cancel{\frac{{{\pi ^2}}}{2}} + \cancel{\frac{{{{\left( { - \pi } \right)}^2}}}{2}}} \right) + \left( {\cancel{\frac{{{\pi ^2}}}{2}} - \cancel{\frac{{{\pi ^2}}}{2}}} \right) - 0} \right] = 0.\]

Determine the coefficients \({a_n}:\)

\[{a_n} = \frac{1}{\pi }\int\limits_{ - \pi }^\pi {f\left( x \right)\cos nxdx} = \frac{1}{\pi }\left[ {\int\limits_{ - \pi }^0 {\left( {\frac{\pi }{2} + x} \right)\cos nxdx} + \int\limits_0^\pi {\left( {\frac{\pi }{2} - x} \right)\cos nxdx} } \right] = \frac{1}{\pi }\left[ {\int\limits_{ - \pi }^0 {\frac{\pi }{2}\cos nxdx} + \int\limits_{ - \pi }^0 {x\cos nxdx} + \int\limits_0^\pi {\frac{\pi }{2}\cos nxdx} - \int\limits_0^\pi {x\cos nxdx} } \right].\]

Determine the coefficients \({a_n}:\)

\[{a_n} = \frac{1}{\pi }\int\limits_{ - \pi }^\pi {f\left( x \right)\cos nxdx} = \frac{1}{\pi }\left[ {\int\limits_{ - \pi }^0 {\left( {\frac{\pi }{2} + x} \right)\cos nxdx} + \int\limits_0^\pi {\left( {\frac{\pi }{2} - x} \right)\cos nxdx} } \right] = \frac{1}{\pi }\left[ {\int\limits_{ - \pi }^0 {\frac{\pi }{2}\cos nxdx} + \int\limits_{ - \pi }^0 {x\cos nxdx} + \int\limits_0^\pi {\frac{\pi }{2}\cos nxdx} - \int\limits_0^\pi {x\cos nxdx} } \right].\]

Integrating by parts, we can write

\[\int {x\cos nxdx} = \frac{{x\sin nx}}{n} - \int {\frac{{x\sin nx}}{n}dx} = \frac{{x\sin nx}}{n} + \frac{{\cos nx}}{{{n^2}}}.\]

Then

\[ {a_n} = \frac{1}{\pi }\left[ {\frac{\pi }{2}\left. {\left( {\frac{{\sin nx}}{n}} \right)} \right|_{ - \pi }^0 + \left. {\left( {\frac{{x\sin nx}}{n} + \frac{{\cos nx}}{{{n^2}}}} \right)} \right|_{ - \pi }^0 + \frac{\pi }{2}\left. {\left( {\frac{{\sin nx}}{n}} \right)} \right|_0^\pi - \left. {\left( {\frac{{x\sin nx}}{n} + \frac{{\cos nx}}{{{n^2}}}} \right)} \right|_0^\pi } \right].\]

The values of \(\sin nx\) at \(x = 0\) or \(x = \pm \pi\) are zero. Therefore,

\[{a_n} = \frac{1}{{\pi {n^2}}}\left[ {\left. {\left( {\cos nx} \right)} \right|_{ - \pi }^0 - \left. {\left( {\cos nx} \right)} \right|_0^\pi } \right] = \frac{1}{{\pi {n^2}}}\left[ {\cos 0 - \cos \left( { - \pi n} \right) - \cos \pi n + \cos 0} \right] = \frac{2}{{\pi {n^2}}}\left[ {1 - \cos \pi n} \right] = \frac{2}{{\pi {n^2}}}\left[ {1 - {{\left( { - 1} \right)}^n}} \right].\]

When \(n = 2k,\) then \({a_{2k}} = 0.\) When \(n = 2k + 1,\) then \({a_{2k + 1}} = {\frac{4}{{\pi {n^2}}}},\) \(k = 0,1,2,3, \ldots \)

Since the function \(f\left( x \right)\) is even, the Fourier coefficients \({b_n}\) are zero. Therefore, the complete Fourier expansion for the triangle wave (see Figure \(5\)) is

\[f\left( x \right) = \frac{4}{\pi }\sum\limits_{k = 0}^\infty {\frac{{\cos \left( {2k + 1} \right)x}}{{{{\left( {2k + 1} \right)}^2}}}} .\]
Fourier series for the triangle wave
Figure 5, n = 1, n = 2

Example 6.

Find the Fourier series for the function

\[ f\left( x \right) = \begin{cases} -1, & \text{if} & - \pi \le x \le - \frac{\pi }{2} \\ 0, & \text{if} & - \frac{\pi }{2} \lt x \le \frac{\pi }{2} \\ 1, & \text{if} & \frac{\pi }{2} \lt x \le \pi \end{cases},\]

defined on the interval \(\left[ { - \pi ,\pi } \right].\)

Solution.

\[{a_0} = \frac{1}{\pi }\int\limits_{ - \pi }^\pi {f\left( x \right)dx} = \frac{1}{\pi }\left[ {\int\limits_{ - \pi }^{ - \frac{\pi }{2}} {\left( { - 1} \right)dx} + \int\limits_{ - \frac{\pi }{2}}^{\frac{\pi }{2}} {0dx} + \int\limits_{\frac{\pi }{2}}^\pi {1dx} } \right] = \frac{1}{\pi }\left( { - \cancel{\frac{\pi }{2}} + 0 + \cancel{\frac{\pi }{2}}} \right) = 0.\]

Compute the coefficients \({a_n}:\)

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

(These results are obvious since this function is odd.)

Calculate the coefficients \({b_n}:\)

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

Thus, the Fourier series expansion of the function is given by

\[f\left( x \right) = \frac{2}{\pi }\sum\limits_{n = 1}^\infty {\frac{1}{n} \left( {\cos\frac{{n\pi }}{2} - \cos n\pi } \right)\sin nx} .\]

The graph of the function and the Fourier series expansion for \(n = 10\) are shown in Figure \(6.\)

Fourier series for a piecewise function
Figure 6, n = 10
Page 1 Page 2