## Section 4.2 The trigonometric series

¶### Subsection 4.2.1 Periodic functions and motivation

As motivation for studying Fourier series, suppose we have the problem

for some periodic function \(f(t)\text{.}\) We already solved

One way to solve (6) is to decompose \(f(t)\) as a sum of cosines (and sines) and then solve many problems of the form (7). We then use the principle of superposition, to sum up all the solutions we got to get a solution to (6).

Before we proceed, let us talk a little bit more in detail about periodic functions. A function is said to be *periodic* with period \(P\) if \(f(t) = f(t+P)\) for all \(t\text{.}\) For brevity we say \(f(t)\) is \(P\)-periodic. Note that a \(P\)-periodic function is also \(2P\)-periodic, \(3P\)-periodic and so on. For example, \(\cos (t)\) and \(\sin (t)\) are \(2\pi\)-periodic. So are \(\cos (kt)\) and \(\sin (kt)\) for all integers \(k\text{.}\) The constant functions are an extreme example. They are periodic for any period (exercise).

Normally we start with a function \(f(t)\) defined on some interval \([-L,L]\text{,}\) and we want to *extend \(f(t)\) periodically* to make it a \(2L\)-periodic function. We do this extension by defining a new function \(F(t)\) such that for \(t\) in \([-L,L]\text{,}\) \(F(t) = f(t)\text{.}\) For \(t\) in \([L,3L]\text{,}\) we define \(F(t) = f(t-2L)\text{,}\) for \(t\) in \([-3L,-L]\text{,}\) \(F(t) = f(t+2L)\text{,}\) and so on. To make that work we needed \(f(-L) = f(L)\text{.}\) We could have also started with \(f\) defined only on the half-open interval \((-L,L]\) and then define \(f(-L) = f(L)\text{.}\)

###### Example 4.2.1.

Define \(f(t) = 1-t^2\) on \([-1,1]\text{.}\) Now extend \(f(t)\) periodically to a 2-periodic function. See Figure 5.2.2.

You should be careful to distinguish between \(f(t)\) and its extension. A common mistake is to assume that a formula for \(f(t)\) holds for its extension. It can be confusing when the formula for \(f(t)\) is periodic, but with perhaps a different period.

###### Exercise 4.2.1.

Define \(f(t) = \cos t\) on \([\nicefrac{-\pi}{2},\nicefrac{\pi}{2}]\text{.}\) Take the \(\pi\)-periodic extension and sketch its graph. How does it compare to the graph of \(\cos t\text{?}\)

### Subsection 4.2.2 Inner product and eigenvector decomposition

Suppose we have a *symmetric matrix*, that is \(A^T = A\text{.}\) As we remarked before, eigenvectors of \(A\) are then orthogonal. Here the word *orthogonal* means that if \(\vec{v}\) and \(\vec{w}\) are two eigenvectors of \(A\) for distinct eigenvalues, then \(\langle \vec{v} , \vec{w} \rangle = 0\text{.}\) In this case the inner product \(\langle \vec{v} , \vec{w} \rangle\) is the *dot product*, which can be computed as \(\vec{v}^T\vec{w}\text{.}\)

To decompose a vector \(\vec{v}\) in terms of mutually orthogonal vectors \(\vec{w}_1\) and \(\vec{w}_2\) we write

Let us find the formula for \(a_1\) and \(a_2\text{.}\) First let us compute

Therefore,

Similarly

You probably remember this formula from vector calculus.

###### Example 4.2.2.

Write \(\vec{v} = \left[ \begin{smallmatrix} 2 \\ 3 \end{smallmatrix} \right]\) as a linear combination of \(\vec{w_1} = \left[ \begin{smallmatrix} 1 \\ -1 \end{smallmatrix} \right]\) and \(\vec{w_2} = \left[ \begin{smallmatrix} 1 \\ 1 \end{smallmatrix} \right]\text{.}\)

First note that \(\vec{w}_1\) and \(\vec{w}_2\) are orthogonal as \(\langle \vec{w}_1 , \vec{w}_2 \rangle = 1(1) + (-1)1 = 0\text{.}\) Then

Hence

### Subsection 4.2.3 The trigonometric series

Instead of decomposing a vector in terms of eigenvectors of a matrix, we decompose a function in terms of eigenfunctions of a certain eigenvalue problem. The eigenvalue problem we use for the Fourier series is

We computed that eigenfunctions are 1, \(\cos (k t)\text{,}\) \(\sin (k t)\text{.}\) That is, we want to find a representation of a \(2\pi\)-periodic function \(f(t)\) as

This series is called the *Fourier series*^{ 1 } or the *trigonometric series* for \(f(t)\text{.}\) We write the coefficient of the eigenfunction 1 as \(\frac{a_0}{2}\) for convenience. We could also think of \(1 = \cos (0t)\text{,}\) so that we only need to look at \(\cos (kt)\) and \(\sin (kt)\text{.}\)

As for matrices we want to find a *projection* of \(f(t)\) onto the subspaces given by the eigenfunctions. So we want to define an *inner product of functions*. For example, to find \(a_n\) we want to compute \(\langle \, f(t) \, , \, \cos (nt) \, \rangle\text{.}\) We define the inner product as

With this definition of the inner product, we saw in the previous section that the eigenfunctions \(\cos (kt)\) (including the constant eigenfunction), and \(\sin (kt)\) are *orthogonal* in the sense that

For \(n=1,2,3,\ldots\) we have

by elementary calculus. For the constant we get

The coefficients are given by

Compare these expressions with the finite-dimensional example. For \(a_0\) we get a similar formula

Let us check the formulas using the orthogonality properties. Suppose for a moment that

Then for \(m \geq 1\) we have

And hence \(a_m = \frac{\langle \, f(t) \, , \, \cos (mt) \, \rangle}{\langle \, \cos (mt) \, , \, \cos (mt) \, \rangle}\text{.}\)

###### Exercise 4.2.2.

Carry out the calculation for \(a_0\) and \(b_m\text{.}\)

###### Example 4.2.3.

Take the function

for \(t\) in \((-\pi,\pi]\text{.}\) Extend \(f(t)\) periodically and write it as a Fourier series. This function is called the *sawtooth*.

The plot of the extended periodic function is given in Figure 5.2.7. Let us compute the coefficients. We start with \(a_0\text{,}\)

We will often use the result from calculus that says that the integral of an odd function over a symmetric interval is zero. Recall that an *odd function* is a function \(\varphi(t)\) such that \(\varphi(-t) = -\varphi(t)\text{.}\) For example the functions \(t\text{,}\) \(\sin t\text{,}\) or (importantly for us) \(t \cos (nt)\) are all odd functions. Thus

Let us move to \(b_n\text{.}\) Another useful fact from calculus is that the integral of an even function over a symmetric interval is twice the integral of the same function over half the interval. Recall an *even function* is a function \(\varphi(t)\) such that \(\varphi(-t) = \varphi(t)\text{.}\) For example \(t \sin (nt)\) is even.

We have used the fact that

The series, therefore, is

Let us write out the first 3 harmonics of the series for \(f(t)\text{.}\)

The plot of these first three terms of the series, along with a plot of the first 20 terms is given in Figure 5.2.8.

###### Example 4.2.4.

Take the function

Extend \(f(t)\) periodically and write it as a Fourier series. This function or its variants appear often in applications and the function is called the *square wave*.

The plot of the extended periodic function is given in Figure 5.2.10. Now we compute the coefficients. Let us start with \(a_0\)

Next,

And finally

The Fourier series is

Let us write out the first 3 harmonics of the series for \(f(t)\text{.}\)

The plot of these first three and also of the first 20 terms of the series is given in Figure 5.2.11.

We have so far skirted the issue of convergence. For example, if \(f(t)\) is the square wave function, the equation

is only an equality for such \(t\) where \(f(t)\) is continuous. That is, we do not get an equality for \(t=-\pi,0,\pi\) and all the other discontinuities of \(f(t)\text{.}\) It is not hard to see that when \(t\) is an integer multiple of \(\pi\) (which includes all the discontinuities), then

We redefine \(f(t)\) on \([-\pi,\pi]\) as

and extend periodically. The series equals this extended \(f(t)\) everywhere, including the discontinuities. We will generally not worry about changing the function values at several (finitely many) points.

We will say more about convergence in the next section. Let us however mention briefly an effect of the discontinuity. Let us zoom in near the discontinuity in the square wave. Further, let us plot the first 100 harmonics, see Figure 5.2.12. While the series is a very good approximation away from the discontinuities, the error (the overshoot) near the discontinuity at \(t=\pi\) does not seem to be getting any smaller. This behavior is known as the *Gibbs phenomenon*. The region where the error is large does get smaller, however, the more terms in the series we take.

We can think of a periodic function as a “signal” being a superposition of many signals of pure frequency. For example, we could think of the square wave as a tone of certain base frequency. This base frequency is called the *fundamental frequency*. The square wave will be a superposition of many different pure tones of frequencies that are multiples of the fundamental frequency. In music, the higher frequencies are called the *overtones*. All the frequencies that appear are called the *spectrum* of the signal. On the other hand a simple sine wave is only the pure tone (no overtones). The simplest way to make sound using a computer is the square wave, and the sound is very different from a pure tone. If you ever played video games from the 1980s or so, then you heard what square waves sound like.

### Subsection 4.2.4 Exercises

###### Exercise 4.2.3.

Suppose \(f(t)\) is defined on \([-\pi,\pi]\) as \(\sin (5t) + \cos (3t)\text{.}\) Extend periodically and compute the Fourier series of \(f(t)\text{.}\)

###### Exercise 4.2.4.

Suppose \(f(t)\) is defined on \([-\pi,\pi]\) as \(\lvert t \rvert\text{.}\) Extend periodically and compute the Fourier series of \(f(t)\text{.}\)

###### Exercise 4.2.5.

Suppose \(f(t)\) is defined on \([-\pi,\pi]\) as \(\lvert t \rvert^3\text{.}\) Extend periodically and compute the Fourier series of \(f(t)\text{.}\)

###### Exercise 4.2.6.

Suppose \(f(t)\) is defined on \((-\pi,\pi]\) as

Extend periodically and compute the Fourier series of \(f(t)\text{.}\)

###### Exercise 4.2.7.

Suppose \(f(t)\) is defined on \((-\pi,\pi]\) as \(t^3\text{.}\) Extend periodically and compute the Fourier series of \(f(t)\text{.}\)

###### Exercise 4.2.8.

Suppose \(f(t)\) is defined on \([-\pi,\pi]\) as \(t^2\text{.}\) Extend periodically and compute the Fourier series of \(f(t)\text{.}\)

There is another form of the Fourier series using complex exponentials \(e^{nt}\) for \(n=\ldots,-2,-1,0,1,2,\ldots\) instead of \(\cos(nt)\) and \(\sin(nt)\) for positive \(n\text{.}\) This form may be easier to work with sometimes. It is certainly more compact to write, and there is only one formula for the coefficients. On the downside, the coefficients are complex numbers.

###### Exercise 4.2.9.

Let

Use Euler's formula \(e^{i\theta} = \cos (\theta) + i \sin (\theta)\) to show that there exist complex numbers \(c_m\) such that

Note that the sum now ranges over all the integers including negative ones. Do not worry about convergence in this calculation. Hint: It may be better to start from the complex exponential form and write the series as

###### Exercise 4.2.101.

Suppose \(f(t)\) is defined on \([-\pi,\pi]\) as \(f(t) = \sin(t)\text{.}\) Extend periodically and compute the Fourier series.

\(\sin(t)\)

###### Exercise 4.2.102.

Suppose \(f(t)\) is defined on \((-\pi,\pi]\) as \(f(t) = \sin(\pi t)\text{.}\) Extend periodically and compute the Fourier series.

\(\sum\limits_{n=1}^\infty \frac{(\pi-n) \sin( \pi n+{\pi}^{2}) +(\pi+n)\sin(\pi n-{\pi}^{2}) }{\pi {n}^{2}-{\pi}^{3}} \sin(nt)\)

###### Exercise 4.2.103.

Suppose \(f(t)\) is defined on \((-\pi,\pi]\) as \(f(t) = \sin^2(t)\text{.}\) Extend periodically and compute the Fourier series.

\(\frac{1}{2}-\frac{1}{2}\cos(2t)\)

###### Exercise 4.2.104.

Suppose \(f(t)\) is defined on \((-\pi,\pi]\) as \(f(t) = t^4\text{.}\) Extend periodically and compute the Fourier series.

\(\frac{\pi^4}{5} + \sum\limits_{n=1}^\infty \frac{{(-1)}^{n} (8{\pi}^{2}{n}^{2}-48) }{{n}^{4}} \cos(nt)\)