Pure mathematics is much more than an armory of tools and techniques for the applied mathematician. On the other hand, the pure mathematician has ever been grateful to applied mathematics for stimulus and inspiration. From the vibrations of the violin string they have drawn enchanting harmonies of Fourier Series, and to study the triode valve they have invented a whole theory of non-linear oscillations.
George Frederick James Temple In 100 Years of Mathematics: a Personal Viewpoint (1981).

The Fourier Series is a very important mathematics tool discovered by Jean-Baptiste Joseph Fourier in the 18th century. The Fourier series is used in many important areas of science and engineering. They are used to give an analytical approximate description of complex periodic function or series of data. In this blog, I am going to give a short introduction to it.
Let start with some definition. A function is said to be periodic with period T (T being a nonzero constant) if it if it is defined for all real
and if there is some positive number,
, such that
An example of periodic functions are the sinusoidal function (or sinusoidal oscillation or sinusoidal signal)} given by the function where
: Amplitude. It gives how high the graph
rises above the t-axis at its maximum values.
: phase lag. Position of the maximum of the function.
: the time delay or time shift. It tell you how far the graph of the
has been shifted along the t-axis.
: angular frequency. It gives the number of complete oscillation of
in a time interval of length
.
: frequency of
. It gives the number of complete oscillation of
in a time interval of length 1.
: period.Time required for one complete oscillation.

If the function is a periodic function with period
The function in the interval
can be represented by a trigonometric series as:
namely as a summation of sinusoidal functions of different frequency and amplitude that allows to approximate any periodic function with any level of accuracy.

In order to achieve this result we need to calculate the coefficients and
in the series. But for that, we need to recall of properties of these functions and of their integrals.
Integral of Orthogonal Functions
This means that for :
for :
This means for all value of that
This means that for :
for :
Determination of 
We start to integrate both the members of the Fourier series from to
For the integrals formulas that we have derived before, we obtain
namely,
is equal to the average value of the function
Determination of 
We start by multiplying both the members of the Fourier series by and then integrate from
to
Shall we consider the integrals that we get on the right-hand-side:
First term:
The second integral for is equal to:
The third integral for the orthonormality of the function is always equal to:
Therefore:
namely, for :
Determination of 
We start by multiplying both the members of the Fourier series by and then integrate from
to
Shall we consider the integrals that we get on the right-hand-side:
First term:
Second term:
Third term:
Therefore:
namely, for :
Summary
The coefficients of the Fourier series
By replacing m with n we can finally express the coefficient of the series in the final form.
with
or in the same way we can integrate in the interval with the same result:
For a given generic interval
with
and the Fourier series is give by
Example 1
In this example, we will calculate the Fourier coefficient of a the square wave function. This function is of paramount importance in digital electronics since it used in the electronic signal to represent unit of information (bit) as on/off state.
Mathematically, the square wave is represented by functions as
The plot of the extended periodic function is given in the following figure.

We now calculate the Fourier coefficients starting from the term
The coefficients are given by
.
And finally
or
The Fourier series is
.
In this way, for example, the first 3 harmonics of the series are
Example 2
In this second example the square wave signal is defined as a odd function such that and mathematically, the square wave is represented by functions as
The plot of the extended periodic function is given in the following figure.

We now calculate the Fourier coefficients starting from the term
The coefficients are given by
.
And finally
or
The Fourier series is
.
The plot of the first 100 terms of the series is given in the following animation.

The overshoting oscillations in correspondence of the discontinuity of the square wave is called Gibbs phenomenon by W. Gibbs that pointed it out in a letter to Nature in 1899. The oscillation overshoot the function of a fixed amount that can be calculated. In addition, the function oscillate with an amplitude that is decreating going far from the discontinuity point.
Fourier Series using Complex Notation
Let be a piecewise linear function on
(This means that
may possess a finite number of finite discontinuities on the interval). Then
can be expanded in a
Using Euler’s identities:
where ,
the Fourier series of can be written in a more compact from as
where
