TL;DR
Many repeating signals, such as a musical note or the voltage in a power supply, can be built from pure sine and cosine waves. A Fourier series is that building recipe: a sum of waves whose frequencies are whole-number multiples of the signal's repetition rate, each with a weight that tells how much of that wave is present. Each weight is found with one Definite Integral, so the decomposition is computed, not guessed.
Builds on: Definite Integral, Euler's Formula · Leads to: Fourier Transform for signals that do not repeat, and Discrete Fourier Transform for signals stored as samples
Where it's used
Musical tones. A plucked guitar string vibrates at a base frequency and also at exact multiples of it, called harmonics. The sound you hear is the sum of those waves, each at its own strength. Audio tools that show the harmonic content of a note are plotting the coefficients of its Fourier series.
Power electronics. The switching circuit in many power supplies produces a square wave, which flips between two voltages. A square wave is a Fourier series with only odd harmonics, with the th harmonic at of the fundamental's strength. Engineers use that list of strengths to design the filter that removes the unwanted harmonics.
Heat and vibration problems. Joseph Fourier introduced the method to solve the heat equation, which describes how temperature spreads through a metal bar. The bar's starting temperature is written as a sum of sine waves, and each wave decays at its own rate. The same idea solves many wave and vibration equations in physics.
How it works
Before the general formula, look at the core move with a tiny signal. Take a Function that repeats every units and is built from pieces we already know: . The question is whether an integral can recover the three pieces from the function alone.
-
Ask for the constant part. Integrate over one full period from to . The cosine and sine terms each average to zero over a full period, so only the constant survives, giving . Check: the integral of over a length interval is . Dividing by gives , and the constant term is half of that, .
-
Multiply by one cosine and integrate. To find the weight of , multiply by and integrate over one period. Every term except integrates to zero, because a cosine times a different wave averages to zero over a full period. Check: the integral of over one period is , and dividing by returns the weight .
-
Repeat for the sine at frequency 2. Multiply by and integrate. Only survives, giving , so the weight is . Check: the constant and the cosine at frequency 1 both integrate to zero against , so they contribute nothing.
-
Read off the recipe. The function is , exactly what went in. The three integrals found the three weights and nothing else. Check: any term that is not in the signal gives a weight of zero.
-
Handle a sharp edge. A square wave cannot be a finite sum of smooth waves, so its series needs infinitely many terms. The sum of the first few odd harmonics already looks like a square wave, and each extra term sharpens the edges.
- 1 term
- 2 terms
- 3 terms
flowchart LR A[Repeating signal f] --> B[Integrate f times each cosine and sine] B --> C[Coefficients a and b] C --> D[Sum of waves reproduces f]
The math
For a function with period , the Fourier series is
where the coefficients are
The constant term is the average value of over one period. For a piecewise smooth , equality holds at points where is continuous, and the series converges to the midpoint of the two one-sided values at a jump.
Step 1 in symbols: the building blocks are orthogonal
The integrals work because the waves are orthogonal, meaning the integral of their product over a period is zero unless the two are the same wave. Using and the fact that for every whole number :
The sine version works the same way, and the product integrates to zero for all whole numbers and . The same result follows in one line from Euler's Formula: writing turns each product into exponentials, and an exponential integrates to zero over a period unless its exponent is zero. This integral is the inner product of two functions, the function version of the Dot Product, and the functions live in a Hilbert space.
Step 2 in symbols: why the integral picks out one weight
Multiply the series by and integrate over one period. By Step 1, every term vanishes except the one with , which gives . Divide by and the formula for follows. Dividing by is dividing by the squared length of , so is the projection of onto that wave. The same argument with gives .
Check with the walkthrough: multiplying by left only , and .
Step 3 in symbols: the square wave
Take on and on . This function is odd, meaning , so every cosine coefficient is zero. For the sines,
When is even, and . When is odd, and . So the series is
Each odd harmonic has strength of the first, as the power-electronics example said.
Worked examples
Let on .
- Constant weight: . So the constant term is .
- Cosine weight at frequency 1: .
- Sine weight at frequency 2: .
- Every other coefficient is , because the integrals of the mismatched products vanish.
- The recipe is , the original function.
Use for odd . Evaluate the three-term partial sum at .
- Odd coefficients: , , .
- Sine values at : , , .
- Partial sum: .
- Inside the bracket: , and .
- The sum is . The true value at is , so three terms are already close, and the next terms bring it closer.
A clock line switches between 0 and 5 volts at 2 kHz. Shift it to a zero average and it is a square wave with fundamental frequency kHz.
- Harmonics are at odd multiples of the fundamental: kHz for odd .
- The 3rd harmonic is at kHz with strength of the fundamental. The 5th is at kHz with strength .
- The 7th harmonic is at kHz with strength of the fundamental.
- Relative to the fundamental, the 6 kHz component is one third as strong and the 10 kHz component one fifth as strong. A filter that passes 2 kHz and blocks everything above 4 kHz removes both, and the designer knows exactly which frequencies to block from the list.
- The series turns a sharp digital edge into a short list of frequencies and strengths, and the filter is designed from that list.
Try it: a square wave repeats at Hz. What are the frequencies of the 3rd and 9th harmonics, and what is the 9th harmonic's strength relative to the fundamental? Answer: Hz and Hz. The 9th harmonic's strength is of the fundamental.
Common mistakes and tradeoffs
It is tempting to think that a Fourier series only works for smooth functions. In fact jumps are fine: the series converges to the midpoint of the two sides at a jump. What jumps cause is a slow approach and an overshoot near the jump. For a square wave the partial sums overshoot by about 9% of the jump size, and the overshoot does not shrink as more terms are added, only narrows. This is the Gibbs phenomenon.
It is tempting to think a Fourier series needs the function to be a sum of sines in the first place. In fact the integrals give coefficients for any function that is integrable over one period, including ones with no obvious sine form. For piecewise smooth functions, the sine-and-cosine sum represents the function exactly at points of continuity.
It is tempting to think the coefficients are the function's values at some points. In fact each coefficient is an integral over the whole period, so changing the function at a single point does not change any coefficient.
Use a Fourier series when a signal repeats exactly and you want its frequency content. Do not use it for a signal that does not repeat; there the Fourier Transform replaces the whole-number harmonics with a continuous range of frequencies. For a signal stored as samples, use the Discrete Fourier Transform, which the computer can evaluate.
History
In 1807, Joseph Fourier submitted a memoir on heat conduction that used sums of sines and cosines to solve the heat equation, and his book on the topic appeared in 1822. Mathematicians of the time doubted that an arbitrary function, with jumps or kinks, could be written this way, and the argument over which functions the series represent went on for decades. Peter Gustav Lejeune Dirichlet gave the first precise convergence conditions in 1829, which settled the question for a broad class of functions.
The overshoot at jumps was noticed in the late 1890s, and it bears the name of Josiah Willard Gibbs, who wrote about it. The method caught on because it turned a hard differential equation into a set of simple coefficients, and the same coefficient calculation later became the basis of signal analysis in engineering.
Recap
- A repeating signal can be written as a constant plus cosines and sines at whole-number multiples of its base frequency.
- Each coefficient is an integral of the signal against one wave, and the orthogonality of the waves makes all other terms vanish.
- A square wave has only odd harmonics, with strength for the th.
- Jumps cause overshoot that does not disappear as more terms are added.
- The non-repeating version is the Fourier Transform, and the sampled version is the Discrete Fourier Transform.
Read next: Fourier Transform to see the same idea for signals that do not repeat.
Check yourself
QuestionWhat do the Fourier coefficient and the constant term measure?Show answer
is the average value of the function over one period. is twice that average, because divides the integral over a length of by .
QuestionFor on , what are and ?Show answer
, and . All other coefficients are zero because the cross terms integrate to zero.
QuestionWhy does a square wave's Fourier series contain only odd harmonics?Show answer
Its coefficients vanish when is even, because for even . Only odd give , which makes the coefficient nonzero.
QuestionA student says a Fourier series of a function with a jump will never converge at any point. Is that correct?Show answer
No. At the jump the series converges to the midpoint of the two one-sided values, and at points of continuity it converges to the function. What the jump causes is slow convergence and an overshoot near the jump, which does not vanish as terms are added.
QuestionA signal repeats every seconds. What is its base frequency, and what is the frequency of its 4th harmonic?Show answer
The base frequency is Hz. The 4th harmonic is at Hz.
Sources
- Fourier series, Wikipedia: https://en.wikipedia.org/wiki/Fourier_series
- Gibbs phenomenon, Wikipedia: https://en.wikipedia.org/wiki/Gibbs_phenomenon