A Fourier series is a way to expand a periodic function in terms of sines and cosines. The Fourier series is named after Joseph Fourier, who introduced the series as he solved for a mathematical way to describe how heat transfers in a metal plate.
The GIFs above show the 8-term Fourier series approximations of the square wave and the sawtooth wave.
Mathematica code:
f[t_] := SawtoothWave[t]
T = 1;
nmax = 18;
a0 = (2/T)*Integrate[f[t], {t, -(T/2), T/2}]
anlist = Table[(2/T)*Integrate[f[t]*Cos[(2*Pi*n*t)/T],
{t, -(T/2), T/2}], {n, 1, nmax}]
bnlist = Table[(2/T)*Integrate[f[t]*Sin[(2*Pi*n*t)/T],
{t, -(T/2), T/2}], {n, 1, nmax}]
fs[t_, nmax_] := a0/2 + Sum[anlist[[n]]*Cos[(2*Pi*n*t)/T] +
bnlist[[n]]*Sin[(2*Pi*n*t)/T], {n, 1, nmax}]
Manipulate[Column[{Plot[{f[t], fs[t, nmax0]}, {t, -1, 1},
PlotRange -> All, AxesLabel -> {"t", "f(t)"},
PlotStyle -> {{Thick, Black}, {Thick, Red}},
ImageSize -> 700, AspectRatio -> 1/2.8],
Row[{"f(t)=", fs[t, nmax0]}]}], {nmax0, 1, nmax, 1}]