Login
📚 Differential Equations for Engineers
Chapters ▾
⇩ Download ▾

4.2 The Trigonometric Series

Periodic Functions and Motivation

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

x + ω 0 2 x = f ( t ) ,

(4.2.1)

for some periodic function f(t). We have already solved

x + ω 0 2 x = F 0 cos ( ω t ) .

(4.2.2)

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

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) for all t. For brevity we will say f(t) is Pperiodic. Note that a Pperiodic function is also 2Pperiodic, 3Pperiodic 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 will start with a function f(t) defined on some interval [L,L] and we will want to extend f(t) periodically to make it a 2Lperiodic 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. We assumed that 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).

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.

Inner Product and Eigenvector Decomposition

Suppose we have a symmetric matrix, that is AT=A. We have said before that the eigenvectors of A are then orthogonal. Here the word orthogonal means that if v and w are two distinct (and not multiples of each other) eigenvectors of A, 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 = a 1 w 1 + a 2 w 2 .

Let us find the formula for a1 and a2. First let us compute

v , w 1 = a 1 w 1 + a 2 w 2 , w 1 = a 1 w 1 , w 1 + a 2 w 2 , w 1 = 0 = a 1 w 1 , w 1 .

Therefore,

a 1 = v , w 1 w 1 , w 1 .

Similarly

a 2 = v , w 2 w 2 , w 2 .

You probably remember this formula from vector calculus.

Trigonometric Series

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

x + λ x = 0 ,         x ( π ) = x ( π )         x ( π ) = x ( π ) .

We have previously computed that the eigenfunctions are 1,cos(kt),sin(kt). That is, we will want to find a representation of a 2πperiodic function f(t) as

f ( t ) = a 0 2 + n = 1 a n cos ( n t ) + b n sin ( n t ) .

This series is called the Fourier seriesto the power 1 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 subspace generated by the eigenfunctions. So we will 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 ) = π π f ( t ) g ( t ) d t .

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

cos ( m t ) , cos ( n t ) = 0 for  m = n , sin ( m t ) , sin ( n t ) = 0 for  m = n , sin ( m t ) , cos ( n t ) = 0 for all  m  and  n .

By elementary calculus for n=1,2,3,. we have cos(nt),cos(nt)=π and sin(nt),sin(nt)=π. For the constant we get

1 , 1 = π π 1 · 1 d t = 2 π .

The coefficients are given by

a n = f ( t ) , cos ( n t ) cos ( n t ) , cos ( n t ) = 1 π π π f ( t ) cos ( n t ) d t , b n = f ( t ) , sin ( n t ) sin ( n t ) , sin ( n t ) = 1 π π π f ( t ) sin ( n t ) d t .

Compare these expressions with the finite-dimensional example. For a0 we get a similar formula

a 0 = 2 f ( t ) , 1 1 , 1 1 π π π f ( t ) d t .

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

f ( t ) = a 0 2 + n = 1 a n cos ( n t ) + b n sin ( n t ) .

Then for m1 we have

f ( t ) , cos ( m t ) = a 0 2 + n = 1 a n cos ( n t ) + b n sin ( n t ) , cos ( m t ) = a 0 2 1 , cos ( m t ) + n = 1 a n cos ( n t ) , cos ( m t ) + b n sin ( n t ) , sin ( m t ) = a m cos ( m t ) , cos ( m t ) .

And hence am=f(t),cos(mt)cos(mt),cos(mt).

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 = 1 2 2 k 1 sin ( ( 2 k 1 ) t ) .

is only an equality for such t where f(t) is continuous. That is, 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 includes all the discontinuities), then

π 2 + k = 1 2 2 k 1 sin ( ( 2 k 1 ) t ) = π 2 .

We redefine f(t) on [π,π] as

0           i f   π < t < 0 , π   i f   0 < t < π , π / 2                                       i f   t = π , t = 0 ,   o r   t = π ,

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 6. You will notice that 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. 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.

Function graph showing y = (pi/2)*(1+sign(sin(t))) and y = pi/2 + (1+sign(n-0.5))/1*sin(1*t) + (1+sign(n-2.5))/3*sin(3*t) + (1+sign(n-4.5))/5*sin(5*t) + (1+sign(n-6.5))/7*sin(7*t) + (1+sign(n-8.5))/9*sin(9*t) + (1+sign(n-10.5))/11*sin(11*t) + (1+sign(n-12.5))/13*sin(13*t) + (1+sign(n-14.5))/15*sin(15*t) + (1+sign(n-16.5))/17*sin(17*t) + (1+sign(n-18.5))/19*sin(19*t) + (1+sign(n-20.5))/21*sin(21*t) + (1+sign(n-22.5))/23*sin(23*t) + (1+sign(n-24.5))/25*sin(25*t) + (1+sign(n-26.5))/27*sin(27*t) + (1+sign(n-28.5))/29*sin(29*t) + (1+sign(n-30.5))/31*sin(31*t) + (1+sign(n-32.5))/33*sin(33*t) + (1+sign(n-34.5))/35*sin(35*t) + (1+sign(n-36.5))/37*sin(37*t) + (1+sign(n-38.5))/39*sin(39*t). Adjustable parameter: Highest harmonic kept (n) = 3. Viewing window: x from -3.8 to 3.8, y from -0.78 to 3.92.
Lebl's Figure 5 freezes this at two settings, 3 harmonics and 20; here you can sweep between them and past them. The dashed trace is the square wave itself; the solid curve is the partial sum of his own series pi/2 + 2 sin t + (2/3) sin 3t + (2/5) sin 5t +.... At the default 3 you are looking at his left-hand panel exactly, and at 20 at his right-hand one. Drag between them and the ripples multiply and crowd in toward the jumps at t = 0 and t = +/- pi, but the tall spike beside each jump refuses to come down: its peak falls only from 3.456 to 3.424 across that whole drag, and never drops below 3.4227 = 1.0895*pi -- a permanent overshoot of 8.95 % of the jump height pi. Even-numbered settings look identical to the odd one below them, because a square wave has no even harmonics at all: this section computes b_n = 0 for every even n.
Close-up of the Gibbs phenomenon: the blue partial sum ripples about a flat green line at the true value of about 3.14, the wiggles growing toward the jump until the tallest reaches roughly 3.42.
Figure 6: 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.

Footnotes

[1] Named after the French mathematician Jean Baptiste Joseph Fourier (1768 – 1830).

Adapted from Differential Equations for Engineers by Jiří Lebl (Oklahoma State University), hosted on LibreTexts (math.libretexts.org) and licensed under CC BY-SA 4.0. Changes were made. License: CC-BY-SA-4.0.