Answers · The mathematics underneath
Why does multiplying by a sine and summing pick out only that frequency?
In shortMultiplying by a sine and adding over whole cycles cancels every other frequency exactly and leaves a positive total for the matching one.
Multiplying by a sine and summing over whole cycles returns zero for every other frequency and a positive total for the matching one. The zero is exact, not a small residue that happens to average away: over a whole number of cycles the product of two different sine waves has equal positive and negative area, so the two areas cancel.
The cancellation is exact
Written this way the cancellation is visible. The product of two different sine waves is a sum of two cosines, one at the difference of the two rates and one at the sum. Over a whole number of cycles a cosine has as much area above the axis as below, so each of those cosines integrates to zero. When the rates match, the difference is zero and the first cosine is the constant ; its area over the record is the record length, and that is the large total. The second cosine still integrates to zero. This is why only the matched rate leaves anything behind.
Take a record of length and a signal that is one unit of . Ask for the amount of . Every product is a square, so the running total never turns back. The integral over the record is , and multiplying by the normalisation gives . The factor is not decoration: the average of a squared sine is , because the wave spends as much time near zero as near its peak, so without the two the answer would come out at half size. Now ask for instead. The probe and the signal drift in and out of step, and the product is positive for part of the record and negative for an equal part. The integral is zero, not small. That is the whole mechanism.
The same exactness appears in a finite sum. With and , a probe at gives products , which add to . A probe at gives , which add to , and times is . The mismatched products were not approximately balanced; the positive and negative terms paired exactly. The matched products were all nonnegative, so none of the signal's own amount was cancelled.
The natural guess is that the other frequencies average out by luck, and that a long enough record makes the average small. That is not what happens. The product identity pairs each positive excursion with an equal negative one inside the same run of cycles. The cancellation is already exact once the record contains whole cycles, and it does not improve with length after that. A probe close to the signal's rate is a different case: it does cancel, but only after the two have drifted through enough cycles. A short record can stop before that has happened, and the leftover area is the thing that looks like contamination. It is not evidence that the recipe is approximate; it is evidence that the record did not contain whole cycles of the difference.
What the exactness depends on
Two conditions carry the exactness. The record must cover whole cycles of the probe and the signal, or at least whole cycles of the difference and the sum that appear in the product identity. If it stops partway through, the positive and negative areas no longer match, and a frequency that is not in the signal can return a nonzero total. This is leakage, and it is a property of the finite record, not of the frequency. The second condition is phase. A sine probe at a given frequency is not a universal detector for that frequency: it is a detector for that frequency with that starting point.
At the same frequency, and are orthogonal over a full period. If the signal is a cosine, a sine probe returns zero even though the frequency is present. The repair is to probe twice, once with a sine and once with a cosine, then combine the two amounts into an amplitude and a phase. A sine probe alone answers how much of this frequency is present in this phase, not how much of the frequency is present at all.
Worth keeping
- Two sine waves at different frequencies multiplied together have equal positive and negative area over a whole number of cycles, so their total is exactly zero.
- A sine multiplied by itself never goes negative, so its total grows and measures the amount present.
- If the record does not cover whole cycles, or the signal's phase is not the probe's phase, the cancellation is incomplete and the answer needs a second probe.
Where this goes next
This question is one step of The Fourier Transform, a course that works through its subject from the beginning. The page that teaches this part of it is Asking a Signal How Much of One Rhythm It Holds, and it reads the whole way through whether or not you have an account.
What an account changes is the practice: problems standing under every idea, marked with a reason rather than a tick, in a copy of the course that is yours.
Read that pageThe whole courseOther questions people ask about this
- How does the FFT get the same answer without doing all the multiplications?The FFT gets the same spectrum by splitting the readings into even and odd positions and reusing the two half-length results for every rate, so shared partial sums are computed once instead of once per rate.
- How can a finite list of samples be turned into frequencies and back with nothing lost?A finite list can be converted into frequencies and back exactly, because the transform is a reversible change of description, not a lossy summary.
- Why does a fast wiggle look like a slow one when I sample too slowly?Because readings taken at regular instants cannot tell a rhythm from the same rhythm sped up by a whole number of cycles per reading, so the fast one is reported at a folded, slower rate.
- Why does sliding a filter along a signal become simple multiplication after a Fourier transform?Because a filter scales every steady rhythm without changing its rate, so the whole sliding sum collapses into one multiplication for each rhythm.
- What is the difference between variance and standard deviation?They measure the same spread: variance is the average squared distance from the mean, standard deviation is its square root, so you report the standard deviation and calculate with the variance.
- How do you make a vague claim precise enough to tell whether it's true?Fix what is being talked about, what is asserted, which cases are covered and the cut-off, then name an observation that would prove it false.