# Even and Odd Extensions

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) = \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) = \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} ,\;\; 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} ,\;\; 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} ,\;\; 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} ,\;\; 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

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

### Example 2

Find the Fourier Cosine series of the function

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

### Example 1.

Find the Fourier Cosine series of the function

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

Solution.

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.$$

### Example 2.

Find the Fourier Cosine series of the function

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

Solution.

Using even extension of the initial function, we can write:

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

The Fourier coefficients $${a_0}$$ and $${a_n}$$ are

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

Thus, the Fourier series (see Figure $$2$$) is

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