Suppose that a function \(f\left( x \right)\) is piecewise continuous and defined on the interval \(\left[ {0,\pi } \right].\) To find its Fourier series, we first extend this function to the interval \(\left[ {-\pi,\pi } \right].\) This can be done in two ways:

- We can construct the even extension of \(f\left( x \right):\)
\[ {{f_\text{even}}\left( x \right) \text{ = }}\kern0pt {\begin{cases} f\left( {-x} \right), & -\pi \le x \lt 0 \\ f\left( {x} \right), & 0 \le x \le \pi \end{cases},} \]
- or the odd extension of \(f\left( x \right):\)
\[ {{f_\text{odd}}\left( x \right) \text{ = }}\kern0pt {\begin{cases} -f\left( {-x} \right), & -\pi \le x \lt 0 \\ f\left( {x} \right), & 0 \le x \le \pi \end{cases}.} \]

For the even function, the Fourier series is called the Fourier Cosine series and is given by

\[{{f_\text{even}}\left( x \right) = \frac{{{a_0}}}{2} }+{ \sum\limits_{n = 1}^\infty {{a_n}\cos nx} ,}\]

where

\[

{{a_n} }={ \frac{2}{\pi }\int\limits_0^\pi {f\left( x \right)\cos nxdx} ,\;\;}\kern-0.3pt

{n = 0,1,2,3, \ldots }

\]

Respectively, for the odd function, the Fourier series is called the Fourier Sine series and is given by

\[{{f_\text{odd}}\left( x \right) }={ \sum\limits_{n = 1}^\infty {{b_n}\sin nx} ,}\]

where the Fourier coefficients are

\[

{{b_n} }={ \frac{2}{\pi }\int\limits_0^\pi {f\left( x \right)\sin nxdx} ,\;\;}\kern-0,3pt

{n = 1,2,3, \ldots }

\]

We can also define the Fourier Sine and Cosine series for a function with an arbitrary period \(2L.\) Let \(f\left( x \right)\) be defined on the interval \(\left[ {0,L } \right].\) Using even extension of the function to the interval \(\left[ {-L,L } \right],\) we obtain

\[{{f_\text{even}}\left( x \right) = \frac{{{a_0}}}{2} }+{ \sum\limits_{n = 1}^\infty {{a_n}\cos \frac{{n\pi x}}{L}} ,}\]

where

\[

{{a_n} }={ \frac{2}{L}\int\limits_0^L {f\left( x \right)\cos \frac{{n\pi x}}{L}dx} ,\;\;}\kern-0.3pt

{n = 0,1,2,3, \ldots }

\]

For the odd extension, we have

\[{{f_\text{odd}}\left( x \right) }={ \sum\limits_{n = 1}^\infty {{b_n}\sin \frac{{n\pi x}}{L}} ,}\]

where the coefficients \({b_n}\) are

\[

{{b_n} }={ \frac{2}{L}\int\limits_0^L {f\left( x \right)\sin \frac{{n\pi x}}{L}dx} ,\;\;}\kern-0.3pt

{n = 1,2,3, \ldots }

\]

## Solved Problems

Click or tap a problem to see the solution.

### Example 1

Find the Fourier Cosine series of the function### Example 2

Find the Fourier Cosine series of the function### Example 3

Find the Fourier Sine series of the function \(f\left( x \right) = \cos x\) defined on the interval \(\left[ {0,\pi } \right].\)### 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].\)### Example 1.

Find the Fourier Cosine series of the functionSolution.

We construct even extension of the given function. The corresponding Fourier series has the form:

\[f\left( x \right) = \frac{{{a_0}}}{2} + \sum\limits_{n = 1}^\infty {{a_n}\cos nx} .\]

Calculate the Fourier coefficients \({a_0}\) and \({a_n}:\)

\[{{a_0} = \frac{2}{\pi }\int\limits_0^\pi {f\left( x \right)dx} }={ \frac{2}{\pi }\int\limits_0^d {dx} }={ \frac{{2d}}{\pi },}\]

\[

{{a_n} }={ \frac{2}{\pi }\int\limits_0^\pi {f\left( x \right)\cos nxdx} }

= {\frac{2}{\pi }\int\limits_0^d {\cos nxdx} }

= {\frac{2}{{n\pi }}\left[ {\left. {\left( {\sin nx} \right)} \right|_0^d} \right] }

= {\frac{2}{{n\pi }}\sin nd.}

\]

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

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

Graphs of the function and its Fourier approximation for \(n = 5\) and \(n = 50\) are shown in Figure \(1.\)