#16 (10/23/2023)

Fourier Series

Alternative formulation

An inner product between two functions, f(x) and g(x), over [−π, π] can be defined as
(f, g) ≡
π

−π 
f(x

g(x)
 
dx,
(1)
where g(x) is the complex conjugate1 of g(x).
Define
em(x) ≡ 1





ei m x,
the fundamental periodic function. It is easy to show that
(em, en) = 1



π

−π 
ei (mn)x dx =



1
    n=m,
0
    nm.
A periodic function, f(x), over [−π, π] can be expanded by a linear combination of the fundamental periodic functions as

f(x) =

n=−∞ 
cn en.
(2)
Taking the inner product between f(x) and em(x) in Eq.(2) yields
(f, em)
=


n=−∞ 
cn (en, em)
=
cm (em, em)
=
cm,
(3)
which is the Fourier coefficient.



Complex
Real
f(x)=

n=−∞ 
cn en
f(x)= a0

2
+

m=1 
am cos m x+

m=1 
bm sin m x
en = 1





ei n x
am= 1

π

π

−π 
f(x) cos m x dx
cn = (f, en)
bm = 1

π

π

−π 
f(x) sin m x dx
(4)

Example 1: Square wave
squarewave.jpg

f(x) =



0
−π < x < 0
1
0 < x < π
(5)

a0
=
1

π

π

−π 
f(x) dx
=
1

π

π

0 
1 dx
=
1.
(6)
am
=
1

π

π

−π 
f(x) cos  mx dx
=
1

π

π

0 
cos  mx dx
=
1

π

sin  mx

m

x

x=0 
=
0.
(7)
bm
=
1

π

π

−π 
f(x) sin  mx dx
=
1

π

π

0 
sin  mx dx
(8)
=
1

π

cos  mx

m

x

x=0 
=
1−(−1)m

m π
.
(9)
so
f(x)
=
1

2
+

m=1 
1−(−1)m

mπ
sin  mx
=
1

2
+ 2

π
(sin  x + sin  3x

3
+ sin  5x

5
+…)
=
1

2
+ 2

π


n=1 
sin(2n−1) x

2n−1
.
(10)
Here is a comparison of five term Fourier series and f(x).
square_comparison.jpg
Substituting x=π/2 in Eq.(10) yields

1 = 1

2
+ 2

π
(1− 1

3
+ 1

5
− …),
(11)
so

1− 1

3
+ 1

5
1

7
+… = π

4
.
(12)
Note that Eq.(12) can be also obtained by Taylor's series of arctanx, i.e.

arctanx = x x3

3
+ x5

5
+ …
(13)
Substituting x=1 in Eq.(13) yields the result of Eq.(12). Note also that Eq.(13) can be obtained by integrating geometric series of
1

1+x2
= 1−x2+x4x6 + …
(14)
Example 2: Triangular wave
triangularwave.jpg

f(x) =



x
−π < x < 0
x
0 < x < π
(15)
Note that f(x) is an even function. Hence its Fourier series consists of only cosine terms.

a0
=
π
(16)
am
=
2 ((−1)m−1)

m2π
(17)
bm
=
0,
(18)
so
f(x)
=
π

2
+

m=1 
2 ((−1)m−1)

m2π
cos  mx
=
π

2
4

π

cos  x

12
+ cos  3 x

32
+ cos  5 x

52
+ cos  7x

72
+ …
.
(19)
Here is a comparison of five term Fourier series and f(x).
triangle_comparison.jpg
Substituting x=0 in Eq.(19) yields

0= π

2
4

π

1

12
+ 1

32
+ 1

52
+ 1

72
+…
,
(20)
which can be solved for the series in the parentheses as

1+ 1

32
+ 1

52
+ 1

72
+ … = π2

8
.
(21)
As shown in class, using Eq.(21), it is possible to sum up the infinite series of

S ≡ 1 + 1

22
+ 1

32
+ 1

42
+ 1

52
+ …
(22)
as

S
=

1

12
+ 1

32
+ 1

52
+ …
+
1

22
+ 1

42
+ 1

62
+ …
=

1

12
+ 1

32
+ 1

52
+ …
+ 1

22
( 1

12
+ 1

22
+ 1

32
+ 1

42
+ …)
=
π2

8
+ 1

4
S.
(23)
Solving the above for S yields
S = π2

6
.

Termwise integration and differentiation

If a Fourier series is continuous, it is possible to differentiate each term inside the summation and the resulting series is also convergent. True for integrations as well with some caveat.
Example: The Fourier series of the triangular wave shown below is expressed as

f(x) = π

2
4

π

cos x

12
+ cos 3x

32
+ cos 5x

52
+ …
(24)
triangularwave.jpg
Differentiating the both sides yields the Fourier series of a square wave.

f′(x) = 4

π

sin x

1
+ sin 3x

3
+ sin 5x

5
+ …
(25)
squarewave2.jpg
(Question) What happens if the above is differentiated again ?

Fourier series application to differential equations

(1) Ordinary differential equation

Solve
u"(x) = x,     u(−π) = u(π) = 0.
(26)
The exact solution is readily available as

u(x) = 1

6
x (x2 − π2),
(27)
but let's pretend that we do not know this. The whole idea is to look at Equation (26) in terms of Fourier coefficients (frequencies) and solve Equation (26) in the Fourier (frequency) region. Express the unknown function, u(x), and the known function, x, in Equation (26) by Fourier series as
u(x)
=


n=1 
un sin n x,
x
=


n=1 
xn sin n x,
(28)
where un is an unknown coefficient yet to be determined but xn is the Fourier coefficient for the function, x. The Fourier coefficients for x are determined as
xn =  − 2 (−1)n

n
.
(29)
Hence, it follows
u"(x)
=


n=1 
n2  un  sin n x
x
=


n=1 
2 (−1)n

n
sin n x,
(30)
from which
un = 2 (−1)n

n3
.
(31)
The first five terms of the Fourier series is
~
u
 

5 
= −2 sin(x)+ 1

4
sin(2 x)− 2

27
sin(3 x)+ 1

32
sin(4 x)− 2

125
sin(5 x).
(32)
Here is the comparison between ~u5 and the exact solution, [1/6]x (x2 − π2).
fourier_diff_ex1.jpg
Figure 1: Comparison of the Fourier series solution with the exact solution.
As is seen, the agreement is excellent. Needless to say, ~u5 is the five term Fourier series of [1/6]x (x2 − π2).

(2) Fourth order differential equation (elastica)

Consider the following fourth order ordinary differential equation (simplified version of beam deflection equation on elastic foundation):

u""(x) + u(x) = w(x),
(33)
where w(x) is a periodic function whose Fourier series expression is given as

w(x) = 1

2
+ 2

π


n=1 
sin  n π

2

n
cos nx.
(34)
elastica.jpg
Figure 2: w(x)
Because of the periodic nature of w(x), it is reasonable to assume that u(x) is also periodic, i.e.

u(x) = u0+

m=1 
um cos m x.
(35)
Substituting eq.(35) into eq.(33) yields

u0 +

m=1 
um (m4+1) cos mx = 1

2
+ 2

π


m=1 
sin  m π

2

m
cos mx,
(36)
thus

u0
=
1

2
,
um
=
2 sin  mπ

2

πm (m4+1)
.
(37)

(3) Diffusion equation

The diffusion equation is a parabolic partial differential equation and is exemplified by the following system (after setting all the physical constants as unity):

2 u(x,t)

x2
= u(x, t)

t
.
(38)
We assume that u(x, t) can be expressed by Fourier sine series as
u(x, t) =

n=1 
un(t) sin n πx,
(39)
except that the Fourier coefficient, un, is a function of t. Note that sin n πx was chosen as the interval is [0, 1] instead of [−π, π]. The both sides of Equation (38) can be expressed in the Fourier domain as
2 u

x2
=


n=1 
n2 un(t) sin n πx,
(40)
u

t
=


n=1 
un(t)

t
sin n πx.
(41)
from which it follows
un(t)

t
= −(nπ)2 un(t),
(42)
which can be solved as
un(t) = An e−(n π)2 t.
(43)
where An is an integral constant yet determined.
Equation (38) with Equation (43) yields
u(x, t) =

n=1 
An e−(nπ)2 t sin n πx.
(44)
Substituting the initial condition at t = 0 into Equation (44) yields
f(x) =

n=1 
An  sin n πx,
(45)
which implies that the unknown coefficient, An, is the Fourier sine coefficient of f(x) as2
An = 2
1

0 
f(x) sin n πx dx.
(46)
Example

2 u

x2
=
u

t
,
(47)
u = 0    
at
    x = 0, 1
u=1    
at
    t = 0

An
=
2
1

0 
1 ×sin n πx dx
=
2 (1−cos(n π))

n π
=
2 (1−(−1)n)

nπ
.
(48)

u(x, t)
=


n=1 
An en2 π2 t sin n πx
=


n=1 
2 (1−(−1)n)

nπ
en2 π2 t sin nπx.
(49)
Here is how the temperature decays.


Footnotes:

1If g(x) = u + i v, g(x)=ui v.
2 Multiply sin m πx from both sides of Equation (45) and integrate the result from −π to π to get

1

0 
f(x) sin m πx d x
=


n=1 
An
1

0 
sin n πx sin m πx dx
(50)
=




Am × 1

2
,
m = n
0,
mn
Hence,
Am = 2
1

0 
f(x) sin m πx.



File translated from TEX by TTH, version 4.03.
On 22 Oct 2023, 07:44.