Skip to main content
Logo image

Section 4.2 The trigonometric series

Note: 2 lectures, §9.1 in [EP], §10.2 in [BD]

Subsection 4.2.1 Periodic functions and motivation

As motivation for studying Fourier series, suppose we have the problem
(4.6)x+ω02x=f(t),
for some periodic function f(t). We already solved
(4.7)x+ω02x=F0cos(ωt).
One way to solve (4.6) is to decompose f(t) as a sum of cosines (and sines) and then solve many problems of the form (4.7). We then use the principle of superposition, to sum up all the solutions we got to get a solution to (4.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. 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π-periodic. So are cos(kt) and sin(kt) for all integers k. 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], 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], F(t)=f(t). For t in [L,3L], we define F(t)=f(t2L), for t in [3L,L], F(t)=f(t+2L), and so on. To make that work we needed f(L)=f(L). We could have also started with f defined only on the half-open interval (L,L] and then define f(L)=f(L).

Example 4.2.1.

Define f(t)=1t2 on [1,1]. Now extend f(t) periodically to a 2-periodic function. See Figure 4.3.

Figure 4.3. Periodic extension of the function 1t2.

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)=cost on [π/2,π/2]. Take the π-periodic extension and sketch its graph. How does it compare to the graph of cost?

Subsection 4.2.2 Inner product and eigenvector decomposition

Suppose we have a symmetric matrix, that is AT=A. As we remarked before, eigenvectors of A are then orthogonal. Here the word orthogonal means that if v and w are two eigenvectors of A for distinct eigenvalues, then v,w=0. In this case the inner product v,w is the dot product, which can be computed as vTw.
To decompose a vector v in terms of mutually orthogonal vectors w1 and w2 we write
v=a1w1+a2w2.
Let us find the formula for a1 and a2. First let us compute
v,w1=a1w1+a2w2,w1=a1w1,w1+a2w2,w1=0=a1w1,w1.
Therefore,
a1=v,w1w1,w1.
Similarly
a2=v,w2w2,w2.
You probably remember this formula from vector calculus.

Example 4.2.2.

Write v=[23] as a linear combination of w1=[11] and w2=[11].
First note that w1 and w2 are orthogonal as w1,w2=1(1)+(1)1=0. Then
a1=v,w1w1,w1=2(1)+3(1)1(1)+(1)(1)=12,a2=v,w2w2,w2=2+31+1=52.
Hence
[23]=12[11]+52[11].

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
x+λx=0,x(π)=x(π),x(π)=x(π).
We computed that eigenfunctions are 1, cos(kt), sin(kt). That is, we want to find a representation of a 2π-periodic function f(t) as
  f(t)=a02+n=1ancos(nt)+bnsin(nt).  
This series is called the Fourier series
 1 
Named after the French mathematician Jean Baptiste Joseph Fourier (1768–1830).
or the trigonometric series for f(t). We write the coefficient of the eigenfunction 1 as a02 for convenience. We could also think of 1=cos(0t), so that we only need to look at cos(kt) and sin(kt).
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 an we want to compute f(t),cos(nt). We define the inner product as
f(t),g(t)=defππf(t)g(t)dt.
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
cos(mt),cos(nt)=0for mn,sin(mt),sin(nt)=0for mn,sin(mt),cos(nt)=0for all m and n.
For n=1,2,3, we have
cos(nt),cos(nt)=ππcos(nt)cos(nt)dt=π,sin(nt),sin(nt)=ππsin(nt)sin(nt)dt=π,
by elementary calculus. For the constant we get
1,1=ππ11dt=2π.
The coefficients are given by
  an=f(t),cos(nt)cos(nt),cos(nt)=1πππf(t)cos(nt)dt,bn=f(t),sin(nt)sin(nt),sin(nt)=1πππf(t)sin(nt)dt.  
Compare these expressions with the finite-dimensional example. For a0 we get a similar formula
  a0=2f(t),11,1=1πππf(t)dt.  
Let us check the formulas using the orthogonality properties. Suppose for a moment that
f(t)=a02+n=1ancos(nt)+bnsin(nt).
Then for m1, we have
f(t),cos(mt)=a02+n=1ancos(nt)+bnsin(nt),cos(mt)=a021,cos(mt)+n=1ancos(nt),cos(mt)+bnsin(nt),cos(mt)=amcos(mt),cos(mt).
And hence am=f(t),cos(mt)cos(mt),cos(mt).

Exercise 4.2.2.

Carry out the calculation for a0 and bm.

Example 4.2.3.

Take the function
f(t)=t
for t in (π,π]. Extend f(t) periodically and write it as a Fourier series. This function is called the sawtooth.

Figure 4.4. The graph of the sawtooth function.

The plot of the extended periodic function is given in Figure 4.4. Let us compute the coefficients. We start with a0,
a0=1πππtdt=0.
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 φ(t) such that φ(t)=φ(t). For example the functions t, sint, or (importantly for us) tcos(nt) are all odd functions. Thus
an=1πππtcos(nt)dt=0.
Let us move to bn. 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 φ(t) such that φ(t)=φ(t). For example tsin(nt) is even.
bn=1πππtsin(nt)dt=2π0πtsin(nt)dt=2π([tcos(nt)n]t=0π+1n0πcos(nt)dt)=2π(πcos(nπ)n+0)=2cos(nπ)n=2(1)n+1n.
We have used the fact that
cos(nπ)=(1)n={1if n even,1if n odd.
The series, therefore, is
n=12(1)n+1nsin(nt).
Let us write out the first 3 harmonics of the series for f(t).
2sin(t)sin(2t)+23sin(3t)+
The plot of these first three terms of the series, along with a plot of the first 20 terms is given in Figure 4.5.

Figure 4.5. First 3 (left graph) and 20 (right graph) harmonics of the sawtooth function.

Example 4.2.4.

Take the function
f(t)={0if π<t0,πif 0<tπ.
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.

Figure 4.6. The graph of the square wave function.

The plot of the extended periodic function is given in Figure 4.6. Now we compute the coefficients. We start with a0
a0=1πππf(t)dt=1π0ππdt=π.
Next,
an=1πππf(t)cos(nt)dt=1π0ππcos(nt)dt=0.
And finally,
bn=1πππf(t)sin(nt)dt=1π0ππsin(nt)dt=[cos(nt)n]t=0π=1cos(πn)n=1(1)nn={2nif n is odd,0if n is even.
The Fourier series is
π2+n=1n odd2nsin(nt)=π2+k=122k1sin((2k1)t).
Let us write out the first 3 harmonics of the series for f(t):
π2+2sin(t)+23sin(3t)+
The plot of these first three and also of the first 20 terms of the series is given in Figure 4.7.

Figure 4.7. First 3 (left graph) and 20 (right graph) harmonics of the square wave function.

We have so far skirted the issue of convergence. For example, if f(t) is the square wave function, the equation
f(t)=π2+k=122k1sin((2k1)t).
is only an equality for such t where f(t) is continuous. We do not get an equality for t=π,0,π and all the other discontinuities of f(t). It is not hard to see that when t is an integer multiple of π (which gives all the discontinuities), then
π2+k=122k1sin((2k1)t)=π2.
We redefine f(t) on [π,π] as
f(t)={0if π<t<0,πif 0<t<π,π/2if t=π,t=0, or t=π,
and extend periodically. The series equals this new 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, briefly mention an effect of the discontinuity. Zoom in near the discontinuity in the square wave. Further, plot the first 100 harmonics, see Figure 4.8. While the series is a very good approximation away from the discontinuities, the error (the overshoot) near the discontinuity at t=π does not seem to be getting any smaller as we take more and more harmonics. 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.

Figure 4.8. Gibbs phenomenon in action.

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.

Exercises 4.2.4 Exercises

4.2.3.

Suppose f(t) is defined on [π,π] as sin(5t)+cos(3t). Extend periodically and compute the Fourier series of f(t).

4.2.4.

Suppose f(t) is defined on [π,π] as |t|. Extend periodically and compute the Fourier series of f(t).

4.2.5.

Suppose f(t) is defined on [π,π] as |t|3. Extend periodically and compute the Fourier series of f(t).

4.2.6.

Suppose f(t) is defined on (π,π] as
f(t)={1if π<t0,1if 0<tπ.
Extend periodically and compute the Fourier series of f(t).

4.2.7.

Suppose f(t) is defined on (π,π] as t3. Extend periodically and compute the Fourier series of f(t).

4.2.8.

Suppose f(t) is defined on [π,π] as t2. Extend periodically and compute the Fourier series of f(t).
There is another form of the Fourier series using complex exponentials ent for n=,2,1,0,1,2, instead of cos(nt) and sin(nt) for positive n. 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.

4.2.9.

Let
f(t)=a02+n=1ancos(nt)+bnsin(nt).
Use Euler’s formula eiθ=cos(θ)+isin(θ) to show that there exist complex numbers cm such that
f(t)=m=cmeimt.
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
c0+m=1(cmeimt+cmeimt).

4.2.101.

Suppose f(t) is defined on [π,π] as f(t)=sin(t). Extend periodically and compute the Fourier series.
Answer.
sin(t)

4.2.102.

Suppose f(t) is defined on (π,π] as f(t)=sin(πt). Extend periodically and compute the Fourier series.
Answer.
n=1(πn)sin(πn+π2)+(π+n)sin(πnπ2)πn2π3sin(nt)

4.2.103.

Suppose f(t) is defined on (π,π] as f(t)=sin2(t). Extend periodically and compute the Fourier series.
Answer.
1212cos(2t)

4.2.104.

Suppose f(t) is defined on (π,π] as f(t)=t4. Extend periodically and compute the Fourier series.
Answer.
π45+n=1(1)n(8π2n248)n4cos(nt)
For a higher quality printout use the PDF version: https://www.jirka.org/diffyqs/diffyqs.pdf