Math24.net Calculus
 Home Calculus Limits and Continuity Differentiation Applications of Derivative Integration Sequences and Series Double Integrals Triple Integrals Line Integrals Surface Integrals Fourier Series Differential Equations 1st Order Equations 2nd Order Equations Nth Order Equations Systems of Equations Formulas and Tables
Definition of Fourier Series and Typical Examples
 Baron Jean Baptiste Joseph Fourier ($$1768-1830$$) introduced the idea that any periodic function can be represented by a series of sines and cosines which are harmonically related. To consider this idea in more detail, we should introduce some definitions and common terms.
Basic Definitions
A function $$f\left( x \right)$$ is said to have period $$P$$ if $$f\left( {x + P} \right) = f\left( x \right)$$ for all $$x.$$ Let the function $$f\left( x \right)$$ has period $$2\pi.$$ In this case, it is enough to consider behavior of the function on the interval $$\left[ { - \pi ,\pi } \right].$$
1. Suppose that the function $$f\left( x \right)$$ with period $$2\pi$$ is absolutely integrable on on $$\left[ { - \pi ,\pi } \right]$$ so that the following so-called Dirichlet integral is finite: $\int\limits_{ - \pi }^\pi {\left| {f\left( x \right)} \right|dx} < \infty ;$

2. Suppose also that the function $$f\left( x \right)$$ is a single valued, piecewise continuous (must have a finite number of jump discontinuities), and piecewise monotonic (must have a finite number of maxima and minima).

If the conditions $$1$$ and $$2$$ are satisfied, the Fourier series for the function $$f\left( x \right)$$ exists and converges to the given function (see also the Convergence of Fourier Series page about convergence conditions.)

At a discontinuity $${x_0}$$, the Fouries Series converges to $\lim\limits_{\varepsilon \to 0} \frac{1}{2}\left[ {f\left( {{x_0} - \varepsilon } \right) - f\left( {{x_0} + \varepsilon } \right)} \right].$ The Fourier series of the function $$f\left( x \right)$$ is given by $f\left( x \right) = \frac{{{a_0}}}{2} + \sum\limits_{n = 1}^\infty {\left\{ {{a_n}\cos nx + {b_n}\sin nx} \right\}} ,$ where the Fourier coefficients $${{a_0}},$$ $${{a_n}},$$ and $${{b_n}}$$ are defined by the integrals ${{a_0} = \frac{1}{\pi }\int\limits_{ - \pi }^\pi {f\left( x \right)dx} ,}\;\; {{a_n} = \frac{1}{\pi }\int\limits_{ - \pi }^\pi {f\left( x \right)\cos nx dx} ,}\;\; {{b_n} = \frac{1}{\pi }\int\limits_{ - \pi }^\pi {f\left( x \right)\sin nx dx} .}$ Sometimes alternative forms of the Fourier series are used. Replacing $${{a_n}}$$ and $${{b_n}}$$ by the new variables $${{d_n}}$$ and $${{\varphi_n}}$$ or $${{d_n}}$$ and $${{\theta_n}},$$ where ${{d_n} = \sqrt {a_n^2 + b_n^2} ,}\;\; {\tan {\varphi _n} = \frac{{{a_n}}}{{{b_n}}},}\;\; {\tan {\theta _n} = \frac{{{b_n}}}{{{a_n}}},}$ we can write: ${f\left( x \right) = \frac{{{a_0}}}{2} + \sum\limits_{n = 1}^\infty {{d_n}\sin \left( {nx + {\varphi _n}} \right)} \;\;\text{or}\;\;} {f\left( x \right) = \frac{{{a_0}}}{2} + \sum\limits_{n = 1}^\infty {{d_n}\cos\left( {nx + {\theta _n}} \right)} .}$
Fourier Series of Even and Odd Functions
The Fourier series expansion of an even function $$f\left( x \right)$$ with the period of $$2\pi$$ does not involve the terms with sines and has the form: $f\left( x \right) = \frac{{{a_0}}}{2} + \sum\limits_{n = 1}^\infty {{a_n}\cos nx} ,$ where the Fourier coefficients are given by the formulas ${{a_0} = \frac{2}{\pi }\int\limits_0^\pi {f\left( x \right)dx} ,}\;\; {{a_n} = \frac{2}{\pi }\int\limits_0^\pi {f\left( x \right)\cos nxdx} .}$ Accordingly, the Fourier series expansion of an odd $$2\pi$$-periodic function $$f\left( x \right)$$ consists of sine terms only and has the form: $f\left( x \right) = \sum\limits_{n = 1}^\infty {{b_n}\sin nx} ,$ where the coefficients $${{b_n}}$$ are ${b_n} = \frac{2}{\pi }\int\limits_0^\pi {f\left( x \right)\sin nxdx} .$ Below we consider expansions of $$2\pi$$-periodic functions into their Fourier series, supposing that these expansions exist and are convergent.

Example 1
Let the function $$f\left( x \right)$$ be $$2\pi$$-periodic and suppose that it is presented by the Fourier series: $f\left( x \right) = \frac{{{a_0}}}{2} + \sum\limits_{n = 1}^\infty {\left\{ {{a_n}\cos nx + {b_n}\sin nx} \right\}} .$ Calculate the coefficients $${{a_0}},$$ $${{a_n}},$$ and $${{b_n}}.$$

Solution.
To define $${{a_0}},$$ we integrate the Fourier series on the interval $$\left[ { - \pi ,\pi } \right]:$$ ${\int\limits_{ - \pi }^\pi {f\left( x \right)dx} } = {\pi {a_0} + \sum\limits_{n = 1}^\infty {\left[ {{a_n}\int\limits_{ - \pi }^\pi {\cos nxdx} + {b_n}\int\limits_{ - \pi }^\pi {\sin nxdx} } \right]} .}$ For all $$n > 0$$, ${\int\limits_{ - \pi }^\pi {\cos nxdx} = \left. {\left( {\frac{{\sin nx}}{n}} \right)} \right|_{ - \pi }^\pi = 0\;\;\text{and}\;\;} {\int\limits_{ - \pi }^\pi {\sin nxdx} = \left. {\left( { - \frac{{\cos nx}}{n}} \right)} \right|_{ - \pi }^\pi = 0.}$ Therefore, all the terms on the right of the summation sign are zero, so we obtain ${\int\limits_{ - \pi }^\pi {f\left( x \right)dx} = \pi {a_0}\;\;\text{or}\;\;} {{a_0} = \frac{1}{\pi }\int\limits_{ - \pi }^\pi {f\left( x \right)dx} .}$ In order to find the coefficients $${{a_n}},$$ we multiply both sides of the Fourier series by $$\cos mx$$ and integrate term by term: ${\int\limits_{ - \pi }^\pi {f\left( x \right)\cos mxdx} } = {\frac{{{a_0}}}{2}\int\limits_{ - \pi }^\pi {\cos mxdx} } + {\sum\limits_{n = 1}^\infty {\left[ {{a_n}\int\limits_{ - \pi }^\pi {\cos nx\cos mxdx} + {b_n}\int\limits_{ - \pi }^\pi {\sin nx\cos mxdx} } \right]} .}$ The first term on the right side is zero. Then, using the well-known trigonometric identities, we have ${\int\limits_{ - \pi }^\pi {\sin nx\cos mxdx} } = {\frac{1}{2}\int\limits_{ - \pi }^\pi {\left[ {\sin\left( {n + m} \right)x + \sin \left( {n - m} \right)x} \right]dx} = 0,}$ ${\int\limits_{ - \pi }^\pi {\cos nx\cos mxdx} } = {\frac{1}{2}\int\limits_{ - \pi }^\pi {\left[ {\cos \left( {n + m} \right)x + \cos \left( {n - m} \right)x} \right]dx} = 0,}$ if $$m \ne n.$$

In case when $$m = n$$, we can write: $\require{cancel} {\int\limits_{ - \pi }^\pi {\sin nx\cos mxdx} } = {\frac{1}{2}\int\limits_{ - \pi }^\pi {\left[ {\sin 2mx + \sin 0} \right]dx} ,}\;\; {\Rightarrow \int\limits_{ - \pi }^\pi {{\sin^2}mxdx} = \frac{1}{2}\left[ {\left. {\left( { - \frac{{\cos 2mx}}{{2m}}} \right)} \right|_{ - \pi }^\pi } \right] } = {\frac{1}{{4m}}\left[ { - \cancel{\cos \left( {2m\pi } \right)} + \cancel{\cos \left( {2m\left( { - \pi } \right)} \right)}} \right] = 0;}$ ${\int\limits_{ - \pi }^\pi {\cos nx\cos mxdx} } = {\frac{1}{2}\int\limits_{ - \pi }^\pi {\left[ {\cos 2mx + \cos 0} \right]dx} ,}\;\; {\Rightarrow \int\limits_{ - \pi }^\pi {{\cos^2}mxdx} } = {\frac{1}{2}\left[ {\left. {\left( {\frac{{\sin 2mx}}{{2m}}} \right)} \right|_{ - \pi }^\pi + 2\pi } \right] } = {\frac{1}{{4m}}\left[ {\sin \left( {2m\pi } \right) - \sin \left( {2m\left( { - \pi } \right)} \right)} \right] + \pi = \pi .}$ Thus, ${\int\limits_{ - \pi }^\pi {f\left( x \right)\cos mxdx} = {a_m}\pi ,}\;\; {\Rightarrow {a_m} = \frac{1}{\pi }\int\limits_{ - \pi }^\pi {f\left( x \right)\cos mxdx} ,}\;\; {m = 1,2,3, \ldots }$ Similarly, multiplying the Fourier series by $$\sin mx$$ and integrating term by term, we obtain the expression for $${{b_m}}:$$ ${{b_m} = \frac{1}{\pi }\int\limits_{ - \pi }^\pi {f\left( x \right)\sin mxdx} ,}\;\; {m = 1,2,3, \ldots }$ Rewriting the formulas for $${{a_n}},$$ $${{b_n}},$$ we can write the final expressions for the Fourier coefficients: ${{a_n} = \frac{1}{\pi }\int\limits_{ - \pi }^\pi {f\left( x \right)\cos nxdx} ,}\;\; {{b_n} = \frac{1}{\pi }\int\limits_{ - \pi }^\pi {f\left( x \right)\sin nxdx} .}$
Example 2
Find the Fourier series for the square $$2\pi$$-periodic wave defined on the interval $$\left[ { - \pi ,\pi } \right]:$$ $f\left( x \right) = \begin{cases} 0, & \text{if} & - \pi \le x \le 0 \\ 1, & \text{if} & 0 < x \le \pi \end{cases}.$

Solution.
First we calculate the constant $${{a_0}}:$$ ${{a_0} = \frac{1}{\pi }\int\limits_{ - \pi }^\pi {f\left( x \right)dx} } = {\frac{1}{\pi }\int\limits_0^\pi {1dx} } = {\frac{1}{\pi } \cdot \pi = 1.}$ Find now the Fourier coefficients for $$n \ne 0:$$ ${{a_n} = \frac{1}{\pi }\int\limits_{ - \pi }^\pi {f\left( x \right)\cos nxdx} } = {\frac{1}{\pi }\int\limits_0^\pi {1 \cdot \cos nxdx} } = {\frac{1}{\pi }\left[ {\left. {\left( {\frac{{\sin nx}}{n}} \right)} \right|_0^\pi } \right] } = {\frac{1}{{\pi n}} \cdot 0 = 0,}$ ${{b_n} = \frac{1}{\pi }\int\limits_{ - \pi }^\pi {f\left( x \right)\sin nxdx} } = {\frac{1}{\pi }\int\limits_0^\pi {1 \cdot \sin nxdx} } = {\frac{1}{\pi }\left[ {\left. {\left( { - \frac{{\cos nx}}{n}} \right)} \right|_0^\pi } \right] } = { - \frac{1}{{\pi n}} \cdot \left( {\cos n\pi - \cos 0} \right) } = {\frac{{1 - \cos n\pi }}{{\pi n}}.}$ As $$\cos n\pi = {\left( { - 1} \right)^n},$$ we can write: ${b_n} = \frac{{1 - {{\left( { - 1} \right)}^n}}}{{\pi n}}.$ Thus, the Fourier series for the square wave is $f\left( x \right) = \frac{1}{2} + \sum\limits_{n = 1}^\infty {\frac{{1 - {{\left( { - 1} \right)}^n}}}{{\pi n}}\sin nx} .$ We can easily find the first few terms of the series. By setting, for example, $$n = 5,$$ we get ${f\left( x \right) = \frac{1}{2} + \frac{{1 - \left( { - 1} \right)}}{\pi }\sin x } + {\frac{{1 - {{\left( { - 1} \right)}^2}}}{{2\pi }}\sin 2x } + {\frac{{1 - {{\left( { - 1} \right)}^3}}}{{3\pi }}\sin 3x } + {\frac{{1 - {{\left( { - 1} \right)}^4}}}{{4\pi }}\sin 4x } + {\frac{{1 - {{\left( { - 1} \right)}^5}}}{{5\pi }}\sin 5x + \ldots } = {\frac{1}{2} + \frac{2}{\pi }\sin x } + {\frac{2}{{3\pi }}\sin 3x } + {\frac{2}{{5\pi }}\sin 5x + \ldots }$ The graph of the function and the Fourier series expansion for $$n = 10$$ is shown in Figure $$1.$$
 Fig.1, n = 10 Fig.2, n = 5, n = 10
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 $$2$$), 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} = - {\large\frac{{\cos nx}}{n}\normalsize},$$ so the integral becomes ${{b_n} = \frac{1}{\pi }\int\limits_{ - \pi }^\pi {x\sin nxdx} } = {\frac{1}{\pi }\left[ {\left. {\left( { - \frac{{\cos nx}}{n}} \right)} \right|_{ - \pi }^\pi - \int\limits_{ - \pi }^\pi {\left( { - \frac{{\cos nx}}{n}} \right)dx} } \right] } = {\frac{1}{\pi }\left[ {\left( { - \frac{{\pi \cos n\pi }}{n} + \frac{{\left( { - \pi } \right)\cos \left( { - n\pi } \right)}}{n}} \right) + \frac{1}{n}\int\limits_{ - \pi }^\pi {\cos nxdx} } \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 is (Figure $$2$$ above) $x = \sum\limits_{n = 1}^\infty {\frac{2}{n}{{\left( { - 1} \right)}^{n + 1}}\sin nx} .$
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 is (Figure $$3$$) ${x^2} = \frac{{{\pi ^2}}}{3} + \sum\limits_{n = 1}^\infty {\frac{4}{{{n^2}}}{{\left( { - 1} \right)}^n}\cos nx} .$
 Fig.3, n = 2, n = 5 Fig.4, n = 1, n = 2
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 < 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} } \right. } + {\left. {\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} \right. } + {\;\left. {\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}} = {\large\frac{4}{{\pi {n^2}}}\normalsize},\;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 $$4$$ above) 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}}}} .$
Example 6
Find the Fourier series for the function $f\left( x \right) = \begin{cases} 0, & \text{if} & - \pi \le x \le 0 \\ \sin x, & \text{if} & 0 < x \le \pi \end{cases},$ defined on the interval $$\left[ { - \pi ,\pi } \right].$$

Solution.
First we find the constant $${a_0}:$$ ${{a_0} = \frac{1}{\pi }\int\limits_{ - \pi }^\pi {f\left( x \right)dx} } = {\frac{1}{\pi }\int\limits_0^\pi {\sin xdx} } = {\frac{1}{\pi }\left[ {\left. {\left( { - \cos x} \right)} \right|_0^\pi } \right] } = {\frac{1}{\pi }\left( { - \cos \pi + \cos 0} \right) } = {\frac{2}{\pi }.}$ Now we calculate the coefficients $${a_n}:$$ ${{a_n} = \frac{1}{\pi }\int\limits_{ - \pi }^\pi {f\left( x \right)\cos nxdx} } = {\frac{1}{\pi }\int\limits_0^\pi {\sin x\cos nxdx} } = {\frac{1}{{2\pi }}\int\limits_0^\pi {\left[ {\sin \left( {x + nx} \right) + \sin\left( {x - nx} \right)} \right]dx} } = {\frac{1}{{2\pi }}\int\limits_0^\pi {\left[ {\sin \left( {n + 1} \right)x + \sin\left( {n - 1} \right)x} \right]dx} } = {\frac{1}{{2\pi }}\left[ {\left. {\left( { - \frac{{\cos \left( {n + 1} \right)x}}{{n + 1}} + \frac{{\cos \left( {n - 1} \right)x}}{{n - 1}}} \right)} \right|_0^\pi } \right] } = {\frac{1}{{2\pi }}\left[ {\frac{{\cos \left( {n - 1} \right)\pi }}{{n - 1}} - \frac{{\cos \left( {n + 1} \right)\pi }}{{n + 1}} - \frac{1}{{n - 1}} + \frac{1}{{n + 1}}} \right] } = {\frac{1}{{2\pi }}\left[ {\frac{{\cos \left( {n - 1} \right)\pi }}{{n - 1}} - \frac{{\cos \left( {n + 1} \right)\pi }}{{n + 1}} - \frac{2}{{{n^2} - 1}}} \right].}$ Notice that ${\cos \left( {n + 1} \right)\pi } = {\cos \left( {\pi n + \pi } \right) } = {\cos \left( {\pi n - \pi + 2\pi } \right) } = {\cos \left( {\left( {n - 1} \right)\pi + 2\pi } \right) } = {\cos \left( {n - 1} \right)\pi .}$ Since $$\cos \left( {n - 1} \right)\pi = {\left( { - 1} \right)^{n - 1}},$$ we get the following expression for the coefficients $${a_n}:$$ ${a_n} = \frac{1}{{2\pi }} \cdot \frac{2}{{{n^2} - 1}} \cdot \left[ {{{\left( { - 1} \right)}^{n - 1}} - 1} \right].$ It can be seen that $${a_n} = 0$$ for odd $$n.$$ For even $$n,$$ when $$n = 2k\;\left( {k = 1,2,3, \ldots } \right),$$ we have ${a_{2k}} = \frac{1}{{2\pi }} \cdot \left( { - \frac{4}{{{k^2} - 1}}} \right) = - \frac{1}{\pi } \cdot \frac{2}{{{k^2} - 1}}.$ Calculate the coefficients $${b_n}.$$ Start with $${b_1}:$$ ${{b_1} = \frac{1}{\pi }\int\limits_{ - \pi }^\pi {f\left( x \right)\sin xdx} } = {\frac{1}{\pi }\int\limits_0^\pi {\sin x\sin xdx} } = {\frac{1}{\pi }\int\limits_0^\pi {{{\sin }^2}xdx} } = {\frac{1}{{2\pi }}\int\limits_0^\pi {\left( {1 - \cos 2x} \right)dx} } = {\frac{1}{{2\pi }}\left[ {\left. {\left( {x - \frac{{\sin 2x}}{2}} \right)} \right|_0^\pi } \right] } = {\frac{1}{{2\pi }} \cdot \pi = \frac{1}{2}.}$ The other coefficients $${b_n}$$ for $$n > 1$$ are zero. Indeed, ${{b_n} = \frac{1}{\pi }\int\limits_{ - \pi }^\pi {f\left( x \right)\sin nxdx} } = {\frac{1}{\pi }\int\limits_0^\pi {\sin x\sin nxdx} } = {\frac{1}{{2\pi }}\int\limits_0^\pi {\left[ {\cos \left( {x - nx} \right) - \cos \left( {x + nx} \right)} \right]dx} } = {\frac{1}{{2\pi }}\int\limits_0^\pi {\left[ {\cos \left( {n - 1} \right)x - \cos \left( {n + 1} \right)x} \right]dx} } = {\frac{1}{{2\pi }}\left[ {\left. {\left( {\frac{{\sin \left( {n - 1} \right)x}}{{n - 1}} - \frac{{\sin \left( {n + 1} \right)x}}{{n + 1}}} \right)} \right|_0^\pi } \right] = 0}$ Thus, the Fourier series of the given function is given by ${f\left( x \right) = \frac{1}{\pi } + \frac{1}{2}\sin x } - {\frac{2}{\pi }\sum\limits_{k = 1}^\infty {\frac{1}{{4{k^2} - 1}}\cos \left( {2kx} \right)} .}$ Graphs of the function and its Fourier expansions for $$n = 2$$ and $$n = 8$$ are shown in Figure $$5.$$
 Fig.5, n = 2, n = 8 Fig.6, n = 10
Example 7
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} < 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 }^{ - \large\frac{\pi }{2}\normalsize} {\left( { - 1} \right)dx} + \int\limits_{ - \large\frac{\pi }{2}\normalsize}^{\large\frac{\pi }{2}\normalsize} {0dx} + \int\limits_{\large\frac{\pi }{2}\normalsize}^\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 }^{ - \large\frac{\pi }{2}\normalsize} {\left( { - \cos nx} \right)dx} + \int\limits_{\large\frac{\pi }{2}\normalsize}^\pi {\cos nxdx} } \right] } = {\frac{1}{\pi }\left[ {\left. {\left( { - \frac{{\sin nx}}{n}} \right)} \right|_{ - \pi }^{ - \large\frac{\pi }{2}\normalsize} + \left. {\left( {\frac{{\sin nx}}{n}} \right)} \right|_{\large\frac{\pi }{2}\normalsize}^\pi } \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 }^{ - \large\frac{\pi }{2}\normalsize} {\left( { - \sin nx} \right)dx} + \int\limits_{\large\frac{\pi }{2}\normalsize}^\pi {\sin nxdx} } \right] } = {\frac{1}{\pi }\left[ {\left. {\left( {\frac{{\cos nx}}{n}} \right)} \right|_{ - \pi }^{ - \large\frac{\pi }{2}\normalsize} - \left. {\left( {\frac{{\cos nx}}{n}} \right)} \right|_{\large\frac{\pi }{2}\normalsize}^\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$$ above.

 All Rights Reserved © www.math24.net, 2010-2016   info@math24.net