# Fourier Series of Functions with an Arbitrary Period

## Solved Problems

Click or tap a problem to see the solution.

### Example 3

Find the Fourier series of the trapezoidal wave defined by the function

${f\left( x \right) }= {\begin{cases} x, & 0 \le x \le 1 \\ 1, & 1 \lt x \le 2 \\ 3-x, & 2 \lt x \le 3 \end{cases}.}$

### Example 4

Find the Fourier series of the function $f\left( x \right) = {\cos ^2}x.$

### Example 3.

Find the Fourier series of the trapezoidal wave defined by the function

${f\left( x \right) }= {\begin{cases} x, & 0 \le x \le 1 \\ 1, & 1 \lt x \le 2 \\ 3-x, & 2 \lt x \le 3 \end{cases}.}$

Solution.

In the given case, obviously, $$L = {\frac{3}{2}}.$$ Calculate the coefficients of the expansion $${a_0}$$ and $${a_n}.$$

${a_0} = \frac{1}{L}\int\limits_a^b {f\left( x \right)dx} = \frac{2}{3}\int\limits_0^3 {f\left( x \right)dx} = \frac{2}{3}\left[ {\int\limits_0^1 {xdx} + \int\limits_1^2 {1dx} + \int\limits_2^3 {\left( {3 - x} \right)dx} } \right] = \frac{2}{3}\left[ {\left. {\left( {\frac{{{x^2}}}{2}} \right)} \right|_0^1 + \left. x \right|_0^1 + \left. {\left( {3x - \frac{{{x^2}}}{2}} \right)} \right|_2^3} \right] = \frac{4}{3};$
${a_n} = \frac{1}{L}\int\limits_a^b {f\left( x \right)\cos \frac{{n\pi x}}{L}dx} = \frac{2}{3}\int\limits_0^3 {f\left( x \right)\cos \frac{{2n\pi x}}{3}dx} = \frac{2}{3}\left\{ {\int\limits_0^1 {x\cos \frac{{2n\pi x}}{3}dx} } \right. + \int\limits_1^2 {\cos \frac{{2n\pi x}}{3}dx} + \left. {\int\limits_2^3 {\left( {3 - x} \right)\cos \frac{{2n\pi x}}{3}dx} } \right\} = \frac{2}{3}\left\{ {\left[ {\left. {\left( {\frac{3}{{2n\pi }}x\sin\frac{{2n\pi x}}{3}} \right)} \right|_0^1 - \int\limits_0^1 {\frac{3}{{2n\pi }}\sin\frac{{2n\pi x}}{3}dx} } \right]} \right. + \left. {\left( {\frac{3}{{2n\pi }}\sin\frac{{2n\pi x}}{3}} \right)} \right|_1^2 + \left. {\left[ {\left. {\left( {\frac{3}{{2n\pi }}\left( {3 - x} \right)\sin\frac{{2n\pi x}}{3}} \right)} \right|_2^3 + \int\limits_2^3 {\frac{3}{{2n\pi }}\sin\frac{{2n\pi x}}{3}dx} } \right]} \right\} = \frac{2}{3}\left\{ {\frac{3}{{2n\pi }}\sin\frac{{2n\pi }}{3}} \right. + \frac{9}{{4{n^2}{\pi ^2}}}\left( {\cos\frac{{2n\pi }}{3} - 1} \right) + \frac{3}{{2n\pi }}\left( {\sin\frac{{4n\pi }}{3} - \sin\frac{{2n\pi }}{3}} \right) - \frac{3}{{2n\pi }}\sin\frac{{4n\pi }}{3} + \left. {\frac{9}{{4{n^2}{\pi ^2}}}\left( { \text{-}\cos 2n\pi + \cos\frac{{4n\pi }}{3}} \right)} \right\} = \frac{2}{3}\left\{ {\frac{9}{{4{n^2}{\pi ^2}}}\left( {\cos\frac{{2n\pi }}{3} - 1} \right) + \frac{9}{{4{n^2}{\pi ^2}}}\left( {\cos\frac{{4n\pi }}{3} - 1} \right)} \right\}.$

Since

$\cos {\frac{{4n\pi }}{3}} = \cos \left( {2n\pi - {\frac{{2n\pi }}{3}}} \right) = \cos {\frac{{2n\pi }}{3}},$

we obtain

${a_n} = \frac{2}{3} \cdot \frac{{2 \cdot 9}}{{4{n^2}{\pi ^2}}}\left( {\cos \frac{{2n\pi }}{3} - 1} \right) = \frac{3}{{{n^2}{\pi ^2}}}\left( {\cos \frac{{2n\pi }}{3} - 1} \right),\;\; n = 1,2,3, \ldots$

The coefficients $${b_n}$$ are zero because the function is even on the given interval $$\left[ {0,3} \right].$$ Then the Fourier series expansion is expressed by the formula

$f\left( x \right) = \frac{2}{3} - \frac{3}{{{\pi ^2}}} {\sum\limits_{n = 1}^\infty {\frac{{1 - \cos \frac{{2n\pi }}{3}}}{{{n^2}}}\cos \frac{{2n\pi x}}{3}}}.$

Graphs of the given function and its Fourier approximation for $$n = 1$$ and $$n = 3$$ are shown in Figure $$3.$$

### Example 4.

Find the Fourier series of the function $f\left( x \right) = {\cos ^2}x.$

Solution.

This function is even with period $$\pi$$ $$\left( {L = {\frac{\pi }{2}}} \right).$$ Therefore, $${b_n} = 0.$$ Find the coefficients $${a_0}$$ and $${a_n}.$$

${a_0} = \frac{2}{L}\int\limits_0^L {f\left( x \right)dx} = \frac{4}{\pi }\int\limits_0^{\frac{\pi }{2}} {{{\cos }^2}xdx} = \frac{2}{\pi }\int\limits_0^{\frac{\pi }{2}} {\left( {1 + \cos 2x} \right)dx} = \frac{2}{\pi }\left[ {\left. {\left( {x + \frac{{\sin 2x}}{2}} \right)} \right|_0^{\frac{\pi }{2}}} \right] = \frac{2}{\pi }\left[ {\frac{\pi }{2} + \frac{{\sin \pi }}{2}} \right] = 1.$
${a_n} = \frac{2}{L}\int\limits_0^L {f\left( x \right)\cos \frac{{n\pi x}}{L}dx} = \frac{4}{\pi }\int\limits_0^{\frac{\pi }{2}} {{{\cos }^2}x\cos 2nxdx} = \frac{2}{\pi }\int\limits_0^{\frac{\pi }{2}} {\left( {1 + \cos 2x} \right)\cos 2nxdx} = \frac{2}{\pi }\int\limits_0^{\frac{\pi }{2}} {\left( {\cos 2nx + \cos 2x\cos 2nx} \right)dx} = \frac{2}{\pi }\int\limits_0^{\frac{\pi }{2}} {\left[ {2\cos 2nx + \cos \left( {2n - 2} \right)x + \cos \left( {2n + 2} \right)x} \right]dx} = \frac{1}{\pi }\left. {\left[ {\sin \frac{{2nx}}{n} + \sin \frac{{\left( {2n - 2} \right)x}}{{2n - 2}} + \sin \frac{{\left( {2n + 2} \right)x}}{{2n + 2}}} \right]} \right|_0^{\frac{\pi }{2}} = \frac{1}{\pi }\left[ {\frac{{\sin n\pi }}{n} + \frac{{\sin \left( {n - 1} \right)\pi }}{{2n - 2}} + \frac{{\sin \left( {n + 1} \right)\pi }}{{2n + 2}}} \right] = 0.$

However, this result is valid only for $$n \ge 2.$$ Therefore we calculate the coefficient $${a_1}$$ separately:

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

Thus, the Fourier series of the function $$f\left( x \right) = {\cos ^2}x$$ is given by

$f\left( x \right) = {\cos ^2}x = \frac{1}{2} + \frac{1}{2}\cos 2x.$

This result is the well-known trigonometric identity.