Something to note is that any periodic wave can be broken down into the sum of sine and cosine waves. This serves as the foundation for the Fourier Series.
The general form of a Fourier Series for a function f(x) defined on the interval [−L,L] is:
f(x)=a0+n=1∑∞ancos(Lnxπ)+n=1∑∞bnsin(Lnxπ)
making L is half the wave period.
a0 , an and bn are coefficients that we need to find, using these equations respectively.
a0=2L1∫−LLf(x)dx
an=L1∫−LLf(x)cos(Lnπx)dx
bn=L1∫−LLf(x)sin(Lnπx)dx
Examples#
Lets first look at the square wave.
We start off with sinx.

We can then add 3sin3x.

We can then keep adding sine waves in the format 2n+1sin(2n+1)x.

As n approaches infinity, we eventually get a square wave. (n=20 in this case.) We can thus use this equation to represent a square wave.
n=0∑∞2n+1sin((2n+1)x)
If we use even coefficients instead, we can get a sawtooth wave using this equation.
n=0∑∞2nsin(2nx)
