Chapter 7: Fourier Series

NOTE: Math will not display properly in Safari - please use another browser

The material covered in this chapter is also presented in Boas Chapter 7, Sections 3, 4, 5, 7, 8, and 9.

7.1 Introduction

Why do a violin and a flute playing the same note sound so different? They are, after all, generating sounds waves of the same frequency. Shouldn't these waves make the same impression on our ears and be heard as identical sounds?

An element of answer is that the violin and the flute are made from different materials --- wood for the violin, brass for the flute --- and use different methods to produce the sound --- a bowed string for the violin, a column of air for the flute. It is not surprising, therefore, that different instruments should produce different sounds. But our ears know nothing of the construction and playing of instruments; how do they actually distinguish the sounds? The answer is that the sound waves generated by different instruments come with different forms, even when they come with the same (dominant) frequency. And waves of different forms are easily distinguished by the ear. A violin and a flute sound different because they produce different wave forms.

Series of graphs
Figure 7.1: Waves of the same (dominant) frequency, but of different forms. In each case the wave (shown on the right) is synthesized from four elementary sine waves (shown on the left). Different mixtures produce different wave forms.

Waves of the same (dominant) frequency but of different forms are shown in Fig.7.1. In each case the wave is synthesized from four simple waves of the form $\sin(2\pi f t)$, in which $f$ is the frequency. The dominant frequency is by definition the lowest, and in the plot it is set to $f = 1$. The other waves have frequencies $f = 2$, $f=3$, and $f = 4$, so that they oscillate twice, three times, and four times as fast as the dominant wave, respectively; these are the harmonics, or overtones, of the fundamental frequency. The exact mixture of waves determines the precise shape of the total wave; different mixtures produce waves of different forms.

A deeper answer to the question can now be given. A violin and a flute sound different because the sound waves entering the ear come as different mixtures of elementary waves. In this case the mixture would involve a very large number of overtones, but the point is still that different mixtures produce different wave forms, and that waves of different forms can easily be distinguished by the ear.

Any periodic function $f(t)$ can be thought of as being synthesized from a (potentially infinite) number of elementary sine and cosine waves. The topic of this chapter, Fourier series, is all about finding out the precise mixture that corresponds to a given shape. Fourier analysis, along with the generalizations examined in the next few chapters, is one of the most powerful tools of mathematical physics. It has many, many applications in virtually all areas of physics.

7.2 Fourier Series

We consider a function $f(x)$ that is periodic with period $2\pi$, so that $f(x + 2\pi) = f(x)$. Our claim is that any such function can be represented as a Fourier series of the form

\begin{align} f(x) &= c_0 + a_1 \cos(x) + a_2 \cos(2x) + a_3 \cos(3x) + \cdots \nonumber \\ & \quad \text{} + b_1 \sin(x) + b_2 \sin(2x) + b_3 \sin(3x) + \cdots \nonumber \\ &= c_0 + \sum_{n=1}^\infty a_n \cos(nx) + \sum_{n=1}^\infty b_n \sin(nx), \tag{7.1} \end{align}

where $c_0$, $a_1$, $a_2$, $b_1$, $b_2$, and so on are constant coefficients. Each member of the sum is itself a periodic function. For example, $c_0$ evaluated at $x + 2\pi$ is still $c_0$, while $\sin[n(x+2\pi)] = \sin(nx + 2n\pi) = \sin(nx) \cos(2n\pi) + \cos(nx) \sin(2n\pi) = \sin(nx)$, since $\cos(2n\pi) = 1$ and $\sin(2n\pi) = 0$. Because a sum of periodic functions is necessarily periodic, and because we have an infinity of choices in the selection of the coefficients $c_0$, $a_n$ and $b_n$, it is intuitively clear that the claim is true, that any periodic function can be decomposed in the Fourier series of Eq.(7.1).

You will have noticed that we changed our notation with respect to Sec.7.1. Here we let $x$ be the independent variable, and take $f(x)$ to be periodic with period $2\pi$. In the introduction we used $t$ as the independent variable, and took the wave $f(t)$ to be periodic with period $1$. It is easy to see that the variables are related by $x = 2\pi t$. A simple rescaling of $x$ can accommodate any other period, and we shall explore this freedom systematically in Sec.7.7.

It can be advantageous to re-express the Fourier series of Eq.(7.1) in terms of the complex exponential

\begin{equation} e^{i \phi} = \cos\phi + i \sin\phi. \tag{7.2} \end{equation}

In terms of this we have that

\begin{equation} \cos\phi = \frac{1}{2}\bigl( e^{i\phi} + e^{-i\phi} \bigr), \qquad \sin\phi = \frac{1}{2i} \bigl( e^{i\phi} - e^{-i\phi} \bigr), \tag{7.3} \end{equation}

and substitution into Eq.(7.1) with $\phi = nx$ yields

\begin{align} f &= c_0 + \sum_{n=1}^\infty \frac{1}{2} a_n \bigl( e^{inx} + e^{-inx} \bigr) + \sum_{n=1}^\infty \frac{1}{2i} b_n \bigl( e^{inx} - e^{-inx} \bigr) \nonumber \\ &= c_0 + \sum_{n=1}^\infty \frac{1}{2} (a_n - i b_n) e^{inx} + \sum_{n=1}^\infty \frac{1}{2} (a_n + i b_n) e^{-inx}. \tag{7.4} \end{align}

If we now introduce the notation

\begin{equation} c_{n} := \frac{1}{2} (a_n - i b_n), \qquad c_{-n} := \frac{1}{2} (a_n + i b_n), \tag{7.5} \end{equation}

the Fourier series becomes

\begin{equation} f = c_0 + \sum_{n=1}^\infty c_n e^{inx} + \sum_{n=1}^\infty c_{-n} e^{-inx}, \tag{7.6} \end{equation}

and if we further let $n \to -n$ in the second sum, we obtain

\begin{equation} f(x) = \sum_{n=-\infty}^\infty c_n e^{inx}. \tag{7.7} \end{equation}

This is the complex form of the Fourier series, which contains, in an attractive and economical package, the same information as Eq.(7.1).


Exercise 7.1: The complex exponential is about to become an essential tool, and it is important for you to be thoroughly acquainted with it. So please do take the time to refresh your knowledge and understanding. As a test, draw the circle $e^{i\phi}$ in the complex plane, with $\phi$ the angle from the real axis. Then without doing any calculation, evaluate $e^{i0}$, $e^{i\pi/2}$, $e^{-i\pi/2}$, $e^{i\pi}$, $e^{-i\pi}$, $e^{3i\pi/2}$, and $e^{2i\pi}$. Verify your answers with Eq.(7.2). If any of this is a struggle for you, you need to spend more time and sort things out.



Exercise 7.2: Verify Eq.(7.3), and reproduce the steps that lead to Eq.(7.7).


It is important to understand that in Eq.(7.7), the function $f(x)$ is real, even though it is decomposed in terms of complex functions. It is easy to go back to the real form of Eq.(7.1) by reversing the steps. The original coefficients $a_n$ and $b_n$ are given by

\begin{equation} a_0 = 2 c_0, \qquad a_n = c_n + c_{-n}, \qquad b_n = i ( c_n - c_{-n} ) \tag{7.8} \end{equation}

in terms of $c_n$ and $c_{-n}$, and substitution of these relations along with Eq.(7.2) into Eq.(7.7) brings us back to Eq.(7.1).


Exercise 7.3: Verify Eq.(7.8), and show that Eq.(7.1) can be obtained from Eq.(7.7).


7.3 Fourier Coefficients

A typical task of Fourier analysis is to obtain the coefficients $c_n$ (or $a_n$ and $b_n$) when $f(x)$ is known. This answers the important question: which mixture of sine and cosine waves forms the function $f(x)$?

We keep working with the complex form of the Fourier series, as given by Eq.(7.7), which we rewrite as

\begin{equation} f = c_0 + c_1 e^{ix} + c_2 e^{2ix} + \cdots + c_{-1} e^{-ix} + c_{-2} e^{-2ix} + \cdots. \tag{7.9} \end{equation}

To extract the coefficients $c_n$ we rely on the identity

\begin{equation} \int_0^{2\pi} e^{nix}\, dx = 2\pi \delta_{n0}, \tag{7.10} \end{equation}

which we encountered before (in a slightly different guise) in Sec.4.7 --- see Eq.(4.38) --- and Sec.5.6 --- see Eq.(5.35). The identity, in fact, applies to any interval of length $2\pi$; the integral could go from $x_0$ to $x_0 + 2\pi$, with $x_0$ completely arbitrary. The choice $x_0 = -\pi$ is sometimes convenient.


Exercise 7.4: You should have done this before, but here's another chance: verify Eq.(7.10) in the more general form \[ \int_{x_0}^{x_0 + 2\pi} e^{nix}\, dx = 2\pi \delta_{n0}. \]


The trick to get each $c_n$ is to multiply both sides of Eq.(7.9) by $e^{-inx}$ and integrate from $x=0$ to $x = 2\pi$ (or any other interval of length $2\pi$). To get $c_0$, for example, multiply by $e^{-i0x} = 1$ and integrate; we get

\begin{align} \int_0^{2\pi} f\, dx &= c_0 \int_0^{2\pi}\, dx + c_1 \int_0^{2\pi} e^{ix}\, dx + c_2 \int_0^{2\pi} e^{2ix}\, dx + \cdots \nonumber \\ & \quad \text{} + c_{-1} \int_0^{2\pi} e^{-ix}\, dx + c_{-2} \int_0^{2\pi} e^{-2ix}\, dx + \cdots, \tag{7.11} \end{align}

and since each integral vanishes except for the first one, we obtain $\int_0^{2\pi} f\, dx = 2\pi\, c_0$, which gives us $c_0$. As another example, let us calculate $c_1$. This time we multiply Eq.(7.9) by $e^{-ix}$ and integrate, to get

\begin{align} \int_0^{2\pi} f e^{-ix}\, dx &= c_0 \int_0^{2\pi} e^{-ix}\, dx + c_1 \int_0^{2\pi}\, dx + c_2 \int_0^{2\pi} e^{ix}\, dx + \cdots \nonumber \\ & \quad \text{} + c_{-1} \int_0^{2\pi} e^{-2ix}\, dx + c_{-2} \int_0^{2\pi} e^{-3ix}\, dx + \cdots. \tag{7.12} \end{align}

This time it is only the second integral that doesn't vanish, and we obtain \newline $\int_0^{2\pi} f e^{-ix}\, dx = 2\pi c_1$, which gives us $c_1$.

The general result is clearly

\begin{equation} c_n = \frac{1}{2\pi} \int_0^{2\pi} f(x) e^{-nix}\, dx = \frac{1}{2\pi} \int_{x_0}^{x_0 + 2\pi} f(x) e^{-nix}\, dx; \tag{7.13} \end{equation}

in the second expression we indicate that the integral can be evaluated for any interval of length $2\pi$. Thus, the (complex) Fourier coefficients are obtained by evaluating the integrals of Eq.(7.13). Then Eq.(7.8),

\begin{equation} a_n = c_n + c_{-n}, \qquad b_n = i ( c_n - c_{-n} ), \tag{7.14} \end{equation}

can be exploited to find $a_n$ and $b_n$, and the real form of the Fourier transform can be constructed from Eq.(7.1). We will learn to become familiar with these steps in the examples that follow.


Exercise 7.5: Substitute Eq.(7.13) into Eq.(7.14) to obtain $a_n$ and $b_n$ as integrals involving $f(x)$ and ordinary trigonometric functions. Verify that the general result for $a_n$ applies to $a_0$.


7.4 Square Wave

As a first example we examine a square wave described by

\begin{equation} f(x) = \left\{ \begin{array}{ll} 1 & \quad 0 \leq x < \pi \\ 0 & \quad \pi \leq x < 2\pi \end{array} \right.; \tag{7.15} \end{equation}

the definition is extended to $x<0$ and $x \geq 2\pi$ according to the periodicity requirement $f(x+2\pi) = f(x)$. The function is plotted in Fig.7.2.

""
Figure 7.2: Square wave of periodicity $2\pi$ and its representation as three truncated Fourier series.

We make use of Eq.(7.13) to calculate the complex coefficients $c_n$. For $c_0$ we have

\begin{equation} c_0 = \frac{1}{2\pi} \int_0^{2\pi} f(x)\, dx = \frac{1}{2\pi} \int_0^\pi (1)\, dx + \frac{1}{2\pi} \int_\pi^{2\pi} (0)\, dx = \frac{1}{2}. \tag{7.16} \end{equation}

For $c_n$ we get

\begin{equation} c_n = \frac{1}{2\pi} \int_0^{2\pi} f(x) e^{-inx}\, dx = \frac{1}{2\pi} \int_0^\pi e^{-inx}\, dx = \frac{1}{2\pi} \frac{e^{-inx}}{-in} \biggr|^\pi_0 = \frac{i}{2\pi n} ( e^{-in\pi} - 1). \tag{7.17} \end{equation}

But $e^{-in\pi} = (e^{-i\pi})^n = (-1)^n$, so that the factor within brackets is $(-1)^n - 1$, which is equal to $0$ when $n$ is even, and to $-2$ when $n$ is odd. We therefore have that $c_n = 0$ when $n$ is even, and

\begin{equation} c_n = -\frac{i}{\pi n} \tag{7.18} \end{equation}

when $n$ is odd. Notice that $c_0$ cannot be obtained directly from this relation, because the manipulations required to evaluate the integral for $c_n$ do not apply when $n=0$.

Equation (7.14) allows us to obtain $a_n$ and $b_n$ from $c_n$ and $c_{-n} = +i/(\pi n)$. We get $a_n = 0$ and

\begin{equation} b_n = \frac{2}{\pi n} \tag{7.19} \end{equation}

when $n$ is odd. Making the substitution in Eq.(7.1) returns

\begin{equation} f(x) = \frac{1}{2} + \frac{2}{\pi} \sum_{n=1, 3, 5, \cdots}^\infty \frac{1}{n} \sin(n x). \tag{7.20} \end{equation}

Apart from the constant $1/2$, the series involves sine functions only. A typical property of Fourier series is that the coefficients $a_n$ and $b_n$ tend to decrease as $n$ increases; in the case of a square wave we see that $b_n \propto n^{-1}$. This implies that a sum truncated after a relatively small number of terms usually offers a very good approximation to the infinite series. This is illustrated in Fig.7.2, where we see that a Fourier series truncated after just five terms does a decent job at reproducing the square wave; truncation after twenty terms, of course, does a lot better. The wave's abrupt transitions at $x =0$, $x=\pi$, and so on, give the Fourier series a serious challenge, because we are attempting to synthesize a discontinuous function with a bunch of continuous sine waves. As we shall see in a moment, Fourier series do better when $f(x)$ is continuous.

7.5 Triangle Wave

As a second example we examine a triangle wave described by

\begin{equation} f(x) = \left\{ \begin{array}{ll} -x & \quad -\pi \leq x < 0 \\ x & \quad 0 \leq x < \pi \end{array} \right.; \tag{7.21} \end{equation}

the definition is extended to $x<-\pi$ and $x \geq \pi$ according to the periodicity requirement $f(x+2\pi) = f(x)$. The function is plotted in Fig.7.3. Notice that here we choose $(-\pi, \pi)$ as the reference interval, instead of $(0, 2\pi)$ as in the preceding section. The reason is that the description of the triangle wave is simpler in $(-\pi, \pi)$ than it would be in $(0,2\pi)$. Recall from Sec.7.3 that only the length of the interval matters, and that the choice of starting point is arbitrary.

""
Figure 7.3: Triangle wave of periodicity $2\pi$ and its representation as three truncated Fourier series.

We exploit Eq.(7.13) with $x_0 = -\pi$ to calculate the Fourier coefficients. For $c_0$ we have

\begin{equation} c_0 = \frac{1}{2\pi} \int_{-\pi}^{\pi} f(x)\, dx = \frac{1}{2\pi} \int_{-\pi}^0 (-x)\, dx + \frac{1}{2\pi} \int_0^{\pi} (x)\, dx = \frac{\pi}{2}. \tag{7.22} \end{equation}

For $c_n$ we get

\begin{align} c_n &= \frac{1}{2\pi} \int_{-\pi}^{\pi} f(x) e^{-inx}\, dx \nonumber \\ &= -\frac{1}{2\pi} \int_{-\pi}^0 x e^{-inx}\, dx + \frac{1}{2\pi} \int_{0}^\pi x e^{-inx}\, dx \nonumber \\ &= -\frac{1+inx}{2\pi n^2} e^{-inx} \biggr|^0_{-\pi} + \frac{1+inx}{2\pi n^2} e^{-inx} \biggr|^\pi_{0} \nonumber \\ &= -\frac{1}{2\pi n^2} \bigl[ 1 - (1-in\pi) e^{in\pi} \bigr] + \frac{1}{2\pi n^2} \bigl[ (1+in\pi) e^{-in\pi} - 1\bigr] \nonumber \\ &= -\frac{1}{\pi n^2} \bigl[ 1 - (-1)^n \bigr], \tag{7.23} \end{align}

where we used the fact that $e^{\pm in\pi} = (e^{\pm i\pi})^n = (-1)^n$. The factor within brackets is $0$ when $n$ is even, and $2$ when $n$ is odd. We therefore have that $c_n = 0$ when $n$ is even, and

\begin{equation} c_n = -\frac{2}{\pi n^2} \tag{7.24} \end{equation}

when $n$ is odd.

We next get $a_n$ and $b_n$ from Eq.(7.14), and find that $b_n = 0$ and

\begin{equation} a_n = -\frac{4}{\pi n^2} \tag{7.25} \end{equation}

when $n$ is odd. Making the substitution in Eq.(7.1), we arrive at

\begin{equation} f(x) = \frac{\pi}{2} - \frac{4}{\pi} \sum_{n=1, 3, 5, \cdots}^\infty \frac{1}{n^2} \cos(n x). \tag{7.26} \end{equation}

Apart from the constant $\pi/2$, the series involves cosine functions only. Here we see that the coefficients are proportional to $n^{-2}$, and therefore decrease much faster than those of the square wave considered previously. This implies that a smaller number of terms will be required of the Fourier series to give an adequate representation of the triangle wave. This fact is illustrated in Fig.7.3, which shows that we get a decent triangle with just two terms; with eight terms we are close to perfection. In the case of a triangle wave, continuity of the function allows the cosines to do a very good job of synthesizing the function.

7.6 Rectified Sine Wave

As a third example we examine the rectified sine wave described by

\begin{equation} f(x) = |\sin x|; \tag{7.27} \end{equation}

the function is automatically periodic with period $2\pi$. We choose $(0,2\pi)$ as the reference interval, and note that while $f(x) = \sin x$ when $0 \leq x < \pi$, $f(x) = -\sin x$ when $\pi \leq x < 2\pi$. The function is plotted in Fig.7.4.

""
Figure 7.4: Rectified sine wave and its representation as three truncated Fourier series.

From Eq.(7.13) we get

\begin{equation} c_0 = \frac{1}{2\pi} \int_0^{2\pi} f(x)\, dx = \frac{1}{2\pi} \int_0^\pi \sin x\, dx - \frac{1}{2\pi} \int_\pi^{2\pi} \sin x\, dx = \frac{2}{\pi} \tag{7.28} \end{equation}

and

\begin{align} c_n &= \frac{1}{2\pi} \int_0^{2\pi} f(x) e^{-inx}\, dx \nonumber \\ &= \frac{1}{2\pi} \int_0^\pi \sin x\, e^{-inx}\, dx - \frac{1}{2\pi} \int_\pi^{2\pi} \sin x\, e^{-inx}\, dx \nonumber \\ &= \frac{1}{4\pi i} \int_0^\pi (e^{ix} - e^{-ix}) e^{-inx}\, dx - \frac{1}{4\pi i} \int_\pi^{2\pi} (e^{ix} - e^{-ix}) e^{-inx}\, dx \nonumber \\ &= \frac{e^{-i(n-1)x}}{4\pi(n-1)} \biggr|^\pi_0 - \frac{e^{-i(n+1)x}}{4\pi(n+1)} \biggr|^\pi_0 - \frac{e^{-i(n-1)x}}{4\pi(n-1)} \biggr|^{2\pi}_\pi + \frac{e^{-i(n+1)x}}{4\pi(n+1)} \biggr|^{2\pi}_\pi \nonumber \\ &= \frac{(-1)^{n-1} - 1}{4\pi(n-1)} - \frac{(-1)^{n+1} - 1}{4\pi(n+1)} - \frac{1 - (-1)^{n-1}}{4\pi(n-1)} + \frac{1 - (-1)^{n+1}}{4\pi(n+1)} \nonumber \\ &= \frac{(-1)^{n-1} - 1}{2\pi(n-1)} - \frac{(-1)^{n+1} - 1}{2\pi(n+1)}. \tag{7.29} \end{align}

Both numerators are equal to $-2$ when $n$ is even, and to $0$ when $n$ is odd. With a bit of simplification, we finally obtain that $c_n = 0$ when $n$ is odd, and

\begin{equation} c_n = -\frac{2}{\pi(n^2-1)} \tag{7.30} \end{equation}

when $n$ is even. These manipulations are not valid when $n = \pm 1$, but a separate calculation reveals that $c_1 = c_{-1} = 0$.


Exercise 7.6: Reproduce the steps leading to Eq.(7.30), and verify that $c_1 = c_{-1} = 0$.


Combining Eqs.(7.14) and (7.30), we get that $b_n = 0$ and

\begin{equation} a_n = -\frac{4}{\pi(n^2-1)} \tag{7.31} \end{equation}

when $n$ is even. The Fourier series associated with the rectified sine wave is therefore

\begin{equation} f(x) = \frac{2}{\pi} - \frac{4}{\pi} \sum_{n=2, 4, 6, \cdots}^\infty \frac{1}{n^2-1} \cos(n x). \tag{7.32} \end{equation}

Here also we find that the coefficients decrease rapidly with increasing $n$. As Fig.7.4 shows, the Fourier series truncated after a small number of terms gives an excellent representation of the rectified sine wave.

7.7 Change of Interval

In our developments so far we have assumed that $f(x)$ is periodic with period $2\pi$, so that $f(x+2\pi) = f(x)$. This choice of period is convenient, because the elementary waves making up the Fourier series are of the simple form $\sin(nx)$ and $\cos(nx)$. But in a typical application of Fourier series the period may not be $2\pi$, and we should generalize our formulation to handle such cases. We still require $f(x)$ to be periodic, but the period shall now be $2L$ instead of $2\pi$. The new condition of periodicity is

\begin{equation} f(x+2L) = f(x). \tag{7.33} \end{equation}

The factor of $2$ in front of $L$ is conventional and introduced for convenience.

The change of period is easily accommodated by a rescaling of the independent variable. While the old variable $x_{\rm old}$ had a periodicity of $2\pi$, the new variable $x_{\rm new}$ must have a periodicity of $2L$, and it is easy to see that this is achieved by the transformation $x_{\rm new} = (L/\pi) x_{\rm old}$. The new set of elementary waves are $\sin(n x_{\rm old}) = \sin(n\pi x_{\rm new}/L)$, $\cos(n x_{\rm old}) = \cos(n\pi x_{\rm new}/L)$, and the Fourier series now takes the form

\begin{align} f(x) &= \frac{1}{2} a_0 + \sum_{n=1} a_n \cos \Bigl( \frac{n\pi x}{L} \Bigr) + \sum_{n=1} b_n \sin \Bigl( \frac{n\pi x}{L} \Bigr) \tag{7.34a} \\ &= \sum_{n=-\infty}^\infty c_n e^{in\pi x/L}, \tag{7.34b} \end{align}

where we henceforth omit the label ``new'' on $x$. The rescaling implies that the Fourier coefficients are now given by

\begin{equation} c_n = \frac{1}{2L} \int_0^{2L} f(x) e^{-in\pi x/L}\, dx = \frac{1}{2L} \int_{x_0}^{x_0 + 2L} f(x) e^{-in\pi x/L}\, dx. \tag{7.35} \end{equation}

The relation of Eq.(7.14) is unaffected by the rescaling, so that we still have

\begin{equation} a_n = c_n + c_{-n}, \qquad b_n = i (c_n - c_{-n}). \tag{7.36} \end{equation}


Exercise 7.7: Verify that Eq.(7.35) gives the correct expression for the Fourier coefficients when the period is $2L$ instead of $2\pi$.


7.8 Sawtooth Wave

As a final example we construct the Fourier representation of a sawtooth wave described by

\begin{equation} f(x) = x, \qquad -L < x < L \tag{7.37} \end{equation}

with $f(x + 2L) = f(x)$. The wave is plotted in Fig.7.5.

""
Figure 7.5: Sawtooth wave and its representation as three truncated Fourier series. The periodicity length was set to $L=1$.

The Fourier coefficients are obtained from Eq.(7.35), in which we set $x_0 = -L$. For $c_0$ we get

\begin{equation} c_0 = \frac{1}{2L} \int_{-L}^L f(x)\, dx = \frac{1}{2L} \int_{-L}^L x\, dx = \frac{x^2}{4L} \biggr|^L_{-L} = 0. \tag{7.38} \end{equation}

For $c_n$ we have

\begin{align} c_n &= \frac{1}{2L} \int_{-L}^{L} f(x) e^{-in\pi x/L}\, dx \nonumber \\ &= \frac{1}{2L} \int_{-L}^{L} x\, e^{-in\pi x/L}\, dx \nonumber \\ &= \frac{L + in\pi x}{2\pi^2 n^2} e^{-in\pi x/L} \biggr|^L_{-L} \nonumber \\ &= \frac{L}{2\pi^2 n^2} \bigl[ (1 + in\pi) e^{-in\pi} - (1 - in\pi) e^{in\pi} \bigr] \nonumber \\ &= (-1)^n \frac{iL}{n\pi}. \tag{7.39} \end{align}

From this and Eq.(7.36) we obtain $a_n = 0$ and

\begin{equation} b_n = - (-1)^n \frac{2L}{n\pi} = (-1)^{n+1} \frac{2L}{n\pi}. \tag{7.40} \end{equation}

The Fourier representation of the sawtooth wave is therefore

\begin{equation} f(x) = \frac{2L}{\pi} \sum_{n=1}^\infty \frac{(-1)^{n+1}}{n} \sin\Bigl( \frac{n\pi x}{L} \Bigr). \tag{7.41} \end{equation}

The series involves sine functions only. The coefficients alternate in sign and decrease as $n^{-1}$ with increasing $n$. Three different truncations are shown in Fig.7.5. We see that as in the case of the square wave in Sec.7.4, the Fourier series has difficulties reproducing the discontinuities of the sawtooth function.

7.9 Even and Odd Functions

The astute reader will have noticed that the Fourier series constructed in Secs. 7.4, 7.5, 7.6, and 7.8 involved either sine waves or cosine waves, but not both. This has to do with the simplicity of our examples; typical Fourier series will implicate both types of waves. But the question arises: why only sine functions for the square and sawtooth waves, and why only cosine functions for the triangle and rectified sine waves?

The reason is that when $f(x)$ is an even function of $x$, so that $f(-x) = f(x)$, its Fourier series can contain only cosine waves (which are even) and must exclude sine waves (which are odd). Similarly, when $f(x)$ is an odd function of $x$, so that $f(-x) = -f(x)$, its Fourier series can contain only sine waves and must exclude cosine waves.


Exercise 7.8:Verify that in the case of a square wave, $f(x) - 1/2$ is an odd function of $x$. Verify that $f(x)$ is an even function in the case of triangle and rectified sine waves. Finally, verify that in the case of a sawtooth wave, $f(x)$ is an odd function.


Suppose that $f(x)$ is an even function of $x$. As stated, its Fourier series can admit cosine waves only, and it must take the form

\begin{equation} f(x) = c_0 + \sum_{n=1} a_n \cos \Bigl( \frac{n\pi x}{L} \Bigr). \tag{7.42} \end{equation}

Such a series is known as a cosine Fourier series, and in this case the coefficients $a_n$ can be obtained directly. We have

\begin{align} a_n &= c_n + c_{-n} \nonumber \\ &= \frac{1}{2L} \int_{-L}^L f(x) \Bigl( e^{-in\pi x/L} + e^{in\pi x/L} \Bigr)\, dx \nonumber \\ &= \frac{1}{L} \int_{-L}^L f(x) \cos\Bigl( \frac{n\pi x}{L} \Bigr)\, dx, \tag{7.43} \end{align}

and notice that the integrand is an even function of $x$, since it is the product of two even functions. The integral from $x=-L$ to $x=0$ is therefore equal to the integral from $x=0$ to $x=L$, and we can write

\begin{equation} a_n = \frac{2}{L} \int_0^L f(x) \cos\Bigl( \frac{n\pi x}{L} \Bigr)\, dx \tag{7.44} \end{equation}

in the case of an even function.


Exercise 7.9: Prove that the product of two even functions is even, that the product of two odd functions is also even, and that the product of even and odd functions is odd.


Suppose now that $f(x)$ is an odd function of $x$. This time the Fourier series can only admit sine waves, so that

\begin{equation} f(x) = \sum_{n=1} b_n \sin \Bigl( \frac{n\pi x}{L} \Bigr). \tag{7.45} \end{equation}

Such a series is known as a sine Fourier series, and the coefficients $b_n$ can be calculated directly as follows. We have

\begin{align} b_n &= i( c_n - c_{-n}) \nonumber \\ &= \frac{i}{2L} \int_{-L}^L f(x) \Bigl( e^{-in\pi x/L} - e^{in\pi x/L} \Bigr)\, dx \nonumber \\ &= \frac{1}{L} \int_{-L}^L f(x) \sin\Bigl( \frac{n\pi x}{L} \Bigr)\, dx. \tag{7.46} \end{align}

This time the integrand is the product of two odd functions, which again makes it an even function. We therefore arrive at

\begin{equation} b_n = \frac{2}{L} \int_0^L f(x) \sin\Bigl( \frac{n\pi x}{L} \Bigr)\, dx \tag{7.37} \end{equation}

for the Fourier coefficients.


Exercise 7.10: Prove that $b_n = i(c_n - c_{-n}) = 0$ when $f(x)$ is an even function of $x$. Show also that $a_n = c_n + c_{-n} = 0$ when $f(x)$ is an odd function of $x$.


for the Fourier coefficients. A similar calculation also reveals that

\begin{equation} c_0 = \frac{1}{L} \int_0^L f(x)\, dx \tag{7.45} \end{equation}

in the case of an even function.


Exercise 7.11: Prove that the product of two even functions is even, that the product of two odd functions is also even, and that the product of even and odd functions is odd.


Suppose now that $f(x)$ is an odd function of $x$. This time the Fourier series can only admit sine waves, so that

\begin{equation} f(x) = \sum_{n=1} b_n \sin \Bigl( \frac{n\pi x}{L} \Bigr). \tag{7.46} \end{equation}

Such a series is known as a sine Fourier series, and the coefficients $b_n$ can be calculated directly as follows. We have

\begin{align} b_n &= i( c_n - c_{-n}) \nonumber \\ &= \frac{i}{2L} \int_{-L}^L f(x) \Bigl( e^{-in\pi x/L} - e^{in\pi x/L} \Bigr)\, dx \nonumber \\ &= \frac{1}{L} \int_{-L}^L f(x) \sin\Bigl( \frac{n\pi x}{L} \Bigr)\, dx. \tag{7.47} \end{align}

This time the integrand is the product of two odd functions, which again makes it an even function. We therefore arrive at

\begin{equation} b_n = \frac{2}{L} \int_0^L f(x) \sin\Bigl( \frac{n\pi x}{L} \Bigr)\, dx \tag{7.48} \end{equation}

for the Fourier coefficients.


Exercise 7.12: Prove that $b_n = i(c_n - c_{-n}) = 0$ when $f(x)$ is an even function of $x$. Show also that $a_n = c_n + c_{-n} = 0$ when $f(x)$ is an odd function of $x$.


7.10 Practice Problems

  1. (Boas Chapter 7, Section 5, Problem 2) Find the Fourier series for the function $f(x)$ defined by $f = 0$ for $-\pi \leq x < 0$, $f = 1$ for $0 \leq x < \pi/2$, and $f = 0$ for $\pi/2 \leq x < \pi$. The function is periodic with period $2\pi$. Plot the function over a few periods, as well as a few truncations of the Fourier series.

  2. (Boas Chapter 7, Section 5, Problem 3) Find the Fourier series for the function $f(x)$ defined by $f = 0$ for $-\pi \leq x < \pi/2$ and $f = 1$ for $\pi/2 \leq x < \pi$. The function is periodic with period $2\pi$. Plot the function over a few periods, as well as a few truncations of the Fourier series.

  3. (Boas Chapter 7, Section 5, Problem 7) Find the Fourier series for the function $f(x)$ defined by $f = 0$ for $-\pi \leq x < 0$ and $f = x$ for $0 \leq x < \pi$. The function is periodic with period $2\pi$. Plot the function over a few periods, as well as a few truncations of the Fourier series.

  4. (Boas Chapter 7, Section 5, Problem 11) Find the Fourier series for the function $f(x)$ defined by $f = 0$ for $-\pi \leq x < 0$ and $f = \sin x$ for $0 \leq x < \pi$. The function is periodic with period $2\pi$. Plot the function over a few periods, as well as a few truncations of the Fourier series.

  5. (Boas Chapter 7, Section 7, Problem 12) Show that if a real function $f(x)$ is expanded in a Fourier series of complex exponentials, then $c_{-n} = (c_n)^*$, with the asterisk denoting complex conjugation.

  6. (Boas Chapter 7, Section 8, Problem 15b) Find the Fourier series for the function $f(x)$ defined by $f = 1+2x$ for $-1 \leq x < 0$ and $f = 1-2x$ for $0 \leq x < 1$. The function is periodic with period $2$. Plot the function over a few periods, as well as a few truncations of the Fourier series.

  7. (Boas Chapter 7, Section 8, Problem 15c) Find the Fourier series for the function $f(x)$ defined by $f = x+x^2$ for $-1 \leq x < 0$ and $f = x-x^2$ for $0 \leq x < 1$. The function is periodic with period $2$. Plot the function over a few periods, as well as a few truncations of the Fourier series.

  8. (Boas Chapter 7, Section 8, Problem 18) Find the Fourier seriesfor the function $f(x)$ defined by $f = x^2$ for $0 \leq x < 10$. The function is periodic with period $10$. Plot the function over a few periods, as well as a few truncations of the Fourier series.

  9. (Boas Chapter 7, Section 9, Problem 11) Find the Fourier series for the even function $f(x)$ defined by $f = \cosh x$ for $-\pi \leq x < \pi$. The function is periodic with period $2\pi$. Plot the function over a few periods, as well as a few truncations of the Fourier series.

  10. Find the Fourier series for the odd function $f(x)$ defined by $f = \sinh x$ for $-\pi \leq x < \pi$. The function is periodic with period $2\pi$. Plot the function over a few periods, as well as a few truncations of the Fourier series.

 

7.11 Challenge Problems

  1. Consider the function

    \[f(x) = 4x(1-|x|), \qquad -1 \leq x \leq 1,\]

    defined to be periodic with period $2$, so that $f(x+2) = f(x)$.

    a) Find the Fourier series of this function.

    b) On the same graph, plot $f(x)$ together with its Fourier series truncated after a single term.

    c) On the same graph, plot $f(x)$ together with its Fourier series truncated after two terms.

    d) On the same graph, plot $f(x)$ together with its Fourier series truncated after three terms.

  2. Consider the function

    \[f(x) = x^2, \qquad -\pi \leq x \leq \pi,\]

    defined to be periodic with period $2\pi$, so that $f(x+2\pi) = f(x)$.

    a) Sketch the function on the interval $-3\pi \leq x \leq 3\pi$.

    b) Obtain the Fourier series of this function.

    c) From your result in part (b), determine the exact value of the sum $\sum_{n=1}^\infty n^{-2}$.