Skip to main content

Applied Mathematics

Section 6.2 Fourier Series

An infinite series of the form:
\begin{equation} a_0 + \sum_{n=1}^{\infty} (a_n \cos n x + b_n \sin nx)\tag{6.2.1} \end{equation}
is called the trigonometric series.
The trigonometric series is periodic with period at most \(2\pi\text{.}\) Consider the terms \(\cos x\) and \(\sin x\text{,}\) which each have period \(2\pi\text{.}\) All other functions have period \(2\pi/n\text{,}\) which are also periodic with period \(2\pi\text{,}\) but their fundamental period is \(2\pi/n\text{.}\)

Definition 6.2.1.

Let \(f(x)\) be periodic of period \(2\pi\) and be piecewise continuous in \([-\pi,\pi]\text{.}\) Suppose \(f(x)\) can be written as a trigonometric series. Then it is called a Fourier Series for \(f(x)\text{.}\) The constants \(a_n\) and \(b_n\) are called the Fourier Coefficients of \(f(x)\) and are given by the Euler formulas:
\begin{align} a_0 \amp = \frac{1}{2\pi} \langle f(x), 1 \rangle = \frac{1}{2\pi} \int_{-\pi}^{\pi} f(x) \, dx\tag{6.2.2}\\ a_n \amp = \frac{1}{\pi} \langle f(x), \cos n x \rangle = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x) \cos nx \, dx\tag{6.2.3}\\ b_n \amp = \frac{1}{\pi} \langle f(x), \sin nx \rangle = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x) \sin nx \, dx\tag{6.2.4} \end{align}
In this section, we’re going to write periodic functions as Fourier Series. This is possible due to the following theorem.

Proof.

Take the inner product of \(f\) with each element in the set from ExampleΒ 6.1.28. We will start with the constant function and use (6.2.1).
\begin{align*} \biggl\langle \frac{1}{\sqrt{2\pi}}, f(x) \biggr\rangle \amp = \biggl\langle \frac{1}{\sqrt{2\pi}}, a_0 + \sum_{n=1}^{\infty} (a_n \cos n x + b_n \sin nx) \biggr\rangle \\ \frac{1}{\sqrt{2\pi}} \langle 1, f(x) \rangle \amp = \frac{1}{\sqrt{2\pi}} \left(\langle a_0,1 \rangle + \sum_{n=1}^{\infty} \left(a_n \langle \cos nx, 1 \rangle + b_n \langle \sin nx , 1 \rangle \right)\right) \\ \amp \qquad \text{since the inner product of 1 with the trig functions are 0}\\ \amp = \frac{a_0}{\sqrt{2\pi}} \langle 1, 1 \rangle \end{align*}
and solving for \(a_0\text{,}\)
\begin{equation*} a_ 0 = \frac{\langle f(x),1 \rangle}{\langle 1,1 \rangle} = \frac{1}{2\pi} \int_{-\pi}^{\pi} f(x) \, dx \end{equation*}
Next, take the inner product of ((6.2.1)) with \(\frac{1}{\sqrt{\pi}}\cos nx\text{.}\)
\begin{align*} \biggl\langle \frac{1}{\sqrt{\pi}}\cos nx ,f(x) \biggr \rangle \amp = \biggl\langle \frac{1}{\sqrt{\pi}}\cos nx, a_0 + \sum_{m=1}^{\infty} (a_m \cos m x + b_m \sin mx) \biggr\rangle \\ \frac{1}{\sqrt{\pi}} \langle \cos nx, f(x) \rangle \amp = \frac{1}{\sqrt{\pi}} \biggl(a_0 \langle 1, \cos nx \rangle + \sum_{m=1}^{\infty} \bigl( a_m \langle \cos mx, \cos n x \rangle \\ \amp \phantom{\frac{1}{\sqrt{\pi}} \biggl(a_0 \langle 1, \cos nx \rangle + \sum_{m=1}^{\infty}} \quad + b_m \langle \sin mx, \cos nx \rangle \bigr) \biggr), \end{align*}
All of the inner products on the right side are zero except when \(n=m\text{.}\) Canceling a \(\sqrt{\pi}\text{,}\) the result is
\begin{equation*} \langle \cos nx, f(x) \rangle = a_n \langle \cos nx, \cos nx \rangle \end{equation*}
or solving for \(a_n\text{,}\)
\begin{equation*} a_n = \frac{\langle f(x), \cos nx \rangle}{\langle \cos nx, \cos nx \rangle} = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x) \cos nx \, dx \end{equation*}
Lastly, take the inner product of (6.2.1) with \(\frac{1}{\sqrt{\pi}}\sin nx\text{.}\)
\begin{align*} \biggl\langle \frac{1}{\sqrt{\pi}}\sin nx ,f(x) \biggr \rangle \amp = \biggl\langle \frac{1}{\sqrt{\pi}}\sin nx, a_0 + \sum_{m=1}^{\infty} (a_m \cos m x + b_m \sin mx) \biggr\rangle \\ \frac{1}{\sqrt{\pi}} \langle \sin nx, f(x) \rangle \amp = \frac{1}{\sqrt{\pi}} \biggl(a_0 \langle 1, \sin nx \rangle + \sum_{m=1}^{\infty} \bigl( a_m \langle \cos mx, \sin n x \rangle \\ \amp \phantom{\frac{1}{\sqrt{\pi}} \biggl(a_0 \langle 1, \cos nx \rangle + \sum_{m=1}^{\infty}} + b_m \langle \sin mx, \sin nx \rangle \bigr) \biggr), \end{align*}
All of the inner products on the right side are zero except when \(n=m\text{.}\) Canceling a \(\sqrt{\pi}\text{,}\) the result is
\begin{equation*} \langle \sin nx, f(x) \rangle = b_n \langle \sin nx, \sin nx \rangle \end{equation*}
and solving for \(b_n\text{,}\)
\begin{equation*} b_n = \frac{\langle f(x), \sin nx \rangle}{\langle \sin nx, \sin nx \rangle} = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x) \sin nx \, dx \end{equation*}
Notice again that the statement in TheoremΒ 6.2.2 requires \(f\) to be periodic with period \(2\pi\text{.}\) This is a fairly strict requirement that we will relax over the rest of this section, however, one way to get a periodic function is to start with a function that is defined on \([-\pi,\pi]\) and extend it periodically such that \(f(x)=f(x+2\pi)\text{.}\) We do this in the following example.

Example 6.2.3.

Find the Fourier coefficients and the Fourier series for the periodic extension square wave:
\begin{equation*} f(x) = \begin{cases} 1 \amp 0 \leq x \leq \pi \\ -1 \amp -\pi \lt x \lt 0 \end{cases} \end{equation*}
and define \(f(x)\) to be its periodic extension of period \(2\pi\text{.}\) That is if \(x\) is outside of \([-\pi,\pi]\text{,}\) then apply \(f(x) = f(x+2\pi)\) or \(f(x) = f(x-2\pi)\) until \(x \in [-\pi,\pi]\text{.}\) This function looks like:
Figure 6.2.4. Graph of the periodic square wave.
Solution.
To begin with, we find all of the coefficients:
\begin{align*} a_0 \amp = \frac{1}{2\pi} \int_{-\pi}^{\pi} f(x) \, dx \\ \amp = \frac{1}{2\pi} \biggl( \int_{-\pi}^0 (-1) \, dx + \int_0^{\pi} (1) \, dx \biggr) = \frac{1}{2\pi} \bigl( -\pi + \pi) = 0 \end{align*}
\begin{align*} a_n \amp = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x) \cos nx \, dx \\ \amp = \frac{1}{\pi} \biggl( \int_{-\pi}^0 (-1) \cos nx \, dx + \int_0^{\pi} \cos nx \, dx \biggr) \\ \amp = \frac{1}{\pi} \biggl( -\frac{1}{n} \sin nx \biggr\vert_{-\pi}^0 + \frac{1}{n} \sin nx \biggr\vert_{0}^{\pi} \biggr) = 0 \end{align*}
\begin{align*} b_n \amp = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x) \sin nx \, dx \\ \amp = \frac{1}{\pi} \biggl( \int_{-\pi}^0 (-1) \sin nx \, dx + \int_0^{\pi} \sin nx \, dx \biggr) \\ \amp = \frac{1}{\pi} \biggl( \frac{1}{n} \cos nx \biggr \vert_{-\pi}^0 - \frac{1}{n} \cos nx \biggr \vert_0^{\pi} \biggr) \\ \amp = \frac{1}{n\pi} \bigl( (1-\cos n(-\pi)) - (\cos(n\pi)-1) \bigr) \\ \amp = \frac{2}{n\pi} (1- (-1)^n) \end{align*}
So the Fourier Series can be written:
\begin{align*} F(x) \amp = \sum_{n=1}^{\infty} \frac{2}{n\pi} (1- (-1)^n) \sin nx \\ \amp = \frac{4}{\pi} \biggl(\sin x + \frac{1}{3}\sin 3x + \frac{1}{5}\sin 5x + \frac{1}{7}\sin 7x + \frac{1}{9}\sin 9x + \cdots \biggr)\\ \amp \qquad \text{or again, writing it more compactly,}\\ \amp = \frac{4}{\pi} \sum_{n=1}^{\infty} \frac{1}{2n-1} \sin (2n-1) x \end{align*}
The above series also shows an interesting result that you should have seen in the series chapter of Calculus. If we let \(x=\pi/2\text{,}\) then \(\sin (2n-1)\frac{\pi}{2}=(-1)^{n+1}\) and \(F(\pi/2) = 1\) from the definition of the square wave and substituting this into the Fourier series, we get:
\begin{equation*} 1 = \frac{4}{\pi} \sum_{n=1}^{\infty} \frac{(-1)^{n+1}}{2n-1} \end{equation*}
or multiplying both sides by \(\pi/4\)
\begin{equation*} \frac{\pi}{4} = \sum_{n=1}^{\infty} \frac{(-1)^{n+1}}{2n-1} \end{equation*}
which shows that some infinite sums have closed form values. This particular series is usually found using the Taylor Series of \(\tan x\) and evaluating it a 1.

Example 6.2.5.

Find the Fourier series of the period sawtooth wave:
Figure 6.2.6. Plot of the sawtooth wave
Solution.
Let \(f(x)\) be the sawtooth wave defined in the picture above. We can write it as a piecewise function as
\begin{equation*} f(x) = \begin{cases} x \amp 0 \leq x \leq \pi \\ -x \amp -\pi \lt x \lt 0 \end{cases} \end{equation*}
and extending it periodically.
Then using the formulas in (6.2.2)--(6.2.4) and we will take advantage of the fact that \(f(x)\) is an even function.
\begin{align*} a_0 \amp = \frac{1}{2\pi} \int_{-\pi}^{\pi} f(x) \, dx \\ \amp = \frac{2}{2\pi} \int_0^{\pi} x \,dx \\ \amp = \frac{1}{\pi} \frac{x^2}{2} \biggr \vert_0^{\pi} = \frac{\pi}{2} \end{align*}
\begin{align*} a_n \amp = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x) \cos nx \, dx\\ \amp = \frac{2}{\pi} \int_{0}^{\pi} x\cos nx \, dx \end{align*}
where TheoremΒ 6.1.19 is used and since \(\cos nx\) is even and the product of even functions is even. Also this is a good example to use tabular integration.
Figure 6.2.7. tabular integration of \(x \cos nx\text{.}\)
and then using the table to find
\begin{align*} a_n \amp =\frac{2}{\pi} \biggl( \frac{x}{n} \sin nx + \frac{1}{n^2} \cos nx \biggr) \biggr \vert_0^{\pi} \\ \amp = \frac{2}{\pi}\biggl(\biggl(\frac{\pi}{n} \sin n \pi + \frac{1}{n^2} \cos n\pi \biggr) - \biggl( 0 +\frac{1}{n^2} \cos 0 \biggr) \biggr)\\ \amp = \frac{2}{\pi n^2} \bigl( (-1)^n - 1) \end{align*}
Lastly,
\begin{equation*} b_n = \frac{1}{\pi} \int_{-\pi}^{\pi} f(x) \sin nx \, dx \end{equation*}
but this is a product of a even and an odd function, which is odd and integrating an odd function over a symmetric interval is 0. Therefore the Fourier series is
\begin{equation*} F(x) = \frac{\pi}{2} + \sum_{n=1}^{\infty} \frac{2}{\pi n^2} \bigl( (-1)^n - 1) \cos nx \end{equation*}

Subsection 6.2.1 Convergence of a Sum of a Fourier Series

Since Fourier series are infinite series, it is important to consider if it converges. As we will see, Fourier series will generally converge, to what value will depend on \(x\text{.}\) Consider the Fourier series in ExampleΒ 6.2.5. If we let
\begin{equation*} F(x) = \frac{\pi}{2} + \sum_{n=1}^{\infty} \frac{1}{n^2} \bigl( (-1)^n - 1) \cos nx \end{equation*}
we would need to test the convergence of every value of \(x\text{.}\) In this case, this can be done by using the direct comparison test to the series to \(\sum_{n=1}^{\infty} \frac{1}{n^2}\) which converges, so the series \(F(x)\) converges for all \(x\text{.}\)
This doesn’t work for all series and the other difficulty is that we don’t know what it converges to. Fortunately, the following theorem gives a very nice result.

Example 6.2.9.

Show that the Fourier series of the square wave function above converges to 0 when \(x=0\text{.}\)
Solution.
Note that average of the left- and right-handed limits of the square wave function at \(x=0\) is \((1+(-1))/2=0\text{,}\) so using the theorem above, the function converges to 0 when \(x=0\text{.}\)
Alternatively, we can evaluate the Fourier series of the square wave function directly. Evaluating the Fourier series at \(x=0\) is
\begin{equation*} F(0) = \sum_{n=1}^{\infty} \frac{2}{n\pi} (1-\cos(n\pi)) \sin n x \biggl \vert_{x=0} = 0, \end{equation*}
which is consistent with that above.

Subsection 6.2.2 Fourier Series of Functions of Period \(2L\)

We saw that the Fourier series above applied only to functions that were periodic with period \(2\pi\text{.}\) This section covers functions with arbitrary periodicity, which we will call period \(2L\text{.}\) If we let \(u=\frac{\pi x}{L}\text{,}\) and substitute this into (6.2.1), then
\begin{equation} f(x) = a_0 + \sum_{n=1}^{\infty} \biggl( a_n \cos \frac{n\pi x}{L} + b_n \sin \frac{n \pi x}{L} \biggr)\tag{6.2.5} \end{equation}
and then it can be shown in a similar manner to that above that (6.2.2)--(6.2.4) can be written as
\begin{align} a_0 \amp = \frac{1}{2L} \int_{-L}^L f(x)\, dx \tag{6.2.6}\\ a_n \amp = \frac{1}{L} \int_{-L}^{L} f(x) \cos \biggl( \frac{n\pi x}{L} \biggr) \, dx\tag{6.2.7}\\ b_n \amp = \frac{1}{L} \int_{-L}^{L} f(x) \sin \biggl( \frac{n\pi x}{L} \biggr) \, dx \tag{6.2.8} \end{align}
The series is called the Fourier series of period \(2L\) with the corresponding Fourier coefficients.

Example 6.2.10.

Find the Fourier Series of the periodic extension (of period 2) of \(f(x) = x\) for \(x \in [-1,1]\) as shown in the graph below:
Figure 6.2.11. A plot of a periodic sawtooth wave on \([-1,1]\text{.}\)
Solution.
To find the Fourier series, we first need to find the Fourier coefficients, by evaluating the integrals in ((6.2.6))--((6.2.8)),
\begin{align*} a_0 \amp = \frac{1}{2} \int_{-1}^1 x \, dx = 0 \qquad\text{because $x$ is an odd function}\\ a_n \amp = \frac{1}{1} \int_{-1}^1 x \cos n \pi x \, dx = 0 \qquad \text{because $x$ times $\cos n\pi x$ is odd}\\ b_n \amp = \frac{1}{1} \int_{-1}^1 x \sin n \pi x \, dx \qquad\text{because $x$ times $\sin n\pi x$ is even}\\ \amp = 2\int_0^1 x \sin n\pi x \\ \amp \qquad \text{using tabular integration,}\\ b_n \amp = -\frac{x}{n\pi} \cos (n \pi x) + \frac{1}{n^2 \pi^2} \sin (n\pi x) \biggr\vert_{-1}^1 \\ \amp = -\frac{2}{n\pi} \cos (n\pi) = \frac{2}{n\pi} (-1)^{n+1} \end{align*}
The Fourier Series of the function is
\begin{equation*} \sum_{n=1}^{\infty} \frac{2}{n\pi} (-1)^{n+1} \sin n \pi x \end{equation*}