It started with heat
Joseph Fourier came up with these series around 1807 while working out how heat spreads through a metal bar. Leading mathematicians of the day, Lagrange among them, doubted that any function could be built from waves.
Any closed outline can be drawn by adding up circles spinning at different speeds. Draw a shape: its outline becomes two equations, x(t) and y(t), each a sum of sines and cosines, and a chain of spinning circles draws it back. Scroll down to see how, step by step.
The pictures below are made from your shape. Draw something new above and they all change.
Your hand drew some parts slowly and others fast, so the points it left are bunched up in places. First the outline is re-measured: points are placed at equal distances along it, a few hundred of them, all the way round and back to the start.
Now a single number, t, says where the pen is: t = 0 at the start, t = 2π after one lap. Equal steps in t are equal steps along the outline.
As the pen walks round, its left-right position goes up and down, and so does its up-down position. Plot each against t and you get two separate wiggly lines: x(t) and y(t).
Both repeat exactly every lap, because the outline is closed. Anything that repeats can be built from waves that also repeat every lap: one wave per lap, two per lap, three per lap, and so on.
To find how much of the "k waves per lap" cosine is in x(t), multiply the two together at every point and take the average. Where they rise and fall together the products are positive; where they don't, they cancel out. Doubled, that average is the coefficient aₖ.
aₖ = 2 · average of x(t)·cos(kt)
bₖ = 2 · average of x(t)·sin(kt)
cₖ, dₖ: the same for y(t)
Nobody guesses these numbers. They are measured from the drawing, which is the whole trick. Most of the size sits in the slow waves; the fast ones only add detail.
With only k = 1, every shape becomes an ellipse: the crudest possible version. Each extra frequency adds a smaller, faster wiggle on top, and the shape sharpens.
Smooth curves need only a few terms. Sharp corners, like a star's points or a bird's beak, need many: smooth waves can only ever approximate a corner.
A cosine and a sine of the same speed together are just a point going round a circle. So each frequency is a circle turning k times per lap, some clockwise and some anticlockwise.
Put each circle's centre on the rim of the one before, biggest first, and the tip of the last one traces your shape. That chain is exactly the animation at the top of the page, and the two equations are the same thing written down.
Joseph Fourier came up with these series around 1807 while working out how heat spreads through a metal bar. Leading mathematicians of the day, Lagrange among them, doubted that any function could be built from waves.
Ptolemy's astronomy, around 150 AD, explained the planets' looping paths with circles riding on circles: epicycles. That is the same idea as the animation above, about 1,650 years before Fourier.
Near a sharp jump, the sum of waves always overshoots by about 9% of the jump, however many terms you add. It's called the Gibbs phenomenon. Henry Wilbraham spotted it in 1848, fifty years before Gibbs.
JPEG images store small blocks of pixels as a sum of cosine waves and throw away the fast, faint ones you'd hardly see. MP3 and AAC audio do the same with sound.
The Fast Fourier Transform, published by Cooley and Tukey in 1965, is one of the most used algorithms ever. Gauss had worked out the same trick around 1805, in notes that went unpublished for decades.
Inside your ear, the cochlea responds to different pitches at different places along its length. In effect it splits sound into its frequencies before your brain ever hears it.