Fourier series can be used to approximate a general periodic function, even with discontinuities. It does this by using the sum of continuous sine and cosine waves.
The Fourier series of the periodic function
defined on the domain
such that
is given by:
where
and
This formula can be extended to functions with an arbitrary period.
In addition, any function defined on an interval
can be extended to a periodic function, with period
, for which a Fourier series can be calculated.
For more details on the mathematics underlying Fourier series see https://mathworld.wolfram.com/FourierSeries.html and the references contained within it.