You are on page 1of 37

Fourier series

Jos e Rodellar, jose.rodellar@upc.edu


Control, Din` amica i Aplicacions - CoDAlab
Departament de Matem` atica Aplicada III
Universitat Polit` ecnica de Catalunya
Barcelona, Spain
Mathematical tools for hydroinformatics
European Master in Hydroinformatics and Water
Management
European Master EUROAQUAE Mathematical tools
Purpose of these notes
This material is written to give the students a mathematical
background for the Fourier series, which can be used to
construct analytical solutions for some problems with partial
differential equations.
In addition, Fourier series are very useful to represent functions
in many practical problems.
European Master EUROAQUAE Mathematical tools
Fourier series - Outline
Sets of orthogonal vectors
Sets of orthogonal functions
Fourier series
Mean square approximation
Orthonormal basis and representation of functions
European Master EUROAQUAE Mathematical tools
Sets of orthogonal vectors
Consider a vector space in '
3
with an orthonormal basis i, j,
k, along the axis x, y, z. Each vector in this space can be
decomposed in the form
f = f
1
i + f
2
j + f
3
k,
where f
1
, f
2
, f
3
are the components which uniquely dene the
vector f.
Dene the internal product of two vectors f, g in the form
f, g) =
3

i=1
f
i
g
i
.
and the norm of a vector
|f| =
_
f, f) =

_
3

i=1
f
2
i
.
|f| > 0 for all f except that |0| = 0.
European Master EUROAQUAE Mathematical tools
We say that f, g are orthogonal if
f, g) = 0 .
Be v
1
, v
2
, v
3
non null vectors. They are called a orthogonal
vector set if v
n
, v
m
) = 0 for any n ,= m.
Any orthogonal set can be turn into a so-called orthonormal
base with the vectors having norm 1 in the form
u
n
=
v
n
|v
n
|
, n = 1, 2, 3 .
such that
u
n
, u
m
) =
_
0, for n ,= m
1, for n = m.
European Master EUROAQUAE Mathematical tools
Every vector f can be expressed as a linear combination of the
vectors u
n
in the form
f =
3

n=1
c
n
u
n
,
where the coefcients c
n
IR are calculated in the form
f, u
i
) =
3

n=1
c
n
u
n
, u
i
) =
3

n=1
c
n
u
n
, u
i
) =
3

n=1
c
n
u
n
, u
i
) = c
i
.
Then
c
n
= f, u
n
) .
Geometric meaning: c
n
are the projections of vector f on the
directions dened by the unit vectors u
n
.
European Master EUROAQUAE Mathematical tools
Sets of orthogonal functions
Consider a function space: a set of functions such that any
linear combination lies inside the set. As prototype, consider
I = [0, ] and the set (
s
(I) of piecewise continuous functions on
I.
Be p (
s
(I) a strictly positive function that is named weighting
function.
We dene the internal product of two functions f , g ((I) with
respect to the weight p as
f , g) =
_

0
f (x)g(x)p(x)dx.
If we see a function f as a vector of innite dimension whose
components are the values f (x) at the innite points x I, this
internal product can be interpreted as the extension of the
internal product for two vectors.
European Master EUROAQUAE Mathematical tools
We dene the norm of a function:
|f | =
_
f , f ) =
_
_

0
f (x)
2
p(x)dx
_
1/2
0 .
If |f | = 0, then f (x) = 0 for all x [0, ].
Two functions f y g are orthogonal if
f , g) =
_

0
f (x)g(x)p(x)dx = 0 .
Be
n

n=1,2,...
a set of functions. It is called orthogonal set if

n
,
m
) = 0 for any n ,= m.
European Master EUROAQUAE Mathematical tools
If no function has null norm, we may normalize them:

n
(x) =

n
(x)
|
n
(x)|
, n = 1, 2, . . . .
These functions forma a orthonormal set, that is

n
,
m
) =
_
I

n
(x)
m
(x)p(x) = dx =
_
0, for n ,= m
1, for n = m.
European Master EUROAQUAE Mathematical tools
Example
_
sin
_
nx

__
n=1,2,...
is a orthogonal set in I = [0, ] with respect
to the the weight p(x) = 1.
Indeed, we may check that
_

0
sin
_
nx

_
sin
_
mx

_
dx =
_
0, for n ,= m
/2, for n = m.
All these functions have norm
_
/2. Then the functions

n
(x) =
_
2

sin
_
nx

_
, n = 1, 2, . . .
form a orthonormal set in [0, ].
European Master EUROAQUAE Mathematical tools
Example
The functions

0
(x) =
1

,
n
(x) =
_
2

cos
_
nx

_
, n = 1, 2, . . .
form a orthonormal set in [0, ].
Example
The functions

c0
(x) =
1

2
,
cn
(x) =
1

cos
_
2nx

sn
(x) =
1

sin
_
2nx

_
, n = 1, 2, . . .
form a orthonormal set in [0, ].
European Master EUROAQUAE Mathematical tools
Fourier series
Be
n
(x)
n=1,2,...
a orthonormal set in (
s
(I). Given a function
f (
s
(I), we have interest in expressing this function as an
innite series of the orthonormal functions in the form
f (x) =

n=1
c
n

n
(x)
with appropriate coefcients c
n
.
This expression is the natural extension of decomposing a
vector into components in a basis. It involves two fundamental
questions:
1) Is it valid for all x [0, ] ?
2) How to select the coefcients c
n
?
European Master EUROAQUAE Mathematical tools
Let us assume that this expression is true for all x [0, ].
Using the internal product, we can write
f ,
i
) =
_

n=1
c
n

n
,
i
_
=
_

0
_

n=1
c
n

n
(x)
_

i
(x)p(x)dx .
Assuming the series can be integrated term by term we
continue the calculation in the form
f ,
i
) =

n=1
c
n
_

0

n
(x)
i
(x)p(x)dx = c
i
,
where we have used that the funcions
n
(x) are orthonormal !!
European Master EUROAQUAE Mathematical tools
In summary
If f (x) =

n=1
c
n

n
(x) for all x [0, ] and if the series can be
integrated term by term, then the coefcients are uniquely
determined by the formula
c
n
= f ,
n
) =
_

0
f (x)
n
(x)p(x)dx . (1)
For a general orthonormal set and a general class of functions
f (x), it can be difcult to ensure both conditions a priori.
However, the formula (1) can be calculated even if the innite
series does not converge to f (x) for all x. The only condition is
that f (x)
n
(x)p(x) are integrable in [0, ]. This is not a very
restrictive condition since it may be satised by general classes
of functions.
European Master EUROAQUAE Mathematical tools
Given a function, we directly construct a Fourier series
Given f (x) in I = [0, ], we calculate a set of coefcients c
n
with
the expressions
c
n
= f ,
n
) =
_

0
f (x)
n
(x)p(x)dx , n = 1, 2, . . . , (2)
and we construct the innite series
f (x)

n=1
c
n

n
(x) . (3)
It is called the Fourier series of f with respect to the
orthonormal set
n
.
The constants c
n
are named the Fourier coefcients of the
function.
European Master EUROAQUAE Mathematical tools
The sign () in (3) is a graphical form of indicating the
association between the function and its Fourier series without
a priori requiring a point to point identication.
This is one way of representing a function through a linear
decomposition in an innite set of orthonormal functions
n
.
The Fourier coefcients c
n
are the components, in an analogy
with the decomposition of a vector in a base.
In general, it may happen that the Fourier series does not
converge or does not coincide with the value of f (x) at all points
in x [0, ]. This coincidence would be the ideal case in which
f (x) =

n=1
c
n

n
(x).
However, in general the Fourier series represents the function
in a weaker but practical form refereed to as mean square.
European Master EUROAQUAE Mathematical tools
Mean square approximation
Consider the rst N functions of a orthonormal set in (
s
(I) and
the linear combination

N
(x) =
1

1
(x) +
2

2
(x) + +
N

N
(x) (4)
with some coefcients
i
.
We dene
E
N
= |f
N
|
2
=
_

0
[f (x)
N
(x)]
2
p(x)dx (5)
as the mean square error when f is approximated by
N
.
It gives an overall measure of the approximation on the whole
domain, instead of focussing point to point.
European Master EUROAQUAE Mathematical tools
Problem: Find the coefcients
i
such that E
N
is minimum
E
N
=
_

0
_
f (x)
N

n=1

n
(x)
_
2
p(x)dx =
_

0
f (x)
2
p(x)dx
. .
f
2
+
_

0
_
N

n=1

n
(x)
_
2
p(x)dx
. .
I2
2
_

0
f (x)
N

n=1

n
(x)p(x)dx
. .

N
n=1

n
c
n
,
where c
n
are the Fourier coefcients.
European Master EUROAQUAE Mathematical tools
I2 =
_

0
_
N

n=1

n
(x)
_ _
N

m=1

m
(x)
_
p(x)dx
N

n=1

n
N

m=1

m
_
_

0

m
(x)
n
(x)p(x)dx
_
=
N

n=1

2
n
,
Then
E
N
= |f |
2
+
N

n=1

2
n
2
N

n=1

n
c
n
= |f |
2
+
N

n=1
(
n
c
n
)
2
. .

n=1
c
2
n
.
Since all the terms are non-negative, the minimum of E
N
is
attained when
n
= c
n
, n = 1, 2, . . . , N. And it is given by
minE
N
= |f |
2

n=1
c
2
n
. (6)
European Master EUROAQUAE Mathematical tools
From (6) we have that the bound

N
n=1
c
2
n
|f |
2
.
Since all the c
2
n
are positive, the innite series for N is
convergent and also bounded:

n=1
c
2
n
|f |
2
.
Since the n-term of a convergent series goes to 0, we have
lim
n
c
n
= lim
n
f ,
n
) = 0 .
The error reduces as N , so that the minimum error (the
better approximation) is when the complete Fourier series is
used:
E = lim
N
minE
N
= lim
N
|f
N
|
2
= |f |
2

n=1
c
2
n
.
European Master EUROAQUAE Mathematical tools
Compilation
Be
n
(x)
n=1,2,...
a orthonormal set in (
s
(I) and the Fourier
series of a function f :
c
n
= f ,
n
); f (x)

n=1
c
n

n
(x) .
We have learned the following properties:

n=1
c
2
n
|f |
2
, (Bessel inequality)
lim
n
c
n
= 0.
Among all the possible linear combinations with
n
(x),
the Fourier series is the best representation of f in the mean
square sense. The mean square error is
E = |f

n=1
c
n

n
|
2
= |f |
2

n=1
c
2
n
.
European Master EUROAQUAE Mathematical tools
Orthonormal basis
The best case occurs when the mean square error is 0. In this
case, we say that the Fourier series converges to f in the mean
square sense.
In this case, the Parseval identity holds:
|f |
2
=

n=1
c
2
n
. (7)
Denition
We say that
n
(x)
n=1,2,...
is a orthonormal base (or a complete
set) in a function space when, for any function f belonging to
the space, its Fourier series converges to f in mean square, that
is
lim
N
|f
N

n=1
c
n

n
(x)|
2
= 0.
European Master EUROAQUAE Mathematical tools
Example
_

2
p
sin
nx

_
n=1,2,...
_

1
p
,

2
p
cos
nx

_
n=1,2,...
_

1
p
,

2
p
cos
2nx

2
p
sin
2nx

_
n=1,2,...
are orthonormal bases in the space of piecewise continuous
functions in [0, ].
European Master EUROAQUAE Mathematical tools
Uniqueness of the Fourier series
Consider Fourier series in a orthonormal base. The Parseval
identity |f |
2
=

n=1
c
2
n
says that the only way for a function f
to have all its coefcients equal to 0 is to have |f | = 0.
Consider now two functions f (x) and g(x) with Fourier
coefcients c
n
and d
n
respectively. Then the function f (x) g(x)
has coefcients c
n
d
n
. Therefore, the only way to have c
n
= d
n
for all n = 1, 2, . . . is that |f g| = 0.
This means to be f (x) = g(x) for all points x [0, ] except
possibly at a discrete number of points.
European Master EUROAQUAE Mathematical tools
Conclusion
For a given piecewise continuous function, its Fourier
coefcients give a unique representation
in the sense that no other functions (except those differing
in a discrete number of points) have the same coefcients.
The Fourier coefcients are the components of the
function in the orthonormal basis.
The corresponding Fourier series is the best
representation of the function in the mean square sense.
European Master EUROAQUAE Mathematical tools
Examples of Fourier series
Consider the interval I = [0, 1] and the orthonormal function
base
n
(x) =

2 sin(nx)
n=1,2,...
.
Let us see the Fourier series of several functions with respect to
this base with the Fourier coefcients calculated by
c
n
=< f ,
n
>=
_
1
0
f (x)
n
(x)dx .
All the calculations and plots are done with Maple.
European Master EUROAQUAE Mathematical tools
Maple program
Dene
n
(x) =

2 sin(nx)
> phi:=(n,x)->sqrt(2)*sin(n*Pi*x);
Dene f (x) = x
> f:=x->x;
Calculate the Fourier coefcients c
n
=
_
1
0
f (x)
n
(x)dx
> c:=n->int(f(x)*phi(n,x),x=0..1);
assume(n,integer);

(1)
n

2
n
European Master EUROAQUAE Mathematical tools
Maple program, cont
Plot the coefcients to observe their convergence to 0.
> coefs:=[seq([n,c(n)], n=1..20)];
> plot(coefs,n=1..20, style=point,
symbol=circle);
15
0.4
0.1
0.1
20
0.2
0.0
n~
0.3
0.2
5 10
European Master EUROAQUAE Mathematical tools
Maple program, cont
Calculate partial summations S
N
(x) =

N
n=1
c
n

n
(x) and
error approximation [f (x) S
N
(x)[.
> SF:=(N,x)-> sum(c(n)*phi(n,x), n=1..N);
> EF:=(N,x)-> abs(f(x)-SF(N,x));
Plot several approximations to observe their convergence
to the function.
> plot(f(x),SF(1,x), SF(5,x),x=0..1,
thickness=2);
> plot(EF(1,x), EF(5,x), EF(20,x),x=0..1,
thickness=2);
European Master EUROAQUAE Mathematical tools
Maple program, cont
1.0
0.5
0.0
0.25 1.0
x
0.75
0.5
0.75
0.25
0.0
f(x)=x
N=1
N=5
0.25 0.5
x
0.75
0.25
1.0
0.75
0.0
1.0
0.5
0.0
f(x)=x
N=15
x
0.75
0.0
0.25
0.25
1.0 0.0 0.75
1.0
0.5
0.5
N=5
N=1
N=15
The accuracy improves as the number of terms N increases.
The approximation is slower for points close to the end x = 1
and none of the functions S
N
attain the value f (1) = 1.
This is due to the fact that all the orthonormal functions give

n
(1) = 0.
European Master EUROAQUAE Mathematical tools
Example 2
f (x) =
_
1, for 0 x 0.5
1, for 0.5 x 1
> g:=x->piecewise(x<0.5,1,x>0.5, -1);
Fourier coefcients:
c
n
= 0.4501581581
1.0+cos(1.570796327 n)
n
+0.4501581581
1.0 cos(1.570796327 n)+(1.0)
n
n
5 15 10
x
25 30
0.4
0.6
0.0
20
0.8
0.2
Most of the coefcients
are 0.
The only c
n
,= 0 are
c
2
, c
6
, c
10

European Master EUROAQUAE Mathematical tools
Example 2, cont.
0
0.5
x
0.75
1
1
0.25 1.0 0.0
f(x)
N=26
N=2
N=10
0.0
0.25
0.25
0.75
0.75 1.0 0.5 0.0
x
0.5
1.0
N=10
N=2
N=26
As N increases, the series converges to f (x) at the points where f
is continuous. Near the discontinuity points, the approximation
s
N
overshoots the function (Gibbs phenomenon) . Even for
N , s
N
does not match the function at these points.
European Master EUROAQUAE Mathematical tools
Example 3
f (x) = x
4
(x 1)
Fourier coefcients:
8

2
_
3 + 12 (1)
1+n
+ (1)
n
n
2

2
_
n
5

5
6
0.01
4 3 1
x
10 9
0.0
8 7
0.03
0.02
0.02
2 0
0.01
5
The coefcients go to
0 very fast
(with
1
n
5
).
European Master EUROAQUAE Mathematical tools
Example 3, cont.
0.075
0.75 0.25
0.05
0.0
x
1.0 0.5
0.0
0.025
f(x)
N=5
N=2
1.0
x
0.75 0.25 0.0
0.015
0.025
0.005
0.02
0.0
0.5
0.01
N=2
N=5
N=10
S
N
(x) matches the function at all points with a very small
number of terms.
Notice that in this case, f (x) is continuous at all points and
the orthonormal functions coincide with f at the extreme
ends.
European Master EUROAQUAE Mathematical tools
On convergence of the Fourier series
In all the examples, as expected from the presented theory, we
have seen that
The functions S
N
(x) converge to the given function f (x) in
the mean square sense.
The Fourier coefcients c
n
0.
More rened convergences have been also observed in the
examples depending on some conditions on the functions and
the conditions at the extreme ends of the interval domain.
They can be understood from the following theorems.
European Master EUROAQUAE Mathematical tools
Theorem Pointwise convergence
Let the set
n
(x)
n=1,2,...
be a orthonormal base of
eigenfunctions. Suppose that f and its derivative f

are
piecewise continuous on x [0, ]. Then the Fourier series for f
converges to f (x) at every x where f is continuous.
If f is discontinuous at x = x
0
, the Fourier series converges to
the average
f (x
+
0
) + f (x

0
)
2
where f (x
+
0
) = lim
xx
+
0
and f (x

0
) = lim
xx

0
.
This theorem has been illustrated by the examples 1 and 2.
European Master EUROAQUAE Mathematical tools
Theorem Uniform convergence
Suppose that f is continuous and has continuous rst and
second derivatives on the closed interval [0, ].
Suppose that f and the orthonormal functions
n
(x)
n=1,2...
satisfy the same conditions at the interval ends (for example
they are 0 like in the example 3).
Then, the Fourier series converges uniformly to f (x) on the
closed interval [0, ].
In pointwise convergence, the quality of the convergence
depend on each point x. Uniform convergence is stronger, has
an overall character independent on the values of x.
Compare example 3 (uniform convergence) with the examples
1-2 (pointwise convergence).
European Master EUROAQUAE Mathematical tools

You might also like